Ls
-l 显示详细信息-a 显示所有文件-lt 排序-lrt 倒序
Cd
MV Move/Change name
Cp
-A equals-DPR
-v verbose display of actions performed by the command
-D point to source files or directories when copying symbolic links
-P Reserved Properties
-R/R recursion
-F Forced replication
RM Delete
-R recursion
-F Force Delete
Be sure to be clear-headed before using RM-RF!!!
PS Viewing process
Ps-ef|grep Process Name
Visudo Edit sudo config file, equivalent to Vi/etc/sudoers
sudo sudo configuration file authorization, command permission is required to be preceded with sudo
wget (some parameters can be removed as needed)
wget--spider <URL> Check if a remote file exists
The following command is retried 30 times (default 20 times) Timeout time 10 seconds (default 900 seconds) Download log write Wget.log downloaded file named tomcat9.tar.gz last download connection
wget--tries 30-t 10-o wget.log-o tomcat9.tar.gz http://mirrors.shu.edu.cn/apache/tomcat/tomcat-9/v9.0.8/bin/ Apache-tomcat-9.0.8.tar.gz
If the breakpoint continues to download the required parameter-C can be
Ifconfig View IP
Free
Uname
Source makes the file effective
- Netstat (ss)
Netstat
-A shows all sockets in the connection
-L Display the socket of the server in monitoring
-P shows the PID and program name of the socket being used
-T--tcp shows the connection status of the TCP transport protocol
-U--udp shows the connection status of the UDP transport protocol
-N refuses to display aliases, showing all numbers converted to numbers
Netstat-pan |grep SSH
NETSTAT-ANP | grep ': 22 '
History View historical record
-C Clears the history of the current session
Getenforce View selinux Status
Setenforce Setting SELinux Status
1 Enable 0 not enabled
RunLevel View current system RunLevel
0 shutdown status, system default RunLevel cannot be set to 0, otherwise it will not start normally
1: Single user working status, root privilege, for system maintenance, prohibit remote login
2: Multi-user status (no NFS)
3: Full multi-user status (with NFS), login to console command line mode
4: System not used, reserved
5: Graphics mode
6: The system shuts down gracefully and restarts, the default runlevel cannot be set to 6, otherwise it will not start normally
Init
Init 0 shutdown
Init 6 Restart System
System default Run Level
In the/etc/inittab file, cannot be set to 0 and 6
Id:5:initdefault:
Shutdown-h now shutdown
Halt shut down the machine
Poweroff-f shut down the machine
Reboot restart
Chkconfig setting up the boot service
diff two files compared to Vidiff
Vidiff High-level comparisons
Which find the path where the command is located, the search scope is the environment variable path
Whereis Find command, source file, man file, is through file index database, cannot find any specified file
Locate through the database to find files, but the scope of application is larger than Whereis, this command can find any specified to find the file, the file name part matches. -R using regular expressions
Find is found by searching the hard drive directly to ensure that the information found is absolutely reliable. and support a variety of search conditions, but slow
Find Path parameter
-type type
-exec
find/root/-type F! -name "1.txt"
find/root/-type f-exec mv {}/root/test/\;
find/root/-type F! -name "1.txt" |xargs RM
Man view the Help document for the command, press Q to exit
Chown changing the owning user and group
Chown-r Git.git 1.log
chmod change file permissions, use numbers or symbols to change permissions
chmod u/g/o/a +/-/= rwx/numerals and (124)
For example
chmod a+x test.sh Change file to executable file
chmod 777 test.sh Give all permissions
PWD View current directory location
mkdir Creating a Directory
-P Recursive creation
Cat prints out all the contents of the file
-N Print Line count
TAC prints all the contents of the file in reverse.
Head to see how many lines are in front of the file
How many rows are printed by-N lines (default 10)
Tail
-N lines to print the countdown line (default 10 lines)
-F real-time monitoring printing is equivalent to TAILF
More
Less useful
Less
Less file name
Space switch next page, the keyboard can be manipulated up or down, you can also enter a colon to search
echo Output
Touch New File
Tar is packaging, not compression, just put a bunch of files into a file, zip mainstream compression format, tar not how to compress, compression rate of 100%, mainly always packaging, zip compression rate of file type, JPG is not how compression rate, but BMP is very high
Tar
-Z. tar.gz file decompression or compression
-X Decompression
-V Show More information
-F write at last, followed by filename
-C Specify Unzip directory
-j . tar.bz2 file Decompression or compression
-P retains the original permissions and attributes for this sub-data
TAR-ZCVPF 1.tar.gz 1.log
TAR-ZXVF 1.tar.gz
Zip
Zip-r Test.zip 1.log Recursive compression
Unzip
Unzip-o-d/root/test Test.zip
Sync shuts down a few more times before restarting the machine, forcing the file buffer in memory to be written to disk (this command I didn't use until recently)
Jar
-C Create a jar package
-T displays a list of the contents of the JAR package
-X Decompression Jar Package
-f Specifies the file name of the jar package
-V Display procedure
-u Add file to jar package
Follow-up will continue to add ...
Common commands for Linux