Wednesday 6 May 2015

Introduction to linux commands

Linux file system hierarchy and basic commands

/ is the root folder. It contain other folders such as root, home, usr, etc, dev, var, bin, boot, run, sbin, tmp.

/root  : Home directory for the super user. i.e., root
/home: Home directory for regular users where there personal data's are stored.
/usr    : Installed software, shared libraries, include files and static read only program data.
/etc    : All the configuration files are stored here.
/dev   : All the device files are listed here.(All hardware are treated as file in Linux)
/var    : Files that dynamically change (variables). All log files are found in this directory.
/tmp   : Contains temporary files. Files older than ten days are deleted automatically in all Linux systems.

Some basic commands and its uses

touch: Used to create an empty file of any type.

syntax: touch <filename.type>

eg: touch newfile.txt
  
This command will create an empty file newfile.txt in the present working directory.
eg: touch /home/newfile.txt
This command will create an empty file newfile.txt in the home directory.

cd: This command is used to change working directory.

syntax: cd <path>

eg: cd /etc/var
This command changes the present working directory to /etc/var

pwd: This command shows the present working directory.

syntax: pwd
eg: pwd

mkdir: This command is used to make a new directory

syntax: mkdir <directoryname>

eg: mkdir newdirectory
This command will create a new directory on present working directory.
eg: mkdir /home/newdirectory
This command will create a new directory in home directory.

ls: This command is used to list all the files and directories in pwd.

syntax: ls [option]

eg: ls -l
this command will list all the files and folders in the pwd.


          

No comments:

Post a Comment