Hot answers tagged top
hi is the time spent processing hardware interrupts. Hardware interrupts are generated by hardware devices (network cards, keyboard controller, external timer, hardware senors, ...) when they need to signal something to the CPU (data has arrived for example). Since these can happen very frequently, and since they essentially block the current CPU while they ...
On Linux, top actually supports focusing on a single process, although it naturally doesn't have a history graph: top -p PID This is also available on Mac OS X with a different syntax: top -pid PID
By default, htop lists each thread of a process separately, while ps doesn't. Turn off the display of threads: in the “Setup / Display options” menu, “Hide userlands threads”. This puts the following line in your ~/.htoprc (you can alternatively put it there manually): hide_userland_threads=1 (Also hide_kernel_threads=1, but it's 1 by default.)
From inside top you can try the following: Press SHIFT+f Press the Letter corresponding to %MEM Press ENTER You might also try: $ ps -eo pmem,pcpu,vsize,pid,cmd | sort -k 1 -nr | head -5 This will give the top 5 processes by memory usage.
man ps in NOTES section. CPU usage is currently expressed as the percentage of time spent running during the entire lifetime of a process. This is not ideal, and it does not conform to the standards that ps otherwise conforms to. CPU usage is unlikely to add up to exactly 100%. And, guess you know, but you can also do: top -p <PID> ...
htop is a great replacement to top. It has... Colors! Simple keyboard shortcuts! Scroll the list using the arrow keys! Kill a process without leaving and without taking note of the PID! Mark multiple processes and kill them all! Among all of the features, the manpage says you can press F to follow a process. Really, you should try htop. I never started top ...
You can also use htop. It's much cooler than top. If you are using Debian or one of its derivatives, then you can install it using sudo apt-get install htop.
You are in a multi-core/multi-CPU environment and "top" is working in Irix mode. That means that your process (vlc) is performing a computation that keeps 1.2 CPUs/cores busy. That could mean 100%+20%, 60%+60%, etc. Press 'I' to switch to Solaris mode. You get the same value divided by the number of cores/CPUs.
An alternative to sed for simple things like this is tr: top -p $(pidof program | tr ' ' ',') tr can also easily handle a variable number of spaces: tr -s ' ' ',' Additionally, if you have it available, pgrep can work well here: top -p $(pgrep -d, program)
F1 or h will show you the legend. It looks like in this color scheme: CPU: blue is for low priority threads green is normal priority threads black is for io-wait see below for more. Memory: green is memory in use blue is buffer orange is cache
top is a full screen interactive console application. It requires a tty to run. Try ssh -t or ssh -tt to force pseudo-tty allocation.
There is a command-line option which does that: -M : Detect memory units Show memory units (k/M/G) and display floating point values in the memory summary. So it is sufficient to run top like that: top -M
top -M doesn't work on any of the Fedora, Debian or Ubuntu distros to my knowledge. I just tried it and it's not in the procps-ng package that provides top. There are many implementations of top so one needs to pay special attention to which they use. In general it's best to use free with switching to get the amount of memory free on Linux. procps vs. ...
I use this script (from this thread on the Arch boards): #!/bin/bash read cpu a b c previdle rest < /proc/stat prevtotal=$((a+b+c+previdle)) sleep 0.5 read cpu a b c idle rest < /proc/stat total=$((a+b+c+idle)) CPU=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
The top command reads the data from proc, which is provided directly from the kernel. In order to hide processes, you'd have to use code inside the kernel to do the masking. Aside from using a security framework like SELinux and grsecurity (mentioned in the other answers), rootkit-style code is your only remaining option. I say "style" because a "rootkit" ...
You're question is well defined, but you're not giving a lot of information about your environment, how you're currently monitoring or what graphing tools you're using. However, given that SNMP is used pretty much universally for that I'll assume that you're using it and have at least some familiarity with it. Although (as near as I can tell) the CPU Steal ...
If you have it installed I like htop once launching it you can press f6, down arrow (to MEM%), enter to sort by memory.
A process in S state is usually in a blocking system call, such as reading or writing to a file or the network, or waiting for another called program to finish. You can use strace -p pid to find out which system call is currently happening, it'll produce output like write(1, "foobar"..., 4096 which means that the process is trying to write 4096 bytes ...
There are plenty of monitoring CLI commands with Solaris. They are easy to find as almost all share the stat suffix: vmstat mpstat iostat netstat lockstat nfsstat prstat busstat cpustat kstat sar swap kstat (or the equivalent netstat -k) provides all of the kernel statistics in raw form. About the IOWAIT statistic, note that the fact it was often poorly ...
It doesn't seem to be possible in an easy way. From top's perspective, any command a user runs using sudo would appear to be running as root because it really is running as root. One way you could try, is to track it down to the terminal where the user is logged in, then see processes running as root on that terminal. For example, $ w user USER TTY ...
Linux kernel since 3.3 contains support for hiding processes to other users. It is done by hidepid= and gid= mount options for /proc as described in the corresponding commit and Documentation/filesystems/proc.txt. Debian Wheezy, which will become the next Debian stable release, also includes this feature.
Most top implementations have a way to turn the display of threads on or off. htop: in the “Setup / Display options” menu, “Hide userlands threads”. Linux top: press H to toggle the showing of threads (but they're off by default). OpenBSD top: press T to toggle the showing of threads (but they're off by default). Note that memory mappings, and hence ...
sed replaces your with ,: top -p $(pidof program | sed 's/ /, /g')
From the top manpage: -n : Number of iterations limit as: -n number Specifies the maximum number of iterations, or frames, top should produce before ending. So just run: top -n 1
No problem in that. Linux is borrowing the RAM for caching. This is desirable (RAM is faster than disk) and absolutely normal behaviour. From that link: Why does top and free say all my ram is used if it isn't? This is just a misunderstanding of terms. Both you and Linux agree that memory taken by applications is "used", while memory that isn't ...
top is mostly used interactively (try reading man page or pressing "h" while top is running) and ps is designed for non-interactive use (scripts, extracting some information with shell pipelines etc.)
Your mysqld is configured to use 1,8 GB of RAM - propably due to your settings in /etc/my.cnf. This is much more than is physically available. Now in some point of time (you might install sysstat and ask sar about that) you seem to get memory requests (might be PHP, too) that use more RAM than is available - so the systems starts to swap. At the end of ...
ps can give you that information if you ask for the psr column (or use the -F flag which includes it). Ex: $ ps -F $$ UID PID PPID C SZ RSS PSR STIME TTY STAT TIME CMD me 6415 6413 0 5210 2624 2 18:52 pts/0 SN 0:00 -su Or: $ ps -o pid,psr,comm -p $$ PID PSR COMMAND 6415 0 bash My shell was running on CPU 2 ...
I believe this is a question of timing. top checks CPU state every N seconds. At the moment the check is run, top will have to be active since it is actively checking the state of the system. A nice way of seing this in action is to decrease the update time of top and watch your processes move! As suggested in man top: o The user interface, through ...
I found this tool that matches my need exactly, called logtop. According to the documentation: logtop displays real-time count of strings received in standard input. Examples Is useful for some cases, like getting the IP flooding your server: $ tail -f /var/log/apache2/access.log | cut -d' ' -f1 | logtop Or the top buzzing article of your blog: $ ...
Only top voted, non community-wiki answers of a minimum length are eligible