You need to use the tar command as follows (syntax of tar command): tar -zcvf archive-name.tar.gz source-directory-name. To extract an archive to a directory different from the current, use the -C, or --directory, tar option, as in. Unlike the head command, however, the tail command prints the last few number of lines (10 lines by default) of a certain file. The following command will create the directory data-1 on the second hard drive can copy the content of the directory to the destination: Letâs assume we want to take backup of / home/linuxtechi, /etc and /opt folder. Example 1: Extracting tar Files to a Specific Directory. In the first example, I will extract the files in articles.tar to a directory /tmp/my_article. Always make sure that the directory into which you want to extract tar file exists. Let me start by creating the /tmp/my_article directory using the command below: 1. 1. cd Command. To extract archive file to a specific folder, use â-Câ option followed by directory path. Over 80% of the internet runs on Linux servers. unzip backup.zip. What Im doing wrong. examples in Linux # ln -s /root/test_file test_link. 6. Linux Commands â Looping Through Directories Examples of the tar command in Linux | Blogstores We can call this for Linux zip folder. Tar Command in Unix To Create Backups (Examples) and f= ⦠More so, about 70-80% of smartphones operate on the Linux operating system. SCP is the classic tool for making encrypted copies between two Linux- and POSIX-compatible computers in a network. rm Command Syntax rm OPTIONS FILES. Tar In Linux For example, the -a option, if added, will display the hidden files (which have their names started with a . Linux Tar Command Examples. This answer is useful. It is 51 MB in size. Letâs assume you have a directory /media/hdd1/data-1 on hard drive 1 and you want to make a copy of it on a new hard drive which is mounted at /media/hdd2.