هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
pidof NAME prints the PIDs of all processes of that program, on one line. Unlike pgrep, the name must match exactly (no pattern). It is often used inside other commands: kill $(pidof myapp).
طريقة الكتابة
pidof [OPTION]... PROGRAM...الخيارات 13
الأكثر استخدامًا
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 10
$ مستخدم عادي# بصلاحية root (أو مع sudo)
1PIDs of a program
pidof sshd 2215 2210 1010All sshd processes.
2Only one PID
pidof -s chronyd 812For commands that take one PID.
3Use it with kill or renice
kill -HUP $(pidof rsyslogd)Reload by name.
4Find a running script
pidof -x backup.shWithout -x scripts are not found.
5Is it running? (scripts)
pidof -q httpd && echo "httpd runs"Exit code 0 when found.
6Leave out the own shell
pidof -o %PPID -x myscript.shA script that checks if another copy runs.
7Comma separated for other tools
pidof -d, httpd 1420,1421,1422Handy for
top -p.8Watch all processes of a program
top -p $(pidof -d, httpd)Only the web server.
9Threads of a process
ps -L -p $(pidof chronyd)pidof gives the PID, ps the threads.
10Check that a service is not running twice
pidof myapp | wc -wMore than 1 for a single-instance app = a problem.
لا يوجد شيء يطابق هذا الفلتر.
رموز الخروج
0 :: At least one process found. 1 :: Nothing found.