Questions tagged [process]

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

Filter by
Sorted by
Tagged with
55 votes
11 answers
42k views

How to track newly created processes in Linux?

I know that with ps I can see the list or tree of the current processes running in the system. But what I want to achieve is to "follow" the new processes that are created when using the computer. As ...
1 vote
0 answers
20 views

Send Input to Interactive Process via File Descriptor

How can I find the file descriptor that a process reads input from? Background I run a Vite (pronounced veet) server when developing in an Alpine container. Currently I login to the container and ...
0 votes
1 answer
69 views

why don't we create processes from scratch and make it a "fork", in linux? [duplicate]

why in Linux do we not create a process from scratch, as "init" is created, but create a "fork" of it by the method of branching?
4 votes
2 answers
2k views

API Monitoring and Hooking

I am currently reading the "Malware Analyst's Cookbook and DVD". There is a chapter "Dynamic Analysis" and there are also some recipes about hooking and monitoring API calls of process but it is for ...
0 votes
0 answers
32 views

What killed my process? No relevant entries seen via dmesg or journalctl on Rocky Linux 9.2 (Blue Onyx)

A program from a vendor gets killed instantly. I need to know why. Log shows nothing relevant. Any advice? I looked into OOM killer etc. Added tons of swap. Did not specify log in journalctl so I ...
1 vote
1 answer
3k views

Questions about WCHAN values

I have a CentOS 8 (3.10) running on VirtualBox 6.0... And I have 2 questions about WCHAN The 'ps' man page describes WCHAN as: Blockquote nwchan WCHAN address of the kernel function where ...
1 vote
0 answers
35 views

mysqld thread count exceeds max_connections

As the question title suggests: I have set max_connections = 2 in my my.cnf file, but when I activate my mysql daemon, the thread count sits at 37. I am searching online but cannot find indication my ...
2 votes
1 answer
368 views

How to check whether a shell process has job-control enabled?

Is there a way to programmatically check whether a given (shell) process has job-control enabled?
0 votes
1 answer
31 views

Run Additional Commands on a Specific PID

I'm completely new with Linux so forgive me if this seems like an absurd question. I am trying to open new tabs on Firefox without a url from the terminal. So my command is: $ firefox -new-tab -search ...
1 vote
1 answer
1k views

trying to make my own shell handle ctrl+c properly

I am trying to understand how shells are set up so that the programs they are running receive the SIGINT when you press ctrl C but the shell doesn't, because when you are running bash, and run another ...
1 vote
1 answer
70 views

Capturing output from a bash function without using a subshell [closed]

I have a bash script listening on a pipe for commands. When it sees a command it runs it. However, I would like it to support the "sideloading" of bash functions that can be called at a ...
0 votes
0 answers
19 views

User space swap

I have low physical memory 1GB in my VPS container based (LXC), therefore I can't change kernel parameter such as swap memory swappiness. Even though there is swap allocated from built-in VPS when I ...
0 votes
0 answers
17 views

Prevent OOM killer inside guest in LXC

I have a python program myprogram.py. I realized that my python program is being killed due to Out Of Memory (OOM). But, I noticed also that my VPS is inside LXC and has swap 1GB, when the memory full ...
2 votes
1 answer
88 views

How to pass a parameter to a command that's being executed by exec in bash?

I'm trying to start a subprocess with a unique process name from a bash script. This works: bash -c "exec -a MyUniqueProcessName './start_service' &" but my problem is that I want to ...
3 votes
2 answers
11k views

Test whether a process left any orphans behind

I don't need to wait for them, I just need a yes or no. I'm executing a program that I know is going to fork (and the children are likely to fork too). If run correctly, it should take care of all ...
2 votes
2 answers
3k views

How to find out on which core a thread is running on?

Let's say we have a CPU-intensive application called multi-threaded-application.out that is running on top of Ubuntu with a PID of 10000. It has 4 threads with tid 10001, 10002, 10003, and 10004. I ...
0 votes
1 answer
633 views

Give user permission to change priority of an IRQ/root process

Is it possible, in Linux, to allow an user to change the priority of a process owned by root? More specifically an IRQ process? For an embedded real-time application I want to raise the priority of ...
0 votes
0 answers
16 views

Identification of processes that are not terminated by logging out

I'm trying to better understand how to terminate all undesired processes and start a Linux session fresh. By "undesired", I mean any processes left over from applications that have crashed. ...
29 votes
4 answers
24k views

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?
2 votes
1 answer
48 views

When SIGTERM is received by a process, what happens to its children?

I am wondering what happens when a process receives SIGTERM and it has children spawned (e.g. JVM that has /bin/sh commands running). Is there some sort of automatism or does the parent simply exit ...
0 votes
0 answers
35 views

Why does a program launched by echoing into sh persist after parent termination?

I was looking at dmenu_run, which is the default dmenu script to launch a program, and saw this part of it that intrigued me: [..other stuff..] | dmenu | sh & So I did some testing. Prerequisites ...
2 votes
2 answers
2k views

Killing all python scripts except grep process and a specific python script

How can I run command in bash to kill all python scripts except script called test.py and the grep's pid itself, in case we are using something like ps -ef |grep I think I can use something like ...
1 vote
1 answer
52 views

Count the total processes spawned using /proc/loadavg

In a Red Hat Linux 8 operating system, I examined the output of cat /proc/loadavg and obtained "5.20 5.78 8.04 16/1596 1954863". After 4 minutes, I rechecked the /proc/loadavg output and ...
45 votes
3 answers
144k views

When does the system send a SIGTERM to a process?

My server program received a SIGTERM and stopped (with exit code 0). I am surprised by this, as I am pretty sure that there was plenty of memory for it. Under what conditions does linux (busybox) send ...
2 votes
1 answer
3k views

Kill a running shell script, and kill all process running within it

I have a shell script running in the background, which runs 5 different jobs. When I run the shell script all 5 jobs start running in order. When I kill this shell, whichever process is running, will ...
0 votes
1 answer
55 views

How to detect if a process runs longer than X seconds, then do something with it?

I’m on debian. I am calling a ffmpeg process to generate a mp3. this gets called from a php script using shell_exec. This works fine 99% of the time. Sometimes, the ffmpeg process doesn’t exit and I’m ...
0 votes
0 answers
11 views

Log PID and TCP Listen

I'm trying find, how can I log all process activites, for logging all TCP Listen syscalls. System is linux. My main problem, I need do some logging for passive FTP connections, but with time occurence,...
0 votes
0 answers
62 views

What is the process "pool_workqueue_release"?

What is pool_workqueue_release? It seems it's spawned right after kthreadd, ktrheadd is the main process/daemon to create kernel threads, right? In linux/kernel/workqueue.c I found: static void __init ...
1 vote
1 answer
3k views

remove on stale pid file after power failure to allow software startup via systemd service

i got such situation there is a power failure the UPS battery is drained during power failure the servers in rack are shut off from power lose power is restored servers powering up and their os'es ...
43 votes
3 answers
152k views

When a process will go to 'D' state?

I'm using "Linux hostname 2.6.28-15-generic #49-Ubuntu SMP Tue Aug 18 18:40:08 UTC 2009 i686 GNU/Linux" All the client machines will use Thin-client ,I will use my laptop for working and I will ...
0 votes
2 answers
2k views

Monitor process pid for change

I have a service that is always supposed to be running. I’d like to know when the service ever stops or gets restarted. I’ve thought about referencing the service’s PID. If it gets restarted, it ...
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 | ...
0 votes
2 answers
105 views

What happens when I give the shell a "command" versus a script?

A variant of this question has been asked a few times (here and here, for instance) but I'm afraid that the answers either didn't fully capture my question here or else perhaps assumed more than I ...
0 votes
0 answers
20 views

List processes by cpu system time

I have a Node exporter up and running on my server, on my dashboard I see that my CPU time is mostly (+40%) spent in system mode which is not normal. How can I list processes sorting them by CPU ...
1 vote
3 answers
92 views

is there a way to allow only a single proccess to delete a file?

Is there a way to allow only a single main process to delete an original file? Other processes may read and modify it, but not delete. I know a process can empty its contents but there is no problem ...
409 votes
13 answers
725k 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 ...
0 votes
1 answer
24 views

When does a hup signal affect the parent process? [duplicate]

If I run ./script.sh &, where script is the following: #!/bin/bash echo "hello" sleep 30 echo "hello again" sleep 30 touch /root/foo.txt Then I use ps au, to identify the &...
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 ...
1 vote
1 answer
5k views

nginx stop is not working and nginx is creating new process after killing processes

nginx version: nginx/1.8.0 I am trying to stop nginx with the following command /etc/init.d/nginx stop, however it is not returning any successful message. Then I tried to view the nginx processes ...
1 vote
3 answers
142 views

start multiple terminal windows in a "process group" so that remaining processes can be killed, if any one of the processes terminates

I have a script which starts 3 terminal emulator windows: #!/bin/sh terminator --role='terminator-left' 2>/dev/null & sleep 0.1 terminator --role='terminator-center' 2>/dev/null & sleep ...
1 vote
1 answer
145 views

How do I configure auditd to print the ppid name, not just the ppid?

OS is Debian. I have set up auditd to try and determine what is rebooting a system. I have the following rule: -a exit,always -F arch=b64 -S execve -F path=/bin/systemctl -k debug_test Creating a ...
0 votes
1 answer
65 views

How to get PID of last process run from bash script?

I am trying to get the process ID of the last executed command from within a bash script. Normally I would do: $ nohup ./test > nhout & nohup: redirecting stderr to stdout $ echo $! 3006196 #...
3 votes
2 answers
3k views

Current environmental variables of a process

This question relates to this answer. Is it possible to get the current (not initial) environmental variables of a process by making a child process and checking its initial environmental variables? ...
68 votes
7 answers
100k views

How to read environment variables of a process

Linux's /proc/<pid>/environ does not update a process's environment. As I understand it, the file contains the initial environment of the process. How can I read a process's current environment?
5 votes
5 answers
14k views

How to get the PID of a sub process across to the parent process in a bash shell script?

My shell script is as following: #!/bin/bash ./process1 #It will create a sub process: sub_process1 while [ condition ]; do break done kill -9 process1 and sub_process1 In my script, it will ...
4 votes
1 answer
3k views

What's the difference between a "job" and a "service" to systemctl?

What's the difference between a "job" and a "process" "service" wrt these two systemctl commands? root@linuxbox:~# systemctl list-jobs No jobs running. root@linuxbox:~# ...
0 votes
1 answer
2k views

Launching a program via `xdg-open` from a subshell without blocking

I've noticed that calling xdg-open from a subshell will reliably block until the launched process is closed. I suspect there may be a reason for this, but I'm not sure as to why. For example, ...
0 votes
4 answers
3k views

How to get the pid of a process that is run through ssh

Lets say I have two servers, server1 & server2 In server 1, i do ssh root@server2 "some_command" How do I find the pid of this some_command from server1?
1 vote
2 answers
142 views

System calls involved in stack and heap allocation

In the process address space, there is the stack and the heap. When a function is called, or even when a local variable is declared, it uses the stack; the kernel must assign physical address and ...
0 votes
1 answer
2k views

pidstat %CPU vs htop %CPU of a process

I'm using the pidstat to monitor the cpu usage of a process and it shows 100%. For the same process the htop or top shows 200% for the same process. The system has 16 cores, and the process i am ...

1
2 3 4 5
54