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

Can linux commands back up folders?

WBOY
WBOYOriginal
2022-06-23 10:37:276058browse

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

or

cp [options] source... directory

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

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]

Parameters:

  • -0123456789 Backup level.

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

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

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

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

  • -f5d50dee8a3b92c4eac078cf803a8c793 Specifies the backup device.

  • -h6c7c492c1e590ba259d751c1901a89de 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.

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

  • -T352d74cc95fc55ac4e33b71390625dbf 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/

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!

Statement:
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