Here is a list of some useful Linux/Ubuntu commands that I gathered from here and there. This list is not meant to be comprehensive or to cover  the most important Linux/Ubuntu commands. However, I tried to include commands from various categories with examples.



#10: man[..]


Show the manual page/s of a command:
man <command>

#9: top[..]

Save process snapshot to a file:
top -b -n1 > /home/DIR/process.log


#8: wc[..]

Count the number of:
  • Lines (-l)
  • Words (-w)
  • Characters (-c)
wc -l Yourfile


#7: dpkg[..]

Install a Debian (.deb) package:
sudo dpkg -i packagename


#6: auto-apt run[..]

auto-apt run asks you to install the packages needed by a command that tries to access a file that belongs to some uninstalled package.

Example:

sudo auto-apt run ./configure
This command will ask you to install the needed packages (It will call apt-get automatically) stopping the current process and continuing once the package is installed.


#5: ls[..]

List directory contents (Use a long listing format):
ls -l


#4: history[..]

Print recently used commands:
history


#3: ln[..]

Make links between files.

Example:

ln -s ~/.vim/vimrc ~/.vimrc
This will create a symbolic link to ~/.vim/vimrc with the name .vimrc.


#2: find[..]

Search for files in a directory hierarchy.

Example:

find /tmp -name '*.mp3' -print | xargs /bin/rm -f
This code can be used to find all the mp3 files contained in or below the directory /tmp and delete them.


#1: grep[..]

Search using a pattern.

Example:

grep ­v 'Linux' /home/user/Desktop/file.txt
Use it to display all the lines that do not contain the word Linux in file.txt.

Comments