9951 explained code solutions for 126 technologies


cli-tarHow do I use the tar command in Linux via the command line?


The tar command in Linux is used for creating, extracting, viewing, and modifying archives. It stands for Tape Archive and is commonly used for creating backups.

To use the tar command, you need to open a terminal window and enter the command with the appropriate flags.

For example, to create an archive of a directory, you can use the following command:

tar -cvf archive.tar /path/to/directory

This will create an archive called archive.tar of the directory specified.

To extract the contents of the archive, you can use the following command:

tar -xvf archive.tar

This will extract the contents of the archive archive.tar into the current directory.

The tar command has many other flags and options for creating, extracting, viewing, and modifying archives. For more information, see the GNU Tar Manual.

Edit this code on GitHub