How to compress a folder in Ubuntu?
In Ubuntu, you can use the tar command to compress a folder.
- Open the terminal.
- Navigate to the directory where the folder you want to compress is located. For example, if the folder you want to compress is on the desktop, you can use the following command to navigate to the desktop directory:
cd ~/Desktop
- To compress a folder, use the tar command. Here is the basic syntax for compressing a folder.
tar -czvf 压缩文件名.tar.gz 要压缩的文件夹名
- -c: Create a new compressed file.
- -z: compress using the gzip algorithm.
- -v: display a detailed process of compression.
- -f: Specify the name of the compressed file.
For example, to compress a folder named “myfolder”, you can use the following command:
tar -czvf myfolder.tar.gz myfolder
- Wait for the compression process to finish. Once completed, a compressed file named “compressedfilename.tar.gz” will be created in the current directory, with “compressedfilename” being the name you specified in the command.