Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the cpio command in Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to use the cpio command in Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Linux common command cpio is mainly used to create or restore backup files tool programs, the cpio command can copy files to the archive package, or copy files from the archive package

A tool program used by cpio to create and restore backup files.

# # Supplementary Notes

The cpio command is mainly used to create or restore backup files. The cpio command can copy files to or from the archive package.

Syntax cpio (option) option-0 or-- null: accept new column control characters, usually used with the "- print0" parameter of the find instruction;-an or-- rest-access-time: reset the access time of the file;-An or-- append: append to an existing backup document, and the backup document must be stored on disk, not on the tape drive -b or-- awap: this parameter has the same effect as specifying the "- ss" parameter at the same time;-B: change the input / output block size to 5210 Bytes;-c: use the old ASCII backup format;-C or-- io-size=: set the input / output block size in Byte;-d or-- make-directories: if necessary, cpio will create its own directory. -E or-- pattern-file=: specify a template file containing one or more template styles that allow cpio to unlock files that meet the template conditions in the format of one template style per column;-f or-- nonmatching: let cpio unlock all files that do not meet the template conditions -F or-- file=: specify the name of the backup file to replace standard input or output, or access the backup file over the network using another host's storage device;-H: specify the file format to be used for backup;-I or-- extract: execute copy-in mode to restore the backup file -l: specify the name of the backup file, which is used instead of standard input, so that the backup file can be read through the network using the saving device of another host;-k: this parameter will be ignored and is only responsible for solving the compatibility problem between different versions of cpio;-l or-- link: replace the copied file with a hard connection and can be used in copy-pass mode -L or-- dereference: copy the original file pointed to by the connection without establishing a symbolic connection;-m or preserve-modification-time: do not change the change time of the file;-M or-- message=: setting to change the information of the saved media -n or-- numeric-uid-gid: when using the parameter "- tv" to list the contents of the backup file, if the parameter "- n" is added, the file list will be listed with the user identification and group identification code instead of the owner and group name;-o or-- create: execute the copy-out mode and establish the backup file -O: specify the name of the backup file to replace the standard output, or use the save device of another host to store the backup file over the network;-p or-- pass-through: execute copy-pass mode, skip the backup step and copy the file directly to the destination directory;-r or-- rename: use interactive mode when there is a file name that needs to be changed -R or-owner when restoring backup files in copy-in mode, or copying files in copy-pass mode, you can specify these backups, the owner of the copied file and the group to which it belongs;-s or-- swap-bytes: swap the contents of each line of bytes;-S or-- swap-halfwords: swap the contents of every half byte;-t or-- list: present the input -u or-- unconditional: replace all files, regardless of whether the date and time is old or new, and overwrite them directly without questioning;-v or-- verbose: show the execution of the instruction in detail;-V or-- dot: when the instruction is executed. Add "." before the execution program of each file. Number;-- block-size=: sets the input / output block size. If the value is set to 5, the block size is 2500, if set to 10, the block size is 5120, and so on;-- force-local: force backup files to be stored on the local host;-- help: online help;-- no-absolute-filenames: create file names using relative paths -- no-preserve-owner: does not retain the owner of the file. Whoever unlocks the backup file will own those files.-- only-verify-crc: when the backup file is in CRC backup format, you can use this parameter to check whether each file in the backup file is correct;-- quiet: does not show how many chunks have been copied. -- sparse: if a file contains a large number of consecutive 0 bytes, the file is sparse;-- version: displays version information. The instance backs up all the ordinary files under / etc to / opt/etc.cpio, using the following command:

Find / etc-type f | cpio-ocvB > / opt/etc.cpio back up all data on the system to the tape drive, use the following command:

Find /-print | cpio-covB > / dev/st0 where / dev/st0 is the device name of the tape and represents the SCSI tape drive.

To view the files backed up on the tape drive above, use the following command:

Cpio-icdvt / tmp/st_content sometimes because there are too many files backed up, a screen cannot be displayed, so we use the following command to output the file information of the tape drive to the file.

Restore the backup package in example 1 to the appropriate location, and if the same file is overwritten, use the following command:

Cpio-icduv above is all the contents of this article entitled "how to use cpio commands in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report