linux
linux
1)memory managemet
2)procees
3)file sysytem
4)Hardware
creating a folder(directory)
mkdir
syntax:
mkdir foldername
ex:
mkdir training
go into the folder
cd (change directory/folder)
ex:
cd training
remove a file
rm (remove)
ex:
rm display1.c
copy the file into another file
cp
Syntax:
cp source destination
ex:
cp display.c display1.c
this command will keep the source and copy into another file,
source and destination both exists.
mv (move)
syntax:
mv source destination
this command will rename source file to destination, hence
after this command execution, source will not exists
find:
command:
find . -name testing.csh
grep:
search for a string in a folder/file:
ex:
search for "main" in my current folder
command : grep
ex:
grep "main" * (this command will search for a string "main" in all the files
in the current folder)
Display the file names that matches the pattern : We can just display the files
that contains the given string/pattern.
$grep -l "unix" *
Show line number while displaying the output using grep -n : To show the line
number of file with the line matched.
$ grep -n "unix" geekfile.txt
grep -i "Main" * (this command will search for a string "Main" in all the files in
the current folder after ignoring the case sensitivity)
df -->
to check for free disk space in all disks : df
kill -15 is the safe and correct way of terminating a process. It's equivalent to
safely shutting down a computer.
cat file3.txt
head:
it will print from top
cat testcut.txt | head -n 2 (this command will print first 2 lines from the
testcut.txt file)
tail command:
tail -n 1 testcut.txt
cat testcut.txt | tail -n 1
this command will print the last line of the testcut.txt file
VIM---
Vi editor
vi commands
vi is a editor in unix/linux
this editor will work in 2 modes:
1. insertion mode
2. esc mode
yy ->to copy full line and store in buffer and press key to paste it
For example, to search for the first occurrence of the string ‘foo’ in the current
line and replace it with ‘bar’, you would use:
:s/foo/bar/
To replace all occurrences of the search pattern in the current line, add the g
flag:
:s/foo/bar/g
If you want to search and replace the pattern in the entire file, use the
percentage character % as a range.
This character indicates a range from the first to the last line of the file:
:%s/foo/bar/g
ssh
scp
telnet
putty
which command is used to access system from another linux server?(to connect
remotley)
ssh
defual port is 22
ssh (Secure shell)bcs communication between host and client in encrypted format.
we can also use telnet command but it's not secures but ssh is secured.
defual port is 23
Linux OS.
System call is we are going to get the service from kernal.sysytem call is a
gateway get enter into kernal.
each module present in kernal there will be system call , for process, file ,
device management etc.
process states.
start -> ready ->running ->exit