Tag Info

Hot answers tagged

15

On most unix systems, you can use GDB. gdb -batch -ex bt -p 1234 There's also pstack (not a standard utility, you'll probably have to install it manually). It looks like an equivalent of AIX's procstack. But on my Debian wheezy amd64, it seems to always error out. On i386, for a program compiled without debugging symbols, it doesn't print any symbol, not ...


13

My first step would be to run strace on the process, best strace -s 99 -ffp 12345 if your process ID is 12345. This will show you all syscalls the program is doing. How to strace a process tells you more. If you insist on getting a stacktrace, google tells me the equivalent is pstack. But as I do not have it installed I use gdb: tweedleburg:~ # sleep ...


13

Two answers have been given for finding the stack trace of a program (remember to install debugging symbols first!). If you want to find out where a system call got stuck, examine /proc/PID/stack, which lists the kernel stack. Example: $ cat /proc/self/stack [<ffffffff81012b72>] save_stack_trace_tsk+0x22/0x40 [<ffffffff81213abe>] ...


5

The kill() system call and the kill shell command can be used to kill either processes or process groups. Either way, there is no "cascading", ever. When the kill() system call or kill shell command is given a positive integer, this represents a process. The signal is sent to that process and no others. When the kill() system call is given a negative ...


3

This sets off alarm bells for me. Check its process ID, and look at ls -l /proc/process_id/ to see e.g. what the executable is (the exe symlink). You could copy what that link points to for analysis. Also check what it's doing with strace -p process_id. If it's connecting to the internet, you may be able to firewall those outgoing connections while ...


3

"arguments that cannot be located" typically means that the process has no command line arguments because it's not a normal user process but one started directly by the kernel. When you're looking for a process that's doing something wrong, it's usually not one of these kernel processes, so your colleague suggested filtering those out. tty is not "just a ...


2

The problem is that the direct call makes the script name the command name, see cat /proc/$PID/comm That causes pgrep to match. If called via bash then the command name is "bash". Use pgrep --exact zeal instead.


2

The only thing that comes close is iostat from the sysstat suite which also works for regular users or maybe atop -d (fails with a floating pointing exception here). Nearly same question was already asked here: http://serverfault.com/questions/260818/in-absense-of-iotop-which-command-is-most-appropriate-for-get-i-o-bounded-proces iotop doesn't work for ...


2

scp itself has no such feature. With GNU parallel you can use the sem command (from semaphore) to arbitrarily limit concurrent processes: sem --id scp -j 50 scp ... For all processes started with the same --id, this applies a limit of 50 concurrent instances. An attempt to start a 51st process will wait (indefinitely) until one of the other processes ...


2

The command ulmit -u shows the maximum number of processes that you can start. However, do not start that many processes in the background: your machine would spend time switching between processes and wouldn't get around to getting actual work done. For CPU-bound tasks, run as many tasks as there are cores on your machine, or one more. This is if there's ...


1

To get the parent PID of the process, portably (POSIXly), you can use: ps -p "$PID" -o ppid= or (on Linux): grep '^PPid' "/proc/$PID/status" |cut -f2 for more ways, see http://superuser.com/questions/150117/how-to-get-parent-pid-of-a-given-process-in-gnu-linux-from-command-line


1

Don't use sudo in init scripts. They're run as root to start with. If you were to use sudo in /etc/rc.local (which as per #1 there is no point in doing), you need to provide a $PATH or the path to the executable because there is no $PATH set when this is run at boot by init. So, e.g., if you wanted to run ls, first find out where it is: whereis ls ...


1

Frankly it sounds a bit silly. grep -Ev "[[]" excludes processes having the opening square bracket in their command. While these are often kernel processes, even a regular user space program can have that character present on the command line. grep -Ev "tty" is the same in pale blue. It excludes processes having the string "tty" somewhere on their line ...


1

Manipulating the name in the process list is a common practice. E.g. I have in my process listing the following: root 9847 0.0 0.0 42216 1560 ? Ss Aug13 8:27 /usr/sbin/dovecot -c /etc/dovecot/d root 20186 0.0 0.0 78880 2672 ? S Aug13 2:44 \_ dovecot-auth dovecot 13371 0.0 0.0 39440 2208 ? S Oct09 ...


1

Looking through the /proc documentation, I see that huge page usage is recorded in /proc/PID/smaps with the ht flag in VmFlags and (other than file-backed pages) with the AnonHugePages field. grep '^VmFlags:.* ht' /proc/[0-9]*/smaps


1

The mistake was to presume those numbers were PIDS, when in fact they are TIDS (thread IDs). See Linux function gettid(2). Reading up on clone(2) gives a lot of extra (and interesting) details.


1

Other good answers have been provided, but I made a script some time ago, which I named ptop, that serves me well: #!/bin/sh top -p $(pidof "$@" |sed s#\ #,#g) 2>/dev/null if [ $? -ne 0 ]; then echo No processes with the specified name\(s\) were found fi This supports multiple process names to be specified (like ptop bash chrome) and provide a nicer ...


1

You can simply use grep: NAME grep, egrep, fgrep, rgrep - print lines matching a pattern SYNOPSIS grep [OPTIONS] PATTERN [FILE...] grep [OPTIONS] [-e PATTERN | -f FILE] [FILE...] DESCRIPTION grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is given as file ...


1

From my other answer here, you could do something like, top -p `pgrep "java"`


1

this will identify the top memory consuming processes ps -A --sort --rss -o pid ,pmem:40,cmd:500 | head -n 6 | tr -s" " ";"



Only top voted, non community-wiki answers of a minimum length are eligible