Basic Bash Command For New Linux Users

One of the challenges that new Linux users face is the using of bash command on the terminal. Even though some Linux distro (such as Ubuntu Gutsy) has improved the user interface a great extent and reduced the need to execute applications via command line, there will still be cases where using the command line terminal is required.

As a Linux newbie, there are some commands that you may want to acquaint with.

  • apt-get – Retrieve a Debian package from the Net. It is often used together with install and autoremove. For example:
sudo apt-get install vlc

retrieve the vlc package and install it on your system.

sudo apt-get autoremove vlc

will uninstall your vlc application and all dependencies package.

  • cd – change the current directory.
cd foldername

change the current directory to foldername

  • clear – clear the terminal screen.
  • chmod – change the permission of a file or folder.
sudo chmod 777 yourfile

allow everyone to read/write/execute yourfile

  • cp – copy a file/folder from one destination to another destination
cp yourfile /home /home/temp

copys yourfile from home to temp folder

  • mv – move a file/folder from one destination to another destination
mv yourfile /home /home/temp

move yourfile from home to temp folder

  • mount – mount an external device
sudo mount /media/sda1
  • chown – change the file owner and group
sudo chown root /u

change the owner of /u to root

  • tar – Untar (or uncompress) or tar (or compress) a file with the .tar extension
tar -xf compress.tar
  • dir – list the folders in the current directory.
  • eject – eject disc from optical device
  • grep – Search file(s) for lines that match a given pattern.
grep -i 'hello world' menu.h

look for the statement with ‘hello world’ in the file menu.h

  • gzip – compress or uncompress a file in .gz format

To uncompress:

gzip myfile.txt.gz

To compress:

gzip myfile.txt
  • fsck – check the consistency of file system and repair it
  • make – recompile a group of program, or source code
  • mkdir – create new directory/folder
mkdir temp
  • passwd – modify a user password
  • wget – retrieve web pages or file via HTTP, HTTPS, FTP
wget -r ''

retrieve yourfile.pdf from the web url

  • rm – remove a file from a folder.
rm filename
  • rmdir – remove a folder
rmdir /temp
  • shutdown – shutdown or restart linux
  • useradd – add a user account
sudo useradd --gid prison criminal

adds the user criminal to the group prison

  • usermod – modify a user account
  • users – list the current users

If there is anything that you are unsure of, you can always append --help to the end of the command to show usage instruction.