1

I'm looking at the output of w:

ehryk@ArchHP ~> sudo w                                                                                                               
 14:12:37 up  4:08,  4 users,  load average: 2.18, 1.93, 1.55                                                                        
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT                                                                                 
ehryk    tty1      10:04    4:08m 57.70s  0.00s xinit /home/ehryk/.xinitrc -- /etc/X11/xinit/xserverrc :0 vt1 -auth /tmp/serverauth. 
ehryk    pts/0     10:04    4:08m  0.04s  0.04s /usr/bin/fish                                                                        
ehryk    pts/1     10:04    4:06m  0.00s  0.00s bash                                                                                 
ehryk    pts/2     13:04   24:53   6.24s  0.00s x86_64-unknown-linux-gnu-gcc -o conftest -O2 -I/home/ehryk/Projects/openwrt/staging_ 
ehryk@ArchHP ~> 

However, the command exits. How do I keep running w in the same 'area' of the command line window, similar to the way top works, and control the refresh rate?

Ehryk
  • 1,822
  • 3
  • 20
  • 22
  • 3
    `watch w`. `man watch` for the refresh rate... – jasonwryan Jan 08 '15 at 20:20
  • Thank you. 1) could you write that up in an answer, and 2) is there an option to not start at the top of the screen? – Ehryk Jan 08 '15 at 20:34
  • Sort of like `wget`, I suppose, where it updates the same line(s) without clearing the screen first. – Ehryk Jan 08 '15 at 20:36
  • 1
    Probably `watch` is not used for the same purpose in FreeBSD as suggested [here](http://askubuntu.com/a/431363). You could follow the suggestion over there in that answer if you need portability in future. – Ramesh Jan 08 '15 at 20:48

1 Answers1

2

You can use watch command to constantly running w (every some time defined in -n parameter). For example:

watch -n 1 w

will run w every second.

Output of w will be kept on top of the terminal window.

pbm
  • 24,747
  • 6
  • 36
  • 51