I'm using suse 9 and redhat 5. Sometimes I see that "less" takes a lot of cpu. It happens more on suse 9 though happened on redhat 5 too. I have to admit that the frequency of such event is very low - somewhat once in several months. I would appreciate if you can give me some hints why it could happen. Thanks in advance
2 Answers
It's far more likely that a command you are piping to less
is taking up a lot of CPU. It's also possible that you are having it page a very large file (or data stream) and it's just doing some work on an otherwise busy system, and it floats up on your top
.
Don't spend time staring at a process monitor and worrying about it, especially for something that happens on an interval of months. :-)
Actually, since you ask for "hints on why this might happen", my comment qualifies as an answer :)
- large files could cause high CPU usage (especially with, e.g. line numbering and UNICODE perhaps with a lot of ANSI escapes that cancel each other out?)
- Does the file have long lines? Long lines can cause problematic performance with wrapping
- What options (-S? -R?) ('munging' ANSI sequences or control characters may take time while not being visible)
- Is there a .lessrc? (It may contain hidden options responsible for the high CPU)
- What is the terminal emulator? Are you working remotely (ssh/screen/tmux?) etc. etc.
Various things
- Are you showing line numbers?
- Which version of coreutils is this?
- What does
type less
say? - What are the locale settings (try
LANG=C less
?)
less
?type less
say? What are the locale settings (tryLANG=C less
?) What is the terminal emulator? Are you working remotely (ssh/screen/tmux?) etc. etc.