IN PREVIOUS ARTICLE LINUX TERMINAL-COMMAND-I-INTRODUCTION WE ONLY DISCUSS THE BASIC COMMANDS.
so, today we are going to discuss about the navigation of the file directory in the linux distribution system..basically today we learn mostly three things..
pwd : current working directory
ls : content in the directory
cd : changing the directory
but before starting it must to be understand how the file system orgnized in the linux..so let's start ...
but before if you don't read my previous article in linux commanding please read it first..

LINUX TERMINAL-COMMAND-I-INTRODUCTION
Understanding The File System Tree
Like Windows, a Unix-like operating system such as Linux organizes its files in what is called a hierarchical directory structure.
The first directory in the file system is called the root directory.
The root directory contains files and subdirectories, which contain more files and subdirectories and so on and so on.
Note :-
that unlike Windows, which has a separate file system tree for each storage device, Unix-like systems such as Linux always have a single file system tree, regardless of how many drives or storage devices are attached to the computer.
The Current Working Directory
When we first log in to our system or start a terminal emulator session our current working directory is set to our home directory.
At any given time, we are inside a single directory and we can
see the files contained in the directory and the pathway to the directory above us called the parent directory and any subdirectories below us.
The directory we are standing in is called the current working directory.
To display the current working directory, we use the
pwd (print working directory) command.
command :pwd
Listing The Contents Of A Directory
To list the files and directories in the current working directory, we use the ls command.
command : ls
Changing The Current Working Directory
pathname : is the route we take along the branches of the tree to get to the directory we want.
Pathnames can be specified in one of two different ways; as absolute
pathnames or as relative pathnames.
Absolute Pathnames :An absolute pathname begins with the root directory and follows the tree branch by branch until the path to the desired directory or file is completed.
like here if you want to navigate to the directory..'bin' ,which is subdirectory of 'usr' directory...
then you have to pass through 'usr' directory.
command : cd /usr/bin
..actually '/'(forward slash) use for the navigation from directory to subdirectory.
so , cd /usr/bin ..is an relative pathname start from the root directory to the destination.
Relative pathname..
it start from the working directory.
lets understand what it's mean..
like by command : cd /usr/bin...
command :pwd...this will give you the current directory name..which is 'bin'..
so if you want to navigate to another directory like to '/usr'..from the current working directory ..'bin'..then you have to go with relative pathname.
for this their is two command ...
1. '.'(dot) command :actually this is use for current working directory.if you don't get the point we will discuss it through practicle..wait..||
2. '..'(double dot): through this it will navigate to parent directory of the current working directory..
means if you are in 'bin' directory currently..then
command : cd ..
this will take you to the parent directory of the 'bin' directory, which is 'usr'.
ok ,that's it for theory now start the practicle game...
but before this just someup basic things...
pwd : use to display current working directory pathname.
ls : listing the content of the directory
cd : used to change the directory
pathname:-
absolute pathname : start from the root to destination directory.
relative pathname :- start from the current working directory.
The "." symbol refers to the working directory and the ".." symbol refers to the working
directory's parent directory.
Here is how it works. Let's change the working directory to
/usr/bin..
commands :
ubuntu@ubuntu:~$ cd /usr/bin
ubuntu@ubuntu:/usr/bin$ pwd
/usr/bin
ubuntu@ubuntu:/usr/bin$
so by 'cd' command we change directory to '/usr/bin' and by 'pwd' command we
get the current working directory '/usr/bin'.
Okay, now let's say that we wanted to change the working directory to the parent of
/usr/bin which is /usr.
for this their is two way to doing this.
1. by absolute pathname..
commands :
ubuntu@ubuntu:/usr/bin$ cd /usr
ubuntu@ubuntu:/usr$ pwd
/usr
ubuntu@ubuntu:/usr$
2. or by the relative pathname..
commands :
ubuntu@ubuntu:/usr/bin$ cd ..
ubuntu@ubuntu:/usr$ pwd
/usr
ubuntu@ubuntu:/usr$
here what we learn above used here that..
by using '..' it will navigate to parent directory of the current working directory.
Two different methods with identical results. Which one should we use? The one that
requires the least typing!
Likewise, we can change the working directory from /usr to /usr/bin in two
different ways. Either using an absolute pathname:
commands :
ubuntu@ubuntu:/usr$ cd /usr/bin
ubuntu@ubuntu:/usr/bin$ pwd
/usr/bin
ubuntu@ubuntu:/usr/bin$
or by the relative pathname :
commands:
ubuntu@ubuntu:/usr$ cd ./bin
ubuntu@ubuntu:/usr/bin$ pwd
/usr/bin
ubuntu@ubuntu:/usr/bin$
like what we learn that command '.' will represent the current working directry which is now 'usr'..so
commnad : "cd /usr/bin" or "cd ./bin" both are equivalent.
an important thing here :
"if you do not specify a pathname to something, the working directory will be assumed"
it's mean that in 'usr ' directory their is many directory . so if you ommitted './' from command it will assume that you are working in the current directory.
if you don't get this see here..
commands :
ubuntu@ubuntu:/usr$ ls
bin games include lib local sbin share src
ubuntu@ubuntu:/usr$ cd bin
ubuntu@ubuntu:/usr/bin$ pwd
/usr/bin
ubuntu@ubuntu:/usr/bin$
some useful ..'cd shortcuts'..
1. cd Changes the working directory to your home directory.
2. cd - Changes the working directory to the previous working directory.
commands :
ubuntu@ubuntu:~$ cd /usr/bin
ubuntu@ubuntu:/usr/bin$ pwd
/usr/bin
ubuntu@ubuntu:/usr/bin$ cd ..
ubuntu@ubuntu:/usr$ cd -
/usr/bin
ubuntu@ubuntu:/usr/bin$ cd -
/usr
ubuntu@ubuntu:/usr$
that's it for today..
read my next article based on commanding..

LINUX TERMINAL COMMAND – EXPLORE THE SYSTEM
until next article this is..
ZEROCOOL
SIGN OUT