Process control

From Tux
Jump to: navigation, search

On UNLV CS servers you have a limited number of processes that you can create. Once you have exceeded that number, you will not be able to remotely log in.

Finding a process

Find the process ID (PID) by typing ps -ef | grep username

You will see output like this

UID        PID  PPID  C STIME TTY          TIME CMD 
janedoe   2233  2231  0 16:57 ?        00:00:00 /usr/sbin/sshd
janedoe   2234  2233  0 16:57 pts/0    00:00:00 -sh
janedoe   2254  2234  0 16:57 pts/0    00:00:00 ps -ef
janedoe   2255  2234  0 16:57 pts/0    00:00:00 grep janedo

Killing a process

Killing your programs is important because it relieves the workload on the CPU, therefore making data process faster for every user. Here is how to kill a process:

  • kill -9 PID where PID is replaced with the appropriate PID, such as 2233 from above

If this does not work, try one the following

  • kill -9 -1
  • pkill -U username

Running a process in the background

ctrl-c is typically used to terminate a process. You would usually use this when a program crashes or when you are executing a program with infinite loops.

ctrl-z is used for running a program in the background. This will not terminate your process.

Learning more

Use man command to learn more about any Linux command.