cpio command in Linux with Examples Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report cpio stands for “copy in, copy out“. It is used for processing the archive files like *.cpio or *.tar. This command can copy files to and from archives. Synopsis: Copy-out Mode: Copy files named in name-list to the archive Syntax: cpio -o < name-list > archive Copy-in Mode: Extract files from the archive Syntax: cpio -i < archive Copy-pass Mode: Copy files named in name-list to destination-directory Syntax: cpio -p destination-directory < name-list Policy Options: -i, –extract: Extract files from an archive and it runs only in copy-in mode. -o, –create: Create the archive and it runs only in copy-out mode. -p, –pass-through: Run in copy-pass mode. -t, –list: Print a table of contents of all the inputs present. Operation modifiers valid in any Mode: -B: Changes the I/O block size to 5120 bytes. -c: Use the old portable (ASCII) archive format. -C, –io-size=NUMBER: Set the I/O block size to the given particular NUMBER of bytes. -D, –directory=DIR: Changes to Directory DIR. -H, –format=FORMAT: Use given arc. -v, –verbose: List the files processed in a particular task. -V, –dot: Print “.” for each file processed in a particular task. -W, –warning=FLAG: Control warning display. Currently FLAG is one of ‘none‘, ‘truncate‘, ‘all‘. Examples: To create a *.cpio file : We can create *.cpio files containing files and directory with the help of cpio command. Syntax: cpio -ov < name-list > archive Here -ov is used as -o create the new archive and -v list the files processed. To extract a *.cpio file: We can extract *.cpio files containing files and directory with the help of cpio command. Syntax: cpio -iv < archive To create *.tar archive file using cpio: The cpio helps to create a *.tar archive. Syntax: cpio -ov -H tar > archive To extract *.tar archive file using cpio: The cpio helps to extract *.tar files containing files and directory. Syntax: cpio -iv -F < archive To create a *.cpio archive with selected files: We can create *.cpio files containing specific files with the help of cpio command. In the example we are using .txt files. Syntax: find . -iname "*.txt" | cpio -ov > archive To create a *.tar archive with selected files: We can create *.tar files containing specific files with the help of cpio command. In the example we are using .txt files. Syntax: find . -iname "*.txt" | cpio -ov -H tar > archive To only view *.tar archive file using cpio: The cpio helps to view *.tar files containing files and directory. Syntax: cpio -it -F < archive Note: To check for the manual page of cpio command, use the following command: man cpio To check the help page of cpio command, use the following command: cpio --help Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now! Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore. Last Updated : 15 May, 2019 Like Article Save Article Previous How to Copy Files in Linux | cp Command Next cpp command in Linux with Examples Share your thoughts in the comments Add Your Comment Please Login to comment...