"I'm not anti-social; I'm just not user friendly"
All articles
Last comments
me again
If you would like to backup your system to ISO- disk image or clone a partition.
humble pie
I think it works, Mint 18 xfce. Have installed clonezilla from the mint package manager, called it [sudo clonezilla] and it opened.
hoek
This is awesome!
david mabitsi
i cant seem to be winning uninstalling linux mint 17.2
Archive
«    December 2016    »
MonTueWedThuFriSatSun
 1234
567891011
12131415161718
19202122232425
262728293031 
» » Using archiver TAR in Linux Mint

Using archiver TAR in Linux Mint

Using archiver TAR in Linux Mint

tar is one of the tools that we use often to create backups. In this article I will give examples of using tar in Linux Mint. Amendment: these commands work in all versions of Linux Mint. Not only in Linux Mint))))



Sorry for the spelling and phonetic errors in the text.
Owner and main writer of MintGuide.org is not a native English speaker.


By itself, tar is not a archiver in the usual sense of the word, because he does not use compression. At the same time, many file compression software (such as Gzip or bzip2) do not know how to compress multiple files and work with only one file or input stream. Therefore, most of these programs are used together. tar creates an uncompressed archive to store the selected files and directories while keeping some of their attributes (such as access rights). The resulting file *.tar is compressed by a compression tool such as gzip. That is why the archives usually have the extension .tar.gz or .tar.bz2 (tar gzip and bzip2, respectively)

 

We all used to use the software (control program file archives) using the GUI, but sometimes at the most inopportune moment a situation arises where a convenient and beautiful interface favorite desktop is unavailable. Then comes the old good console. And so, let's say in front of us naked the console, the command "ls" showed a list of files, among which are necessary to us, for example, driver.tar.gz. In the last packaged the driver of your video card required for operation of the graphics server. What, hurry to unpack them faster, because boring and uninteresting console already pretty tired. For these purposes, provided the tar command.

 

Options for TAR:

-c

To create an archive.

-f
Create a file output (otherwise it goes to the terminal).

-j
To use bzip2 compression.

-J
Use xz compression.

–lzma
Use lzma compression.

-z
To use gzip compression.

-v
The output in the terminal what happens (action).

To retrieve:

-x
Extracting the archive.

-v
The output in the terminal what happens (action).

-p
Preserve permissions when extracting (ignore mask).

-k
Do not overwrite existing files.

-m
Not to restore the modification time.

-O
To record on the recording”entries” to stdout, not a restore disk.

Other options:

-t
Get the table of contents (contents) from the archive.

-d
The difference between archive and file system.

-b
Use #512 byte records in the I/O blocks.

-W
Option is used to check the archive.

-w
The interactive mode.

-r
Click to add files to an archive (already created).


Other interesting options of this very important commands can be found in the user guide:

man tar
or
tar --help

Therefore, by using the TAR command with the following parameters I will unpack the archive with the driver:

tar -xvzf driver.tar.gz

Other examples:

Create archive directory:

tar -cf directory.tar directory/

To create an archive with multiple files (selected files):

tar -cf directory.tar file1 file2 file3

Pack only .mp3 files in the current directory using BZIP compression and show everything that happens on the console:

tar -cvf my_mp3_collection.tar ./*.mp3

To create an archive of your home directory /home/user/ and keeping the right files:

tar -cvpf user.tar /home/user/

To create an archive of the /etc/ directory , but exclude the directory apache2:

tar -cvf backup_etc_without_apache_folder.tar –exclude='/etc/apache2/'

will pack the folder ~/files with all contents in a compressed gzip archive

tar -cvzf files.tar.gz ~/files

will create the same archive using bzip2 compression

tar -cvjf files.tar.bz2 ~/files

Key -v includes a list of Packed files in the process. Unfortunately, more advanced display process (e.g., indicating the extent of readiness in percent) in tar is not provided. To do this, use graphic archivers.
In addition to gzip and bzip2 can be used, for example, lzma (key lzma) or xz (-J), while the corresponding archiver must be installed in the system.

The action of "unpacking" is specified using key -x. And here again you will need the -f to specify the file name of the archive. Also add the -v switch to the visual display of the process. 

tar -xvf /path/to/archive.tar.bz2

unpack the archive contents to the current folder. Alternative place to decompress, you can specify by using the-C switch:

tar -xvf archive.tar.bz2 -C /path/to/folder

 

To view the contents of the archive use the following command:

tar -tf archive.tar.gz

It displays a simple list of files and directories in the archive. If we add the -v switch, it will display a detailed list indicating size, access rights and other parameters (the same as in ls -l) 

To add files or directories to an existing tar archive files, we use the -r option:

tar -rvf linux-notes.tar test.txt

To check the contents of an archive, use the-W option as shown in the example below:

tar -tvfW linux-notes.tar

 

 

Tags: tar archive

Related articles

Add a comment

  • bowtiesmilelaughingblushsmileyrelaxedsmirk
    heart_eyeskissing_heartkissing_closed_eyesflushedrelievedsatisfiedgrin
    winkstuck_out_tongue_winking_eyestuck_out_tongue_closed_eyesgrinningkissingstuck_out_tonguesleeping
    worriedfrowninganguishedopen_mouthgrimacingconfusedhushed
    expressionlessunamusedsweat_smilesweatdisappointed_relievedwearypensive
    disappointedconfoundedfearfulcold_sweatperseverecrysob
    joyastonishedscreamtired_faceangryragetriumph
    sleepyyummasksunglassesdizzy_faceimpsmiling_imp
    neutral_faceno_mouthinnocent
Login via
Up