Questions tagged [process]

A process is an instance of a computer program that is being executed.

A process is an instance of a running computer program.

Obtaining information about processes

Some useful tools

  • top, htop: text-mode system monitors, showing process information in real time
  • lsof: list process open files. Also netstat specifically for network connections.
  • ptrace(): a programming interface to see all the system calls that a process is making. Different systems have different command line tools: strace on Linux, ktrace on *BSD, truss on Solaris, dtrace on FreeBSD and Mac OS X, …

Further reading

Keeping processes running

Some useful tools

  • screen: run programs in a detachable terminal that you can reattach to later from a different place
  • cron: schedule a task at regular intervals. Also at for a one-off.

Further reading

Other topics

Further reading

2558 questions
701
votes
8 answers

Finding the PID of the process using a specific port?

I am installing hadoop on my Ubuntu system. When I start it, it reports that port 9000 is busy. I used: netstat -nlp|grep 9000 to see if such a port exists and I got this: tcp 0 0 127.0.0.1:9000 0.0.0.0:* …
wuchang
  • 7,457
  • 5
  • 16
  • 16
611
votes
15 answers

What if 'kill -9' does not work?

I have a process I can't kill with kill -9 . What's the problem in such a case, especially since I am the owner of that process. I thought nothing could evade that kill option.
tshepang
  • 64,472
  • 86
  • 223
  • 290
451
votes
11 answers

How can I run a command which will survive terminal close?

Sometimes I want to start a process and forget about it. If I start it from the command line, like this: redshift I can't close the terminal, or it will kill the process. Can I run a command in such a way that I can close the terminal without…
Matthew
  • 5,417
  • 4
  • 19
  • 11
391
votes
12 answers

How to view the output of a running process in another bash session?

I have left a script running on a remote machine from when I was locally working at it. I can connect over SSH to the machine as the same user and see the script running in ps. $ ps aux | grep ipcheck myuser 18386 0.0 0.0 18460 3476 pts/0 …
jwbensley
  • 7,402
  • 11
  • 35
  • 43
336
votes
4 answers

How to get the pid of the last executed command in shell script?

I want to have a shell script like this: my-app & echo $my-app-pid But I do not know how the get the pid of the just executed command. I know I can just use the jobs -p my-app command to grep the pid. But if I want to execute the shell multiple…
David S.
  • 5,529
  • 5
  • 30
  • 39
331
votes
12 answers

How to terminate a background process?

I have started a wget on remote machine in background using &. Suddenly it stops downloading. I want to terminate its process, then re-run the command. How can I terminate it? I haven't closed its shell window. But as you know it doesn't stop using…
306
votes
16 answers

How to monitor CPU/memory usage of a single process?

I would like to monitor one process's memory / cpu usage in real time. Similar to top but targeted at only one process, preferably with a history graph of some sort.
Josh K
  • 3,866
  • 4
  • 22
  • 15
302
votes
12 answers

How to check how long a process has been running?

I would like to avoid doing this by launching the process from a monitoring app.
tshepang
  • 64,472
  • 86
  • 223
  • 290
277
votes
7 answers

Find out current working directory of a running process?

What command(s) can one use to find out the current working directory (CWD) of a running process? These would be commands you could use externally from the process.
slm
  • 363,520
  • 117
  • 767
  • 871
258
votes
3 answers

Why does `htop` show more process than `ps`

In ps xf 26395 pts/78 Ss 0:00 \_ bash 27016 pts/78 Sl+ 0:04 | \_ unicorn_rails master -c config/unicorn.rb 27042 pts/78 Sl+ 0:00 | \_ unicorn_rails worker[0] -c config/unicorn.rb …
Cheng
  • 6,531
  • 11
  • 40
  • 42
241
votes
2 answers

There are stopped jobs (on bash exit)

I get the message There are stopped jobs. when I try to exit a bash shell sometimes. Here is a reproducible scenario in python 2.x: ctrl+c is handled by the interpreter as an exception. ctrl+z 'stops' the process. ctrl+d exits python for…
ThorSummoner
  • 4,312
  • 6
  • 30
  • 47
168
votes
6 answers

How do I read from /proc/$pid/mem under Linux?

The Linux proc(5) man page tells me that /proc/$pid/mem “can be used to access the pages of a process's memory”. But a straightforward attempt to use it only gives me $ cat /proc/$$/mem /proc/self/mem cat: /proc/3065/mem: No such process cat:…
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
164
votes
3 answers

If you ^Z from a process, it gets "stopped". How do you switch back in?

I accidentally "stopped" my telnet process. Now I can neither "switch back" into it, nor can I kill it (it won't respond to kill 92929, where 92929 is the processid.) So, my question is, if you have a stopped process on linux command line, how do…
bobobobo
  • 1,765
  • 2
  • 11
  • 6
161
votes
4 answers

Find and remove large files that are open but have been deleted

How does one find large files that have been deleted but are still open in an application? How can one remove such a file, even though a process has it open? The situation is that we are running a process that is filling up a log file at a terrific…
dotancohen
  • 15,494
  • 26
  • 80
  • 116
156
votes
3 answers

How to see process created by specific user in Unix/linux

I want to see list of process created by specific user or group of user in Linux Can I do it using ps command or is there any other command to achieve this?
1
2 3
99 100