0003_common commands for Linux and 0003_common commands for Linux
1. pwd: view the current directory
2. cd: Switch Directories
3. ls: view the files and folders in the current directory:
4. ls-l: list the files and details in the current directory. If the first character of drwxr-xr-x is d, it indicates the directory.
The ls-lh file size is 1 kb = 1024 bytes, 1 Byte = 8 Bits (BIT), and 1 bit indicates a state.
Ls-a shows hidden files.
Vim. test: Create a hidden file named test.
5. cd ..: Return to the directory of the upper-level
Cd ../back to Layer 4 directory
6. Create a file with the vim file name
I. edit files
After writing the file, Press ESC to exit the editing mode, press shift +:, and then press wq (write + quit) to save the file and exit.
7. view the file content with the cat file name
Vim file name View File Content
For more file names, view the file content slowly. Press enter and press Enter. For the next page, Press space.
8. Create a folder:
Mkdir directory name create directory name
Mkdir-p/etc/temp/1/2/3/4 recursion layer-by-layer creation of multi-level Directories
9. Run the "cd root --> yum-y install tree" command to view the directory structure of CN in tree CN.
10. Move music videos
11. Copy files using cp
12. rm delete the file. Rm-rf force delete files and folders
13. man view online help documentation
14. help view the Linux built-in command help
15. -- h simple view of help
16. find: find/-name * caixin *
Find/-size + 90 M | xargs ls-lh searches for files, MPs queues | and xargs use the preceding command execution result as the subsequent input.
17. Create a file using the touch path name
18. df-h view disk status
19. view the process running status in ps
20. kill pid to close the process, and kill-9 pid to force the process to close
21.> directory name: Clear the content in the file
22. grep keyword file name: captures a line of text with a keyword in the file.
23. vim install. log + 505: Jump to the 505th line of the install log file.
24. tar zcvf demo.tar.gz./*: Pack all files in the current directory.
25. sz file name: download the file to the specified directory of Xshell. If no sz command is prompted, su root --> yum-y install lrzsz
26. du: view the file (directory) Size
27. free-m view Server Memory in MB
28. top dynamically displays the CPU or memory usage of processes (htop)
Cpu: us (user): CPU occupied by user processes
Sy (system): CPU occupied by the system itself
Id (idle): CPU idle rate
Wa (I/o wait): time ratio of CPU wait for I/O
Mem: total used free buffers (buffer zone, ready for use) total free (available memory) = free + cached + buffers total usage (used) = total-total free
Swap: total used free cached (cache)
29. chown user (owner). user group (group) Directory: chown root. root test/change the group of the test directory to root
30. rwxr-xr-x: a group of three letters. The first is user permissions, the second is user group permissions, and the third is other user permissions.
R read 4
W write 2
X excute 1
-0
Then rwx r-x:
4 + 2 + 1 4 + 1 4 + 1
Rwxrwxrwx is 777: rwx
4 + 2 + 1 4 + 2 + 1 4 + 2 + 1
Change File Permission: chmod 755 test/755 is the security permission
31. SEARCH Command Parameter usage: man find -->/size to view the size usage of find
Overall:
Online query and help (2): man, help
File and directory operations (19): ls cd cp find mkdir mv pwd rename rm rmdir touch tree basename dirname chattr lsattr file md5sum
Command for viewing files and content processing (19): cat tac more less head tail cut split paste sort uniq wc iconv dos2unix file diff vimdiff
Rev grep egrep join tr vi/vim
File compression and decompression command (4): tar unzip gzip
Information Display command (12): uname hostname dmesg uptime file stat du df top free date cal
Search FILE command (4): which whereis find locate
User management command (10): useradd usermod userdel groupadd passwd chage id su has do sudo
Basic Network Operation Command (10): telnet ssh scp wget ping route ifconfig ifup ifdown netstat
In-depth Network Operation Command (6): nmap lsof route mail mutt nslookup dig host traceroute tcpdump
Commands for disks and file systems (10): mount umount df du fsck dd dumpe2fs dump fdisk parted mkfs partprobe
E2fsck mkswap swapon sync resize2fs
Command for shutdown and Viewing System Information (3): shutdown halt init
System Management commands (8): uptime top free vmstat mpstat iostat sar (sysstats) chkconfig
System security commands (10): chmod (modify file permissions) chown (modify file group) chgrp chage passwd su sudo umask chattr lsattr
Command for viewing system user logon information (7): whoami who w last lastlog users finger
Others (19): echo printf rpm yum watch alias unalias date clear history eject time nohup nc xargs exec export unset type bc
Advanced System Performance Monitoring command (12 ):
Memory: top free vmstat mpstat iostat sar
CPU: top vmstat mpstat iostat sar
I/O: vmstat mpstat iostat sar
Process: ipcs ipcrm lsof strace lstrace
Load: uptime
Shutdown/restart/logout command (7 ):
Shutdown and restart: shutdown init halt poweroff reboot
Logout: logout exit ctl + d
Process Management (16 ):
Bg: Running fg in the background: suspending the program jobs: displaying the background program kill, killall, pkill: killing the process
Crontab: Set scheduled ps: view process pstree: Display Process status tree
Top: Display process nice: Change Priority nohup: the user continues to work after exiting the system
Pgrep: Find the matching process strace: trace the system call of a process
Ltrace: trace the details of the function called by the process. vmstat: reports the virtual memory statistics.
Runlevel init service
Very dangerous system commands (5 ):
Mv rm fdisk parted dd