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

learn more… | top users | synonyms (1)

4
votes
4answers
183 views

Single instance of script, but only with same arguments

I have this beautiful little code here that will exit from a script if there's another instance of it running: single_instance(){ if pidof -x "${0##*/}" -o %PPID >/dev/null; then exit ...
4
votes
4answers
11k views

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

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 ...
4
votes
4answers
206 views

“Virtual” shell, ie. jailing an user inside a process after the (SSH) login

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 ...
4
votes
3answers
572 views

What is a subshell (in the context of the documentation of make)?

I'm reading a book about the make command and there is a paragraph: If any of the prerequisites has an associated rule, make attempts to update those first. Next, the target file is considered. ...
4
votes
4answers
405 views

why new pid is smaller than the old ones?

Is there any chance the new process's pid is smaller than the existed ones ? I have a daemon process which will restart when be killed, I recorded the pids, and found that the pid first came smaller, ...
4
votes
3answers
11k views

How to find which Process is causing High CPU usage

Is there any way to find out from terminal which process is causing high CPU Usage ? It would also be useful to order processes in descending order of cpu Usage
4
votes
2answers
7k 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 ...
4
votes
3answers
1k views

Possible to get SMS/text message notification when process ends/is killed?

There are scripts that will send an e-mail when a server process is finished. However, I do not want to check my email every so often just to see whether a job has finished. Therefore I'd like to get ...
4
votes
3answers
4k views

Terminating a bash shell script running in the background

I often use bash shell scripts to run simple commands for many different files. For example, suppose that I have the following bash shell script, called script.sh, that runs the program/command foo ...
4
votes
2answers
200 views

Is grandchild process also child process?

In Unix/Linux terminology, do child processes of a process include grandchild processes of the process?
4
votes
3answers
105 views

how to determine how many times pid_max wrapped?

Is it even possible to know that? may be some kind of tests are required to be performed in order to find that information? My system, just after I login, seem to have already wrapped the max_pid, so ...
4
votes
2answers
177 views

LD_PRELOAD or similar to prevent network access

I'd like to start a program disconnected from the network (because immediately upon starting it tries to download huge amounts of data, which can be prevented by changing settings as soon as it ...
4
votes
1answer
98 views

Is it the process that cleans itself on termination or the kernel?

Recently I found this in a powerpoint presentation: When a program is compiled and linked, the linker inserts some extra code in the program. It is this code that calls the main function about the ...
4
votes
3answers
94 views

A way for saving running state of a program

I have a program that will perform a lengthy calculation which may take several days to be completed. Is there a way to save the program's running state; so I will be able to turn off the computer ...
4
votes
2answers
1k views

Do sleeping processes get the same CPU time?

Some processes spend most of their "lives" in a sleep status. Daemons, servers and general listener come to mind. I was wondering if they get the same CPU time in that state? On something like my ...
4
votes
1answer
2k 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 ...
4
votes
2answers
4k 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 ...
4
votes
3answers
260 views

Why is there a type for process ids (pid_t), but not for file descriptors (fd)?

I see that pid_t is typedef'd in unistd.h, and file descriptors are defined to be int in fcntl.h. But since they are used in similar ways, wouldn't it make sense to have a typedef for file ...
4
votes
1answer
1k 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 ...
4
votes
3answers
748 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 ...
4
votes
2answers
114 views

How to kill a process started as daemon?

I start a process using foo &. It outputs something like: [1] 16915 This is the process id, I guess. How can I store this number into a variable named MY_PROCESS_ID (for example)? Then I ...
4
votes
2answers
405 views

Why pidof and pgrep are behaving differently?

I have a init script in /etc/init.d/myservice for initialize a service like this: ... start() { ... daemon /usr/sbin/myservice ... } stop() { ... pgrep myservice pidof myservice ps -ef ...
4
votes
3answers
258 views

Locate a directory from a relative path in ps output

When I executed the command to give the pid of my processes running, it gave me like this - user@machineA:/$ ps -eo pid,command | grep exhibitor | grep java | grep -v grep 1615 java -jar ...
4
votes
1answer
498 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 ...
4
votes
1answer
3k views

Stuck process: is it a bad sign?

Sometimes a few process are in a stuck state. For example: PID COMMAND %CPU TIME #TH #WQ #POR #MREGS RPRVT RSHRD RSIZE VPRVT VSIZE PGRP PPID STATE 99357 plugin-container ...
4
votes
1answer
77 views

Launch background processes in one group and later kill them all

The other day I tried writing a script that would kill a PID and all its children processes, but after spending some time on it, I decided it wasn't trustworthy, because sometimes some of the children ...
4
votes
2answers
1k views

How to identify a process which has no pid?

I have a process which listen to 2 ports : 45136/tcp and 37208/udp (actually I assume it is the same process). But netstat doesn't return any pid : netstat -antlp | grep 45136 tcp 0 0 ...
4
votes
4answers
5k 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 ...
4
votes
2answers
975 views

What is “automatic stack expansion”?

getrlimit(2) has the following definition in the man pages: RLIMIT_AS The maximum size of the process's virtual memory (address space) in bytes. This limit affects calls to brk(2), mmap(2) and ...
4
votes
2answers
621 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 ...
4
votes
2answers
1k views

Linux running slow with 0 swap left

Our Linux server is responding very slowly. top doesn't show any excessive CPU usage. I noticed that even though there's about 5GB of free memory, the system is using all of swap with no free swap ...
4
votes
1answer
2k views

Why is my C++ program killed by OS

I've compiled small C++ application for school project on my virtual ubuntu 11.04. However when I attempt to run it over some larger data set after ~20 sec the program is killed by OS. Killed ...
4
votes
1answer
1k views

Disable random memory address generation in my programs

I'm reading "The art of exploitation" and would like to try some experiments, including reading from and writing to various memory address. I've created some simple programs and trying to overwrite ...
4
votes
2answers
465 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 ...
4
votes
1answer
51 views

What causes /proc/<pid>/* resources to become owned by root, despite the procs being launched as a normal user?

I've noticed that some procs, such as bash, have their entire /proc/<pid>/ resources readable by the user who created that proc. However other procs, such as chrome or gnome-keyring-daemon, have ...
4
votes
3answers
914 views

What is a process GID and what purpose does it serve?

Reading mod_wsgi's documentation I found you can choose which group to run the worker processes as. I can understand group ownership of files and how only a user who belongs to that group can achieve ...
4
votes
1answer
44 views

Suspend and edit previous single line commands

Say I want to modify the latter of some concatenated command line options, is it possible without killing the first command? Specifically I have compile and run scripts executed thusly: > compile ...
4
votes
1answer
3k views

Elegantly get list of children processes

I would like to get a list of all the processes whose parent is $pid. This is the simplest way I've come up with: pstree -p $pid | tr "\n" " " |sed "s/[^0-9]/ /g" |sed "s/\s\s*/ /g" Is there any ...
4
votes
2answers
4k 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 ...
4
votes
1answer
1k views

Difference between poll_s and ep_poll WCHAN in ps output

When I issue ps -elf|grep python for example on my system, I see these: 1 S 1000 6020 6008 0 80 0 - 9914 poll_s Jul12 ? 00:00:01 python manage.py run_gunicorn -t 3600 -w 8 -b ...
4
votes
4answers
831 views

How does forking affect a process's memory layout?

Please see the following figure showing the memory layout of a process: : When someone forks(), and a new task_struct is assigned, what happens to the addresses of the process? In more or less other ...
4
votes
1answer
640 views

controlling a process from a different session

So, I ssh into my remote computer and launch a process... time passes... my ssh session breaks. I log in again, and of course, I don't have access to the original process now. I can see it still if I ...
4
votes
2answers
229 views

start process so that it can't spawn new ones

Is it possible to start new process so that it couldn't spawn new ones (untrusted code)? Also how do I start a process so it couldn't make any input/output to files and in general any devices?
4
votes
2answers
855 views

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 ...
4
votes
1answer
48 views

Maximum memory usable by a 32 bit RHEL 6 system

I have installed a 32 bit RHEL OS on a 64 bit system. From the wiki page of PAE: The Linux kernel includes full PAE mode support starting with version 2.3.23, with Linus Torvalds mentioning ...
4
votes
1answer
4k views

Linux : See CPU usage by a process for the last second

vmstat 1 Above will print virtual memory statistics each seconds. It will also show the CPU utilization for last second. I have a web server at hand which runs httpd and MySQL. I need to find how ...
4
votes
1answer
145 views

How to monitor all executions of an executable over a time period

I know how to monitor a process. Commands like top and so forth can monitor the CPU time and memory usage for a given process instance. But say I expect a given executable to be run several times in ...
4
votes
1answer
1k 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 ...
4
votes
1answer
409 views

Is it possible to send a keyboard event to a background script that's expecting user interaction? (Using 'read')

Ex: $read & [1] 15139 [1]+ Stopped $jobs -l [1]+ 15139 Stopped (tty input) read
4
votes
3answers
5k 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 ...