Using top with custom configuration files

I'm starting to use top alongside htop as a system monitor,I see it has many options amongst which the possibility of saving the actual layout to a .toprc file by pressing W : I was wondering if it was somehow possible to save multiple configuration files in order to use top with different layouts without having to rearrange it every time?

Re: Using top with custom configuration files

From the man page

while top is referred to throughout this document, you are free to name the program anything you wish. That new name, possibly an alias, will then be reflected on top’s display and used when reading and writing a configuration file.

Re: Using top with custom configuration files

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. Here is the general layout: global # line 1: the program name/alias notation " # line 2: id,altscr,irixps,delay,curwin per ea # line a: winname,fieldscur window # line b: winflags,sortindx,maxtasks " # line c: summclr,msgsclr,headclr,taskclr
If the $HOME variable is not present, top will try to write the personal configuration file to the current directory, subject to permissions. http://linux.die.net/man/1/top

Re: Using top with custom configuration files

You can link top with some other name. For example,

Code:

ln -s /usr/bin/top topsy
./topsy

Now, top is started with the name topsy, which is shown in top left corner. When you give the W command, the settings are saved in $HOME/.topsyrc. When topsy is run next time, it reads settings from this file.