Common Linux Commands with Examples – Part 6

FREE Online Courses: Click, Learn, Succeed, Start Now!

1. Linux Commands with Examples

This Linux commands tutorial will provide you with Common Linux commands List that will help you in gaining further Linux programming knowledge. You will learn Linux commands like gunzip, bunzip2, tar, uniq, set, unset, uname, df, du and touch in this section. For more commands, go through Linux commands part 1, part 2, part 3, part 4 and part 5.

So, let’s start Common Linux Commands with Examples.

Linux Commands with Example

Common Linux Commands with Example

2. Common Linux Commands with Examples

Here, is the list of Common Linux Commands with Examples:

2.1. gunzip

a. Usage:

$ gunzip file.gz

This Linux command unzips the zip file

2.2. bunzip2

a. Usage:

$ bunzip2 file.bz2

Bun zip is used to again compress the already compressed file

b. Usage:

$ bunzip2 -d file.bz2

This command is used to decompress the file.

c. Usage:

$ zcat file.gz

This command is used to display the compressed zip file

2.3. tar

a. Usage:

$ tar -cvf dir.tar dir

Tar rolls an entire directory into a single file. This Linux command tar the dir into a tarboll called dir.tar, where -c is used to create an archive containing all specified items,-f is used for writing the archived item to spesified file,-v is used for verboed(description) the orignal directory will remain same.

b. Usage:

$ tar -xvf dir.tar

This command is used to untar the directory

2.4. uniq

a. Usage:

$ cat file.txt | uniq

This command will display the file which shows only unique entries .It display duplicate record only once.

b. Usage:

$ cat file.txt | uniq | sort

This command displays unique and sorted file

c. Usage:

$ cat file.txt | sort | uniq –d

This Linux command displays non-unique entries in a sorted form

2.5. set

a. Usage:

$ set -o vi

This command is used to set various properties of your shell. It will use vi style key binding in the terminal.

b. Usage:

$ set -o emacs

This command uses emacs style key bindings in the terminal

c. Usage:

$ set –x

This command will activate debugging from here

d. Usage:

$ set +x

This command will deactivate debugging from here

2.6. unset

a. Usage:

$ TEST=asdf
$ echo $TEST
asdf
$ unset TEST
$ echo $TEST

This Linux command is used to clear or unset the value of a variable.

2.7. uname

a. Usage:

$ uname

uname prints out various system information in the simplest form

b. Usage:

$ uname -a

If you use the -a flag for all, you get all sorts of information

2.8. df

a. Usage:

$ df -h

This command use to see how much space you have left on your hard disk. The -h flag means “human readable,” form

2.9. du

a. Usage:

$ du -sh myfolder

This Linux command use for checking the sizes of individual directories

b. Usage:

$ cd
$ du -sh *

If you wanted to check how much space each folder is using in your HOME directory, you could do using this command

2.10. touch

a. Usage:

$ touch test

Touch makes an empty file. E.g., to make an empty file called test, use the above Linux command.

So, this was all about Common Linux Commands with Examples. Hope you like our explanation.

Furthermore, if you have any query, feel free to ask in the comment section.

Reference

Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google

follow dataflair on YouTube

3 Responses

  1. Mayank says:

    Hey, All the basic Linux commands covered here in a very simple way!. Quickly took a tour to your blog posts and seems to be very useful especially for beginners.

    • DataFlair Team says:

      Hello, Mayank
      Thanks for commenting on Common Linux Commands. We have 5 part of Linux commands please refer them as well.
      Hope, you are enjoying your learning.
      Keep learn and Keep explore DataFlair

  2. harikrishna gajjala says:

    Thanks a lot for Data_flair team.

Leave a Reply

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