PROGRAM 1 : Program of ls command
ls command –(list directory)
The ls command display information about files and directories within a specified directory
ls -l => (long listing format)
ls -a => (show hidden files and directories)
ls -h => (human readable format )
ls -r =>( reverse order )
ls -t => (time) show latest file
ls -S => (size) show largest file
ls -R => (recursively )
ls -la => (show hidden files in long listing format)
ls -lt => (show present file in long listing format )
OUTPUT :
PROGRAM 2: Program of pwd command
pwd => (print working directories/present working directory)
pwd -P => (physical or working path of the working directory)
pwd -L =>(logical or symbolic path of working directory)
OUTPUT :
PROGRAM 3: Program of creating a file and changing a directory
cd => (change the directory)
OUTPUT :
PROGRAM 4: Program of top command
top => (table of processes)
The top command shows a real time view of running process and display task . The
command also provide a system information summary that shows resource utilization,
including CPU and memory .
OUTPUT :
PROGRAM 5: Program of dig command
dig => (Domain Information Groper)
Dig is a linux command that performs DNS lookup by querying name server and display the
result to you.
OUTPUT :
PROGRAM 6: Program of creating a file and copying a file into directory
cp => (copy)
cp [Link] [Link] –(to copy the content of file 1 into file 2)
OUTPUT :
cp
[Link] dir1 –(copy file 1 into directory 1)
OUTPUT :
cp
[Link] [Link] dir1 –(copy file1 and file 2 into directory 1)
OUTPUT :
PROGRAM 7: Program of cal command
cal => calendar
OUTPUT :
PROGRAM 8: Program of date command
OUTPUT :
PROGRAM 9: Program of cat command
cat => concatenates file together
OUTPUT :
PROGRAM 10: Write a shell script to print “Hello World”
Shell Scripting:- The bash script is a text file that contain set of instruction that can be
executed in the terminal
OUTPUT:
PROGRAM 11: Write a shell script to display date in the Y/M/D format
date => display date
date ‘+%y-%m-%d %H:%M:%S’ => display date in the format of Y/M/D with
hour/minute/seconds
date -d ‘5 days ago’ => display date of 5 days ago
OUTPUT:
PROGRAM 12: Local, global and constant variable in shell script
Local variable :-
OUTPUT :
Global variable :-
OUTPUT :
Constant variable :-
OUTPUT :
PROGRAM 13: Decision making in shell script
a) if-else
OUTPUT :
b) elif
OUTPUT :
C) case-sac
OUTPUT :
PROGRAM 14: Loop in shell script
a) for loop:
i) Number
OUTPUT:
ii) Name
OUPUT :
b) while loop
OUTPUT :
c) until loop
OUPUT :
d) infinite loop
OUPUT :
PROGRAM 15: Functions in shell script
OUPUT :
2) Arguments in function
OUTPUT :