Common Linux Commands with Examples – Part 6
Keeping you updated with latest technology trends, Join DataFlair on Telegram
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.
2. Common Linux Commands with Examples
Here, is the list of Common Linux Commands with Examples:
$ gunzip file.gz
This Linux command unzips the zip file
$ bunzip2 file.bz2
Bun zip is used to again compress the already compressed file
$ bunzip2 -d file.bz2
This command is used to decompress the file.
$ zcat file.gz
This command is used to display the compressed zip file
$ 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.
$ tar -xvf dir.tar
This command is used to untar the directory
$ cat file.txt | uniq
This command will display the file which shows only unique entries .It display duplicate record only once.
$ cat file.txt | uniq | sort
This command displays unique and sorted file
$ cat file.txt | sort | uniq –d
This Linux command displays non-unique entries in a sorted form
$ set -o vi
This command is used to set various properties of your shell. It will use vi style key binding in the terminal.
$ set -o emacs
This command uses emacs style key bindings in the terminal
$ set –x
This command will activate debugging from here
$ set +x
This command will deactivate debugging from here
$ TEST=asdf $ echo $TEST asdf $ unset TEST $ echo $TEST
This Linux command is used to clear or unset the value of a variable.
uname prints out various system information in the simplest form
$ uname -a
If you use the -a flag for all, you get all sorts of information
$ df -h
This command use to see how much space you have left on your hard disk. The -h flag means “human readable,” form
$ du -sh myfolder
This Linux command use for checking the sizes of individual directories
$ 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
$ 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.