Blog by Yan

Useful Linux Commands

April 04, 2019

Check CPU on ubuntu
  • grep -c ^processor /proc/cpuinfo
  • nproc
  • lscpu or lscpu | grep 'CPU(s):' | head -1 | awk '{print $2}'
  • getconf _NPROCESSORS_ONLN
  • dmidecode -t processor | egrep 'Designation|Count'
Manage Root User
  • sudo passwd root
  • sudo passwd -dl root
Disable swap
  • sudo swapoff -a && sudo rm -rf /path_to_swap_file Find swapfile name with cat /etc/fstab

Yan Lin Aung

Written by Yan Lin Aung who lives and works in Yangon building useful things. You should follow him on Twitter