From the course: Linux: System Information and Directory Structure Tools (2017)

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Archive files

Archive files - Linux Tutorial

From the course: Linux: System Information and Directory Structure Tools (2017)

Start my 1-month free trial

Archive files

- [Instructor] We often have to archive files and directories for backup purposes. With other operating systems, such as Windows, we might use .zip for this. In Linux, we use an archiver to preserve metadata such as ownership, permissions, access control lists, as well as the file data itself. The tool we usually use is tar, or Tape Archiver. Tar itself doesn't compress files but leaves that job up to compression tools. To demonstrate, we're going to create an archive of the /etc directory. Because we're archiving a system directory, we'll need to elevate privileges with sudo. Type in sudo, space, tar, space, --xattrs. Xattrs preserves extended attributes, including access control lists and SELinux security contexts. Space, -c to create an archive, v for verbose, p to save ownership and permissions, and then f for the final name of the archive. We're going to call it etc.tar, space, and then the last argument is going to be the items you want in the archive; in our case, etc, the…

Contents