Main Menu

Search

Showing posts with label Date TimeStamps. Show all posts
Showing posts with label Date TimeStamps. Show all posts

LINUX: Take Backup of Files Using DateTimeStamps In Backup Filename (How To Doc)

Below is the command to take backup of file so that backup file has datetimestamps (Date / Timestamps) in name when the file was backed up.
cp -rp testfile.out testfile.out__$(date +%F'-'%T)

In above command example we are backing up testfile.out. Change this filename to the filename you want to backup. Below is example snippet which shows the backup file created with datetimestamps (highlighted in bold).

-rw-r--r-- 1 root root   0 Sep 28 14:39 testfile.out__2019-09-28-14:39:16
-rw-r--r-- 1 root root   0 Sep 28 14:39 testfile.out

Products to which Article Applies

All UNIX Operating Systems

LINUX: How To Check Date/Timestamps When Linux Machine Was Rebooted From /var/log/messages system log?

Below command can be used to check date and timestamp when Linux machine was rebooted from /var/log/messages system log.
egrep -iR "Linux version" messages*

Below is example snippet of above command.

# egrep -iR "Linux version" messages*
messages-20190823:Aug 22 22:46:03 [localhost] kernel: Linux version 4.1.12-112.14.13.el7uek.x86_64 (mockbuild@) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #2 SMP Thu Jan 18 11:38:29 PST 2018
messages-20190823:Aug 23 02:23:19 [localhost] kernel: Linux version 4.1.12-112.14.13.el7uek.x86_64 (mockbuild@) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #2 SMP Thu Jan 18 11:38:29 PST 2018
messages-20190826:Aug 26 13:26:52 [localhost] kernel: Linux version 4.1.12-112.14.13.el7uek.x86_64 (mockbuild@) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #2 SMP Thu Jan 18 11:38:29 PST 2018


Products to which Article Applies


All Linux Operating Systems