Linux Basic Commands for Beginners – Everybody Should Know

Linux Basic Commands for Beginners

This post will help you to understand some Linux Basic Commands. We should be more familiar with some basic commands  to access the files and Folders (Directories) in terminal mode.

If you are interested in learning, Request you to go through the below recommended tutorial.

Linux Basic Commands for Beginners

Changing from one folder to different folders:

cd

“cd” command helps to go from one directory to other directory.

Example:

cd /myfolder – Go to the myfolder directory under “/” directory from current directory.
cd ..        – Moves up one directory (include the two little dots)
cd           – Go to the parent direcory.
cd ~         – Go to the parent direcory.
cd –         – Go to the previous folder where we before.

Find the current directory where you are in:

pwd

“pwd” command Shows the current directory (folder) you are in. In Linux, by default you will get into your home directory once you logged in.

Example:
If you are in your home directory (where terminals start) and type pwd, you will see /home/user1. Now go to other directory (cd /tmp/test) and  type the command “pwd” to see the current directory. You will see the output as “/tmp/test”

Making or Creating a Directory (terminal mode)
mkdir dirName     – Creates a directory with name dirName.

For Example:
mkdir temp

Deleting or Removing a Directory (terminal mode)
rmdir dirName      Removes a directory dirName.

For Example:
rmdir temp

Deleting or Removing a File (terminal mode)
rm fileName      Removes a files.

For Example:
rm data1                      Deletes the file data1 in the current directory.
rm -i data*                Removes all of your files which matches the filename data as the first four letters. (careful!!  rm * will remove ALL your files). The “-i” makes the computer prompt before removing each file.

Moving the files or folders
mv data1 /path/data1  –  moves the file or folder data1 to the folder /path/ and deletes the old one.

Renaming the files or folders
mv data1 /path/data2  –  moves the file or folder data1 to the folder /path/ as name “data2” and deletes the old one.

Copying the files or folders
cp data1 newdata/    will copy the data1 to the new directory newdata.

Listing the Files and Folders
ls     – Lists files.
If you add -al options after “ls” command, it will give more details for each file. Such as, size, permissions, owners, dates etc.
ls -al    – You’ll see a huge list of files that you can’t see with the ‘ls’ command alone and lots of details.
If you see such a long list of files that they scroll off the terminal screen, one way to solve the problem is to use:
ls -al |more    – Shows one screen of file names at a time.

Creating or making new files
Use some below text editors to create or make a new files.

  • vi
  • vim
  • cat
  • touch
  • nano
  • emacs

Accessing or Mounting the CDROM or DVD media
CDROM and DVD media’s wont available in linux automatically until you tell it to.
Mount the DVDROM or CDROM to some directory to access the contents of it.

mount source destination

Example : mount /dev/cdrom /media
Where “/dev/cdrom” is a source driver for both cdrom or dvdrom and /media is a destination folder where all datas of cdrom or dvdrom will be available under /media.

Ejecting or Unmounting the CDROM or DVD Media
Unmount the DVDROM or CDROM from the directory where we mounted already.

umount source
or
umount destination

Example : umount /dev/cdrom or umount /media
If you would like to see the avaiable commands in linux, please check inside the directories like /bin, /sbin, /usr/bin, /usr/sbin

Hope the post helped you to understand some linux basic commands with examples.

Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.

 linux basic commands, linux basics, linux commands, linux basic commands for beginners, linux basics for beginners, linux commands with examples