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.
Show the manual page/s of a command:
Save process snapshot to a file:
top -b -n1 > /home/DIR/process.log
Count the number of:
- Lines (-l)
- Words (-w)
- Characters (-c)
wc -l Yourfile
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.
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.
List directory contents (Use a long listing format):
Print recently used commands:
Make links between files.
ln -s ~/.vim/vimrc ~/.vimrc
This will create a symbolic link to ~/.vim/vimrc with the name .vimrc.
Search for files in a directory hierarchy.
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.
Search using a pattern.
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.