Get the App
SLTechnology News&Howtos  ›  Development  › 

How to back up the environment variable file in Linux

Shulou Source: shulou.com Published: 2022-06-01 20:11:46 10月30日 Update

This article will explain in detail how to back up the environment variable files in Linux. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Bzip2 command enter a command at the shell prompt:

Compress the file:

The bzip2 filename / / file is compressed and saved as filename.bz2

Extract the file:

Bunzip2 filename.bz2 / / filename.bz2 is deleted and filename is used instead of bzip2 filename.bz2 file1 file2 file3 / usr/work/school / / to compress the contents of the file1, file2, file3 and / usr/work/school directories into the filename.bz2gzip command

Command at the shell prompt:

Compress the file:

The gzip filename / / file is compressed and saved as filename.gz

Extract the file:

Gunzip filename.gz / / filename.gz is deleted, and filename is used instead of gzip-r filename.gz file1 file2 file3 / usr/work/school / / the above command compresses the contents of the file1, file2, file3, and / usr/work/school directories into the filename.gztar command tar, which packages a large number of files and directories into a file-c to create a new archive-f when used with the-c option The tar file created uses the file name specified by this option When used with the-x option, the archive specified by this option is released-t displays a list of files included in the tar file-v displays the archiving progress of the file-x extracts the file from the archive-z compresses the tar file using gzip-j compresses the tar file using bzip2

To create a tar file:

Tar-cvf filename.tar directory/file / home/mine / / the above command puts directory/file and / home/mine into the archive file

To list the contents of the tar file:

Tar-tvf filename.tar / / to extract the tar file, enter the command: tar-xvf filename.tar / / this command will not delete the tar file, but will copy the unarchived contents to the current directory and retain any directory structure used by the archived file.

Keep in mind that tar does not compress files by default.

To create a file that is archived and compressed using tar and bzip2, use the-j option: tar-cjvf filename.tbz file

If you use the bunzip2 command to extract the filename.tbz file, the filename.tbz is deleted and replaced by filename.tar.

To expand and unarchive the bzip.tar file, enter the command: tar-xjvf filename.tbz

To create a file archived and compressed with tar and gzip, use the-z option: tar-czvf filename.tgz file

If you use the gunzip command to extract the filename.tgz file, the filename.tgz will be deleted and replaced by filename.tar

This is the end of the article on "how to back up environmental variable files in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: File command content directory article input variable backup environment more extraction prompt good practical file name article knowledge structure progress faceted Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Shulou Information Xiaomi Docker MariaDB