The built-in variable $ in Linux represents the process ID of the current shell, that is, the PID of the current process.
Linux query pid process details?
Terminal input ps-ef|greppid can list the details of this process.
How to check whether nginx is running normally with linux command?
Every Linux application will produce a process, so we can judge whether to start it by checking whether the Nginx process exists.
1. Sometimes, if you want to know whether nigix is running normally, you need to use linux commands to check the operation of nginx. Execute the command: ps-A|grepnginx. If the result is returned, nginx is running and the service has been started. If you're not afraid of nginx closing. You can also execute: servicenginxrestart. Restart the nginx service. You can also see if there are any problems when you restart.
2. Look at the port netstat-ntlp;; ; Look at the process PS-ef | grepnginx;; Check whether the log has updated tail-faccess.log
3. directly check the process ID:PS-CNG inx-opid. This method of directly returning pid is more suitable to be combined with other programs, such as executing this command in shell/python script to get pid, and then judging whether Nginx is started according to pid. This method is recommended.
How does linux view the ports occupied by a thread?
Ps-aux|grepjava, or directly: ps-aux|greppid view.
Linux check port command?
Commands for viewing ports on linux:
The first kind:
Lsof-i: port number
The second type:
Netstat-nltp|grep port number
-a: Displays all connection ports and listening ports of this machine.
-n: The form of network IP address, which shows the currently established valid connections and ports.
-r: display routing table information
-s: Display statistics by protocol.
-v: Displays the currently valid connections.
-t: display all TCP protocol connections.
-u: Show all UDP protocol connections.
-i: Displays the status of the auto-configuration port.
-l: Only the service network status with the connection status of monitoring is displayed.
-p: display pid/programname.