Ubuntu

 
 
Ubuntu is a popular Linux distribution (Debian-based), with Unity as its default desktop environment. Development of Ubuntu is led by Canonical Ltd a company based on the Isle of Man and owned by South African entrepreneur Mark Shuttleworth.

The official name of an Ubuntu release is "Ubuntu X.YY" with X representing the year (minus 2000) and YY representing the month of eventual release within in that year.

Every six months a new desktop and server version is released. With the Long Term Support (LTS) version you get three years support on the desktop, and five years on the server. Upgrades to new versions of Ubuntu are free of charge.

More information about Ubuntu can be found at: http://www.ubuntu.com

The latest Ubuntu dekstop version can be downloaded from: http://www.ubuntu.com/download/desktop/







Useful Ubuntu commands



Information
none

Procedure
Open a terminal and enter the commands as shown below.

command Description
apt-cache Query the Ubuntu's Advanced Packaging Tool (APT) cache.
  • List all the available packages:
    apt-cache pkgnames

  • Find the packagename and package description:
    apt-cache search packagename

    Example:
    apt-cache search nmap

  • Show all packagenames starting with nnn:
    apt-cache pkgnames nnn

    Example:
    apt-cache pkgnames emacs

  • Show more information about a package:
    apt-cache show nnn

    Example:
    apt-cache show emacs

  • Show dependencies for a particular package:
    apt-cache showpkg nnn

    Example:
    apt-cache showpkg emacs

  • Show overall statistics about the cache:
    apt-cache stats
apt-get APT package handling utility.
The apt-get command works with Ubuntu's Advanced Packaging Tool (APT) for package management
  • Install a package:
    apt-get install packagename

    Example:
    apt-get install nmap

  • Remove an installed package without removing their configuration files:
    apt-get remove packagename

    Example:
    apt-get remove nmap

  • Completely remove an installed package including their configuration files:
    apt-get purge packagename

    Example:
    apt-get purge nmap

  • Update the package index.
    The APT package index is essentially a database of available packages from the repositories defined in the /etc/apt/sources.list file and in the /etc/apt/sources.list.d directory.
    The update command fetch the packages from their locations and update the packages to newer version.

    apt-get update

  • Upgrade packages.
    Over time, updated versions of packages currently installed on your computer may become available from the package repositories (for example security updates). To upgrade your system, first update your package index as outlined above, and then type:

    apt-get upgrade
cat Concatenate files and print on the standard output
  • Example generate random numbers:
    cat /dev/urandom
dd Convert and copy file
  • Example:
    Create a file with 250 "0".

    dd if=/dev/zero of=zero.txt count=250

    if = input file
    of = input file
dpkg Debian package management system
  • Install a .deb package:
    dpkg -i packagename.deb

    Example:
    dpkg -i skype-ubuntu-precise_4.2.0.13-1_i386.deb

  • List installed packages:
    dpkg -l

  • Remove an installed package:
    dpkg -r packagename

    Example:
    dpkg -r skype-ubuntu-precise_4.2.0.13-1_i386
find Search for files in a directory hierarchy
  • Example:
    find / -name logs -print
    find / -name "*log*" -print
    find / -name "*[dD]esktop" -print
    find / -name passwd 2> error.txt
    find / -name passwd -print 2> /dev/null

    Note:
    0 = stdin
    1 = stdout
    2 = stderr
ln Make link between files
  • Example symbolic link:
    ln -s /etc/passwd passwd

  • Example hard link:
    ln file1.txt file2.txt
samba Access home directory (Linux system) from Windows environment
  • Edit file: /etc/samba/smb.conf

  • To share a user home directory, uncomment lines in smb.conf:

    [homes]
    comment = Home Directories
    browseable = no

  • Restart samba, type: sudo service samba restart

  • To access the Linux home directory from Windows environment, type:
    \\server\username
sysctl Configure kernel parameters at runtime
  • Display all values currently available:
    sysctl -a
tar Stores and extracts files from a tape or disk archive
  • Example tar:
    tar cfzv test.tar.gz weg*.txt

  • Example untar:
    tar xfzv test.tar.gz
Note:
c = create
f = use archive file
z = use gzip
v = verbose
x = extract

which Locate a command
  • Show location:
    which filename

    Example:
    which perl
xdd Make a hexdump or do the reverse
  • Example:
    xxd zero.txt
zip Package and compress files
  • Example zip:
    zip test.zip weg*.txt

  • Example unzip:
    unzip test.zip