Currently, I am working on a small project and I would much appreciate it if someone could tell me how can I get the process's info before it dies? Assuming I have its PID. At the end of the day, I want to know it's estimated time... Also is there any possible way to get Google Chrome Tabs precise PIDS? (I mean, getting all of it isn't hard but which one is which?) Side note: I used psutil in python for getting (user's all processes)... I have not much experience in Linux

  • Is there some kind of event that's thrown before process dies?
    – Zura
    Oct 19, 2019 at 19:17
  • I have just more or less finished an answer related to that topic. unix.stackexchange.com/questions/153382/… It is more about the sideways aspect of managing processes (sleeping). You want to know about the end phase of a process. Maybe that famous "Z" state can lead you a bit.
    – user373503
    Oct 19, 2019 at 19:50
  • Maybe wait for that pidfd, then look for info in /proc. What "estimated time"? You can't know which is which, nobody has this mapping except chrome, unless you really know where exactly chrome stores that mapping and its format and ptrace the chrome main process. Oct 19, 2019 at 23:20

2 Answers 2


how can I get the process's info before it dies?

'ps' is the tool for a "snapshot". top for a live table. Both have complex man pages. I like ps axf which gives a tree structure.

get Google Chrome Tabs precise PIDS?

The other way round like this you mean? (part (branch) of ps axf output)

  \_ /usr/lib/firefox/firefox     
      \_ /usr/lib/firefox/firefox -contentproc -childID 2 ...
      \_ /usr/lib/firefox/firefox -contentproc -childID 3 ...
      \_ /usr/lib/firefox/firefox -contentproc -childID 10 ...  
      \_ /usr/lib/firefox/firefox -contentproc -childID 16 ...  
      \_ /usr/lib/firefox/firefox -contentproc -childID 17 ...  

We only see these childID. There is no easy way of telling which tab content belongs to which -- unless you keep track yourself by comparing ps output before and after opening a browser tab.

These are just technical data. Sometimes very useful. But not meant for user interaction.

If you have a system for experiments in your project, go ahead and send some signals to the pids (not shown) from the command line. But be prepared for the worst - beginning with loosing your bookmarks etc.

  • I am sorry I kind of haven't slept 17 hours... I will Check those tomorrow(mid night here ;) ) and Surely give you an appropriate feedback.
    – Zura
    Oct 19, 2019 at 21:03
  • No hurry. We have a similar here btw ;)
    – user373503
    Oct 19, 2019 at 21:05
  • Good stuff @rastafile. That part "firefox -contentproc ..." Is that a command or output? Oct 19, 2019 at 21:11
  • @IliaGilmijarow It is part of ps axf out put edited together - not very elegant. And misleading? I will first aid correct, thx! )I had assumed OQ knows about listing all - "is easy")
    – user373503
    Oct 19, 2019 at 21:31

Not sure this is what you want, but start time and elapsed time can be found with ps command.

ps -o 'comm,stime,etime' 1134 #1134 is your pid

Other options for ps apply of course, like the -a option to show other than just the user's processes

  • I also think zura has to open up a bit more. "info before it dies?"
    – user373503
    Oct 19, 2019 at 20:47
  • Yeah, i just assumed it meant before it dies as opposed to after it dies, which would be a more challenging proposition Oct 19, 2019 at 20:51
  • What I want is wait before process is at the edge of the death and do that in a manner to not to use while loops. That way I need to check them at every point of time(every 1 or 2minute idk) which consumes lot of power and most likely will drain my laptop battery. If I didn't explain myself or you found it somehow confusing please let me know
    – Zura
    Oct 19, 2019 at 20:53
  • I thought I have clearly defined that estimated time was motsly my interest but other data such as process's names. Also Google Chrome is a pain in my ass... How can i differ process's pids from which tabs it refers to?
    – Zura
    Oct 19, 2019 at 21:00
  • @IliaGilmijarow LOL! btw I just answered, addressing that browser tab thing. Estimated time has three dots and is I think not so clear for all of us. Estimated time of arrival i only know.
    – user373503
    Oct 19, 2019 at 21:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .