Basic Linux Commands For Beginners Part5

By | January 16, 2011

This is the part5 and the final article in the basic linux commands series. I started editing this artile while I was travelling from my office to home on a local train in chennai, India. Do check out my part1, part2, part3, and part4 of the tutorials I previously posted. I’m also planning to extend these tutorials with advanced usage of all the commands mentioned in the basic linux command series. Any way, first things first, let me start with the part5 and the last article in the basic linux commands serices. Note that these commands start in an incremental order as always. The first command starts at 41 and ends at 50. So, here we go…

41: su – su is used to change the user on a linux machine terminal.

linux@india365:~/work/test1$ su root
Password:
india365:/home/linux/work/test1#

42: sudo – sudo is used to give special permissions to users to access, edit or run some restricted files in the linux machine. You can also access the root account using sudo if proper settings were made in the /etc/sudoers file.

Without sudo permission in /etc/sudoers file.

linux@india365:~$ sudo su –
[sudo] password for linux:
linux is not in the sudoers file. This incident will be reported.
linux@india365:~$

With sudo permission in /etc/sudoers file.

linux@india365:~$ sudo su –
india365:~#

43: tail – displays the last few lines of a standard terminal output. You can also specify the total number of lines you want to view from the end using tail followd by number of lines you want to see.

linux@india365:~$ ps aux | tail -5
root 4298 0.0 0.1 4196 1632 pts/0 S 00:11 0:00 bash
linux 4306 0.0 0.1 3772 1120 pts/0 S 00:12 0:00 su linux
linux 4307 0.2 0.2 5684 2968 pts/0 R 00:12 0:00 bash
linux 4334 0.0 0.0 3716 1032 pts/0 R+ 00:13 0:00 ps aux
linux 4335 0.0 0.0 3040 508 pts/0 R+ 00:13 0:00 tail -5

44: tar – Tar is used to compress and decompress a directory. This can be really useful when you want to transfer a file from one host to another.

linux@india365:~/work$ tar czf ../work1/work.tgz *
linux@india365:~/work$ cd ../work1/
linux@india365:~/work1$ ls
work.tgz

45: top – displays the cpu and memory utilization along with the processes running on the machine.

linux@india365:~/work1$ top

46 mount – mounts a filesystem.

linux@india365:~/work/test1$ sudo mount /dev/sda6 ./mount-test/
linux@india365:~/work/test1$ cd ./mount-test/
linux@india365:~/work/test1/mount-test$ ls
linux lost+found vmtools
linux@india365:~/work/test1/mount-test$ cd ..
linux@india365:~/work/test1$ clear

47: umount – unmount a filesystem.

linux@india365:~/work/test1$ sudo umount ./mount-test/
linux@india365:~/work/test1$ cd ./mount-test/
linux@india365:~/work/test1/mount-test$ ls
linux@india365:~/work/test1/mount-test$

48: wc – displays total number of lines, words and byte count of a file.

linux@india365:~/work$ wc hello1
1 2 12 hello1
linux@india365:~/work$ cat hello1
Hello there

49: wget – Downloads a file from the URL that was specified.

wget URL-OF-THE-FILE

50: which – Shows the location of any executable files in the linux machines.

linux@india365:~/work$ which ls
/bin/ls
linux@india365:~/work$ which cat
/bin/cat

51: whoami – displays the username of the user who is curretly logged into the machine.

linux@india365:~/work$ whoami
linux
linux@india365:~/work$

If you like this article, then please consider sharing it. Sharing really inspires us to do things much better!!

Leave a Reply

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