1.netstat
NETSTAT-TNL | grep 443 (see if Port 443 is occupied)
-PNL | grep 443 (also shows the process PID that occupies the native 443 port). -A (all) show all options, default does not show listen correlation -t (TCP) only show TCP-related options -u (UDP) only show UDP-related options -n deny display aliases, Can show that all numbers are converted into numbers. Use the IP address directly, not through the domain name server. -L list only service status with Listen (listening) -p shows the program name that established the link -r shows routing information, routing table -e Displays extended information, such as UID, etc. - s statistics by individual protocol -C executes the netstat command every other fixed time.
2. awk
awk ' {pattern + action} '{filenames} where pattern represents what AWK looks for in the data, and the action is a series of commands that are executed when a match is found. Curly braces ({}) do not need to always appear in the program, but they are used to group a series of instructions according to a particular pattern. pattern is the regular expression to be represented, surrounded by slashes. The most basic function of the awk language is to browse and extract information in a file or string based on the specified rules, before awk extracts the information for additional text operations. A complete awk script is typically used to format the information in a text file. Typically, awk is treated as a unit of a file's behavior. awk processes the text by executing the corresponding command for each line that receives the file. Each row is sliced with a space as the default delimiter, and the cut section is then processed in various analytical ways. 1). command-line mode awk [-F Field-separator] ' commands ' input-file (s) where commands is the real awk command, [-f Domain delimiter] is optional. input-file (s) is pending. In awk, each line in a file, separated by a domain delimiter, is called a domain. In general, without naming-In case of the F field delimiter, the default Domain delimiter is a space. 2The shell script method inserts all the awk commands into a file and makes the awk program executable, and then the awk command interpreter is invoked as the first line of the script, again by typing the script name. Equivalent to the first line of the shell script: #!/bin/sh can be replaced by: #!/bin/awk3). Insert all awk commands into a separate file, and then invoke: Awk-F Awk-script-file input-file (s), whereThe-f option loads the awk script in Awk-script-file, input-file (s) is the same as above. Common commands: Split with ":" To print the first column of content cat/etc/passwd |awk-f ': ' {print $} 'Cat/etc/passwd |awk-f ': ' {print $ \ t ' $7} 'find content that begins with "root" awk-F: '/^root/'/etc/passwd Search/etc/passwd All rows that have the root keyword and displays the corresponding Shellawk-F: '/root/{print $7} '/etc/passwd content is referenced in: http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858470.html
3. Top
The top command is a common performance analysis tool under Linux that shows the resource usage of each process in the system in real time. The first five elements are the statistical information area of the current system situation as a whole. Let's look at the specific meaning of each line of information. The first line, the task queue information, and the execution results of the uptime command, specify the following parameters:14:06:23-Current system time up, 16:44-The system has been running for 70 days, 16 hours and 44 minutes (during which the system has not restarted the Yo!). )2users-currently has 2 users logged into the system load average:1.15, 1.42, 1.44The three numbers behind the-load average are 1-minute, 5-minute, 15-minute loads respectively. The load average data is the number of active processes that are checked every 5 seconds and then calculated by a particular algorithm. If this number is divided by the number of logical CPUs, the result above 5 indicates that the system is overloaded. The second line, tasks-task (process), the specific information is described as follows: The system now has 206 processes, of which there are 1 running, 205 in hibernation (sleep), 0 in the stoped state, and 0 in the zombie State (zombie). The third line, CPU status information, the specific properties are described as follows:5.9%us-The percentage of CPU occupied by the user space. 3.4%sy-The percentage of CPU consumed by the kernel space. 0%ni-The percentage of CPU that processes that have changed priority90.4%id-Idle CPU percentage0%wa-io percentage of CPU waiting to be consumed0%hi-Hard Interrupt (Hardware IRQ)% of CPU occupied0.2%si-Soft Interrupt (software interrupts)% CPU Usage Note: There is a difference between the CPU utilization ratio and the Windows concept, you need to understand the Linux system user space and kernel space knowledge! The four-line, memory state, specific information is as follows: 32949016k total-total Physical Memory (32GB) 14411180k used-total Memory in use (14GB) 18537836k free-total free memory (18GB) 169884k buffers-Cache Memory (169M) line fifth, swap swap partition information, specific information is described as follows: 32764556k total-swap Area total (32GB) 0k used-Total swap area (0K) 32764556k free-free Swap area total (32GB) 3612636k cached-buffered swap area total (3. 6GB) Note: The total amount of memory in use in line fourth (used) refers to the amount of memory that is now controlled by the system kernel, and the total amount of free memory that the kernel has not included in its control range. The memory that is included in kernel management is not always in use, but also includes the memory that has been used in the past that can now be reused, and the kernel does not return these reusable memory to free, so there is less memory on Linux, but don't worry about it. If you are accustomed to calculating the number of available memory, here is an approximate formula: The fourth line of free+ Fourth row of buffers + fifth row of cached, press this formula available memory for this server: 18537836k +169884k +3612636k =around 22GB. For memory monitoring, in the top we have to monitor the fifth line swap partition used, if this value is constantly changing, indicating that the kernel is constantly in memory and swap data exchange, which is really not enough memory. Line six, blank line. Line seventh below: status monitoring of each process (task), the project column information is described as follows: pid-process iduser-Process owner pr-process priority Ni-nice value. A negative value represents a high priority, and a positive value represents the total amount of virtual memory used by the low-priority virt-process, in kilobytes. VIRT=swap+The size, in kilobytes, of the physical memory used by the resres-process and not swapped out. RES=code+datashr-Shared memory size, unit kbs-process state. D= Non-interruptible sleep state r= run s= sleep t= track/Stop z=Zombie Process%cpu-Percentage of CPU time that was last updated to current%percentage of physical memory used by the mem-process time+-CPU time total used by the process, Unit 1/100 seconds command-Process name (command name/command Line) Common operations: Top//Explicit resource usage for all processes every 5 secondsTop-d 2//Explicit resource usage for all processes every 2 secondsTop-c//The resource usage of the explicit process every 5 seconds and displays the process's command-line arguments (by default, only the process name)Top-p 12345-p 6789//every 5 Seconds the PID is 12345 and the PID is 6789 of the resource consumption of two processestop-d 2-c-P 123456//every 2 seconds, the PID is 12345 of the resource usage of the process, and the command-line arguments that the process starts are explicitlythe content goes from: http://www.cnblogs.com/peida/archive/2012/12/24/2831353.htmlhttp//www.cnblogs.com/ggjucheng/archive/2012/01/08/2316399.html
4. View Text command:
Tail
command format; tail[necessary parameters [select parameters] [file] command function: Used to display the end of the specified file, when the file is not specified as input information for processing. Common view log files. Command parameters:-F Loop Read -Q does not display processing information -v displays detailed processing information -c< number > bytes displayed -n< number of rows > display of rows --pid=pid and-F are shared, which means that the process ends after the id,pid dies. -Q,--quiet,--silent never outputs the header-S of the file name ,--sleep-interval=s and -10 log4j.log -N +5 -F Log4j.log
Head
command format: Head [parameters] ... [File] ... Command function: Head is used to display the beginning of the file to the standard output, the default head command prints the first 10 lines of its corresponding file. Command parameters:-q Hide file name -v Show file name -c< bytes > display bytes -n< lines >-N 5 Log4j.log -n-6 log4j.log output file except the last n rows of the entire content
Less
The less tool is also a tool for paging through files or other output. Less does not load the entire file until it is viewed. SPACEBAR to PAGE DOWN. Command parameters:-B < buffer size >set the size of the buffer-e automatically leave when the file display finishes-F forcing special files to be opened, such as peripheral code, directories, and binaries-g only sign the last keyword searched-I ignore the case when searching-m shows a percentage similar to the more command-N Displays the line number of each row-o < file name >save less output in the specified file-Q do not use warning tones-s displays a row of continuous empty behavior-S line too long will be out of the partial discard-X < Digital >Display the "tab" key as a specified number space/string: Search down the function of "string"?string: Search Up "string" function N: Repeat previous search (withOr?about) N: Reverse Repeats the previous search (withOr?about) b turn back one page D back half page h Display Help interface Q exit less command U Roll forward Half page forward scroll one line [PageDown]: screen content to flip a page, not file page [PageUp]: screen content to flip a page, not file page G-move to the last line G-Move to First line
More
The more command, which functions like cat, the Cat command is the entire contents of the file displayed on the screen from top to bottom. More will be a page-by-page display to facilitate users to read pages, and the most basic instruction is to press the blank key (space) on the next page, press the B key will be back to a page, but also the function of the search string. The more command reads the file backwards from the front, so it loads the entire file at startup. Command parameters:+n is displayed from joys n lines -n defines the screen size n lines +/pattern searches for the string before each file is displayed, and then starts from the first two lines of the string -C clear the screen from the top and then display the-D continue, ' Q ' To quit (press SPACEBAR to continue, press Q to exit), disable the ringing function -l Ignore Ctrl +L (page break) -p to page the file by clearing the window instead of scrolling, similar to the-C option -s to display a contiguous number of empty rows as a row - U remove the lower line from the contents of the file
Cat
The purpose of the cat command is to connect files or standard input and print. This command is commonly used to display the contents of a file, or to connect several files to display, or to read from a standard input and display it, often in conjunction with redirection symbols. Command function: Cat has three main functions:1. Display the entire file at once: Cat filename2. Create a file from the keyboard: cat > filename can only create new files and cannot edit existing files. 3. Merge several files into one file: Cat file1 file2 > File command function: Cat has three main functions: 1. Display the entire file at once: Cat filename2. Create a file from the keyboard: Cat > filename can only create new files and cannot edit existing files. 3. Merge several files into one file: Cat file1 file2 > file
nl
The NL command is used in a Linux system to calculate the line number of a file. NL can automatically add a line number to the output file content! The default result is a bit different from Cat-n, NL can make the line number more display design, including the number of digits and whether auto-completion 0 and so on. Command parameters:-B : Specifies the way the line number is specified, mainly in two ways:-B A: Indicates that the line number is also listed (similar to cat-N), regardless of whether it is a blank line;-B T: If there is a blank line, The empty row does not list the line number (the default);-n : Lists the method of the line number representation, there are three main kinds:-N LN: The line number is displayed on the top left of the screen;N RN: The line number is displayed on the right-most side of the field, and does not add 0 ; -N RZ: The line number is displayed on the very right of its own field, plus 0 ;-W : The number of digits occupied by the line number field. -p does not start the calculation again at the logical delimiter. Code reproduced in: http://www.cnblogs.com/peida/archive/2012/12/05/2803591.html
Linux Common Commands Simple introduction (NETSTAT,AWK,TOP,TAIL,HEAD,LESS,MORE,CAT,NL)