Http://www.cnblogs.com/suliuer/p/5448747.html
This article mainly includes two parts, one is the summary of the Linux Basic command, and the other is to summarize some common command knowledge points.
First, the basic summary
When you learn Linux, I use mind map to summarize some common commands of basic part, use Mind map to archive memory, one to keep summarizing and perfecting.
Mainly include file processing, rights Management, file Search, help commands, user management, compression decompression, network configuration, shutdown restart.
II. Common Command System Information UNAME-M display the processor architecture of the machine uname-r display the kernel version that is in use Cat/proc/cpuinfo display information about CPU info cat/proc/meminfo Verify memory usage cat/proc/ Swaps shows which swap is used cat/proc/version display the kernel version Cat/proc/net/dev display the network adapter and statistics cat/proc/mounts display the loaded file system Lspci-tv list PCI devices Lsusb -TV Display USB device date display system Day CAL 2016 Display 2016 calendar table Clock-w save time changes to bios get IP address ifconfig eth0 | grep "inet addr" | awk ' {print $} ' | Cut-c 6-ifconfig | grep "inet Addr:" | Grep-v "127" | Cut-d:-f2 | awk ' {print '} ' Check the number of currently logged on users who | wc-l shutdown (System shutdown, restart, and logout) shutdown-h now shut down system (1) INIT 0 shutdown system (2) Telinit 0 Shutdown System (3) shutdown-h Hours:minutes & closed on scheduled time System shutdown-c Cancel on scheduled time shutdown system Shutdown-r now restart (1) reboot restart (2) Logout logoff Check that DNS server is working properly, Take 61.139.2.69 as an example dig www.baidu.com @61.139.2.69 View the size of the memory free-m |grep "Mem" | awk ' {print $ ' View file size and view disk usage du: file-based, statistical file size addition--is a file-oriented command that calculates the space allocated to a specified file or directory. DF: Disk-based, statistical block usage-determines the size of allocated space in the file system through unallocated space in the file system. Common commands:df-hi du-a view 80 port connections and sort Netstat-an-t | GreP ": 80″| grep established | awk ' {printf '%s%s\n ", $5,$6} ' | sort log view, search Cat/var/log/rflogview/*errorsgrep-i error/var/log/messagesgrep-i fail/var/log/messagestail-f-N 2000/var/log/messages read-write character Read-n read n characters-s not echo-p display hint message-t specific time-D delimiter use Cut command to select field cut-d:-F 1,5/etc/pass The colon after the WD #-d represents the delimiter between the fields. #-f indicates which fields to take after splitting. Extract start or end lines Head-n 5/etc/passwd# displays the first five elements of the input file. tail-n 5/etc/passwd #显示输入文件的最后五行. REDIRECT Output 0: Indicates keyboard input (stdin) 1: Indicates standard output (stdout), system default is 12: Indicates error output (stderr) * 2>&1 is stderr to stdout as output * 1>&2 or >&2 is to stdout stderr as output command >/dev/null 2>&1 & == command 1>/dev/null 2>&1 &am P;1) Command: Represents a shell command or an executable program 2);: Indicates redirect to where 3)/dev/null: Empty device file for Linux 4) 2: Indicates standard error output 5) &1:& means equivalent, 2 >&1, which indicates that 2 of the output redirect equals to () &: Indicates background execution, that is, this instruction execution runs in the background in summary, this command means: Execute this program in the background, redirect error output 2 to standard output 1, and then put the standard output 1 all to/dev/ Null file, which is empty. parameter pass $ A script name $-$9 position parameter #1-#9 $ #位置参数的Number "[email protected]" all positional parameters "$*" All positional parameters $? Returns the return value of the previous command, which can be used to check the execution result after the command is executed. $$ script Process ID (PID) parameters to determine if [expr]; then ... fi-n str: whether the string str is not empty -z str : Whether the string is empty str1 = str2 :str1 is the same as str2 str1! = STR2: str1 is different from str2 int1-eq int2 : equals int1-le int2 : Less than equals int1-ge int2 : Greater than or equal to int1-lt int2 : less than int1-gt int2 : Greater than int1-ne int2 : Not equal to-B: Block file -P: Whether the file is a named pipe -c: Character file -r: whether the file is readable -d : whether a directory *-s : whether the length of the file is not zero-e: File exists * * S: Is the socket file-F: Normal file *-x: whether the file is executable or true-G: Whether the file's SGID bit-u: Set the file's SUID bit-G: whether the file exists and is owned by the group -w: whether the file is writable, True-K: Whether the file is set to paste bit-t fd:fd is an open file descriptor that is connected to the terminal (FD defaults to 1)-O: The file exists and is owned by the user all e_noargs=65if [-z] "#" #-Z if 0 is true Print usage and error parameters then echo "Usage: ' basename $ [domain-name] '" exit $E _NOARGSFI if no parameter exists
The
Linux command learns to organize.