How to permanently set refresh interval for top command?
Solution 1
Personal configurations such as this may be saved to your ~/.toprc
file by hitting SHIFT+W in the interactive top
session.
From man top
(or online):
6b. 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.
Solution 2
Why not just launch top with a preset interval like this top -d 5
. Which will make top start preconfigured to update every 5 seconds.
Related videos on Youtube
![Underoos](https://lh3.googleusercontent.com/-Td_75cnFBl0/AAAAAAAAAAI/AAAAAAAAAC8/COZ0iGRh-Ts/photo.jpg?sz=256)
Underoos
Updated on September 18, 2022Comments
-
Underoos almost 2 years
I'm just looking at the tutorials for
top
command and came to know that the refresh interval can be overridden by hittingS
on the keyboard while thetop
command is displaying information.The default value for refresh interval was
3
seconds. I was able to override the refresh interval to different value.However, when I quit and come back and try the
top
command again, it is refreshing the processes information again for every3
seconds and not with the interval that I've set earlier.I was looking for a way to configure this interval permanently. I've looked at some articles where in they mentioned to use the
toprc
file in/etc
directory for this configuration.But it doesn't seem like I have any such file in
/etc
or my home directory.How do I set the refresh interval for
top
command?I'm using
Ubuntu 18.04
. -
Underoos over 4 yearsIf I do that, I had to do
top -d 5
everytime instead oftop
. -
endrias over 4 yearsThen save this as a one liner script named
/bin/pot
and you'll never have to save a personal config for each user, albeit at the modest price of having to typepot
every time you wanttop
-
Déjà vu over 4 yearsWhat about an alias
alias top="top -d 5"
? -
endrias over 4 years
alias top="top -d 5"
works but only for the current shell, unless you make it permanent bysudo echo "alias top="top -d 5"" >> ~/.bashrc