Hot answers tagged

70

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 ...


23

Here is the laziest way (or homebrew way) First install Homebrew if you haven't Second brew install htop or brew install htop-osx Third, done [Updated htop to htop-osx, thanks @clwen] [Updated: htop is actually an alias to htop-osx, so both will work]


23

From htop source code, file UptimeMeter.c, you can see: char daysbuf[15]; if (days > 100) { sprintf(daysbuf, "%d days(!), ", days); } else if (days > 1) { sprintf(daysbuf, "%d days, ", days); } else if (days == 1) { sprintf(daysbuf, "1 day, "); } else { daysbuf[0] = '\0'; } I think ! here is just a mark that server has been up for more ...


18

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


11

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) ))


11

htop shows the exclamation mark when the server has been up since 100 or more days. While once system administrators had pride in showing long uptimes, nowadays the system has to be rebooted to be kept up to date with new kernels and some security fixes. For such reason, a long uptime is probably not a good thing and I tend to interpret the exclamation mark ...


9

htop has a setup screen, accessed via F2, that allows you to customize the top part of the display, including adding or removing a "Load average" field and setting it's style (text, bar, etc.). These seem to be auto saved in $HOME/.config/htop/htoprc, which warns: # Beware! This file is rewritten by htop when settings are changed in the interface. # The ...


7

From man htop: INTERACTIVE COMMANDS 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 one. U Untag all processes (remove all tags added with the Space key). F9, k "Kill" process: sends a ...


7

A complete re-write of my previous post. Got a bit curious and checked out further. In short: the reason for the difference is that openSUSE uses a patched version of top and free that adds some extra values to `cached'. A) Standard version top, free, htop, ...: Usage is calculated by reading data from /proc/meminfo: E.g.: #free: Row Column | ...


7

Something like this? (while kill -0 $pid; do sleep 1; done) && echo "finished" Replace $pid with the process id and echo "finished" with whatever you want to do when the process exited. For example: (while kill -0 $pid; do sleep 1; done) && mail ...


6

The fan Mine does this too, running Fedora 14. Try getting a compressed can of air and blowing out the vents on the back and side of the case. Also periodically you'll wan to remove the keyboard and blow compressed air directly on the fan's blades. They get caked with dust and start to effect its effectiveness by weighting it down. The best thing about ...


6

Check out sar, as well. Implementations can vary widely from nix to nix, but it should give you basic system stats, at given snapshots. I'm not sure how accurate the values are at the point at which the command is first initialized, but you might play around to see how it compares to top, iostat, etc. The output is column-based, like top, so you should be ...


5

htop is unaware it is running on a kernel level virtualized environment (Dreamhost VPS is using VServer technology). It is then showing the CPU usage for all the OS instances sharing the same kernel, not just yours. Have a look to vtop output which sho ws all processes sharing the CPUs, not just the ones in your container. If vtop is not installed, and ...


5

You're asking the wrong question: you've got an overheating system which should be solved by cooling the system. Playing games with process load is going to yield an unsatisfying hack. And since you've got hardware running at its thermal limits, you can fairly expect that problem to worsen. If you cannot remedy the hardware, see if you can slow the whole ...


4

This is not possible, as of htop 0.8.3. Source: the source code. The best you can do is sort processes by user, root's processes will be conveniently lumped together.


4

You have greatly misunderstood what that post means by "fake swap". There are some programs that for various reasons insist on a system having swap space enabled (cough Oracle cough). If it isn't, the program—or at least its installer—complains. Of course with the aforementioned database there are ways to tell it to continue anyway, but people often don't ...


4

If I understand that script correctly, it doesn't actually enable swap in any way. Instead it just pretends that the system has swap by replacing /proc/meminfo so that free and htop believe that the system has swap, but the kernel is in no way able to use this fake swap. If you look at the script, you may notice that no swap file or partition is mentioned ...


4

The easiest way is to use the setup in the program and then save and exit the program with F10, not with CTRL-C. Next time you can close the program the way you like.


4

I am wondering why top and htop don't display -100 for higest priority real time processes ? That's because SCHED_RR and SCHED_FIFO have fixed static priorities from 1-99: Source For realtime priorities, the order is reversed: 99 is indeed the highest one, contrary to the ususal "lower is higher". Per your comment I misunderstood your question, ...


4

As far as I know, the only way to show the full command line is to scroll right with the arrow keys or to use a terminal with a small font.


3

If you run a fake job such as sleep 120 and then watch it in htop you'll notice that its state is S aka "SLEEP" and the processes TIME remains at 0:00.00 for the duration. That's because that process is consuming 0 CPU time, which is the intent of the TIME column. It tracks the amount of CPU time a given process has used. ...


3

System load isn't really directly related to how much work the system is doing. You could have a load average of only 2.0 and be doing a lot more work than a load average of 8.0. All the load tells you is the average number of programs eligible to be run. If they are all waiting on your overloaded disk, your CPU won't be doing much of anything, but your ...


3

This is more of a long comment but you should have a look at thinkwiki.org it is the resource for Linux on ThinkPads. As for the temperature, I had similar problems with my t4500 and sorted it out by playing with The CPU governor which controls CPU frequency scaling. Your choices are: Performance keeps the CPU at the highest possible frequency Powersave ...


3

Don't you have colors? Green Blue Orange Mem[|||||||||||||||||||||||||||||||||||||||||||| 1978/7847MB] Where green should be 1978 MiB. Else you can enter F2 -> Under setup stay on "Meters" -> Right arrow to get to "Left column". -> Down 1 to get to "Memory Bar". Then press enter to view various ways of display. When it comes to ...


3

This sort of inconsistency is usually indicative of high processor usage by kernel threads, which aren't displayed in htop by default. To display them, in htop go to Setup, then Display options, and then uncheck Hide kernel threads. This should allow you to see the thread(s) that are responsible. You can also disable this behaviour by setting ...


3

Have you looked at collectl? It's handy because you can tailor the output to your needs. See: http://collectl.sourceforge.net/


3

Have a look at cgroups, it should provide exactly what you need - CPU reservations (and more). I'd suggest reading controlling priority of applications using cgroups. That said, put the important yet often idle processes into group with allocated 95% of CPU and your other applications into another one with allocated 5% - you'll get (almost) all of the power ...


3

This sure looks like malware that isn't hiding itself very well. Well-written malware would infect the kernel and arrange to hide itself completely from the task list. This one clumsily disguises itself as the innocuous uptime, but does a bad job of it, and uptime is suspicious anyway because it wouldn't be running for such a long time. If you confirm that ...


3

I figured out that a large portion of the memory usage was, in fact, attributable to inactive memory used by exited processes. The most accurate way to determine how much memory is available post-January 2014 is to look at MemAvailable in /proc/meminfo. You can also see the amount of inactive memory is this file.


3

It is because htop is counting buffers and cached memory as free memory, because it can actually can be seen this way. There is no "cost" in having some cached data in memory, so the kernel keep stuff there just in case it needs afterwards. For instance, suppose you have watched a video of about 500mb, after you close the video, the kernel may decide to ...



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