Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [process]

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

Filter by
Sorted by
Tagged with
752 votes
8 answers
1.7m views

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 ...
wuchang's user avatar
  • 7,967
628 votes
15 answers
783k views

What if 'kill -9' does not work?

I have a process I can't kill with kill -9 <pid>. 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's user avatar
  • 65.9k
459 votes
11 answers
663k views

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 ...
Matthew's user avatar
  • 5,547
410 votes
13 answers
732k views

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 ...
Baldrick's user avatar
  • 7,682
342 votes
4 answers
441k views

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 ...
David S.'s user avatar
  • 5,599
337 votes
12 answers
961k views

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 ...
Mohammad Etemaddar's user avatar
314 votes
17 answers
489k views

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's user avatar
  • 3,956
306 votes
12 answers
434k views

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's user avatar
  • 65.9k
287 votes
7 answers
240k views

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's user avatar
  • 371k
266 votes
3 answers
142k views

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 | ...
Cheng's user avatar
  • 6,671
245 votes
2 answers
453k views

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'...
ThorSummoner's user avatar
  • 4,442
171 votes
6 answers
179k views

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/...
Gilles 'SO- stop being evil''s user avatar
168 votes
3 answers
240k views

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 ...
bobobobo's user avatar
  • 1,805
167 votes
4 answers
377k views

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 ...
dotancohen's user avatar
  • 15.9k
160 votes
5 answers
272k views

How do I attach a terminal to a detached process?

I have detached a process from my terminal, like this: $ process & That terminal is now long closed, but process is still running, and I want to send some commands to that process's stdin. Is ...
Rogach's user avatar
  • 6,363
156 votes
3 answers
449k views

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?
gaurav VINAYAK shirodkar's user avatar
147 votes
10 answers
624k views

Is there a way to see details of all the threads that a process has in Linux?

For Windows, I think Process Explorer shows you all the threads under a process. Is there a similar command line utility for Linux that can show me details about all the threads a particular process ...
Lazer's user avatar
  • 35.4k
136 votes
8 answers
219k views

How do I find out which processes are preventing unmounting of a device?

Sometimes, I would like to unmount a usb device with umount /run/media/theDrive, but I get a drive is busy error. How do I find out which processes or programs are accessing the device?
Stefan's user avatar
  • 25.3k
135 votes
7 answers
73k views

Why do we need to fork to create new processes?

In Unix whenever we want to create a new process, we fork the current process, creating a new child process which is exactly the same as the parent process; then we do an exec system call to replace ...
sarthak's user avatar
  • 1,472
134 votes
7 answers
226k views

How to get whole command line from a process?

How can I get the command arguments or the whole command line from a running process using its process name? For example this process: # ps PID USER TIME COMMAND 1452 root 0:00 /sbin/...
Michael's user avatar
  • 1,673
132 votes
10 answers
371k views

How to view a specific process in top

Are there any relatively strightforward options with top to track a specific process? Ideally by identifying the process by a human readable value? e.g. chrome or java. In other words, I want to view ...
Michael Coleman's user avatar
122 votes
11 answers
415k views

How to find which processes are taking all the memory?

I'm looking for somthing like top is to CPU usage. Is there a command line argument for top that does this? Currently, my memory is so full that even 'man top' fails with out of memory :)
ripper234's user avatar
  • 31.9k
121 votes
12 answers
318k views

Kill many instances of a running process with one command

Suppose I have a thousand or more instances of any process (for example, vi) running. How do I kill them all in one single shot/one line command/one command?
The Dark Knight's user avatar
121 votes
5 answers
58k views

What process created this X11 window?

Given an X11 window ID, is there a way to find the ID of the process that created it? Of course this isn't always possible, for example if the window came over a TCP connection. For that case I'd ...
Gilles 'SO- stop being evil''s user avatar
121 votes
5 answers
248k views

Determining what process is bound to a port

I know that using the command: lsof -i TCP (or some variant of parameters with lsof) I can determine which process is bound to a particular port. This is useful say if I'm trying to start ...
user avatar
121 votes
3 answers
65k views

What does `kill -0` do?

I recently came across this in a shell script. if ! kill -0 $(cat /path/to/file.pid); then ... do something ... fi What does kill -0 ... do?
slm's user avatar
  • 371k
121 votes
5 answers
227k views

Kill all descendant processes [duplicate]

I'm writing an application. It has the ability to spawn various external processes. When the application closes, I want any processes it has spawned to be killed. Sounds easy enough, right? Look up ...
MathematicalOrchid's user avatar
114 votes
11 answers
79k views

Block network access of a process?

Is it possible to block the (outgoing) network access of a single process?
larkee's user avatar
  • 1,243
112 votes
5 answers
80k views

If processes inherit the parent's environment, why do we need export?

I read here that the purpose of export in a shell is to make the variable available to sub-processes started from the shell. However, I have also read here and here that "Processes inherit their ...
Amelio Vazquez-Reina's user avatar
104 votes
3 answers
52k views

What are "session leaders" in `ps`?

What are session leaders, as in ps -d which selects all processes except session leaders?
its_me's user avatar
  • 14.1k
97 votes
9 answers
50k views

How can I check what signals a process is listening to?

How can I verify whether a running process will catch a signal, or ignore it, or block it? Ideally I'd like to see a list of signals, or at least not have to actually send the signal to check.
Jander's user avatar
  • 16.7k
97 votes
2 answers
123k views

How to limit a process to one CPU core in Linux? [duplicate]

How to limit process to one cpu core ? Something similar to ulimit or cpulimit would be nice. (Just to ensure: I do NOT want to limit percentage usage or time of execution. I want to force app (with ...
Grzegorz Wierzowiecki's user avatar
95 votes
6 answers
396k views

How to check which process is using most memory

When I check free in one of Prod server it showing 70% of memory is being used: total used free shared buffers cached Mem: 164923172 141171860 23751312 ...
sandeep's user avatar
  • 951
94 votes
3 answers
18k views

How does Linux "kill" a process?

It often baffles me that, although I have been working professionally with computers for several decades and Linux for a decade, I actually treat most of the OS' functionality as a black box, not ...
seratoninant's user avatar
91 votes
7 answers
36k views

Are threads implemented as processes on Linux?

I'm going through this book, Advanced Linux Programming by Mark Mitchell, Jeffrey Oldham, and Alex Samuel. It's from 2001, so a bit old. But I find it quite good anyhow. However, I got to a point ...
user avatar
90 votes
5 answers
45k views

What's the difference between pkill and killall?

I know that pkill has more filtering rules than killall. My question is, what is the difference between: pkill [signal] name and killall [signal] name I've read that killall is more effective and ...
mavillan's user avatar
  • 3,107
88 votes
4 answers
3k views

Can I somehow add a "&& prog2" to an already running prog1?

Most shells provide functions like && and ; to chain the execution of commands in certain ways. But what if a command is already running, can I still somehow add another command to be executed ...
us2012's user avatar
  • 953
88 votes
4 answers
52k views

Use & (ampersand) in single line bash loop

I have been using this command successfully, which changes a variable in a config file and then executes a Python script within a loop: for((i=114;i<=255;i+=1)); do echo $i > numbers.txt; python ...
ljs.dev's user avatar
  • 2,137
87 votes
5 answers
68k views

Run multiple commands and kill them as one in bash

I want to run multiple commands (processes) on a single shell. All of them have own continuous output and don't stop. Running them in the background breaks Ctrl-C. I would like to run them as a single ...
user1876909's user avatar
85 votes
2 answers
49k views

What do the brackets around processes mean?

$ ps -Awwo pid,comm,args PID COMMAND COMMAND 1 init /sbin/init 2 kthreadd [kthreadd] 3 ksoftirqd/0 [ksoftirqd/0] 5 kworker/u:0 [kworker/u:0] 6 ...
joslinm's user avatar
  • 971
83 votes
4 answers
260k views

How to list processes locking file?

Using flock, several processes can have a shared lock at the same time, or be waiting to acquire a write lock. How do I get a list of these processes? That is, for a given file X, ideally to find the ...
Benubird's user avatar
  • 5,932
81 votes
5 answers
71k views

Why is SIGINT not propagated to child process when sent to its parent process?

Given a shell process (e.g. sh) and its child process (e.g. cat), how can I simulate the behavior of Ctrl+C using the shell's process ID? This is what I've tried: Running sh and then cat: [user@...
rob87's user avatar
  • 813
81 votes
5 answers
168k views

How to determine which process is creating a file? [duplicate]

Given file path, how can I determine which process creates it (and/or reads/writes to it)?
Anton Barkovsky's user avatar
81 votes
3 answers
175k views

Which process has PID 0?

I'm looking for the process started in Linux which has process ID 0. I know init has PID 1 , which is the first process in Linux, is there any process with PID 0?
user9744's user avatar
  • 721
79 votes
2 answers
101k views

Need explanation on Resident Set Size/Virtual Size

I found that pidstat would be a good tool to monitor processes. I want to calculate the average memory usage of a particular process. Here is some example output: 02:34:36 PM PID minflt/s ...
Flanfl's user avatar
  • 965
76 votes
8 answers
54k views

Who's got the other end of this unix socketpair?

I want to determine which process has the other end of a UNIX socket. Specifically, I'm asking about one that was created with socketpair(), though the problem is the same for any UNIX socket. I ...
Jonathon Reinhart's user avatar
75 votes
2 answers
21k views

Process with weird random name consuming significant network and CPU resources. Is someone hacking me?

In a VM on a cloud provider, I'm seeing a process with weird random name. It consumes significant network and CPU resources. Here's how the process looks like from pstree view: systemd(1)───...
oldhomemovie's user avatar
  • 1,707
75 votes
3 answers
202k views

'ps' arguments to display PID, PPID, PGID, and SID collectively

I tried ps with different kinds of switches e.g. -A, aux, ef, and so forth but I cannot seem to find the right combination of switches that will tell me the Process ID (PID), Parent Process ID (PPID), ...
JohnMerlino's user avatar
  • 6,211
75 votes
4 answers
87k views

What is the maximum value of the Process ID?

What is the maximum value of the Process ID? Also, is it possible to change a Process ID?
Dmitry Kodmov's user avatar
72 votes
4 answers
425k views

How do I know what service is running on a particular port in linux? [duplicate]

I am trying to run weblogic server on my linux machine and I am getting the following error : ERROR: transport error 202: bind failed: Address already in use ERROR: JDWP Transport dt_socket failed to ...
Geek's user avatar
  • 6,728

1
2 3 4 5
54