Shell-Scripting(Linux)
Notes
-
Case sensitive
-
Terminal open = CTRL + ALT + T
-
In linux we have tree like structures for files
-
In linux we call directory not folder like in windows
-
(.) it represent current directory
-
(..) it represent parent direcotry
-
Path
- Absolute -: start from root
~
- Relative -: start from the current working dir
/
CTRL + C
-: kill process
- Absolute -: start from root
-
Types of Linux Command
- Executable program which is in bin/userbin. example-: cp,wc
- Shell buttons built in shell example-: cd,mv
- Shell Scripts files that contains codes
- Alias command that we can define by our own like example given in last commands section below
Commands
pwd
print working directory gives the absolute path from the rootdate
cal -y
clear
to clear the shellls
list the dirls -l
all non hidden filels -a
hidden filels -la
combo of above twocd
change dircd..
to move one step toward rootcd~
move directly to homecd /
go to root dircd -
to get prev working dirtouch filename
to create a file to update filename same commandcat > file.txt
cat "hello" > hello.txt
touch file1 file2
multiple file creationmkdir dir
To create dirrmdir dirname
To removedir only work with empty dirrmdir -R dir
remove all subdirectoryrm -i file
prompt base Y or Nrm -f file
rm -rf /
delete everthingcp oldfile newfile
cp -R dir1 dir2
to copy foldermv oldfile newfile
rename also can be donemkdir 'my dir'
to give space between file namermdir "my cat"
history
history -c
to delete historycat file1 file2
to read multiple file from l to rwhich cp
to get absolute pathhelp cd
to get detail of cdman cp
to get manualman cd
whatis cp
to get brief of cpifconfig
linux andipconfig
windowsdate;time
';' it is for sepration not terminationalias dat="date"
it create a command dat which perform date operaton *
Shortcut key
- CTRL + A move to very beggining of line.
- CTRL + D to remove next char
- CTRL + E move to last element
- CTRL + F move one char forward
- CTRL + B move one char backward
- ALT + U upper case
- ALT + L Lower case
- CTRL + U cut from right to left
- CTRL + V paste
- clear or CTRL + L
Text editior
gedit filename
nano filename
vi filename
vim filename
advance vi- CTRL + O save
- CTRL + X exit