Skip to content

System Status Checking One-Liners#

Get all users with UID >= 1000#

awk -F: '($3>=1000 && $3<=60000 && $1 !~ /^#/ && $1 != "") {print $1}' /etc/passwd

Get the CPU model#

awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo

Get the Operating System Name and Version#

grep '^PRETTY_NAME=' /etc/*-release | cut -d'=' -f2 | tr -d '"'
echo $(grep '^NAME=' /etc/*-release | cut -d'=' -f2 | tr -d '"') $(grep '^VERSION=' /etc/*-release | cut -d'=' -f2 | tr -d '"')

Get the Kernel Version#

uname -r

Get the Number of CPU cores#

grep -c ^processor /proc/cpuinfo

Get the Total Memory in Gigabytes#

free -g | awk '/^Mem:/ {print $2}'

Get the Total Space of all Disks#

df -h -x tmpfs -x squashfs -x devtmpfs -x vfat -x efivarfs --total | grep 'total' | awk '{print $2}'

Get the Total Free Space of all Disks#

df -h -x tmpfs -x squashfs -x devtmpfs -x vfat -x efivarfs --total | grep 'total' | awk '{print $4}'