Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, April 17, 2012

date command linux

To display yesterdays date in linux:

date --date="yesterday"

To subtract 1 day from date in linux:

previous_date=`date -d "$(date +%Y-%m-%d) -1 days" +%Y%m%d`

Tuesday, October 18, 2011

Linux Shell Date Expressions

Very often you have to work with date and time information in shell scripts.
date command takes various format options

1)MM/DD/YYYY
[username@hostname ]$ tname=$(date +%m/%d/%Y)
[username@hostname ]$ date +%m/%d/%Y
10/18/2011
[username@hostname]$ echo $tname

2)YYYYMMDDHH24MISS
[username@hostname ]$ tname=$(date +%Y%m%d%H%M%S)
[username@hostname ]$ echo $tname
20111018095553

Tuesday, September 14, 2010

Linux System Information

To display information about the cpu:
cat /proc/cpuinfo


To display information about the RAM:
free -g  [in GB]