Tuesday, June 16, 2015

Date Command with Format

Date command in Linux shows the results as below:
#date
#Tue Jun 16 16:18:50 EDT 2015

But if you want to display the date say in the format 16-06-15 then use the following format option with date command:
#date +"%d-%m-%y"
#16-06-15

Choose vi editor to open with crontab

Generally "crontab -e" opens with nano editor or gives an option to choose editor when opened for the first time. 
If you want to change the editor later on, enter the command "select-editor" and choose vi. This will force crontab to use vi.

To find your ip address

To find your local IP address type the following command:
  • ip -o -f inet address show scope global|grep -Po "(?<=inet ).*(?=/)"

To find your global or internet ip address, type the following command:
  • curl -w '\n' ident.me
  • curl http://icanhazip.com