I. file commands
Ls-list Directories
Ls-al-list hidden files with formatting
Cd dir-Change directory to dir
Cd-change to home directory
Pwd-display the current directory
Mkdir dir-create directory dir
Rm file-delete file
Rm-r dir-delete directory dir
Rm-f file-force delete file
Rm-rf dir-force Delete directory dir *
Cp file1 file2-copy file1 to file2
Cp-r dir1 dir2-copy dir1 to dir2; Create dir1 if dir2 does not exist
Mv file1 file2-Rename or move file1 to file2; If file2 is an existing Directory, move file1 to file2
Ln-s file link-create a symbolic link for file
Touch file-Create file
Cat> file-add standard input to file
More file-View file Content
Head file-view the first 10 rows of file
Tail file-view the last 10 rows of file
Tail-f file-view the file content from the last 10 lines
2. Process Management
Ps-display the current active process
Top-display all running processes
Kill pid-kill process id pid
Killall proc-kill all processes named proc *
Bg-list stopped or background jobs
Fg-bring the latest job to the foreground
Fg n-bring job n to the foreground
Iii. File Permissions
Chmod octal file-change file Permissions
● 4-read (r)
● 2-write (w)
● 1-execution (x)
Example:
Chmod 777-Add read, write, and execute permissions to all users
Chmod 755-add rwx permissions to the owner and add rwx permissions to the group and other users
Rx permission
For more options, see man chmod.
Iv. SSH
Grep pattern files-search for files that match pattern
Grep-r pattern dir-recursive search for the content matching pattern in dir
Command | grep pattern-search for the content matching pattern in the command output
V. System Information
Date: displays the current date and time.
Cal-display calendar of the current month
Uptime-display the system running time from startup to now
W-display logon users
Whoami-view your current user name
Finger user-displays user-related information
Uname-a-display kernel information
Cat/proc/cpuinfo-view cpu Information
Cat/proc/meminfo-view memory information
Man command-display command instruction manual
Df-Displays disk usage
Du-displays the directory space usage
Free-Display memory and swap zone usage
Vi. Compression
Tar cf file.tar files-create the tar file file.tar that contains files
Tar xf file.tar-Extract files from file.tar
Tar czf file.tar.gz files-use Gzip to compress and create a tar file
Tar xzf file.tar.gz-use Gzip to extract tar files
Tar cjf file.tar.bz2-use Bzip2 to compress and create a tar file
Tar xjf file.tar.bz2-use Bzip2 to extract the tar file
Gzip file-compress the file and rename it file.gz
Gzip-d file.gz-decompress file.gz to file
VII. Network
Ping host-ping host and output results
Whois domain-Get whois information of domain
Dig domain-Get DNS information of domain
Dig-x host-reverse query host
Wget file-download file
Wget-c file-resumable upload
8. Installation
Install from source code:
./Configure
Make
Make install
Dpkg-I pkg. deb-installation package (Debian)
Rpm-Uvh pkg. rpm-installation package (RPM)
IX. Shortcut Keys
Ctrl + C-stop the current command
Ctrl + Z-stop the current command and use fg to restore
Ctrl + D-log out of the current session, similar to exit
Ctrl + W-delete words in the current row
Ctrl + U-delete the entire row
!! -Repeat the previous command
Exit-cancel the current session