New answers tagged

1

You could install the package nethogs if it is available for your system. This command is similar to top and will show you your running processes and how much network traffic they are generating. Use this command sequence: nethogs nethogs my_interface(s) If nethogs is not available you might try the iptraf command which will sort connections by usage. ...


2

You can use something like this while sleep 1;do ps -eo start_time,pid,euser,args:100 --sort start_time;done This will list all processes running in order of start time although it will be latest at the bottom. The loop update every second, if you need a finer time period change the sleep as needed. If you want the latest at the top you can pipe into tac ...


0

Start with the application logs (if available). Then check the system logs (ie. /var/adm/messages, /var/cron/log if launched by cron, /var/svc/log/ in case of service etc.). If the process is maintained by SMF, check svcs -xv and appropriate logs. Also have a look if coreadm is configured to create core dumps for crashing processes. Note that core dumps are ...


-1

As simple as: $ kill -9 $(pgrep -f vmstat)


2

You didn't have a nohup process. Your search found an instance of grep which was searching for nohup, but by the time you got your next prompt, the grep process had already terminated. You're actually looking for a python instance. ps aux | grep python | grep manage.py # This will show you the process you're looking for kill $(ps aux | grep python | grep ...


1

The POSIX standard defines that $$ always is the pid of the main shell. If you run a process in the background, $! returns the pid of the last background process.


1

Not sure if this is too old to answer (first time answering a question), but the AIX equivalent you're looking for is ps -ef | awk '$NF~/[o]ra_pmon/ {print $2,$NF}' e.g. [oracle@aixbox ]$ ps -ef | awk '$NF~/[o]ra_pmon/ {print $2,$NF}' 8061108 ora_pmon_XXX 38993950 ora_pmon_YYY


0

If you have the util-linux package installed, you set hard and soft limits for a particular process using the prlimit command. To set the soft and hard limits for maximum number of open files to 10 and 20, respectively, for a command command, run: prlimit -n10:20 command Arguments for the command can be provided as well: prlimit -n10:20 command arg1 ...


1

Unfortunately, your question is not specific on what you're wanting. Here's a few examples, though. Hopefully they are what you're wondering about. Note: There are seriously billions of ways of achieving these things. Find the one that's right for you with experimentation. Top 5 CPU Hogs So you want the top 5 cpu hogs. Got it. You can do this. ps -Ao ...


0

Above definitions are very technical but maybe the op wanted a more day to day clarification. I think that a job is a scheduled process. When we deal with processes in general there is not necessarily the notion of schedule, but when we use the word "job" we always mean that it is scheduled, or repetitive like a loop, it's like a worker.


0

The previous answer is correct, but I would encourage you to go further and learn how to use strace. strace attaches to a process and then prints each system call the process is making to your terminal. This can be very educational and maybe a bit overwhelming. Each system call has a man page and you'll see every little action the program is doing in ...


3

Look at the man page for fork(2). A child process inherits the parent's file descriptors, including standard input and standard output. For a single command, the shell simply lets the child process inherit those descriptors and write its output to the terminal. For a pipeline, it forks each process, sets up a pipe between the output of one and the input of ...


1

This is probably not a complete solution, but it may help. See this htop example: To change the refresh interval of the htop output, use the -d command line option. “htop -d x”. Where x is referred in thenths of seconds. htop -d 10 So you could change the rate to 30, after which the refresh rate goes to 3 seconds. This is no guarantee, but it makes ...


2

I don't use htop, but judging from the man page it looks like you could use the space bar to "tag" a process, then the F9/k kill function will apply only to that process. Space Tag or untag a process. Commands that can operate on multiple processes, like "kill", will then apply over the list of tagged processes, instead of the currently highlighted ...


1

See kernel/sched/loadavg.c which has a long and excellent comment at the start explaining the derivation of load average from a exponentially decaying average of the number of runnable threads (the "run queue") plus the number of uninterruptable threads (waiting on I/O or waiting on a lock). Here's the essence of the comment, but it is worthwhile reading in ...


0

pgrep "name-of-application" | xargs kill -9 Was simple enough to remember and worked nicely for me.


1

We see that those two processes are related (the parent of PID 1236 is 1234) and that PID 1234 is the session leader (lower-case 's' in the STAT field). See http://unix.stackexchange.com/a/18178/117549 where we see that pipelines in shell scripts create a new process group. Thus, I believe that Upstart is executing your script correctly, and you are seeing ...


18

The question asks about two types of programs: programs which interact with the user in the shell, and programs which do not interact with the user in the shell. In the first case, programs which interact with the user in the shell are designed to run to completion before returning control to the shell. Nothing special is done. The second case is more ...


-2

This is best command I found to get the process id using port number: sudo netstat -lpn |grep :9997


1

The purpose of the operating systems is to handle this for you, Windows, Mac OS, Linux, the two fundamental purposes of all of them are scheduling and hardware interface. This question has nothing to do with Linux or Unix.


17

It depends on whether your application is a computational one (like this) or interactive. For a computational application, full utilisation of the CPU(s) is your goal, as that means that the result is ready sooner. Anything that causes that utilisation to go down is an opportunity for improvement (e.g. waiting on I/O). For an interactive application, any ...


2

Of course it's good. The CPU's sole raison d'être is to be used by applications. The entire hw+os combo exists for this single purpose. Why wouldn't it be good to consume as much cpu as there is in the system?


1

You could try killall pleeease to kill all instances of pleeease; it will tell you when it couldn't find any. ps -A | grep pleeease to filter the output of ps for the process you're looking for, then use kill with the process ID. pgrep pleeease as a variation of 2. to just get the PID(s) instead of the complete ps line (which may make it hard to ...


1

iotop is your friend (assuming your server runs Linux).


0

In BSD check the watch command. Otherwise please check the following example using strace (where 7214 is your PID): strace -e trace=write -s1000 -fp 7214 2>&1 \ | grep --line-buffered -o '".\+[^"]"' \ | grep --line-buffered -o '[^"]\+[^"]' \ | while read -r line; do printf "%b" $line; done For further explanation or more examples, check: How to ...


0

In BSD, you can use watch which snoops a given tty, e.g. watch /dev/pts/0 In Linux, it won't be possible if the process wasn't run under multiplexer before such as screen or tmux. See also: Reptyr: Attach a Running Process to a New Terminal It seems the only way is to debug the process (e.g. strace, dtrace/dtruss, gdb, lldb, etc.). Since you've used ...


0

Below link fixes your issue. echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" >> /etc/apt/sources.list sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 sudo apt-get update sudo apt-get install ...


3

Most Unix variants allocate process IDs sequentially: 1, 2, 3, 4, ... When the largest possible PID value is reached, they start again at 1, skipping PIDs that already exist. This is not an obligation. For example, OpenBSD assigns PIDs randomly, not sequentially; this is also an option on FreeBSD. The goal is improved security, though the benefits are ...


1

If you just want to run commands as soon as the previous one has completed, you can separate them with ; like this: command1 ; command2 Or, if you only want to run the second command if the first command returns true, like this: command1 && command2


2

Often, having given a long-running command, when you want to prepare the next command to run afterwards, you use shell job control to achieve it. Eg, you have given command1, not with an &, and then you want to give command2, so you suspend the current running command by typing control-z. You now have the shell prompt again, so you type fg; command2 ...


1

/proc/[pid] disappears when the program exits. See this: https://superuser.com/questions/365576/lifetime-of-the-symlinks-from-the-file-descriptors-in-proc-pid-fd edit: The wait man page says The wait() function shall suspend execution of the calling thread until status information for one of the terminated child processes of the calling ...


4

Processes are managed by the kernel. The kernel doesn't care how the programmer allocates variables. All it knows is that certain blocks of memory belong to the process. The C runtime matches C memory management features to kernel features: automatic variables go into a memory block called “stack” and dynamic storage (malloc and friends) go into a memory ...


3

You can use lsof (available for just about any Unix variant, but often not part of the default installation) to list all the files a process is using. “Using” includes open file descriptors as well as closely related concepts such as which executable the process is running. The executable has txt in the FD column, for obscure historical reasons. $ lsof ...


1

Whenever a process exits either gracefully or through SIGINT,SIGTERM,SIGKILL etc, the exit system call is invoked. Part of the exit call's job is to reclaim any resources that were being used by the process. Essentially, whenever the OS sees an exit status (success or not) being returned, two things happen: SIGCHLD is sent to the parent process to let the ...


-2

If certain bits of memory need to be zeroed (e.g. a password or private key), then you'll need a signal handler that calls memset(3) or whatever prior to the process showing itself out the door. See also libsodium, which has some handy and portable routines relevant to this: sodium_mlock, sodium_memzero, etc. Always zeroing all memory after every process ...


2

From the ps man page, the status field will tell you if a thread is on the run queue (use the 'L' option to see threads) -- D uninterruptible sleep (usually IO) R running or runnable (on run queue) S interruptible sleep (waiting for an event to complete) T stopped by job control signal t stopped by debugger during the tracing W ...


4

There's no general answer. Under modern Linux, you can look in /proc/$PID where $PID is the numerical process ID. You can get it out of the top output. ls -l /proc/$PID/exe will show you where exe is a symbolic link to. That's the full path to the a.out executable.


-1

You should have stopped your process with kill -STOP, not kill -TSTP. The former is designed to support suspending/resuming a process just with signals so kill -CONT would have produced the expected result while the latter (SIGTSTP) is more designed to support job control. The interactive shell that launched your stopped script is able to revive it through ...


-1

kill -CONT is something that is not understood by the shell. For this reason, it just continues the process without any effect to the shell. This results in something similar to a background process. If you like to continue a process, better call fg or if this is not the "current job", use jobs to list all current jobs and then call e.g. fg %3 if the job ...


0

People here have mentioned using the --partial flag works, it needs to be mentioned however that it only resumes when the --append or --append-verify flag is used when resuming. --partial creates a hidden file of the file that has not finished the sync process, the file is kept when you interrupt syncing. It continues to complete the file when you use ...


2

If the load stay low and the process count stay pretty constant, that just means short lived processes are spawn during the ten second period. Twenty seven processes per second might not be a problem at all so there might be nothing to fix. On the other hand, that might be a bogus daemon or something trying to launch a process that quickly fails and doing ...


1

If nothing else, your shell script creates a process for each command such as ps, cut, tail, etc., in that loop. You could only observe the systems with an application (one process...) which scanned the /proc filesystem looking for relevant changes. Further reading: How to continuously monitor process creation in Linux? Monitor all newly spawned ...


2

If you run ps ax without the grep, you'll see the column headers: PID TT STAT TIME COMMAND ?? is in the TT column -- that's the controlling terminal for the process. The ?? indicates that the process isn't associated with a terminal. The U in the STAT column indicates that the process is in the uninterruptible sleep state. That explains why you ...


2

Try ps --ppid ${pid} --no-headers | wc --lines.


0

Find Zombies using #ps auxwww | grep -w Z | grep defunct | grep -v grep Check the parent process ids of these zombies and Kill it.


0

The root cause of the problem was the faulty hardware. ttyS1 port of the system was receiving thousands of interrupts per second, which in turn resulted in high CPU usage by kworker. This caused the creation of heap of <defucnt> processes and were not cleaned by init. This could be bug of init as suggested by @jilliagre. Disabling getty on ttyS1 ...


2

ps -eo ppid= | grep -Fwc $pid If your grep does not support -w: ps -eo ppid= | tr -d '[:blank:]' | grep -Fxc $pid or ps -eo ppid= | awk '$1==ppid {++i} END {print i+0}' ppid=$pid or (clobbering the positional parameters) set $(ps -eo ppid=); echo $# Note that this is not atomic, so the count may be wrong if some processes die and others get ...


1

If pgrep available, filter by parent pid[-P]: sproc_pids=( $(pgrep -P $pid) ) && echo ${#sproc_pids[@]}



Top 50 recent answers are included