Unix uses Shells to accept commands given by users.
Commonly used shells: SH(Bourne SHell) CSH(C SHell) and KSH(Korn SHell
Other shells: KSH is based on SH and so is BASH(Bourne again shell). TCSH(Extended C SHell) is based on CSH.
To check which shell is installed: echo $SHELL
Shell's command line gives interface between users and UNIX Kernel.
Frequently used commands:
sudo su -
gzip -d xyz.gz
pwd
ls -a
cd /home
./sample.sh (to execute a file)
cp
mv
date "%y,%m,%d,%h"
whoami
ps -e | grep parse
kill
hostname
ifconfig
General:
Use semicolon(;) to separate commands, backslash(\) to continue the commands in new line and pipe(|) to pass the output of one command as input to another command.
Conditional Operators:
&& - A command runs only the previous command is successful
|| - A command runs only the previous command is failed.
Group Commands:
Braces ({}) -Command runs in current shell and returns one exit status for the entire block of the command with in the braces.
Round Brackets(()) - Commands execute is subshell as single block.
Redirection:
> - redirect the output of the command to a new file (ls > output.log)
< - pass the file as input to the command (grep venkat )
Commonly used shells: SH(Bourne SHell) CSH(C SHell) and KSH(Korn SHell
Other shells: KSH is based on SH and so is BASH(Bourne again shell). TCSH(Extended C SHell) is based on CSH.
To check which shell is installed: echo $SHELL
Shell's command line gives interface between users and UNIX Kernel.
Frequently used commands:
sudo su -
gzip -d xyz.gz
pwd
ls -a
cd /home
./sample.sh (to execute a file)
cp
mv
date "%y,%m,%d,%h"
whoami
ps -e | grep parse
kill
hostname
ifconfig
General:
Use semicolon(;) to separate commands, backslash(\) to continue the commands in new line and pipe(|) to pass the output of one command as input to another command.
Conditional Operators:
&& - A command runs only the previous command is successful
|| - A command runs only the previous command is failed.
Group Commands:
Braces ({}) -Command runs in current shell and returns one exit status for the entire block of the command with in the braces.
Round Brackets(()) - Commands execute is subshell as single block.
Redirection:
> - redirect the output of the command to a new file (ls > output.log)
< - pass the file as input to the command (grep venkat )