(separator = $IFS)
Shows a less detailed output, made only of the process tree and their pids.
if you have problem threads problem in tomcat
use Linux ;) Show Sample Output
Grabs the cmdline used to execute the process, and the environment that the process is being run under. This is much different than the 'env' command, which only lists the environment for the shell. This is very useful (to me at least) to debug various processes on my server. For example, this lets me see the environment that my apache, mysqld, bind, and other server processes have.
Here's a function I use:
aa_ps_all () { ( cd /proc && command ps -A -opid= | xargs -I'{}' sh -c 'test $PPID -ne {}&&test -r {}/cmdline&&echo -e "\n[{}]"&&tr -s "\000" " "<{}/cmdline&&echo&&tr -s "\000\033" "\nE"<{}/environ|sort&&cat {}/limits' ); }
From my .bash_profile at http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html
Show Sample Output
Same as previous but compatible with BSD/IPSO
This version also attaches to new processes forked by the parent apache process. That way you can trace all current and *future* apache processes.
grep по ps aux
If you have ever been trying to look for a list of processes based on their elapsed time you don't need to look any further. This command lets you find the list of processes ordered in a reversed order (oldest at the top) that have been running for over an hour on your system. Any system processes are filtered out, leaving only user initiated ones in. I find it extremely useful for debugging and performance analysis. Show Sample Output
This checks the system load every second and if it's over a certain threshold (.8 in this example), it spits out the date, system loads and top 4 processes sorted by CPU. Additionally, the \a in the first echo creates an audible bell.
No need for sort Show Sample Output
If you really _must_ use a loop, this is better than parsing the output of 'ps': PID=$! ;while kill -0 $PID &>/dev/null; do sleep 1; done kill -0 $PID returns 0 if the process still exists; otherwise 1
Using -f treats the process name as a pattern so you don't have to include the full path in the command. Thus 'pkill -f firefox' works, even with iceweasel.
Using ps options rather than filtering. Show Sample Output
Gets the current system user running a process with the specified pid Show Sample Output
Tested in bash on AIX & Linux, used for WAS versions 6.0 & up. Sorts by node name. Useful when you have vertically-stacked instances of WAS/Portal. Cuts out all the classpath/optional parameter clutter that makes a simple "ps -ef | grep java" so difficult to sort through. Show Sample Output
Kill all process that concide whit PATTERN Show Sample Output
Using the output of 'ps' to determine CPU usage is misleading, as the CPU column in 'ps' shows CPU usage per process over the entire lifetime of the process. In order to get *current* CPU usage (without scraping a top screen) you need to pull some numbers from /proc/stat. Here, we take two readings, once second apart, determine how much IDLE time was spent across all CPUs, divide by the number of CPUs, and then subtract from 100 to get non-idle time. Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: