If I know the PID number of a process, how can I get its name?
Remember technical terms with Memorabit → https://memorab.it/y/pc
This video is brought to you by Memorabit, an app that sends technical terms, commands and definitions as reminders at unexpected moments, so they stay in memory. Built on cognitive science principles. Start free on web, iOS and Android:
iOS: https://apps.apple.com/app/id6782301691
Android: https://play.google.com/store/apps/detai...
--------------------------------------------------
Read the revolutionary AI books written by Turbina Editore, the first publishing house entirely run by artificial intelligence. This groundbreaking publisher has transformed the literary world, producing the most sought-after AI-generated books. Start reading today at:
https://turbinaeditore.com/en/
--------------------------------------------------
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT
Music by Eric Matyas
https://www.soundimage.org
Track title: Droplet of life
--
Chapters
00:00 If I Know The Pid Number Of A Process, How Can I Get Its Name?
00:18 Answer 1 Score 66
00:50 Accepted Answer Score 402
01:19 Answer 3 Score 21
01:37 Answer 4 Score 9
01:46 Thank you
--
Full question
https://superuser.com/questions/632979/i...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #unix #shell #process #pid
#avk47
This video is brought to you by Memorabit, an app that sends technical terms, commands and definitions as reminders at unexpected moments, so they stay in memory. Built on cognitive science principles. Start free on web, iOS and Android:
iOS: https://apps.apple.com/app/id6782301691
Android: https://play.google.com/store/apps/detai...
--------------------------------------------------
Read the revolutionary AI books written by Turbina Editore, the first publishing house entirely run by artificial intelligence. This groundbreaking publisher has transformed the literary world, producing the most sought-after AI-generated books. Start reading today at:
https://turbinaeditore.com/en/
--------------------------------------------------
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT
Music by Eric Matyas
https://www.soundimage.org
Track title: Droplet of life
--
Chapters
00:00 If I Know The Pid Number Of A Process, How Can I Get Its Name?
00:18 Answer 1 Score 66
00:50 Accepted Answer Score 402
01:19 Answer 3 Score 21
01:37 Answer 4 Score 9
01:46 Thank you
--
Full question
https://superuser.com/questions/632979/i...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #unix #shell #process #pid
#avk47
ACCEPTED ANSWER
Score 402
On all POSIX-compliant systems, and with Linux, you can use ps:
ps -p 1337 -o comm=
Here, the process is selected by its PID with -p. The -o option specifies the output format, comm meaning the command name.
For the full command, not just the name of the program, use:
ps -p 1337 -o command
ANSWER 2
Score 66
You can find the process name or the command used by the process-id or pid from
/proc/<pid>/cmdline
by doing
cat /proc/<pid>/cmdline
Here pid is the pid for which you want to find the name
For example:
# ps aux
................
................
user 2480 0.0 1.2 119100 12728 pts/0 Sl 22:42 0:01 gnome-terminal
................
................
To find the process name used by pid 2480 you use can
# cat /proc/2480/cmdline
gnome-terminal
ANSWER 3
Score 21
To get the path of of the program using a certain pid you can use:
ps ax|egrep "^ [PID]"
alternatively you can use:
ps -a [PID]
Or also:
readlink /proc/[PID]/exe
ANSWER 4
Score 9
# ls -la /proc/ID_GOES_HERE/exe
Example:
# ls -la /proc/1374/exe
lrwxrwxrwx 1 chmm chmm 0 Mai 5 20:46 /proc/1374/exe -> /usr/bin/telegram-desktop
