Interview preparation knowledge

Use of lower 1.linux ps

    ps to display the state of the current process

    ps a display of all processes

    ps -A display all the process information

    ps -u root shows a specified user information

    ps -ef show all process information, along with the command line

    ps -ef | grep ssh find the specified process

    ps -l lists the currently belong to own the PID and related information log on to

    ps aux lists all current programs are among the memory

    ps -axjf lists similar program tree display program

    Find out about the cron and syslog both services PID number ps aux | egrep '(cron | syslog)'

2.grep command

    grep match filename search for a word in the text, the command will return a line of text that contains "match" of

    grep match file1 file2 ... Find text in multiple

    grep -v "match" filename output all lines except the -v option

    grep "match" filename --color = auto color matching tag

    grep -c "text" filename or text file contains statistics the number of rows matched string, and then returns the number of rows

    The number of rows grep "match" -n filename output matching string is located

    grep "text". -r -n recursive search for text in a multi-level directory

    echo "hello world" | character case grep -i "HELLO" Ignore match in style

3.netstat

    netstat -a displays all socket, including listening, showing all connections and listening ports

    netstat -n display address port numbers in digital form

    netstat -r Displays the routing table

    netstat -s to display statistics by protocol, the default display IP, Icmp, TCP, UDP

    netstat -v Show Details

    netstat -tunlp | grep port number to find the port number

    netstat -ntulp | grep 80 View all 80 Port Usage

    ps -aux | grep tomcat found no tomcat process port 8080

    netstat -apn View all processes and port usage

4. Check whether the port is occupied

    1. Using the method lsof

    Install lsof lsof -i: port number to see if a port is occupied

    2. Using netstat

    netstat -anp | grep 80 view port 80 is occupied

5. View thread

    1. ps -T Spid indicates that the thread ID, CMD thread display name

      ps -T -p <pid> lists all the threads created by the process of process ID <pid> the

    2. top -H can display real-time individual threads, the view mode is switched on or off

      top -H -p <pid> pid output for a particular process and check the threads in the process run case


    

    

    

    

Published 36 original articles · won praise 19 · views 30000 +

Guess you like

Origin blog.csdn.net/qq_27182767/article/details/79768821