Useful Linux Commands

​Here is a list of the most common commands that you will probably find useful. The commands and descriptions are all separated by “=”, so don’t include the = sign in the commands

The most important one which will make your life MUCH easier is:

sudo apt-get install <enter a programme name here>

This finds the most up to date repository for you and installs the latest version of the software. No going to different websites, downloading and then trying to figure out how to install from an extracted bzip etc…

Now… on to the rest of the goodies.

  • cat /proc/cpuinfo # CPU info
  • cd # change directory
  • convert -resize 640×480 -colors 14 wallpaper.png splashimage.xpm
    && gzip splashimage.xpm # change picture into grub splash.
  • cp # copy
  • df -h # disk space usage
  • fglrxinfo # graphics driver info
  • free -m # memoryusage
  • glxgears # check 3d graphics
  • glxinfo # opengl info
  • ifconfig # network configuration info
  • killall gnome-panel # kill,refresh panel
  • locate # find target
  • lsb_release -a # OS info
  • lshw # list hardware
  • ls # list contents
  • lspci # list pci devices
  • man command | col -b > file.txt # save man uotput to file
  • man -f # man title of target
  • man intro # user commands help
  • man -k # man file for target
  • man man # man manual
  • mkdir # make directory
  • mv # move
  • netstat -l –tcp –udp (and then) watch -n 1 netstat -an –tcp –udp # watch port activities
  • rmdir # remove directory
  • rm # remove
  • rm -r # remove all
  • sudo apt-cache # debian apt library
  • sudo apt-cache search (search subject) # Search debian repo for apps
  • sudo apt-get dist-upgrade # upgrade all
  • sudo apt-get update # update sources.list
  • sudo cp /<filename.backup>/<filename> # reset to backup file
  • sudo deborphan | xargs sudo apt-get -y remove –purge # remove orphans
  • sudo dmidecode | more # Detailed hardware info
  • sudo dpkg -l | cut -d ” ” -f 3 # list installed packages
  • sudo dpkg-reconfigure menu sudo dpkg-reconfigure menu-xdg (reboot) # fix Debian menu
  • sudo dpkg-reconfigure xserver-xorg # Reconfigure periphials, graphics
  • sudo fdisk -l # View Hard drive partitions
  • sudo hdparm -l /dev/sda # hard drive settings
  • sudo hdparm -tT /dev/sda # hard drive speed
  • sudo ln -s ~/.themes /root/.themes sudo ln -s ~/.icons /root/.icons sudo ln -s ~/.fonts /root/.fonts # make root look like user
  • top # system,processes,resources,cpu,ram,etc. info
  • uname -a # kernel version
  • update-menu # update gnome menu
  • whereis program-name # location of program/man page
  • which <program name> # location of program

Cheatsheet may. be downloaded HERE. All credit for it goes to http://fosswire.com

Thanks to Michael Lindner for reading and offering insight. A few corrections made, thanks to his assistance!

Another update from a different Michael:

alias claer=”clear” “There are lots of variations on that for other common misspellings, but I think I’ve used ‘claer’ instead of ‘clear’ far more than any other mistake. Also, if you’re going back and forth between Windows and Linux a lot, it might not be a bad idea to make ‘cls’ an alias of ‘clear’, and maybe do the same for ‘ls’/’dir’.”