Home > Operation and Maintenance > Linux Operation and Maintenance > Can linux commands back up folders?

Can linux commands back up folders?

WBOY
Release: 2022-06-23 10:37:27
Original
6304 people have browsed it

Linux commands can back up folders. There are two commands for backing up folders: 1. cp command, which is used to copy files or folders. The syntax is "cp [options] source dest"; 2. dump command, which is used to back up the file system. The syntax is "cp [options] source dest". is "dump [-cnu][-0123456789]...".

Can linux commands back up folders?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

Linux command backup folder

1. cp command

Linux cp (English full spelling: copy file) command is mainly used to copy files or Table of contents.

Syntax

cp [options] source dest
Copy after login

or

cp [options] source... directory
Copy after login

Parameter description:

  • -a: This option is usually used when copying a directory, it Preserve links, file attributes, and copy all contents of the directory. Its effect is equal to the dpR parameter combination.

  • -d: Keep the link when copying. The links mentioned here are equivalent to shortcuts in Windows systems.

  • -f: Overwrite an existing target file without giving a prompt.

  • -i: Contrary to the -f option, a prompt is given before overwriting the target file, asking the user to confirm whether to overwrite. The target file will be overwritten when answering y.

  • -p: In addition to copying the contents of the file, the modification time and access permissions are also copied to the new file.

  • -r: If the given source file is a directory file, all subdirectories and files in the directory will be copied.

  • -l: Do not copy files, just generate link files.

Use the command cp to copy all files in the current directory test/ to the new directory newtest. Enter the following command:

$ cp –r test/ newtest
Copy after login

Note: Users use this command to copy the directory When , you must use the parameter -r or -R.

2. Dump command

The Linux dump command is used to back up the file system.

dump is a backup tool program that can back up a directory or the entire file system to a specified device or into a large file.

Syntax

dump [-cnu][-0123456789][-b <区块大小>][-B <区块数目>][-d <密度>][-f <设备名称>][-h <层级>][-s <磁带长度>][-T <日期>][目录或文件系统] 或 dump [-wW]
Copy after login

Parameters:

  • -0123456789 Backup level.

  • -b Specifies the size of the block in KB.

  • -B Specifies the number of blocks in the backup volume.

  • -c Modify the default density and capacity of the backup tape.

  • -d Set the density of the tape. The unit is BPI.

  • -f Specifies the backup device.

  • -h When the backup level is equal to or greater than the specified level, files marked as "nodump" by the user will not be backed up.

  • -n When backup work requires administrator intervention, send a notification to all users in the "operator" group.

  • -s The length of the backup tape, in feet.

  • -T Specify the time and date to start the backup.

  • -u After the backup is completed, record the backup file system, level, date and time in /etc/dumpdates.

  • -w Similar to -W, but only displays files that need to be backed up.

  • -W Display the files to be backed up and the level, time and date of the last backup.

Backup files to tape

# dump -0 -u /dev/tape /home/
Copy after login

The "-0" parameter specifies the backup level. "-u" requires that the corresponding information be stored in the file/ after the backup is completed. etc/dumpdates for records

Recommended learning:Linux video tutorial

The above is the detailed content of Can linux commands back up folders?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template