The First time when you login to a remotehost from a localhost, it will display the host key not found message and you can give “yes” to continue. The host key of the remote host will be added under .ssh2/hostkeys directory of your home directory, as shown below.
[continue reading…]
Sometimes it may be necessary to identify the SSH client that you are currently running and it’s corresponding version number. Use ssh –V to identify the version number. Please note that Linux comes with OpenSSH.
[continue reading…]
Following examples shows how to display a future date and time.
[continue reading…]
Following are various ways to display a past date and time:
[continue reading…]
Following are different ways of displaying the current date and time in various formats.
$ date Thu Jan 1 08:19:23 PST 2009 $ date --date="now" Thu Jan 1 08:20:05 PST 2009 $ date --date="today" Thu Jan 1 08:20:12 PST 2009 $ date --date='1970-01-01 00:00:01 UTC +5 hours' +%s 18001 $ date '+Current Date: %m/%d/%y%nCurrent Time:%H:%M:%S' Current Date: 01/01/09 Current Time:08:21:41 $ date +"%d-%m-%Y" 01-01-2009 $ date +"%d/%m/%Y" 01/01/2009 $ date +"%A,%B %d %Y" Thursday,January 01 2009
Following are the different format options you can pass to the date command:
- %D date (mm/dd/yy)
- %d day of month (01..31)
- %m month (01..12)
- %y last two digits of year (00..99)
- %a locale’s abbreviated weekday name (Sun..Sat)
- %A locale’s full weekday name, variable length (Sunday..Saturday)
- %b locale’s abbreviated month name (Jan..Dec)
- %B locale’s full month name, variable length (January..December)
- %H hour (00..23)
- %I hour (01..12)
- %Y year (1970…)
Before setting the hardware date and time, make sure the OS date and time is set appropriately as shown in the hack#7.
Set the hardware date and time based on the system date as shown below:
[continue reading…]
Use shopt -s cdspell to correct the typos in the cd command automatically as shown below. If you are not good at typing and make lot of mistakes, this will be very helpful.
[continue reading…]
You can use directory stack to push directories into it and later pop directory from the stack. Following three commands are used in this example.
- dirs: Display the directory stack
- pushd: Push directory into the stack
- popd: Pop directory from the stack and cd to it
You can toggle between the last two current directories using cd – as shown below.
[continue reading…]