Useful Linux Commands in Ubuntu

There is a lot of confusion about CLI (Command Line Interface) commands in Ubuntu.  While a lot of functions can be done through the GUI it is nice to be able and understand some very useful commands.  Here is a list of some useful commands in Ubuntu.  While this page does reference Ubuntu command line, some of the commands may also work with other Linux/UNIX distros.  This page does not attempt to be a Linux CLI tutorial more a reference of useful commands.  

When a command has < > then that means a required parameter.
When you see [ ], it means optional parameter.

I will update this page as I get more information.

                                                                 Command                               Purpose
/bin/sh change to the bourne shell
/bin/csh change to the C-shell
/bin/bash change to the bash shell (Ubuntu default)
echo $SHELL show which shell you are currently using
pwd print working directory, displays the directory that the terminal is pointing to
echo $PATH show your current path
ls -d */ or ls -l | grep "^d"list directories only
ls -l | grep -v "^d"list files only
> <file_name> redirect output to a text file, ex: ls -l > files.txt
This will create a file called files.txt with the output of ls -l, warning if any files with name files.txt will be erased in favor of new file
>> <file_name> similar to redirect except that an existing file will be appended to on the end of the file
echo $USER or whoami show which user is currently logged in
cd ~ change to the currently logged in user's home directory
echo $HOME displays the currently logged in users home directory
ln -s <path> <location of link> create a symbolic link to a file or folder, a shortcut by another name
sudo fdisk -l shows you all the partitions available mounted or unmounted
sudo dpgk -i <.deb package> install a debian package, *.deb will install a series of debian packages
dpkg -l list all packages installed on your PC, follow with | grep <string> to find a certain package
sudo apt-get update update the package manager
sudo apt-get install <package(s)> install packages, there can be multiple packages each separated by a space
ps -ef list all processes running, follow with | grep <string> to list a processes
shred -fuz <filename>completely remove file from media, shred overwrites files with zeroes
rm -rf <folder>wipe files AND folders recursively, VERY dangerous command
wipe -rf <folder>securely wipe files AND folders recursively, VERY dangerous command
kill [-9] <process id> terminalte a process, process number can be gotten from the ps -ef command, the -9 means to kill without anymore input
df -k list free disk space of all partitions in kilobytes
wget <website> retrieves a file from a website using http or ftp
ifconfig -a give information about all networking interfaces
iwconfig tests to see if network interfaces have wireless connectivity
lspci list of devices connected to the PC via PCI
lsusblist of devices connected to the PC via USB
gksudo gedit /etc/X11/xorg.conf allows editing of the xorg.conf using gedit for X-Server
gksudo gedit /etc/fstab allows editing of the fstab using gedit for mounting drives
sudo mount -a mounts all mount points specified by your /etc/fstab file
sudo umount -aun-mounts all mount points specified by your /etc/fstab file
sudo fc-cache -f -v adds fonts for usage by applications
sudo apt-get clean remove cached .deb packages that apt-get uses during installation
sudo apt-get autoremove <package> removes package and the package dependencies
sudo /etc/init.d/networking restart restart network manager
sudo /etc/init.d/cupsys restart restart CUPS
firefox localhost:631CUPS web based manager
sudo dpkg-reconfigure xserver-xorgreconfigure your xorg.conf file
<command> & follow shell commands with the & character, example: gksudo gedit /etc/fstab & will free terminal up for other commands
uname -rinformation of what kernel you are using
find <dir> -exec grep "<string>" '{}' \; -printfind all files recursively cantaining <string> in directory <dir>, wildcards allowed
find -name <filename>find files recursively cantaining <filename>, wildcards allowed
gnome-terminal --geometry=WxHsizes the gnome-terminal where W=width and H=height in colums
cat /proc/cpuinfoinformation on CPU
cat /proc/meminfoinformation on RAM
sudo /etc/init.d/nfs-kernel-server restartrestart NFS networking service, can use start and stop as well
sudo /etc/init.d/samba restartrestart Samba service, can use start and stop as well
sudo smbpasswd -L -a <username>create Samba user and set user password for Samba <username>
 sudo passwd <username> create new password for user <username>
 du -cb <folder> show disc space used in bytes of <folder>
find . -depth -print0 | cpio --null --sparse -pvd <dest>  create exact copy of current folder to <dest>, use sudo if needed
k3b --nofork  allow k3b to run multiple instances
cat /etc/issuetell what version of Ubuntu you are running

I hope these help.