whoami
hostname
- get username and hostnameid
- get information which group ids current user belongs togroups $USER
- check groupslast
- check users that logged in recently
lscpu
- show cpu informationfree -h
- display memory usageuname -p
oruname -m
- show system architectureuname -r
- see a running kernellsb_release -a
orcat /etc/*release
- see running distribution
iostat
- show current io (disk usage, cpu usage)mpstat
- show current cpu usage (detailed)
Simple script to log system resources:
#!/bin/bash
set -eux
LOGFILE="/var/log/system_stats.log"
echo "Logging CPU, Memory, Swap, Disk, and Network usage to $LOGFILE"
while true; do
echo "----- $(date) -----" >> $LOGFILE
echo "CPU Usage:" >> $LOGFILE
mpstat -P ALL 1 1 >> $LOGFILE
echo "Disk Usage:" >> $LOGFILE
iostat >> $LOGFILE
echo "Memory and Swap Usage:" >> $LOGFILE
free -m >> $LOGFILE
echo "Network Usage:" >> $LOGFILE
ifstat 1 1 >> $LOGFILE
sleep 10
done