DAY 09 - PATH | RESERVED | EDITOR | COMMAND

r  PATH – file/folder location
 
v  Absolute Path – From ground to direct desire place [Full Path]
v  Relative Path – From your place to direct desire place [5th floor to 10th floor]

q  Reserved Filenames:   
 
Ü  /   - The root directory (slash)     
Ü  .   - Current directory (period)     
Ü  ..  - Parent directory (double period)     
Ü  ~   - Your home directory (tilde)

r  Output Redirection:
 
v  date > file.txt [create new file file1 and output of date command will be there]
v  cal > file.txt [will override the existing file with output of cal command]
v  who >> file.txt [will append the output of who command]
 
v  su [switch user]

Ü  su – [redirect to root user]
Ü  su – shohan [redirect to normal user]
 
v  rm -rf file1 dir1
v  touch file1 file2 [create empty blank file]
v  rmdir * [will delete all empty directory]
 
v  cp [copy files & directory]

Ü  cp httpd.conf httpd.conf.bkp
Ü  cp file1 /opt/file2 /backup
Ü  cp -u * /backup [copy file only updated content inside the file]
Ü  cp -n * /backup [newly create file will be copied & exist will be skip]
Ü  cp /backup/file1.bkp . [dot means it will copy into current directory]
 
v  mv [move or rename]

Ü  mv dhaka newdhaka
Ü  mv /opt/file1 /tmp
 
r  Editor:
 
v  gedit file1
v  nano
v  vi/vim file1
 
Ü  i/I/insert >> insert mode
Ü  Esc+a >> after the cursor point
Ü  Esc+A >> end of line
Ü  Esc+o >> open new line under the cursor
Ü  Esc+O >> open new line above the cursor
 
Ü  Esc+u [undo]
Ü  Ctrl+r [redo]
 
Ü  :x [save and exit]
Ü  :wq [write and quit]
Ü  :q! [exit without saving]
Ü  :w [write without quite]
  
Ü  Esc+shift:set nu/number [set line number into file]
Ü  Esc+shift:set nonu/nonumber [unset line number into file]
 
Ü  wc -l file1 [check how many lines into the files]
 
Ü  10gg [go line number 10th]
Ü  gg [go to the first line]
Ü  shift+G [go to the last line]
 
v  vi file.txt +10 [file will be open with cursor line number 10]
v  vi file.txt + [file will open with cursor last line]
 
Ü  Line Copy [yy]

       o (n)yy = yy[Yank] | n[No of line]
       o   yy | 5yy

Ü  Line Paste [p/P]

    o   (n)p = N time(s) Paste below the cursor
    o   (n)P = N time(s) Paste up the cursor
    o   p/p | 5p/5P
 
Ü  Line Cut [dd]

       o   dd | 3dd
 
Ü  wc -l cat /etc/passwd
 
r  Cat

v  cat file1
v  cat file1 /opt/file2
v  cat –n file1 [n means with line number]
v  cat > newfile [enter for another line then exist from file by ctrl+d]
 
r  watch ls [It will be executing every after 2 seconds]
r  du -sh file1
r  df -hT
r  echo ‘Hello there’ >> file1
r  tac [reverse text of the file]
r  seq 10
r  seq 10 20
r  more file2 [display screen by screen/line by line content]
r  less file3 [display screen by screen/line by line content, allow scroll up/down arrow]
r  head file1 [will be display from top, by default 10 lines]
r  head –n 5 file1
r  tail file1 [will be display from bottom, by default 10 lines]
r  tail –f file2 [f means follow]

Previous Post Next Post

نموذج الاتصال