Basic Linux Commands

This post explains about basic Linux commands.

Working with a command line is a fun. It helps you to do the work faster and save your time. because it helps you to avoid double click again & again. this article is for newbie Linux users.

Basic Linux Commands


Sends file contents to standard output. This is a way to list the contents of short files to the screen. It works well with piping.

cat .1
  • Sends the contents of the “.bashrc” file to the screen.


Change directory

cd /home
  • Change the current working directory to /home. The ‘/’ indicates relative to root, and no matter what directory you are in when you execute this command, the directory will be changed to “/home”.
cd ..
  • Move to the parent directory of the current directory. This command will make the current working directory “/home.
cd ~
  • Move to the user’s home directory which is “/home/username”. The ‘~’ indicates the users home directory.


Copy files

cp myfile filename
  • Copy the files “myfile” to the file “filename” in the current working directory. This command will create the file “filename” if it doesn’t exist. It will normally overwrite it without warning if it exists.
cp -i myfile filename
  • With the “-i” option, if the file “filename” exists, you will be prompted before it is overwritten.
cp -i /data/myfile
  • Copy the file “/data/myfile” to the current working directory and name it “filename”. Prompt before overwriting the file.
cp -dpr srcdir destdir
  • Copy all files from the directory “srcdir” to the directory “destdir” preserving links (-p option), file attributes (-p option), and copy recursively (-r option). With these options, a directory and all it contents can be copied to another directory.


Disk duplicate. The man page says this command is to “Convert and copy a file”, but although used by more advanced users, it can be a very handy command. The “if” means input file, “of” means output file.

dd if=/dev/hdb1 of=/backup/


  • Show the amount of disk space used on each mounted filesystem.


less textfile

Example :

less 1.c
  • Similar to the more command, but the user can page up and down through the file. The example displays the contents of textfile.