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

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