How do I use cpio command under Linux?

How do I use cpio command under Linux?

The "cpio" command is a utility that is used to create and extract archives of files in the "cpio" format under Linux and other Unix-like operating systems. Some of the common tasks that you can perform with the "cpio" command include:

  1. Create a cpio archive:
    To create a cpio archive, you can use the "-o" option followed by the name of the archive file, and then list the files and directories that you want to include in the archive. For example:
ref‮e‬r to:lautturi.com
cpio -o > archive.cpio file1 file2 dir1

This command will create a cpio archive called "archive.cpio" with the files "file1" and "file2" and the directory "dir1".

  1. Extract a cpio archive:
    To extract the files and directories from a cpio archive, you can use the "-i" option followed by the name of the archive file. For example:
cpio -i < archive.cpio

This command will extract the files and directories from the cpio archive "archive.cpio" into the current directory.

  1. List the contents of a cpio archive:
    To list the contents of a cpio archive, you can use the "-t" option followed by the name of the archive file. For example:
cpio -t < archive.cpio

This command will list the names of the files and directories contained in the cpio archive "archive.cpio".

  1. Extract specific files or directories from a cpio archive:
    To extract specific files or directories from a cpio archive, you can use the "-i" option followed by the names of the files and directories that you want to extract. For example:
cpio -i file1 file2 dir1 < archive.cpio

This command will extract the files "file1" and "file2" and the directory "dir1" from the cpio archive "archive.cpio" into the current directory.

These are just some examples of how to use the "cpio" command. Consult the documentation of the "cpio" command and the man pages for more information on how to use the various options and features of the command.

Created Time:2017-10-28 21:38:56  Author:lautturi