Click here to visit Original posting
Some Linux commands that might not be sitting in your top favorites list can still come in very handy in a number of ways. In today's post, we're going to examine some interesting though somewhat unusual command options.
Looking at dates -- with a twist
The date command is certainly one that is used quite often, but not necessarily with options that reformat the command's output. In the date commands shown below, we display the normal output and then reformat the date in a format that makes it more convenient to create files or directories that can be easily sorted by date.
$ date Mon Mar 27 10:51:11 EDT 2017 $ date +%Y-%m-%d 2017-03-27
$ ls -l | grep 2017-03-2 drwxrwxr-x 5 graycat graycat 4096 Mar 20 17:00 2017-03-20 drwxrwxr-x 5 graycat graycat 4096 Mar 21 17:00 2017-03-21 drwxrwxr-x 5 graycat graycat 4096 Mar 22 17:00 2017-03-22 drwxrwxr-x 5 graycat graycat 4096 Mar 23 17:00 2017-03-23 drwxrwxr-x 5 graycat graycat 4096 Mar 24 17:00 2017-03-24 drwxrwxr-x 5 graycat graycat 4096 Mar 25 17:00 2017-03-25 drwxrwxr-x 5 graycat graycat 4096 Mar 26 17:00 2017-03-26 drwxrwxr-x 5 graycat graycat 4096 Mar 27 17:00 2017-03-27
A cron job that runs every night might create directories used to store various system or application metrics.
To read this article in full or to leave a comment, please click here