0

I open and connect an ssh terminal window shell to my server and run this:

nohup sleep 50000 &

When I then run ps I see this:

  PID TTY          TIME CMD
    1 ?        00:00:00 bash
   56 ?        00:00:00 sleep
  148 ?        00:00:00 ps

Now while I am still connected to first shell session and using same credentials as first session, I open up a second ssh terminal window shell to my server and run ps again and I see this:

  PID TTY          TIME CMD
    1 ?        00:00:00 bash
   86 ?        00:00:00 ps

How can I see the nohup processes that were started from the first shell session in the second shell session (assuming that I do NOT know the PID)? Or more generally, how can I see all nohup processes that are running that were started in other shells/sessions?

EDIT: Note that I also tried opening up a new shell/session with root user credentials and I still do not see the sleep process when using ps from here either.

1
  • Well long story short, I could seem to get this to work after trying things so I ended up setting up the script to run as a service so that makes sure it will always be running even after a reboot.
    – jsherk
    Apr 8, 2023 at 14:32

1 Answer 1

0

If you run ps from a different shell, you will see only processes initiated by that shell session even with root privileges. To see processes initiated by other users or in a different session, use option -a or -e. See man ps.

scrot1

scrot2

2
  • I tried both -a and -e but neither works... it still does not show anything from the other session.
    – jsherk
    Mar 19, 2023 at 12:15
  • @jsherk - I added 2 screenshots from my test on Debian 11. Second one is from a separate terminal I opened after closing the three first ones. Maybe you could edit your question to add similar screenshots? Mar 19, 2023 at 12:35

You must log in to answer this question.

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