Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Mar 28 '13 at 14:36

This question came from our site for professional and enthusiast programmers.

    
What do you execute that you see high usage by less? –  Shahbaz Mar 28 '13 at 13:18
    
@Shahbaz: Then, won't the question be appropriate for Unix.SE –  Aditya Mar 28 '13 at 13:19
1  
@Aditya, it most certainly is. –  Shahbaz Mar 28 '13 at 13:22
    
can you supply more details? are you viewing large files? Does the file have long lines? What options (-S? -R?) Is there a .lessrc? 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?) What is the terminal emulator? Are you working remotely (ssh/screen/tmux?) etc. etc. –  sehe Mar 28 '13 at 13:24
    
suse 9 is horribly out of date. UPGRADE you will have better everything. openSuSE is at 12.3. I had suse 9 and it was awful compared to 12. –  cybernard Apr 8 '13 at 3:09
add comment

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

share|improve this answer
add comment

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?)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.