The most used shell commands for Ubuntu

This is a list of Shell commands that can be very useful.

Privileges

sudo command – Run a command as root (administrator)
sudo -s – Open a shell as root
sudo -s -u user – Open a shell as user
sudo -k – Use it if you forget your password
gksudo command – Run command in GUI (GNOME)
kdesudo command – Run command in GUI (KDE)
sudo visudo – Change /etc/sudoers
gksudo nautilus – Launch the file manager (GNOME)
kdesudo konqueror – Launch the file manager (KDE)
passwd – Change password

Display

sudo /etc/init.d/gdm restart – Restart GDM (GNOME)
sudo /etc/init.d/kdm restart – Restart KDM (KDE)
sudo gedit /etc/X11/xorg.conf – Edit the configuration file Xorg
sudo dexconf – Reset xorg.conf
Ctrl+Alt+Bksp – Restart the X server when it crashes
Ctrl+Alt+FN – Switch to tty N
Ctrl+Alt+F7 – Back in the X server

System services

start service – Start a service as user
stop service – Stop a service as user
status service – Check if a service is running
/etc/init.d/service start – Start a service as root
/etc/init.d/service stop – Stop a service as root
/etc/init.d/service status – Check service
/etc/init.d/service restart – Restart a service as root
runlevel – Having the current runlevel

Package Manager

sudo apt-get update – Have updates available
sudo apt-get upgrade – Apply updates
sudo apt-get dist-upgrade – Upgrade to newer version of Ubuntu
sudo apt-get install pkg – Install a package
sudo apt-get purge pkg – Uninstall a package
sudo apt-get autoremove – Remove obsolete packages
sudo apt-get -f install – Forcing the installation of a package
sudo dpkg -i pkg.deb – Install the file package.Deb
sudo gedit /etc/apt/sources.list –  Edit the APT source file

Network

ifconfig – View information about the network configuration of the machine
iwconfig – View information on the wireless network
sudo iwlist scan – Scan for wireless networks
sudo /etc/init.d/networking restart – Restarts the network setup
/etc/network/interfaces – The configuration file interfaces
ifup interface – Enable an interface
ifdown interface – Disable interface

Firewall

ufw enable – Enable Firewall
ufw disable – Disable firewall
ufw default allow – Allow all connections by default
ufw default deny – Block all connections by default
ufw status – View the status of the firewall
ufw allow port – Allow port
ufw deny port – Block port
ufw deny from ip – Block an IP address

System
lsb_release -a – Show version of Ubuntu
uname -r – Show Kernel version
uname -a – Show information about the installed Kernel

If you know other commands please feel free to post a comment or email me so I can complete the list.

Practical Guide to Linux Commands, Editors, and Shell Programming, A (2nd Edition)

Advertisements

One response to “The most used shell commands for Ubuntu

  1. Thanks.

    Here there are more, that can be run from Alt+F2:
    http://ubuntuforums.org/showthread.php?t=1656060

    The ones not present above:

    eog : Eye of GNOME (image viewer)

    file-roller : File Roller (archive manager)

    gcalctool : gcalctool (calculator)

    gconf-editor : Configuration Editor (user preferences and system configuration data editor for the GNOME Desktop and many applications)

    gnome-control-center : GNOME Control Center (control panel)

    gnome-search-tool : Search for Files (file searcher)

    gnome-session-save –logout-dialog : “Log Out of the Session” dialog (to finish or close the session; or to switch or change the user)

    gnome-session-save –shutdown-dialog : “Shut Down the Computer” dialog (to turn the computer off, reboot it, suspend it or hibernate it)

    gnome-terminal : GNOME Terminal (terminal emulator)

    gucharmap or gnome-character-map : GNOME Character Map

    setxkbmap xx : change the keyboard layout (xx can be it or gb or es or fr …)

    totem : Totem (movie player; also plays audios)

    xcalc : xcalc (calculator)

    xset dpms force off : turns the screen off (useful for laptops)

    xterm : xterm (terminal emulator)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s