Questions tagged [process]

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

Filter by
Sorted by
Tagged with
624 votes
15 answers

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.8k
459 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 ...
Matthew's user avatar
  • 5,537
171 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/...
Gilles 'SO- stop being evil''s user avatar
114 votes
11 answers

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
29 votes
4 answers

New parent process when the parent process dies

In UNIX, when a parent process disappears, I thought that all child processes reset init as their parent. Is this not correct all the time? Are there any exceptions?
user100503's user avatar
81 votes
5 answers

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
166 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 ...
dotancohen's user avatar
  • 15.9k
24 votes
2 answers

Portability of file descriptor links

I've always wondered this but never took the time to find out, so I'll do so now - how portable is the usage shown here of either /proc/$$/fd/$N or /dev/fd/$N? I understand POSIX guarantees /dev/null, ...
mikeserv's user avatar
  • 58.4k
121 votes
5 answers

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
50 votes
4 answers

How can I set the processor affinity of a process on Linux?

How can I set the processor affinity of a process on Linux?
chillitom's user avatar
  • 653
15 votes
2 answers

Is a sub-shell the same thing as a child-shell

There are this two names: a subshell and a child-shell. Yes, a child process will be started by any of this: sh -c 'echo "Hello"' ( echo "hello" ) echo "$(echo "hello") echo "hello" | cat Are all ...
user avatar
76 votes
8 answers

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
36 votes
3 answers

What causes various signals to be sent?

I sometimes get a little confused by all of the signals that a process can receive. As I understand it, a process has a default handler (signal disposition) for each of these signals, but it can ...
Nathan Osman's user avatar
  • 6,240
409 votes
13 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 ...
Baldrick's user avatar
  • 7,672
158 votes
5 answers

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,313
85 votes
2 answers

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
75 votes
4 answers

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
57 votes
5 answers

Measuring RAM usage of a program

time is a brilliant command if you want to figure out how much CPU time a given command takes. I am looking for something similar that can measure the max RAM usage of the program and any children. ...
Ole Tange's user avatar
  • 35.6k
55 votes
4 answers

What's the difference between running a program as a daemon and forking it into background with '&'?

What are the practical differences from a sysadmin point of view when deploying services on a unix based system?
user1561108's user avatar
  • 1,071
55 votes
2 answers

Why is the default process creation mechanism fork?

The UNIX system call for process creation, fork(), creates a child process by copying the parent process. My understanding is that this is almost always followed by a call to exec() to replace the ...
Ellen Spertus's user avatar
4 votes
6 answers

Check for Process if Same is Running

Is there a script or a way in linux that when I try to execute a shell script/process, if the same is running, it will prompt that same is running and will exit otherwise it will continue.
user60216's user avatar
  • 325
1 vote
3 answers

can't kill gedit process from its PID

This is the sequence of commands, gedit starts, but it cannot be killed from its process ID $ gedit& $ t=$! $ echo $t 4824 $ kill $t bash: kill: (4824) - No such process It would work just fine ...
nightcod3r's user avatar
342 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 ...
David S.'s user avatar
  • 5,599
112 votes
5 answers

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

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
  • 14k
82 votes
5 answers

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
  • 823
51 votes
2 answers

How to ensure exclusive CPU availability for a running process?

At first, the question seems to be a little bit silly/confusing as the OS does the job of managing process execution. However, I want to measure how much some processes are CPU/IO-bound and I feel ...
Jeanderson Candido's user avatar
32 votes
9 answers

Process descendants

I'm trying to build a process container. The container will trigger other programs. For example - a bash script that launches running background tasks with '&' usage. The important feature I'm ...
Craig Turner's user avatar
26 votes
2 answers

How can I kill minerd malware on an AWS EC2 instance? (compromised server)

I found malware on my ec2 instance which was continuously mining bitcoin and using my instance processing power. I successfully identified the process, but was unable to remove and kill it. I ran ...
Nadeem Ahmed's user avatar
25 votes
3 answers

Is it possible to pass environment variables from child to parent in user space? [duplicate]

As the title says, I want to be able to change environment variables in a parent process (specifically, a shell) from a child process (typically a script).  From pseudo terminal /dev/pts/id trying to ...
Error's user avatar
  • 391
21 votes
3 answers

How does a program decide whether or not to have coloured output?

When I execute a command from a terminal that prints coloured output (such as ls or gcc), the coloured output is printed. From my understanding, the process is actually outputting ANSI escape codes, ...
Chris Smith's user avatar
18 votes
1 answer

Reliable way to jail child processes using `nsenter:`

I know that Linux namespaces, among many other things, can be leveraged to handle restricting and jailing child processes securely without any chance of their being zombied and dumped on init. But I'm ...
mikeserv's user avatar
  • 58.4k
97 votes
9 answers

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
89 votes
7 answers

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
15 votes
4 answers

How to kill a process which can't be killed without rebooting?

There are 5 processes which can't be killed by kill -9 $PID and executing cat /proc/$PID/cmdline will hang the current session. Maybe they're zombie processes. Executing ps -ef or htop will also hang ...
Sam Stoelinga's user avatar
4 votes
2 answers

Is there a log of past threads that are now closed?

Sometimes, I have a rogue Java process which takes up 100% of my CPU and makes it jump about 30C in temperature (usually resulting in a crash if not killed). Problem is, I can never really identify ...
nopcorn's user avatar
  • 9,579
306 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's user avatar
  • 65.8k
97 votes
2 answers

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
75 votes
2 answers

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
70 votes
6 answers

Which process is `/proc/self/` for? says The /proc/self/ directory is a link to the currently running process. There are always multiple processes running ...
Tim's user avatar
  • 102k
60 votes
6 answers

How to send keystrokes (F5) from terminal to a GUI program?

I'm using a Raspberry Pi in combination with Chromium (kiosk mode) to show up some stats. The Pi doesn't have a connected keyboard so I searched for a solution to send keystrokes from the terminal to ...
burnersk's user avatar
  • 758
24 votes
3 answers

per process private file system mount points

I was checking unshare command and according to it's man page, unshare - run program with some namespaces unshared from parent I also see there is a type of namespace listed as, mount namespace ...
Ramesh's user avatar
  • 39.4k
17 votes
1 answer

Why should I not use 'kill -9' / SIGKILL

Posting this question because I was surprised to not find it directly answered; apologies if this is a duplicate - I did look! I have heard that kill -9 or kill -SIGKILL is bad, but I don't ...
dimo414's user avatar
  • 1,807
17 votes
1 answer

How is a process group ID set?

I have read that a session's ID is the same as the pid of the process that created the session through the setsid() system call, but I haven't found any information about how a process group ID is set....
user7681202's user avatar
  • 1,313
11 votes
4 answers

What is an open file description?

When you fork a process, the child inherits its parent's file descriptors. I understand that when this happens, the child receives a copy of the parent's file descriptor table with the pointers in ...
user avatar
9 votes
2 answers

Hide processes from other users based on groups (under Linux)?

Is it possible to configure process hiding for certain user groups under a linux system? For example: Users from group X should not see processes owned by users from group Y in ps/top or under /proc. ...
maxschlepzig's user avatar
  • 57.6k
3 votes
1 answer

Redirect a file descriptor before execution

I know that I can change the file a program writes to by interrupting the process in gdb, closing using the file descriptor and then re-opening with the file name I want. Is there a way to do the same ...
user3856370's user avatar
335 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 ...
Mohammad Etemaddar's user avatar
314 votes
17 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's user avatar
  • 3,956
285 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's user avatar
  • 370k

2 3 4 5