A process is an instance of a computer program that is being executed.
3
votes
2answers
848 views
How is /proc/self implemented in Linux?
I was tinkering around with the /proc filesystem in Linux, and I came across /proc/self, which is a symbolic link to the process directory of the current process. I would like to know how it is ...
3
votes
2answers
201 views
Force change of a user's cwd as root
I'm looking to change a user's process such that I can set it's cwd.
Related, and secondary to the question, I have a filesystem I want to unmount but a user is sitting on it with a bash process. I ...
3
votes
3answers
152 views
Detecting whether a server is loaded
I have to start some performance test on a Rhel 6 box, but before starting the test, i have to make sure there are no other java processes running.
The manual way of doing it would be to use "ps -ef ...
3
votes
2answers
933 views
How to check how long a process ran after it finished?
Currently I'm using the following to check how long a process is actually running:
ps -eo uid,pid,etime | egrep '^ *MY_ID' | egrep 'PID_OF_PROCESS'
And that outputs the following:
MY_ID ...
3
votes
2answers
270 views
How do I execute a script later?
I need to compile gcc45 on my computer and that's a lengthy and resource-intensive process for my computer, so I'd prefer to have it do it while I sleep (at night).
What's the closest thing to:
$ ...
3
votes
5answers
2k views
Drop Process Privileges
I have a process that gets started by a damon running as root, now I want to "downgrade" this process's privileges to those of your average user. Is this possible? If yes how?
PS: Running unix on a ...
3
votes
2answers
97 views
Is grandchild process also child process?
In Unix/Linux terminology, do child processes of a process include grandchild processes of the process?
3
votes
3answers
141 views
“Virtual” shell, ie. jailing an user inside a process
The title might not say much about the issue at hand so let me get straight to the point.
Let's assume I have a casual user who can log in to the system via SSH into a bash shell. I also have a PHP ...
3
votes
2answers
368 views
How to reload a background process?
I have a python script which I would like to run in the background. So I do this:
$ nohup python script.py &
If I am frequently making changes to the script, I need to terminate the process ...
3
votes
2answers
444 views
Using top to see processes run by a user on behalf of sudo
If I run top -u username I will see all the processes by a particular user. Is there a way to also see all the processes that the user called via sudo?
3
votes
2answers
253 views
What is meant by stack in connection to a process?
From the book Advanced programming in the Unix environment I read the following line regarding threads in Unix like systems
All the threads within a process share the same address space, file
...
3
votes
2answers
99 views
What does the term static variable mean in unix speak?
From the section 2.7 of the book - The Linux programing Interface named Process memory layout :
Data is defined as the
static variables used by the program.
What is the significance of the word ...
3
votes
1answer
954 views
mmap() failed: Cannot allocate memory - how do I find out who's complaining?
mmap() failed is popping up in my .xsession-errors in bursts. But there's no indication about what application it is failing with. How do I look into this after it has happened? I usually discover the ...
3
votes
1answer
558 views
Will process ids be recycled? What if you reach the maximal id?
Process IDs are strictly increasing, but if your system runs long enough and there is a lot of processes terminating and starting, you could at some point reach the limit of the underlying integral ...
3
votes
1answer
313 views
Which processes should I NOT strace?
I've created a little function for strace'ing a set of the current user's processes by name:
function pstrace() {
local pattern="$1";
shift;
prefixDashP $(pgrep -U $(whoami) $pattern) | ...
3
votes
5answers
658 views
how to ensure a program is always running but without root access?
Currently I need to have a program running all the time, but when the server is rebooted I need to manually run the program. And sometimes I'm not available when that happens.
I can't use a normal ...
3
votes
3answers
32 views
How can you change the process name of Wing IDE from python to something more descriptive
In my process list under Ubuntu (using top/System Monitor) one of the largest memory hogs (200+Mb) was python. I searched a bit for one of my programs to be the cause until I realised this was my ...
3
votes
3answers
160 views
What after exec() in ls command. Is the parent process printing the output to the console or the child?
I have a simple doubt on execution of the command ls. As per my understanding from the research I have done on the internet, I understood the below points.
When we type ls command shell interprets ...
3
votes
2answers
146 views
Please explain the -f option in pgrep
man pgrep says the following about -f option:
-f The pattern is normally only matched against the process name.
When -f is set, the full command line is used.
What does it ...
3
votes
1answer
144 views
What is the difference between exiting a process via Ctrl+C vs issuing a kill -9 command?
I know I can kill any process with kill -9 command . But sometimes i see that even if I have terminated a program with CTRL+C , the process doesn't get killed . So I want to know the difference ...
3
votes
1answer
530 views
Find processes using a network interface
I'm trying to find a way to safely shutdown a network interface, i.e. without disturbing any processes. For this I need to find out what processes are currently using that interface. Tools like ss, ...
3
votes
1answer
158 views
bash: disable new process PID message
It may look like this: [2] 2847. I guess the first digit is just an enumeration of processes created from the shell. The second is the PID. Anyway, I never care about that information so it is just ...
3
votes
2answers
1k views
How to see complete list of processes in top
When I do 'top', I learn that there are many processes running out of which many are in sleep state. I need to see complete snapshot of all processes at that point. the 'top' is able to show listing ...
3
votes
2answers
397 views
How is FireFox running on a virtual machine that has no display?
I am using a Red Hat virtual machine, accessible only remotely. However when I use the top command, one of the displayed processes taking up the most memory is firefox, located at ...
3
votes
2answers
120 views
How to detect out-bound port from PID
I have several applications that run on random ports. How would I take the pid or the file location and find which port it is running on?
Example of desired output:
www-data/apache = 80
...
3
votes
1answer
102 views
Is there a way to tell which file (script, specifically) executed a command?
I'm running Slackware 13.37, and I was wondering if there was a way to tell which script executed a command. I tracked the process and its arguments, but I would like to know where the command ...
3
votes
2answers
820 views
How to list only non-<defunct> processes?
Is there a combination of command-line options for ps or pgrep or some other relatively direct way to determine if a particular process name is actually running (available for normal use)..
By ...
3
votes
3answers
323 views
What process is sending TCP SYNs on Solaris 10?
Some process on my Solaris 10 machine is sending TCP SYNs to a remote machine. The remote machine never responds, so the connection is not established. How do I find out what process is initiating ...
3
votes
1answer
885 views
Understanding ps elapsed time format for long running processes
I'm using a ps command as part of an exercise to identify processes running longer than a given threshold.
I'm using the following template to get the elapsed time for a know process command:
ps -eo ...
3
votes
1answer
181 views
wait does not wait
If i have a file called myprogram containing
sleep 200
date
Run this in the background:
$ sh myprogram &
i want to know when myprogram has completed by using wait command
$ cat >notify
...
3
votes
3answers
2k views
Fork bomb on a Mac?
I just learned about a fork bomb, an interesting type of a denial of service attack. Wikipedia (and a few other places) suggest using :(){ :|:& };: on UNIX machines to fork the process an infine ...
3
votes
3answers
224 views
What's the best way to determine the working directory for UNIX process using 'ps'?
I am running a Ruby command line script (rufus.sh)which ultimately calls Thread.new, which spawns a UNIX process as shown below. I run this script for more than 1 directory as the output of the ps ...
3
votes
2answers
597 views
Questions on Linux kernel internals
I was reading "Linux device drivers, 3rd edition" and faced a few kernel items I don't quite understand. Hope gurus on this forum will help me out.
Does the Linux kernel internally operate with ...
3
votes
2answers
332 views
retrieving names of all open pdf files (in evince or otherwise)
I constantly have many PDF files open. These are usually downloaded using chrome and immediately opened using evince.
I sometimes want to persist the state of all my open PDF files, so I could ...
3
votes
2answers
2k views
Discovering the number of running and blocked processes in Mac OS X
In Linux, I could discover the number of running and blocked processes running
grep "procs_running" /proc/stat
and
grep "procs_blocked" /proc/stat
Is there a way to do it in Mac OS X? ...
3
votes
3answers
34 views
Print process ID (PID) of a Matlab instance
To run my Matlab scripts, I've created a shell script to which I give two parameters - the path to the matlab file ($1) and to the log file ($2):
nohup time matlab -some_parameters -r "run $1;exit" ...
3
votes
2answers
264 views
Bash script wait for processes and get return code
I am trying to create a script which will start many background command.
For each background command I need to get the return code.
I have been trying the following script :
#!/bin/bash
set -x
...
3
votes
3answers
260 views
How to track the number of processes and forks per user?
I need to figure out how many forks are done and how many concurrent processes are run by each user over time. It does not look like this information is tracked by my distribution.
I know how to ...
3
votes
1answer
70 views
Can I add to my groups in the current (shell) process?
If I add myself to a group, it applies only to newly launched processes. Actually it's more restricted than that; it seems to apply only to new logins. I'm not sure what the exact mechanism is, but ...
3
votes
1answer
128 views
How to know which commands are executed when I do something in GUI
This is for academic purpose. I want to know which commands are executed when we do something in GUI, for example creating a folder. I want to show that both the mkdir shell command and create folder ...
3
votes
3answers
181 views
Prevent users from killing processes that they own
I have started some processes (window based) from user's .bashrc file. I want to prevent users from killing those processes. Is there a way to transfer the process to superuser so that a normal user ...
3
votes
2answers
275 views
Why is `sudo pkill -HUP -f “nginx: master process”` returning code 129 and no output
I'm trying to trigger a reload of the Nginx master process by using pkill and sudo.
The server reloads fine, but I was just curious if anyone knows why the command sudo pkill -HUP -f "nginx: master ...
3
votes
1answer
252 views
Rationale for making user space text segment start at 0x8048000
I read somewhere that (at least since Linux v. 2.6) all user-space code is placed at load address 0x8048000 in the virtual memory address space.
My own observations confirm this. I have done a
cat ...
3
votes
2answers
459 views
How can I kill the top CPU/IO process quickly?
I find that sometimes my Linux will stop responding, so I need to switch to another terminal with CtrlAltF2, and type a command to kill the top CPU usage process or top IO usage process, so that the ...
3
votes
2answers
1k views
How to know reason of a process going to sleep state and wake it up?
When I do 'top' , I see my perl script process in 'S' state. Is there a way to know, what is making this perl process go in sleep state and ways to wake it up? Any way to debug to give more insights ...
3
votes
1answer
276 views
Redirecting/grep'ing an existing shell's STDOUT
I run a lot of long running processes (simulations) that print progress to STDOUT. I occasionally forget to redirect to STDOUT to a file I can grep, and it's usually too far along to restart.
...
3
votes
1answer
435 views
Solution to get data from memory of a process
If I'm using Firefox and filling out a big form (with lots of text to write), and for some reason I accidentally press F5 and all my text in the forms is lost, I can use e.g. HxD on Windows to ...
3
votes
1answer
858 views
I don't want other users see my processes in ps aux. I have root. It's Debian. How to use grsec?
I installed 'linux-patch-grsecurity2' and it has some sort of interface.
~$ sudo gradm2
gradm 2.1.14
grsecurity administration program
Usage: gradm [option] ...
Examples:
gradm -P
...
3
votes
1answer
215 views
Linux system calls
I want to obtain information about memory used by different users and different processes which users are running and statistics about those processes like memory consumption ,execution speed etc ...
3
votes
3answers
160 views
Running multiple nohup commands in background
Got two commands cmd1 and cmd2. Of the two, cmd2 takes longer to finish. Need to run cmd2 and then cmd1.
Tried to run them in following way:
bash$ (nohup ./cmd2>result2 &) && nohup ...
