What is Shell
Shell is interface between user and kernal.
shell scripting
Shell scripting is a series of sequence of UNIX commands written in a plan txt file.
importance
Shell scripts takes input from the user file and displays it on screen, very useful to creating your own command,to automate some tasks,mainly it saves time.
$ LS, $ LS LTR
$ LS its list file of current directory, $ LS LRT shows files with long format
$ CD, $ CD test,$ CD ..
it changes directory to home directory, it chnages to test directory, it move back to parent directory
$ mkdir test
create directory
$rmdir test
remove directory
$ cp file1 test
it copies file1 to test directory
$ cp file1 file1.bak
it takes backup of file1
rm file1
remove file 1
$ mv file1 file2
it move or rename file1 to file2
$more
it checks or display one page at a time
$ cat file1
it display content of file1
$ cat test1 > test2
create a new file name teste with data of test1 file
$ find .-name '*.t' -print
it searches in the current diretory and in all sub dir for files ending with name t and writes their name in output
$ finger
user info
$date
date info
$who
list of logging user
$ grep Hello file1
it searches for the line containing hello in file1
$kill 1892
it kill process id 1892
lp
to print file
$ head -15 file1
it display first 15 lines of file1
$ tail -15 file1
it display last 15 line of file 1
type of shell
bourne shell (sh), c shell (csh), korn shell (KSH), bourne again shell (bash)
Advantage of C shell over bourne shell
C shell allows alias system and remember command history.
how many shell script come with UNIX system
280 shell scripting
by default file permission
666 rw-rw-rw-
how modify file permision
umask
variable
2 type - unix defined will be always in caps letter and user defined will be in small letters, variable store as string
unchangeable variable
$ a=10, $readonly a,
to clear variable
$ a=10, $ unset a,
$uptime
to know sine when system is up
Shebang (#!/bin/bash)
shebang is a #sign followed by an exclamation. Shebang mainly determine the location of the engine.
Unix
Unix is a multitasking multi user operating system which was developed in 1960s by Bell System. It is not a open sourced.
Why unix better than Windows
Unix handles high server loads better than windows. Server running on UNIX enjoy extremely high up time
No comments:
Post a Comment