Otto background

Linux Hack of The Week #1: Date/Time Straight From the Command Line

Everyone here at Automox is a Linux user. Most of us started on Unix, I cut my teeth on Solaris 2.4, and our CTO (Mark Manes) used Slackware first. Over the years we have all discovered some handy tricks. We are going to post a weekly Linux tip starting with some date manipulation tricks.

cal  : Displays the calendar on the command line.
Yes your phone has a calendar, and your desktop for that matter. But having the calendar on the command line is handy so you don’t have to switch out of the terminal.

ntpdate : Set system time over network.
NTP or Network Time Protocol runs on UDP/123 and allows you machine to set it’s time over NTP. The syntax is ntpdate <timeServer> , i.e. ntpdate time.nist.gov. When you are done, set up ntpd to continually set your time over the network.

date : display the date on the command line
The date command has almost infinite uses. Obviously checking the date, but then adding it to log file, adding to filenames, etc.


Running date with no options prints the day.
Running date with +(format) prints the date in a specific format.Then adding it to an echo statement can be really handy for logs.

The date can be formatted in any number of ways. Simply run man date to see the options.

Thanks for reading and we will be back next week with another Linux tip!

About Automox

Facing growing threats and a rapidly expanding attack surface, understaffed and alert-fatigued organizations need more efficient ways to eliminate their exposure to vulnerabilities. Automox is a modern cyber hygiene platform that closes aperture of attack by more than 80% with just half the effort of traditional solutions.

Cloud-based and globally available, Automox enforces OS & third-party patch management, security configurations, and custom scripting across Windows, Mac, and Linux from a single intuitive console. IT and SecOps can quickly gain control and share visibility of on-prem, remote and virtual endpoints without the need to deploy costly infrastructure.

Experience modern, cloud-based patch management today with a 15-day free trial of Automox and start recapturing more than half the time you're currently spending on managing your attack surface. Automox dramatically reduces corporate risk while raising operational efficiency to deliver best-in-class security outcomes, faster and with fewer resources.

Dive deeper into this topic

loading...