Categories
CLI command Command Line Linux release Ubuntu version Windows

Command to Find Current Ubuntu Version

Run this command to find the installed version of Ubuntu.

cat /etc/lsb-release

You will get the following info.

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION=”Ubuntu 8.04.3 LTS”

You could also use

cat /etc/issue

Which will display the version only:

Ubuntu 8.04.3 LTS n l

Categories
CLI Command Line Linux Timezone Ubuntu Windows

Adjust Ubuntu Linux Timezone from Command Line

sudo dpkg-reconfigure tzdata

Categories
CLI Command Line Linux Utility WhoIS Windows

Whois Windows Command Line Utility

WhoisCL is a simple command-line utility that allows you to easily get information about a registered domain. It automatically connect to the right WHOIS server, according to the top-level domain name, and retrieve the WHOIS record of the domain. It supports both generic domains and country code domains.

Runs on all Windows platforms (XP, Vista, Windows 7, 2000, 2003, 2008) & uses TCP/IP port 43.

Download WhoisCL

Categories
CLI Command Line Linux Utility WhoIS Windows

Whois IP Windows Command Line Utility

WhosIP is a simple command-line utility that allows you to easily find all available information about an IP address: The owner of the IP address, the country/state name, IP addresses range, contact information (address, phone, fax, and email), and more.

Runs on any Windows operating system: Windows 95/98/ME/NT/2000/XP/2003/Vista/Windows 7, etc.

Download WhosIP

Categories
CLI Command Line Linux Net User Windows

Disable Windows Users From The Command Line

Whether in an Active Directory domain or standalone in a workgroup you can use this simple command line to disable one or more users.

net user <username> /active:no </domain>

Categories
Administration CLI Command Line Exchange Server 2007 Exchange Shell Linux Windows Windows 2000 Windows 2003

Exchange 2007 HOW TO: Add Email Addresses To Public Folders

How do we add email addresses to Public Folders?

It should be pretty simple – If Get-Mailbox shows the emailaddresses property for a mailbox, and Set-Mailbox allows you to use the -EmailAddresses switch to add email addresses, one can’t be blamed for believing it’ll work the same way for Public Folders.

Objects other than Public Folders need to be mailbox or mail-enabled to be Exchange recipients, Public Folders do not (Yes, they are mail-enabled by default). To modify mail-related attributes of Public Folders, you use the Set-MailPublicFolder command.

To add additional email address to a (mail-enabled) Public Folder:

$PF = Get-MailPublicFolder “Sales”

$PF.EmailAddresses += “Sales-EMEA@domain.com”

$PF | Set-MailPublicFolder

The first line gets mail-related properties of Public Folder “Sales” in a variable called $PF. Next, we add the additional email address, without wiping out the existing ones. Finally, we commit the change using Set-MailPublicFolder.

If you simply use Set-MailPublicFolder “Sales” -EmailAddresses “Sales-EMEA@domain.com”, it will replace the existing values in the EmailAddresses property.

Another difference to note between how the Set-PublicFolder and Get-PublicFolder commands work, compared to Set-MailPublicFolder and Get-MailPublicFolder – the former takes a relative path of a Public Folder. For instance, to get the Sales PF if it’s in the root of the Public Folder tree, we would need to add a before the name:

Get-PublicFolder Sales

However, the Get/Set-MailPublicFolder commands work using the alias/display name of the PF. Why the difference? One way to look at it – when using Get/Set-PublicFolder, you’re working with the actual Public Folder. When using Get/Set-MailPublicFolder, you’re working with the Active Directory object created for that Public Folder (which holds mail-related attributes, making it possible for a Public Folder to be mail-enabled).

To change the primary email address of the Public Folder “Sales” from “Sales@domain.com” to the new address we just entered – “Sales-EMEA@domain.com”:

Set-MailPublicFolder “Sales” -EmailAddressPolicyEnabled $false -PrimarySmtpAddress “Sales-EMEA@domain.com”

As you may have already figured out, we exempted the Public Folder from getting EmailAddressPolicies applied. In Exchange Server 2003/2000, you could change the default email address of a recipient, without unchecking the checkbox. Result: A few minutes after you completed the change, Recipient Policies would apply and change the primary email address back.

Exchange Server 2007 doesn’t let you change the default email address without exempting the recipient from email address policies.

Categories
CLI Command Line Encryption FTP Linux Passwords Windows winscp

FTP – File Transfer Protocol

FTP

File Transfer Protocol

Syntax
FTP [-options] [-s:filename] [-w:buffer] [host]

key
-s:filename Run a text file containing FTP commands.

host Host name or IP address of the remote host.

-g Disable filename wildcards.

-n No auto-login.

-i No interactive prompts during ftp.

-v Hide remote server responses.

-w:buffer Set buffer size to buffer
(default=4096)

-d Debug

-a Use any local interface when binding data connection.


Commands to run at the FTP: prompt

append local-file [remote-file]
Append a local file to a file on the remote computer.

ascii Set the file transfer type to ASCII, the default.
In ASCII text mode, character-set and end-of-line
characters are converted as necessary.

bell Toggle a bell to ring after each command.
By default, the bell is off.

binary Set the file transfer type to binary.
Use `Binary' for transferring executable program
files or binary data files e.g. Oracle

bye End the FTP session and exit ftp

cd Change the working directory on the remote host.

close End the FTP session and return to the cmd prompt.

debug Toggle debugging. When debug is on, FTP will display
every command.

delete remote-file
Delete file on remote host.

dir [remote-directory] [local-file]
List a remote directory's files and subdirectories.
(or save the listing to local-file)

disconnect Disconnect from the remote host, retaining the ftp prompt.

get remote-file [local-file]
Copy a remote file to the local PC.

glob Toggle the use of wildcard characters in local pathnames.
By default, globbing is on.

hash Toggle printing a hash (#) for each 2K data block transferred.
By default, hash mark printing is off.

help [command]
Display help for ftp command.

lcd [directory]
Change the working directory on the local PC.
By default, the working directory is the directory in which ftp was started.

literal argument [ ...]
Send arguments, as-is, to the remote FTP host.

ls [remote-directory] [local-file]
List a remote directory's files and folders.
(short format)

mdelete remote-files [ ...]
Delete files on remote host.

mdir remote-files [ ...] local-file
Display a list of a remote directory's files and subdirectories.
(or save the listing to local-file)
Mdir allows you to specify multiple files.

mget remote-files [ ...]
Copy multiple remote files to the local PC.

mkdir directory
Create a directory on the remote host.

mls remote-files [ ...] local-file
List a remote directory's files and folders.
(short format)

mput local-files [ ...]
Copy multiple local files to the remote host.

open computer [port]
Connects to the specified FTP server.

prompt Toggle prompting. Ftp prompts during multiple file transfers to
allow you to selectively retrieve or store files;
mget and mput transfer all files if prompting is turned off.
By default, prompting is on.

put local-file [remote-file]
Copy a local file to the remote host.

pwd Print Working Directory
(current directory on the remote host)

quit End the FTP session with the remote host and exit ftp.

quote argument [ ...]
Send arguments, as-is, to the remote FTP host.

recv remote-file [local-file]
Copy a remote file to the local PC.

remotehelp [command]
Display help for remote commands.

rename filename newfilename
Rename remote files.

rmdir directory
Delete a remote directory.

send local-file [remote-file]
Copy a local file to the remote host.

status Display the current status of FTP connections and toggles.

trace Toggles packet tracing; trace displays the route of each packet

type [type-name]
Set or display the file transfer type:
`binary' or `ASCII' (the default)

If type-name is not specified, the current type is displayed.
ASCII should be used when transferring text files.

In ASCII text mode, character-set and end-of-line
characters are converted as necessary.

Use `Binary' for transferring executable files.

user user-name [password] [account]
Specifes a user to the remote host.

verbose Toggle verbose mode. By default, verbose is on.

! command Run command on the local PC.

? [command] Display help for ftp command.

Examples
an example FTP Script to retrieve files in binary and then ascii mode:

::GetFiles.ftp

[User_id]
[ftp_password]
binary
get /usr/file1.exe
get file2.html
mget *.jpeg
ascii
mget *.txt
quit

To run the above script:
FTP -s:GetFiles.ftp [hostname]
This will connect as the user:User_id with password:ftp_password

An FTP Script to publish files in binary mode:

::PutFiles.ftp

[User_id]
[ftp_password]
binary
mput *.html
cd images
mput *.gif
quit

To run the above script:
FTP -s:PutFiles.ftp [hostname]
This will connect as the user:User_id with password:ftp_password


Using the Windows GUI for FTP
Windows Explorer (not Internet Explorer) also has a built in FTP client.
Type in the address bar:

ftp://username@ftpserver.address.com

you will be prompted for the password.
You can also use

ftp://username:password@ftpserver.address.com

This is not recommended as anyone can read the password.

Secure FTP
Standard FTP does not encrypt passwords – they are sent across the network in plain text. A more secure method is to use SecureFTP (SFTP) or SecureCopy (SCP) Freeware clients are available such as WinSCP.

Categories
CLI Command Line DNS Linux Nano Ubuntu Windows

Ubuntu Linux DNS Settings

DNS server settings are found in /etc/resolv.conf.  To edit use your favorite editor to open, personally I prefer nano.

sudo nano /etc/resolv.conf

Entries will look like

nameserver <ip address>
nameserver <ip address>
nameserver <ip address>

You should enter at least two known good DNS servers.

Categories
CLI Command Line Control Panel Linux SERVER Time TIME ZONE Timezone Windows Windows 2000 Windows 2003

Set Time Zone From Command Line in Windows 2003, XP and 2000

Quick and easy way to set timezone from command line in Windows 2003, XP and 2000.

CONTROL.EXE TIMEDATE.CPL,,/Z Eastern Standard Time
CONTROL.EXE TIMEDATE.CPL,,/Z Central Standard Time
CONTROL.EXE TIMEDATE.CPL,,/Z Mountain Standard Time
CONTROL.EXE TIMEDATE.CPL,,/Z Pacific Standard Time

These are a little longer but they do the same thing.

RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Eastern Standard Time
RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Central Standard Time
RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Mountain Standard Time
RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Pacific Standard Time

See also Set Time Zone From Command Line in Windows 7 and Windows 2008

Keywords:
change time zone from command line windows xp
windows 2003 change timezone
command to get time zone in win xp

Categories
CLI Command Line Linux Time Timezone Win 7 Win7 Windows Windows 7 Windows7

Windows 7 (and Windows 2008) Command Line Utility to Change Time Zone

Here is a great hidden command line utility which is available starting in Windows 7, “tzutil.exe,” which can be used to view or change the computer’s Time Zone. To use this command:

1. Open the Command Prompt.
2. Enter any of following commands:

tzutil /g (To view current time zone)
tzutil /l (To get a list of all available time zones)
tzutil /s time_zone_ID (To change time zone)

time_zone_ID is the new time zone you want to set. Fox example, if you want to set the time zone to “Eastern Standard Time”, then the command would be:

tzutil /s “Eastern Standard Time”

See also Set Time Zone From Command Line in Windows 2003, XP and 2000