Last night I launched a command via nohup on a cluster and then closed the connection. Today I would like to kill this job (I know it's still running because output is being generated in an output file) but I can't even determine its PID. If I type ps -ax, for instance, the name of my executable does not show up. Just typing ps only shows me executables that I have launched this login session.

Any suggestions?

  • I use $ps -ef all the time. For me it shows all process (even not owned by me) on linux hosts. Does it help for you ? Get the pid and kill it.
    – bagavadhar
    May 28 '13 at 14:43
  • It depends on the OS. For BSD-derived systems, ps -aux is reasonably equal to ps -ef on Linux.
    – Jenny D
    May 22 '14 at 9:46

Try jobs command, if you can see it there take note of the job number and then kill -9 %job_number_you_recorded


You can use lsof to find the pid of what has that output file open.

  • lsof:command not found. Cluster is running Red Hat: Scientific Linux SL release 5.5 (Boron)
    – alexvas
    Feb 16 '13 at 21:40
  • Run it as root. Feb 16 '13 at 21:42
  • I don't have root access on the cluster... Also, why would a command be recognized by root but not by another user?
    – alexvas
    Feb 16 '13 at 22:02
  • Becaue on RHEL 5 and clones, /sbin and /usr/sbin are not in normal users' $PATH. You can use the full path, but lsof works best as root. Feb 16 '13 at 22:07

do you remeber the name of the process? Try to list with:

ps aux | grep -i $your_process_name

If you find that process you can easily kill it with ($pid = second column):

kill -9 $pid

You will not find that process in your current session, the nohup executed the given program then detached the program from your terminal. This parent-less process's parent will now be the init process (PID #1). You can see this with the command:

pstree -a

If you are sure, only one instance of given process is running you can easily kill with this:

killall -9 $process_name

for example:

killall -9 nano
  • pgrep is probably a better tool here than killall, since it can selectively search for the process name (with -f) and only select processes started by the user (-u)
    – jsbillings
    Sep 1 '13 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.