Tuesday, February 5, 2013

Understanding basic shell commands of Linux



Understanding basic shell commands of Linux:-

Shell:-
The shell act's as the most powerful interaction between user and the kernel in system. The shell is a command line interpreter, it interprets the user typed commands in console of terminal.
There are various types of shells are available, which are as follows:
       Bourne shell
       C shell
       Korn shell
       Bash shell
Let's discuss some basic shell commands:-
pwd:
The shell command “pwd” prints the current working directory. That means if you are working in home it will display “/home”.
Ex:ravi@ravi:~$ pwd
/home/ravi
cd:
The shell command “cd” allows us to change the directory. We have to move to particular directory to access the contents in it or by specifying explicit  path of a file, so we can access any file.
Ex:
ravi@ravi:~$ cd Downloads
ravi@ravi:~/Downloads$
cat:
The shell command “cat” displays the contents of file in console.
Ex:
ravi@ravi:~$ cat workshop
Displays the contents of file workshop
rm:
The shell command “rm” allows us to remove the file from current directory.          
Ex:
ravi@ravi:~$ rm unixfile
After executing this command the file “unixfile” is removed or deleted.
rmdir:
The shell command “rmdir” allows us to remove the directory from current directory.
Ex:
ravi@ravi:~$ rmdir directory
After executing this command the directory named “directory” is removed from current directory.
touch:
The shell command “touch” allows us to create file in current directory.
Ex:
ravi@ravi:~$ touch newfile
After executing this command the file “newfile” is created in current directory.
mkdir:
The shell command “mkdir” allows us to create directory in current directory.
Ex:
ravi@ravi:~$ mkdir newdir
After executing this command the directory newdir.
nautilus:
The shell command “nautilus”  allows us to show the home window.
Ex:
ravi@ravi:~$ nautilus
ps:
The shell command “ps” allows us to show the current running process started by the user.
Ex:
ravi@ravi:~$ ps
PID TTY          TIME CMD
3795 pts/0    00:00:00 bash
4867 pts/0    00:00:00 ps
top:
The shell command “top” allows us to show the all the daemon process.
Ex:
ravi@ravi:~$ top
ls:
The shell command “ls” allows us to show the contents of current directory.
Ex:ravi@ravi:~$ ls