spotjava.blogg.se

Unix tar compress folder to another directory
Unix tar compress folder to another directory





  1. #UNIX TAR COMPRESS FOLDER TO ANOTHER DIRECTORY HOW TO#
  2. #UNIX TAR COMPRESS FOLDER TO ANOTHER DIRECTORY ARCHIVE#

#UNIX TAR COMPRESS FOLDER TO ANOTHER DIRECTORY ARCHIVE#

Here's a useful tip: commands that take a long time to execute can continue in the background with &.Īdding files to an archive and extracting an archive can take a while. f is extracting from the archive named 'logs_'. To extract files from an archive, you use the -x flag like this: tar -xzvf logs_ f specifies the filename and -v displays the detailed contents. In this command, -t flag specifies that we need to only view the contents of the archive. You might need to view the contents of an archive without actually extracting it. Once we list the files, we only see the archive. Here, the -czvf flags are working as demonstrated before, but the original files are also removed. tar -czvf logs_ * -remove-files Files removed once archive has been created For that, we can use the -remove-files flag. Let's say we don't want to keep the original files after creating an archive. Archive has been created with supplied command. In the results below, we can see that the archive has been created successfully. f is creating an archive with the name 'logs_' as supplied in the command above. v is providing details of the files that have been archived. Let's break down this command and look into each flag. To compress them, we'll use tar like this: tar -czvf logs_ * We have a list of the following files which we'll compress with tar. We use this flag when files need to be extracted from an archive. Providing the -v flag shows details of the files compressed.Īrchive file names are mapped using the -f flag.

unix tar compress folder to another directory

When we specify this flag, it means that archive will be created using gzip compression. We use this flag whenever we need to create a new archive. The tar command uses the following flags to customize the command input: Flag The syntax is shown below: tar destinationFileName sourceFileName We use the tar command to compress and expand files from the command line.

#UNIX TAR COMPRESS FOLDER TO ANOTHER DIRECTORY HOW TO#

In this post, we'll look at how to compress files with the tar command in Linux, along with some examples of tar in action.

unix tar compress folder to another directory

You can also compress older and rarely used files and save them for future use which helps you conserve disk space. And compressed files are also easier to copy to remote servers. It helps you reduce file size and share files efficiently. File compression is an essential utility across all platforms.







Unix tar compress folder to another directory