Connect with us


13 Most Used Cat Command Examples In Linux



The cat command in Linux is one of the most used commands that give you a wide variety of options to perform executions. You can create a file, view the content of single and multiple files, make modifications in the file, add data, remove data, and much more with the cat commands.

Cat commands are widely used in Linux and Unix-like systems and are very helpful to do your work only with short commands. These commands read the file data and display it in the output terminal. Know the cat commands in Linux and use them for your system executions.

cat command in linux

Here, we will show you 13 basic cat command examples in Linux. Make sure to go through all of them and use the commands for your operations.

Cat Command In Linux

The Cat commands in Linux are used to read the data and to give the output. Here, one thing you have to note is the syntax of cat commands. There is a fixed general form for the cat commands, and you have to make your program entries as it says to do.

General Syntax For Cat Command

Whenever you want to write a command for Concatenating the files, the syntax must be like this:

cat [OPTION] [FILE]...

Create A File

To create a file, give this cat command in Linux.

# cat >test2

Once you create a file, you have to enter the content or input. Type whatever input you want to save and press Ctrl+D. The text will be saved in the created file.

# cat test2

hello everyone, how do you do?

View Contents Of Single File

For viewing a specific file’s content, you have to give the command as shown below.

# cat /etc/passwd


View Contents Of Multiple Files

To view more than one file content, you can give a cat command as shown in below. From this command, you will get the content from test and test1 files.

# cat test test1

Hello everybody
Hi world,

View Multiple Files At Once

Besides the above command, you can also use this method for viewing multiple files. Here, you have to give multiple filenames with the cat command. The semicolon (;) is a must to include at the end.

# cat test; cat test1; cat test2

This is test file
This is test1 file.
This is test2 file.

For More & Less Options

If you want to reduce the size of the file or contrast to it, you can use this cat command in Linux. Since large files don’t fit in the output terminal and might create output errors, these commands will be helpful.

# cat song.txt | more
# cat song.txt | less

Display Line Numbers Of File

If you want to view the line numbers of a file, then you have to use the number option “-n”. You can view the number of lines of the file name given. The command should be as this:

# cat -n song.txt

1  "Heal The World"
2  There's A Place In
3  Your Heart
4  And I Know That It Is Love
5  And This Place Could
6  Be Much
7  Brighter Than Tomorrow
8  And If You Really Try
9  You'll Find There's No Need
10  To Cry
11  In This Place You'll Feel
12  There's No Hurt Or Sorrow

Display $ In File

To fit multiple lines in a single line, and also to easily notice the unnecessary gaps in paragraphs, you can add a $ in the file with the “-e” option.

# cat -e test

hello everyone, how do you do?$
Hey, am fine.$
How's your training going on?$

Display Tab Separated Lines

By using “-T” in the cat command, you can separate the Tab used lines from the normal lines. The TAB separated lines will show “^I” notations at the beginning.

# cat -T test

hello ^Ieveryone, how do you do?

Hey, ^Iam fine.
^I^IHow's your training ^Igoing on?
Let's do ^Isome practice in Linux.

Redirect Standard Output

You can also redirect the standard output of a file to another file. For example, you can transfer the output of file1 to file2 with the help of the redirection operator (>). Here, the file2 content will be replaced with file1 content. So, file2 content will be erased.

# cat test > test1

Appending Standard Output

The appending redirection operator symbol is “>>” and is used to add the content to an existing file without removing the content. For example, if you want to add file1 content to file2, the cat file1>>file2 command will add the file1 content at the end of file2.

# cat test >> test1

Redirect Standard Input

The standard input redirection operator symbol “<” transfers the input from a file to another file and gives as the output.

# cat < test2

This is test2 file.

Redirect Multiple Files

A new output file is created and the redirected multiple files will be saved in the output file and displayed in the output terminal. Here test3 is the newly created file. Give the below Linux cat command to direct multiple standard output files.

# cat test test1 test2 > test3

Sort Contents Of Multiple Files

When you want to sort all the files, you have to create a new file that will store the output results of multiples in an arranged manner. Give the below cat command in Linux.

# cat test test1 test2 test3 | sort > test4

How To Use Cat Command In Linux

To use the cat command in Linux, just follow the simple steps given here.

  1. Go to the terminal program on your Linux system.
  2. Now, type the cat command based on the operation that you want to perform.
  3. And press Enter to run the command.

This was the simple procedure to use the cat command in the Linux system. The commands vary based on your operation. You can add, modify, concatenate, and many such operations with cat commands. Use the cat command in Linux that we have given above using this procedure.


We hope you found this article helpful. Here we have listed the cat command in Linux that are widely used and are easy too. If you liked this article about cat command Linux, share it with your friends. For more updated cat commands, keep in touch with us on our website Tech 170.

Continue Reading
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

How to

How To Unblock Someone On Snapchat {Complete Step by Step Guide}




Are you a Snapchat user and do you want to know how to unblock someone on Snapchat? People quite think about adding any number of friends/ strangers and unblock someone for some specific reason. The process of unblocking one particular person might be permanent or temporary. It is all up to the user’s choice or opinion.

When you go for the option to block, in the same way, there is an option to unblock and start interacting back with no doubt. But remember one specific point as when you block someone, no more their account will be visible to you. Even your search by tapping their name will be invisible.

unblock someone on snapchat

Therefore, the user is highly requested to get back to their profile, account settings without any fail. Then navigate to the list of multiple blocked users respectively. As a result, let us go here with a simple process associated with various steps provided here. Follow & implement all the steps one by one right away.

How to Unblock Someone on Snapchat [Step by Step Process]

Well, let us move to the process straightforward and implement accordingly. Also, we have come with screenshots involved for every step to have a better understanding further very well.

  • In the first step, open the Snapchat app and click on Snapchat login on your mobile without any fail.


  • Click or open the avatar/ bitmoji/ user’s icon available at the left corner of the screen respectively.


  • Now, navigate to the settings which are available in the form of a gear icon at the top right of the screen.


  • Here the user is going to select the option called account actions-> and then select block available in the form of lists.


  • Once after a successful tap, the user can view the block lists of multiple users. There you have to search for the person you like to unblock and tap on X available next to the user’s name.
  • Doing so successfully unblocks them where one can interact back without any fail.
  • Finally, it asks to confirm whether you really looking to unblock that particular user. If your answer is yes, tap on yes.


  • That’s all!!! As simple as that.

Now the user is successfully unblocked on your profile. This process is applicable to how to unblock someone on Snapchat android and also iOS users to a greater extent.

What Can Be Done After Unblocking Someone On Snapchat

Once after unblocking someone successfully, how can you add back to continue all your journey? Here is the way. Just simply look forward and implement accordingly.


  • Firstly, the user has to type the user’s name at the available search bar.
  • Click on the + button to add available at the right side of the profile on your screen.
  • Now, as per the privacy settings, the blocked person also must and should add you to their friend’s list without any fail.
  • Till the other person accepts your request, you no longer can share snaps, private stories, or other things through Snapchat. At last, those will remain in a pending mode.
  • Therefore, have patience and wait till your friend accepts the request again. Then start afresh journey by interacting and sharing all the things in a more successful way.

Points To Remember

  • One has no limit either to block or unblock any number of friends on Snapchat.
  • When you block someone and unblock in a short time, there is a chance of no re-add option. Just simply wait for 24 hours, search for the person you blocked and unblock without stepping back. That’s all.
  • Snapchat does not give any kind of notification to the blocked/ unblocked users respectively.
  • One can use the Do not disturb mode instead of blocking someone on Snapchat.

These are the few tips involved when you go for either blocking/ unblocking someone on Snapchat respectively. For more information or any doubts, mention the comment box to help and guide you accordingly.

Wrapping Up

As per my views, the process mentioned here is very clear and helps to unblock someone on Snapchat without any fail. For any doubts or like to learn more information about it, just simply drop in the followed rectangular section. So that we help and explain to you accordingly. If you think this article is helpful and like to share this information with others, share it right away through any of the social networking sites. Thank you and get connected with Tech 170 for more interesting tutorials and evergreen tricks.

Continue Reading

How to

Free Netflix Premium Account and Password in 2021




Looking for some free Netflix accounts? Well, this is the right place to get them. Here, we will tell you some working accounts & passwords for Netflix that can get you a free Netflix account.

Netflix is the world’s largest online video streaming service that covers most of the entertainment part on its platform. Just a Netflix subscription can turn your device into a multi-channel Television. You can watch a wide variety of TV series, movies, Netflix originals, American shows, and many more with a Netflix subscription.

free netflix accounts

A monthly Netflix plan can range from $8.99 to $17.99 based on the type of plan you choose. But, not everyone can afford to spend a handful of dollars every month. No need to worry if you don’t want to buy a subscription. You can easily get free Netflix accounts and subscriptions with our useful methods.

Free Netflix Accounts

There are so many ways for getting free Netflix accounts. The easiest of them is getting it from the Netflix fan pages. The current Netflix users who already bought the yearly subscription or a monthly plan but don’t watch anymore due to lack of interest or any other reasons, share their accounts and passwords to let others watch it for free. Generous people, aren’t they?

Free Netflix Accounts & Passwords List

Below we have listed the email addresses and passwords for free Netflix accounts. These are the correct details given by the users themselves. Those who don’t want to use the account anymore, or want to share the account for free give their details like this.

Hence, grab an email id and its password and login to the Netflix account for free. Start watching all your favorite Netflix content with the free accounts. But, don’t change the password so that others can also take the benefit from these accounts.

  • Email ID:                  Password: benjamin03
  • Email ID:             Password: 1564565
  • Email                        Password: netflixpass
  • Email ID:                Password: 051201
  • Email ID:        Password: jm2719
  • Email ID:                  Password: 008249
  • Email ID:                       Password: interview0929
  • Email ID:                                Password: cdefgahc
  • Email ID:                         Password: qwerty7
  • Email ID:                       Password: asser89
  • Email ID:                          Password: slider66
  • Email ID:                         Password: 0o0o6565
  • Email ID:                            Password: jsdaw1979

Since one Netflix account can be shared throughout four platforms at once, the above accounts can also be shared among 4 users. But, some people who get the id first, change the password. If you didn’t get an account and is showing an incorrect password message, then you can try the other methods that we are gonna tell you here.

How To Get Free Netflix Accounts

If you want to stream your favorite videos as in shows and movies on Netflix, then buying a subscription is the most relieving thing to do. But, not everyone is gonna like this option. Since we all know that a Netflix subscription burns holes in our pockets, it is better to find an alternative rather than buying a subscription.

Now we are going to share some effective and practical methods that can surely get you free Netflix accounts. All the methods that we are listing here are legal so don’t worry to try them.

Netflix Free Trial

This method is the easiest and also hundred-percent working. When wanting to get a free Netflix account, just try the free trial of 30 days on Netflix. The first time Netflix subscribers are allowed to sign up for a free trial of one month i.e, 30 days. You can watch all the Netflix premium content completely free of cost for 30 days.

Netflix free trial accounts

Here is how to sign up for a Netflix free trial.

  1.  Install the Netflix app or go to the “” website.
  2. Click on “Sign Up” and create an account by providing your email id and password.
  3. Now, it’s time to get a subscription. Click on the “Start Free Trial” or “Try 30 days free” option.
  4. Enter your card details and other personal information you are asked for.
  5. You will get a free Netflix premium account now that is valid for 30 days.
  6. On the 29th day of your free trial period, cancel the subscription.
  7. This will not charge any fees and you can back out for free anytime.

As of Jan 2021, the free trial option is not available right now. Therefore, look out for updates if this feature goes available again.

Free Netflix Accounts With Virtual Credit Card

Once you used your credit card details to sign up for a free trial, you can’t get another free trial on credit cards. So, you can use a virtual credit card to get a free Netflix account. First of all, get a virtual credit card online. You will need real credit card details to create a virtual credit card.

netflix premium account

Once you have a virtual credit card, just follow the same steps that we have listed for the free trial sign up. This time give the VCC details and use the free Netflix accounts for 30 days.

Use Netflix Cookies

how to get netflix for free

If you don’t want to give your card details, or done giving your card details already, then here is another method that doesn’t involve your credit card. Cookies are very helpful and can get you free Netflix accounts. Follow the given steps below to get a free Netflix account.

  • Firstly, install the “EditThisCookie” extension and add it to your browser.
  • Now, launch the browser again and go to
  • Click on the “EditThisCookie” icon on the top-right of the page.
  • Next, click on “Import”.
  • Paste a Netflix cookie on the page and proceed.

That’s it. You will get a free Netflix premium account and can watch all your favorite shows and movies for free.

Win Free Netflix Accounts Through Giveaways

netflix account free

Giveaways are always the best. You can participate in a giveaway contestant on the online sites where the prize is a Netflix subscription. The official website of Netflix conducts a yearly or twice a year giveaway contest. Or you can look out for some social media fan pages on Twitter, Facebook, Instagram, etc that throw giveaways. Join the giveaway and try your luck.

Share Netflix Account

If you have a friend or family relative who bought a Netflix subscription, just request them to share their account with you. Log in to the Netflix service using their email id and password and start streaming. This is also one of the easiest methods you can use to get free Netflix accounts.

share netflix with friends

If you can’t find a free account, then why not buy it but at a cheaper price. Since a single Netflix account can be shared among 4 users at a time, you can look out for Netflix users who are willing to share their account in exchange for some money. Join a group of 4 members and you all can equally share the fees for the Netflix plan. This way you can watch all your favorite content at a 75% reduced cost.


Even though Netflix is a paid streaming service, it is not like it is impossible to get a free account. Starting with a free trial, you have many options that can you free Netflix accounts. Right now, Netflix free trial option is not available. But, don’t worry you can still use the other methods that we have given here. For more related articles, visit our website Tech 170.

Continue Reading


18 Useful Tar Command with Practical Examples in Linux



The tar commands are the Linux or Unix-like operating system commands that are used to compress, gather, and archive files. In this post, we will be discussing the tar command in Linux. So, make sure to read and note them all to use them on your system.

The tar stands for tape archive files that create a single archive file from a large number of files for easiness of the user. You can easily know the files with their names that will be ending with “tar” and such files are called “tarballs”. There are various commands in Linux to create tarballs such as  .tar.gz or .tgz archive files. Only a little part of the command keeps changing while the else part remains the same.

tar command in linux

Since most of the Linux beginner users are not familiar with all the commands, here we will be giving various examples for Linux tar command tape archive files.

Tar Command In Linux

The tar command in Linux is not only one command. There are various commands that can be used to compress so many files into an archive. Also, you can extract, modify, and maintain the tape archive files with the tar commands.  Therefore, knowing the tar commands is a must.

Create A Tar Archive

To create a tar archive, use the command given follow. The tar command will be

tar -cvf file.tar /path/to/dir

# tar -cvf tecmint-14-09-12.tar /home/tecmint/


The options that we have used above are for the purpose as given below.

  • c – Creates a new tar archive.
  • v – This verbosely shows tar file progress.
  • f – The file type of the archive file.

Create a tar.gz Archive

For creating an archive with the gzip files, we have to use the “z” option. The commands tar.gz and tgz are the same and can be used to compress the gzip files into an archive file.

tar cvzf file.tar.gz /path/to/dir

tar cvzf file.tgz /path/to/dir

# tar cvzf MyImages-14-09-12.tar.gz /home/MyImages
# tar cvzf MyImages-14-09-12.tgz /home/MyImages


Create tar.bz2 Archive

The commands tar.bz2,, and tb2 does the same function. To compress files that are lesser in size when compared to gzip files, we use these commands. The tar.bz2 takes more time to archive files when compared to the tar.gz archive files. Therefore, to create a highly compressed tar.bz2 archive file, we use the “j” option here.

# tar cvfj Phpfiles-org.tar.bz2 /home/php OR # tar cvfj Phpfiles-org.tar.tbz /home/php OR # tar cvfj Phpfiles-org.tar.tb2 /home/php /home/php/ /home/php/iframe_ew.php /home/php/videos_all.php /home/php/rss.php /home/php/index.php /home/php/vendor.php /home/php/video_title.php /home/php/report.php /home/php/object.html /home/php/video.php

Untar tar Archive

To untar means to extract an archive file. To extract a directory from the archive, we use the “x” option. If you want to extract from a different directory, you can use the “-c” option. The below command will untar the specified file.

## Untar files in Current Directory ##
# tar -xvf public_html-14-09-12.tar

## Untar files in specified Directory ##
# tar -xvf public_html-14-09-12.tar -C /home/public_html/videos/


Untar tar.gz Archive

The command to uncompress the tar.gz archive files is as shown in the image. Use the “-c” option to extract from a different directory.

# tar -xvf thumbnails-14-09-12.tar.gz


Untar tar.bz2 Archive

The highly compressed tar.bz2 files can be untarred with the following command. All the .flv files will be extracted from the archive file.

# tar -xvf videos-14-09-12.tar.bz2


View List Content Of tar Archive

For the command for viewing all the list contents that are compressed into an archive file, you have to run the command given below. This command will get you the list of all uploadprogress.tar file.

# tar -tvf uploadprogress.tar

-rw-r--r-- chregu/staff   2276 2011-08-15 18:51:10 package2.xml
-rw-r--r-- chregu/staff   7877 2011-08-15 18:51:10 uploadprogress/examples/index.php
-rw-r--r-- chregu/staff   1685 2011-08-15 18:51:10 uploadprogress/examples/server.php
-rw-r--r-- chregu/staff   1697 2011-08-15 18:51:10 uploadprogress/examples/info.php
-rw-r--r-- chregu/staff    367 2011-08-15 18:51:10 uploadprogress/config.m4
-rw-r--r-- chregu/staff    303 2011-08-15 18:51:10 uploadprogress/config.w32
-rw-r--r-- chregu/staff   3563 2011-08-15 18:51:10 uploadprogress/php_uploadprogress.h
-rw-r--r-- chregu/staff  15433 2011-08-15 18:51:10 uploadprogress/uploadprogress.c
-rw-r--r-- chregu/staff   1433 2011-08-15 18:51:10 package.xml

View List Content Of tar.gz Archive

To view the list content of tar.gz archive file, run the command as given below. You will get all the compressed tar.gz archive files on the screen.

# tar -tvf

-rw-r--r-- root/root         0 2012-08-30 04:03:57
-rw-r--r-- root/root       587 2012-08-29 18:35:12
-rw-r--r-- root/root       156 2012-01-21 07:17:56
-rw-r--r-- root/root       156 2011-12-21 11:30:56
-rw-r--r-- root/root       156 2011-11-20 17:28:24
-rw-r--r-- root/root         0 2012-08-30 04:03:57
-rw-r--r-- root/root      3981 2012-08-29 18:35:12
-rw-r--r-- root/root       211 2012-01-21 07:17:56
-rw-r--r-- root/root       211 2011-12-21 11:30:56
-rw-r--r-- root/root       211 2011-11-20 17:28:24

View List Content Of tar.bz2 Archive

To view the list content of tar.bz2 archive file, give the command as following.

# tar -tvf Phpfiles-org.tar.bz2

drwxr-xr-x root/root         0 2012-09-15 03:06:08 /home/php/
-rw-r--r-- root/root      1751 2012-09-15 03:06:08 /home/php/iframe_ew.php
-rw-r--r-- root/root     11220 2012-09-15 03:06:08 /home/php/videos_all.php
-rw-r--r-- root/root      2152 2012-09-15 03:06:08 /home/php/rss.php
-rw-r--r-- root/root      3021 2012-09-15 03:06:08 /home/php/index.php
-rw-r--r-- root/root      2554 2012-09-15 03:06:08 /home/php/vendor.php
-rw-r--r-- root/root       406 2012-09-15 03:06:08 /home/php/video_title.php
-rw-r--r-- root/root      4116 2012-09-15 03:06:08 /home/php/report.php
-rw-r--r-- root/root      1273 2012-09-15 03:06:08 /home/php/object.html

Untar A Single File From tar Archive

To uncompress or extract a single file called from the archive tar file, use the following command.

# tar -xvf
# tar --extract

Untar A Single File From tar.gz Archive

To untar a single file from the tar.gz highly compressed archive files, use the follwing tar command in Linux.

# tar -zxvf tecmintbackup.tar.gz tecmintbackup.xml
# tar --extract --file=tecmintbackup.tar.gz tecmintbackup.xml


Untar A Single File From tar.bz2 File

To extract a single from a tar.bz2 highly compressed archive file, run the following tar command in Linux.

# tar -jxvf Phpfiles-org.tar.bz2 home/php/index.php
# tar --extract --file=Phpfiles-org.tar.bz2 /home/php/index.php


Untar Multiple Files From tar, tar.gz, and tar.bz2 Archive

If you want to untar multiple files from more than one archive file, you can give the following command.

# tar -xvf tecmint-14-09-12.tar "file 1" "file 2" 

# tar -zxvf MyImages-14-09-12.tar.gz "file 1" "file 2" 

# tar -jxvf Phpfiles-org.tar.bz2 "file 1" "file 2

Untar Group Of Files Using Wildcard

For extracting a group of files from archive files, we have to use Wildcard. To extract a group of files with .php type from a tar, tar.gz, or tar.bza2 archive files, use the Linux tar command as given below.

# tar -xvf Phpfiles-org.tar --wildcards '*.php'

# tar -zxvf Phpfiles-org.tar.gz --wildcards '*.php'

# tar -jxvf Phpfiles-org.tar.bz2 --wildcards '*.php'


Add Directories To tar Archive

To add a new directory to the existing archive file, we use the path option as r(append). For example, here we are adding  php and xyz.txt directories to the already archive file.

# tar -rvf tecmint-14-09-12.tar xyz.txt

# tar -rvf tecmint-14-09-12.tar php

drwxr-xr-x root/root         0 2012-09-15 02:24:21 home/tecmint/
-rw-r--r-- root/root  15740615 2012-09-15 02:23:42 home/tecmint/
-rw-r--r-- root/root    863726 2012-09-15 02:23:41 home/tecmint/openvpn-2.1.4.tar.gz
-rw-r--r-- root/root  21063680 2012-09-15 02:24:21 home/tecmint/tecmint-14-09-12.tar
-rw-r--r-- root/root   4437600 2012-09-15 02:23:41 home/tecmint/phpmyadmin-
-rw-r--r-- root/root     12680 2012-09-15 02:23:41 home/tecmint/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
-rw-r--r-- root/root 0 2012-08-18 19:11:04 xyz.txt
drwxr-xr-x root/root 0 2012-09-15 03:06:08 php/ 
-rw-r--r-- root/root 1751 2012-09-15 03:06:08 php/iframe_ew.php 
-rw-r--r-- root/root 11220 2012-09-15 03:06:08 php/videos_all.php 
-rw-r--r-- root/root 2152 2012-09-15 03:06:08 php/rss.php 
-rw-r--r-- root/root 3021 2012-09-15 03:06:08 php/index.php 
-rw-r--r-- root/root 2554 2012-09-15 03:06:08 php/vendor.php 
-rw-r--r-- root/root 406 2012-09-15 03:06:08 php/video_title.php

Add Directories To tar.gz and tar.bz2 Archive

There are no commands for adding directories to an already existing tar.gz or tar.bz2 highly compressed archive file. If you try adding a directory to either of them, you will get an error.

# tar -rvf MyImages-14-09-12.tar.gz xyz.txt

# tar -rvf Phpfiles-org.tar.bz2 xyz.txt

tar: This does not look like a tar archive
tar: Skipping to next header
tar: Error exit delayed from previous errors

Verify tar, tar.gz, and tar.bz2 Archive

The option we use to verify is W(verify). To verify a tar archive file, use the tar command in Linux as given below. However, verifying tar.gz and tar.bz2 is not supported.

# tar tvfW tecmint-14-09-12.tar

tar: This does not look like a tar archive
tar: Skipping to next header
tar: Archive contains obsolescent base-64 headers
tar: VERIFY FAILURE: 30740 invalid headers detected
Verify -rw-r--r-- root/root    863726 2012-09-15 02:23:41 /home/tecmint/openvpn-2.1.4.tar.gz
Verify -rw-r--r-- root/root  21063680 2012-09-15 02:24:21 /home/tecmint/tecmint-14-09-12.tar
tar: /home/tecmint/tecmint-14-09-12.tar: Warning: Cannot stat: No such file or directory
Verify -rw-r--r-- root/root   4437600 2012-09-15 02:23:41 home/tecmint/phpmyadmin-
tar: /home/tecmint/phpmyadmin- Warning: Cannot stat: No such file or directory
Verify -rw-r--r-- root/root     12680 2012-09-15 02:23:41 home/tecmint/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
tar: /home/tecmint/rpmforge-release-0.5.2-2.el5.rf.i386.rpm: Warning: Cannot stat: No such file or directory
Verify -rw-r--r-- root/root         0 2012-08-18 19:11:04 xyz.txt
Verify drwxr-xr-x root/root         0 2012-09-15 03:06:08 php/

Check The Size Of tar, tar.gz, and tar.bz2 Archive

You can check the size of tar, tar.gz, and tar.bz2 archive files with the following command. The size will be given in KB.

# tar -czf - tecmint-14-09-12.tar | wc -c

# tar -czf - MyImages-14-09-12.tar.gz | wc -c

# tar -czf - Phpfiles-org.tar.bz2 | wc -c

How To Use Tar Command In Linux

To use the tar command in Linux, just follow the simple steps given here.

  1. Go to the terminal program on your Linux system.
  2. Now, run “tar -zcvf file. tar. gz/path/to/dir/ command to compress a directory into a file.
  3. To compress a single file into an archive, use the “tar -zcvf file. tar .gz/path/to/dir/ command.
  4. And to compress multiple directories into an archive, run the “tar -zcvf file. tar. gz dir1 dir2 dir3 command.

This was the simple procedure to use the tar command in the Linux system. The commands vary according to the file size and number of files. Use the tar command in Linux that we have given above using this procedure.


We hope you found this article helpful and got an idea about the tar command in Linux. You can use the tar commands to compress large files into an archive file. For more related articles, visit our website Tech 170.

Continue Reading


Copyright © 2021 All Rights Reserved by Tech 170