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.
2. Common Linux Commands
$ gunzip file.gz
This 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 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 command displays non unique entries in 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 command is used to clear or unset the value of 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 is used to see how much space you have left on your hard disk. The -h flag means “human readable,” form
$ du -sh myfolder
This command is used 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 above command.