When backing up files in Centos7, add the backup date to the backup file

When backing up files in Centos7, add the backup date to the backup file

Linux uses files as the basis to manage the devices, interfaces, files, startup and application software in the system. Because in this process, the .conf files, script software, shell, etc. of the application system are required to be backed up before editing. Generally, when I operate important files, I always back them up first, such as:

01. Create a new file

#echo "test copy.." > /home/hdnnadmin/test-copy 

02. Spare parts test-copy file

#cp /home/hdnnadmin/test-copy /home/hdnnadmin/test-copy-bak

Or #cp /home/hdnnadmin/test-copy{,-bak}

View the backup results

03. How to add backup time

#cp /home/hdnnadmin/test-copy{,_back_`date '+%Y%m%d%H%M'`}

View backup results

At this time, it is displayed where the spare part date is added in the backup file

Summarize

The above is what I introduced to you about adding spare parts date to backup files when backing up files in Centos7. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • CentOS7 enables MySQL8 master-slave backup and daily scheduled full backup (recommended)
  • Rsync+crontab regular synchronization backup under centos7
  • How to backup and restore Redis data in Centos7

<<:  JS implements array filtering from simple to multi-condition filtering

>>:  Detailed explanation of how to view the current number of MySQL connections

Recommend

Implementation of installing Docker in win10 environment

1. Enter the Docker official website First, go to...

MySQL full backup and quick recovery methods

A simple MySQL full backup script that backs up t...

Implementation of a simple login page for WeChat applet (with source code)

Table of contents 1. Picture above 2. User does n...

Share some tips on using JavaScript operators

Table of contents 1. Optional chaining operator [...

HTML page adaptive width table

In the pages of WEB applications, tables are ofte...

Some points on using standard HTML codes in web page creation

<br />The most common mistake made by many w...

How to build Nginx image server with Docker

Preface In general development, images are upload...

Summary of common functions of PostgreSQL regular expressions

Summary of common functions of PostgreSQL regular...

Win10 installation Linux system tutorial diagram

To install a virtual machine on a Windows system,...

Use the sed command to modify the kv configuration file in Linux

sed is a character stream editor under Unix, that...

Minio lightweight object storage service installation and browser usage tutorial

Table of contents Introduction Install 1. Create ...

How to deploy Angular project using Docker

There are two ways to deploy Angular projects wit...

Summary of various postures of MySQL privilege escalation

Table of contents 1. Write Webshell into outfile ...