How do I get the system time in BASH? How can I get the Linux system using bash shell?
You can use the date command to display and/or set the Linux / UNIX system date and time. To display current time, enter (open the terminal or login over ssh session and type the command at bash prompt):
$ date
Sample outputs:
Wed Oct 27 16:50:41 IST 2010
You can only display time, enter:
$ date +"%T"
Sample outputs:
16:51:05
The following command use your local standards to display date and time:
$ date +"%c"
Sample outputs:
Wednesday 27 October 2010 04:52:06 PM IST
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop




![Linux / Unix: Sed Substitute Multiple Patterns [ Find & Replace ]](http://s13.cyberciti.org/images/shared/rp/3/17.jpg)




![Linux: Change the PATH [ Add New Directory ]](http://s13.cyberciti.org/images/shared/rp/3/19.jpg)




{ 1 comment… read it below or add one }
And to set the time trought BASH, use this:
date MMDDHHmmYYYY
where
MM = Month (2 digits)
DD = Day (2 digits)
HH= Hours (24 hours format)
mm= Minutes (2 digits)
YYYY= Year (4 digits)
Example:
date 102712232010
Set the time to Wed Oct 27 12:23:00 CDT 2010