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]
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)
Ü . - 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]
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]
Ãœ su – [redirect to root user]
Ãœ su – shohan [redirect to normal user]
v touch file1 file2 [create empty blank file]
v rmdir * [will delete all empty 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]
Ü mv dhaka newdhaka
Ü mv /opt/file1 /tmp
v nano
v vi/vim file1
Ü 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
Ü Ctrl+r [redo]
Ü :wq [write and quit]
Ü :q! [exit without saving]
Ü :w [write without quite]
Ü Esc+shift:set nonu/nonumber [unset line number into file]
Ü gg [go to the first line]
Ü shift+G [go to the last line]
v vi file.txt + [file will open with cursor last line]
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
o dd
| 3dd
Ü wc
-l cat /etc/passwd
r Cat
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 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]
Tags
RHCSA