Table of Contents
Uptime Duration
$ uptime
14:35:45 up 1 day, 18:41, 1 user, load average: 0.04, 0.03, 0.05
Get the full history
Getting a handle on who
$ w
14:34:59 up 1 day, 18:41, 1 user, load average: 0.08, 0.03, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
joel pts/0 123.456.78.9 14:34 3.00s 0.01s 0.00s w
- USER – The user’s name.
- TTY – The terminal type.
- FROM – The IP or hostname from which the user accessed your VPS.
- LOGIN@ – The time at which the user logged in.
- IDLE – Their idle time.
- JCPU – This refers to the time used by all the processes related to this terminal instance.
- PCPU – This refers to the time used by only the current process that’s displayed in the WHAT field.
- WHAT – The user’s current process from the command line.
You can also use the last | head # to see a list of all the previous logins.
Running vps
Never use disk space
Famous last words, eh? People often underestimate their disk space needs, and running out of space can be disastrous.
To visualize the available space on every disk and partition, you can use the df -h command. If you are running out of space, there could be several reasons for it. For instance, you may have uploaded too many GIFs on your WordPress blog or have a massive apt cache. However, using this command will help you identify the issue and get started with troubleshooting.
To take it a step further, you can also check for available inodes by using the df -hi variation.
Killing is never good
$ sudo grep kill /var/log/messages
Looking down from on high
$ top
top - 16:08:53 up 1 day, 20:15, 2 users, load average: 0.00, 0.01, 0.05
Tasks: 25 total, 1 running, 24 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 8388608 total, 8220476 free, 44288 used, 123844 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 3024374 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 1 -19 42960 3316 2296 S 0.0 0.0 0:02.26 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd/210ddf
3 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khelper
56 root 1 -19 223060 73908 73616 S 0.0 0.9 0:17.83 systemd-journal