In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How can I see all the information about the process in Linux? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.
View all the information of the process, including the full path of the startup command, the full path of the corresponding file, and so on: ls-l / proc/PID
For example, when you use ps-ef | grep webhook to view a process, you can only get the following information
> ps-ef | grep webhookroot 15902 10 Aug15? 00:00:00 python-u src/webhook.pyroot 30639 30612 0 22:50 pts/0 00:00:00 grep-- color=auto webhook
Then execute ls-l / proc/15902
> ll / proc/15902dr-xr-xr-x 2 root root 0 Sep 18 22:52 attr-rw-r--r-- 1 root root 0 Sep 18 22:52 autogroup-r- 1 root root 0 Sep 18 22:52 auxv-r--r--r-- 1 root root 0 Sep 18 22:52 cgroup--w- 1 root root 0 Sep 18 22:52 clear_refs-r--r--r-- 1 root root 0 Aug 15 16 48 cmdline-rw-r--r-- 1 root root 0 Sep 18 22:52 comm-rw-r--r-- 1 root root 0 Sep 18 22:52 coredump_filter-r--r--r-- 1 root root 0 Sep 18 22:52 cpusetlrwxrwxrwx 1 root root 0 Aug 15 16:48 cwd-> / services/apps/webhook-r- 1 root root 0 Sep 18 22:52 environlrwxrwxrwx 1 root root 0 Aug 15 16:48 exe-> / usr/bin/python2. 7drmerx2 root root 0 Aug 15 16:48 fddr-x- 2 root root 0 Sep 18 22:52 fdinfo-rw-r--r-- 1 root root 0 Sep 18 22:52 gid_map-r- 1 root root 0 Sep 18 22:52 io-r--r--r-- 1 root root 0 Sep 18 22:52 limits...
There are a few major documents that we can follow:
Cwd: the directory where the file is located
Exe: the full path to execute the command
Environ: environment variable when executing a command
Add:
# lsof lists the files currently opened by the system, often used with the-I option Used to see which program occupies a port [root@bogon ~] # lsof-i:80COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEhttpd 6701 root 4U IPv6 64259 0t0 TCP *: http (LISTEN) httpd 6702 apache 4u IPv6 64259 0t0 TCP *: http (LISTEN) httpd 6703 apache 4u IPv6 64259 0t0 TCP *: http (LISTEN) httpd 6704 apache 4u IPv6 64259 0t0 TCP *: http (LISTEN) httpd 6705 apache 4u IPv6 64259 0t0 TCP *: http (LISTEN) httpd 6706 apache 4u IPv6 64259 0t0 TCP *: http (LISTEN) [root@bogon ~] # lsof-i:22COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEsshd 931 root 3u IPv4 20955 0t0 TCP *: ssh (LISTEN) sshd 931 root 4u IPv6 20965 0t0 TCP *: ssh (LISTEN) sshd 3926 root 3u IPv4 36374 0t0 TCP bogon:ssh- > bogon:53436 (ESTABLISHED) [root@bogon ~] # # get all information about the processes of all users on the terminal [root@bogon ~] # ps-auxUSER PID% CPU % MEM VSZ RSS TTY STAT START TIME COMMANDroot 1 0.0 0.4 128092 4724? Ss Jun25 0:03 / usr/lib/systemd/systeroot 2 0.0 0.0 0 0? S Jun25 0:00 [kthreadd] root 3 0.0 0.0 00? S Jun25 0:00 [ksoftirqd/0] root 6 0.0 0.0 00? S Jun25 0:00 [kworker/u256:0] root 7 0.0 0.0 00? S Jun25 0:00 [migration/0] root 8 0.0 0.0 00? S Jun25 0:00 [rcu_bh] root 9 0.0 0.0 00? R Jun25 0:01 [rcu_sched] root 10 0.0 0.0 0 0? S Jun25 0:00 [watchdog/0] root 12 0.0 0.0 00? S
< Jun25 0:00 [khelper]root 13 0.0 0.0 0 0 ? S Jun25 0:00 [kdevtmpfs]root 14 0.0 0.0 0 0 ? S< Jun25 0:00 [netns]root 15 0.0 0.0 0 0 ? S Jun25 0:00 [khungtaskd]root 16 0.0 0.0 0 0 ? S< Jun25 0:00 [writeback]root 17 0.0 0.0 0 0 ? S< Jun25 0:00 [kintegrityd]root 18 0.0 0.0 0 0 ? S< Jun25 0:00 [bioset]root 19 0.0 0.0 0 0 ? S< Jun25 0:00 [kblockd]root 20 0.0 0.0 0 0 ? S< Jun25 0:00 [md]root 26 0.0 0.0 0 0 ? S Jun25 0:00 [kswapd0]root 27 0.0 0.0 0 0 ? SN Jun25 0:00 [ksmd]root 28 0.0 0.0 0 0 ? SN Jun25 0:00 [khugepaged]root 29 0.0 0.0 0 0 ? S Jun25 0:00 [fsnotify_mark]root 30 0.0 0.0 0 0 ? S< Jun25 0:00 [crypto]root 38 0.0 0.0 0 0 ? S< Jun25 0:00 [kthrotld]root 40 0.0 0.0 0 0 ? S< Jun25 0:00 [kmpath_rdacd]root 41 0.0 0.0 0 0 ? S< Jun25 0:00 [kpsmoused]root 43 0.0 0.0 0 0 ? S< Jun25 0:00 [ipv6_addrconf]root 62 0.0 0.0 0 0 ? S< Jun25 0:00 [deferwq]root 94 0.0 0.0 0 0 ? S Jun25 0:00 [kauditd]root 233 0.0 0.0 0 0 ? S< Jun25 0:00 [mpt_poll_0]root 234 0.0 0.0 0 0 ? S< Jun25 0:00 [ata_sff]root 235 0.0 0.0 0 0 ? S< Jun25 0:00 [mpt/0]root 241 0.0 0.0 0 0 ? S Jun25 0:00 [scsi_eh_0]root 243 0.0 0.0 0 0 ? S< Jun25 0:00 [scsi_tmf_0]root 245 0.0 0.0 0 0 ? S Jun25 0:00 [scsi_eh_1]root 246 0.0 0.0 0 0 ? S Jun25 0:00 [kworker/u256:2]。。。。。。#获取某服务程序的所有进程号[root@bogon ~]# pgrep httpd670167026703670467056706#杀死进程,killall通过程序名字杀死所有进程[root@bogon ~]# killall httpd[root@bogon ~]# pgrep httpd[root@bogon ~]# #kill杀死程序[root@bogon ~]# cat a.sh #死循环#!/bin/bashwhile truedo echo "linux">/ dev/nulldone [root@bogon ~] #. / a.sh ^ Z [1] + Stopped. / a.sh [root@bogon ~] # ps PID TTY TIME CMD 3930 pts/1 00:00:00 bash 11719 pts/1 00:00:01 a.sh 11729 pts/1 00:00:00 ps [root@bogon ~] # kill 11719 # accidentally discovered this problem The cause is temporarily unknown [root@bogon ~] # ps PID TTY TIME CMD 3930 pts/1 00:00:00 bash 11719 pts/1 00:00:01 a.sh 11733 pts/1 00:00:00 ps [root@bogon] # kill-9 11719 # since ordinary kill cannot be killed, send a-9 signal to kill directly Problem solving [root@bogon ~] # ps PID TTY TIME CMD 3930 pts/1 00:00:00 bash 11734 pts/1 00:00:00 ps [1] + Killed. / a.sh [root@bogon ~] # / a.sh & [1] 11735 [root@bogon] # ps PID TTY TIME CMD 3930 pts/1 00:00:00 bash 11735 pts/1 00:00:01 a.sh 11736 pts/1 00:00:00 ps [root@bogon ~] # kill 11735 # ordinary background programs can directly kill [root@bogon ~] # ps PID TTY TIME CMD 3930 pts/1 00:00:00 bash 11737 pts/1 00:00:00 ps [1] + Terminated. / a.sh [root@bogon ~] # is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.