Linux--Ubuntu reference terminal commands
and Cheat sheets
Enter these commands in TERMINAL==>
To open TERMINAL:
Press Ctrl+Alt+T simultaneously.
ALSO PREFIX ALL THE BELOW COMMANDS WITH::sudo
Priviledges Commands:
- sudo command – run command as root
- sudo -s – open a root shell
- sudo -s -u user – open a shell as user
- sudo -k – forget sudo passwords
- gksudo command – visual sudo dialog (GNOME)
- kdesudo command – visual sudo dialog (KDE)
- sudo visudo – edit /etc/sudoers
- gksudo nautilus – root file manager (GNOME)
- kdesudo konqueror – root file manager (KDE)
- passwd – change your password
System Services:
- start service – start job service (Upstart)
- stop service – stop job service (Upstart)
- status service – check if service is running (Upstart)
- /etc/init.d/service start – start service (SysV)
- /etc/init.d/service stop – stop service (SysV)
- /etc/init.d/service status – check service (SysV)
- /etc/init.d/service restart – restart service (SysV)
- runlevel – get current runlevel
- Recovery - Type the phrase “REISUB” while holding down Alt and SysRq (PrintScrn) with about 1 second between each letter. Your system will reboot.
- lsb_release -a – get Ubuntu version
- uname -r – get kernel version
- uname -a – get all kernel information
Package Management:
- apt-get update – refresh available updates
- apt-get upgrade – upgrade all packages
- apt-get dist-upgrade – upgrade with package
- replacements; upgrade Ubuntu version
- apt-get install pkg – install pkg
- apt-get purge pkg – uninstall pkg
- apt-get autoremove – remove obsolete packages
- apt-get -f install – try to fix broken packages
- dpkg --configure -a – try to fix broken packages
- dpkg -i pkg.deb – install file pkg.deb
- (file) /etc/apt/sources.list – APT repository list
Special Packages:
- Ubuntu-desktop – standard Ubuntu environment
- Ubuntu-desktop – KDE desktop
- Ubuntu-desktop – XFCE desktop
- Ubuntu-minimal – core Ubuntu utilities
- Ubuntu-standard – standard Ubuntu utilities
- Ubuntu-restricted-extras – non-free, but useful
- Ubuntu-restricted-extras – KDE of the above
- Ubuntu-restricted-extras – XFCE of the above
- build-essential – packages used to compile
- programs
- Linux-image-generic – latest generic kernel
- image
- Linux-headers-generic – latest build headers
Network Commands:
- ifconfig – show network information
- iwconfig – show wireless information
- sudo iwlist scan – scan for wireless networks
- sudo /etc/init.d/networking restart – reset network for manual configurations
- (file) /etc/network/interfaces – manual configuration
- ifup interface – bring interface online
- ifdown interface – disable interface
Firewall Commands:
- ufw enable – turn on the firewall
- ufw disable – turn off the firewall
- ufw default allow – allow all connections by default
- ufw default deny – drop all connections by default
- ufw status – current status and rules
- ufw allow port – allow traffic on port
- ufw deny port – block port
- ufw deny from ip – block ip adress
Display Commands:
- sudo /etc/init.d/gdm restart – restart X and return to login (GNOME)
- sudo /etc/init.d/kdm restart – restart X and return to login (KDE)
- (file) /etc/X11/xorg.conf – display configuration
- sudo dexconf – reset xorg.conf configuration
- Ctrl+Alt+Bksp – restart X display if frozen
- Ctrl+Alt+FN – switch to tty N
- Ctrl+Alt+F7 – switch back to X display
Application Commands:
- nautilus – file manager (GNOME)
- dolphin – file manager (KDE)
- konqueror – web browser (KDE)
- kate – text editor (KDE)
- gedit – text editor (GNOME)
NOTE:In order to open other application just write the NAME of the Application and hit Enter.
Now get your Linux cheat sheet pdf on these links: