Hot answers tagged top
Use quick tip using top command in linux/unix top hit Shift + f, then choose the display to order by memory usage by hitting key n then press Enter. You will see active process ordered by memory usage. Or you can just press M after running the top command. On OS X 10.10 the command top -o MEM seems to work. References ...
By default, htop lists each thread of a process separately, while ps doesn't. To turn off the display of threads, press H, or use the "Setup / Display options" menu, "Hide userland threads". This puts the following line in your ~/.htoprc or ~/.config/htop/htoprc (you can alternatively put it there manually): hide_userland_threads=1 (Also ...
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
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.
You can switch the memory unit by pressing e. E will select the memory unit in the top summary bar. Use W to permanently write your configuration to /home/user/.toprc and see also ? for more configuration options.
When in top, typing capital "E" cycles through different memory units (kb, mb, gb etc) in the total memory info: While lower-case "e" does the same individual process lines: From the manpage: 2c. MEMORY Usage This portion consists of two lines which may express values in kibibytes (KiB) through exbibytes (EiB) depending on the scaling ...
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> ...
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
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. Edit: Here is a screenshot with a better color scheme:
The command line option -o (o standing for "Override-sort-field") also works on my Xubuntu machine and according to the Mac man page of top it should work on a Macintosh too. If I want to short by memory usage I usually use top -o %MEM which sorts by the column %MEM. But I can use VIRT, RES or SHR too. On a Macintosh I would probably use mem or vsize. I ...
The other answer is totally wrong. ps and top display CPU time used, not clock time since the process started. One way to check when the process started is use the following command. The PID file creation date is when the process started: ls -ld /proc/pid So for process 2303 it would be: ls -ld /proc/2303
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 ...
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. ...
minutes:seconds.hundredths Searching for “TIME+” or for “seconds” gives the answer, kind of (I wouldn't call the man page clear). This format is inherited from BSD, you also get it with ps u or ps l under Linux.
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
To add to the answers already P (upper case P) makes top order by CPU, Then hit W (again upper case W) to save. M goes back to memory
I'm not entirely sure what you're asking here. Yes, top shows CPU usage as a percentage of a single CPU by default. That's why you can have percentages that are >100. On a system with 4 cores, you can see up to 400% CPU usage. You can change this behavior by pressing I (that's Shift + i and toggles "Irix mode") while top is running. That will cause it to ...
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.
%CPU -- CPU Usage : The percentage of your CPU that is being used by the process. By default, top displays this as a percentage of a single CPU. On multi-core systems, you can have percentages that are greater than 100%. For example, if 3 cores are at 60% use, top will show a CPU use of 180%. See here for more information. You can toggle this ...
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.
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 will produce output like write(1, "foobar"..., 4096 which means that the process is trying to write ...
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) ))
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) Make sure that you leave a space between -d and , as the comma is the argument (the ...
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 also includes this feature.
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 ...
top in the summary reports usage relative to the CPU with all cores added up. On the other hand, when you look in the list of processes, top reports percent referenced to one core (real or HT). Try running a process with 4 threads that can eat up 4 CPU cores, you will find it using 400% CPU. I can't tell why, but that's how top works on all Linux system ...
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 ...
The problem is that top by defaults includes ANSI/VT100 escape codes. In this case, it seems like what you want is only the "raw" text output (i.e. not information that some text should be bold etc etc). Luckily, top has built-in support for this mode of operation, called "batch mode" in their documentation. From the top man page (man top): -n : Number of ...
tops default output is intended for terminal. As such is uses various control codes (invisible when viewed in a terminal). Those include various ways to move around the screen. Style output etc. To get a more friendly output for text files / editing or what ever use the batch mode. top -b ...
Only top voted, non community-wiki answers of a minimum length are eligible