commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
More recent versions of the date command finally have the ability to decode the unix epoch time into a human readable date. This function makes it simple to utilize this feature quickly.
A shell function using perl to easily convert Unix-time to text.
Put in in your ~/.bashrc or equivalent.
Tested on Linux / Solaris Bourne, bash and zsh. using perl 5.6 and higher.
(Does not require GNU date like some other commands)
This command displays a clock on your terminal which updates the time every second. Press Ctrl-C to exit.
A couple of variants:
A little bit bigger text:
watch -t -n1 "date +%T|figlet -f big"
You can try other figlet fonts, too.
Big sideways characters:
watch -n 1 -t '/usr/games/banner -w 30 $(date +%M:%S)'
This requires a particular version of banner and a 40-line terminal or you can adjust the width ("30" here).
Do not run this command if you already have ntpd running!
This needs to run as root, for example with sudo:
sudo ntpdate pool.ntp.org && sudo hwclock --systohc && sudo hwclock --adjust
This command will fetch accurate time from NTP servers and synchronize your system clock, then it will use the system clock to synchronize your hardware clock, and will calculate the time drift.
Reconfigures time zone in Ubuntu, which I cannot figure out how to do through the GUI. Worked like a charm to set my time zone to CEST from EDT.