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

Code analysis of synchronous and asynchronous setState issues in React

React originated as an internal project at Facebo...

Understanding JSON (JavaScript Object Notation) in one article

Table of contents JSON appears Json structure Jso...

How to use HTML 5 drag and drop API in Vue

The Drag and Drop API adds draggable elements to ...

Detailed explanation of docker network bidirectional connection

View Docker Network docker network ls [root@maste...

MySQL slow query method and example

1. Introduction By enabling the slow query log, M...

Detailed explanation of Apache website service configuration based on Linux

As an open source software, Apache is one of the ...

Summary of several MySQL installation methods and configuration issues

1. MySQL rpm package installation # Download the ...

Vue implements real-time refresh of the time display in the upper right corner

This article example shares the specific code of ...

Flex layout achieves fixed number of rows per line + adaptive layout

This article introduces the flex layout to achiev...

A detailed introduction to wget command in Linux

Table of contents First install wget View Help Ma...

Super detailed steps to install zabbix3.0 on centos7

Preface Recently, part of the company's busin...

How to automatically import Vue components on demand

Table of contents Global Registration Partial Reg...

How to use Docker+DockerCompose to encapsulate web applications

Table of contents Technology Stack Backend build ...

How to optimize MySQL group by statement

In MySQL, create a new table with three fields, i...