I know that once you run top if you press 1 you can see the load on each processor (let's forget the multi-threading issue) and if you press s you can configure the refresh time.

How can I put this options in the launch command?

I am trying to log the output with

$ top -b -p $(pidof myprocess) > top.log

But I want to see my four processors and a higher refresh rate.

2 Answers 2


Linux top has support for a configuration file (~/.toprc) which it can also write from running configuration:

  • start top
  • enable the options you want (colors, update frequency, sort order, statistics displayed, ...)
  • hit W (that is, shift+w)

Next time you run top, it will read your configuration and change its defaults to what you asked.


The top manpage shows the Startup Defaults that are configurable from the commandline. The Cpu display is not one of them.

   Startup Defaults
   The following startup defaults assume no configuration file, thus no user customizations.  Even so, items shown with an asterisk (’*’) could be overridden  through  the  command-

          ’A’ - Alt display      Off (full-screen)
        * ’d’ - Delay time       3.0 seconds
          ’I’ - Irix mode        On  (no, ’solaris’ smp)
        * ’p’ - PID monitoring   Off
        * ’s’ - Secure mode      Off (unsecured)
          ’B’ - Bold disable     Off
          ’l’ - Load Avg/Uptime  On  (thus program name)
          ’t’ - Task/Cpu states  On  (1+1 lines, see ’1’)
          ’m’ - Mem/Swap usage   On  (2 lines worth)
          ’1’ - Single Cpu       On  (thus 1 line if smp)
          ’b’ - Bold hilite      On  (not ’reverse’)
        * ’c’ - Command line     Off (name, not cmdline)
        * ’H’ - Threads          Off (show all threads)
        * ’i’ - Idle tasks       On  (show all tasks)
          ’R’ - Reverse sort     On  (pids high-to-low)
        * ’S’ - Cumulative time  Off (no, dead children)
          ’x’ - Column hilite    Off (no, sort field)
          ’y’ - Row hilite       On  (yes, running tasks)
          ’z’ - color/mono       Off (no, colors)

This can be accomplished using a top configuration file. From the top manpage:

   5b. PERSONAL Configuration File
   This file is written as ’$HOME/.your-name-4-top’ + ’rc’.  Use the ’W’ interactive command to create it or update it.

Steps to create Configuration file that starts top showing all processors:

1. Start `top`.
2. Toggle display of all CPUs (press 1).
3. Press `d` or `s` and set new delay (default=3.0 seconds).  (This can be set on the `commandline`.  See the `Startup Defaults` above.
4. Press Shift+W.  Notice message 'Wrote configuration to '/home/youruser/.toprc'.
5. Quit `top`.
6. Start `top`.  Until you rewrite the `top` configuration file with a different option (Step #3), it will start with all CPUs showing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .