• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • What is . and .. in Unix/Linux ?

    So, if you are reading this blog then you are confused with the fact that each of the directory in your linux/unix box contains a"." and ".." , what does this basically means?

    Well the answer is really simple, You just need to use a little bit of logic. Let me demonstrate you with an example.

    Scenario 1
    You need to go one step back of the current directory where you are. For eg. you are inside /home/deepak and you want to go to /home so what is the command you would run?

    # cd ..
    Now does that 2 dots used after cd makes any sense? I think you must have got my point and the usage of double dot in each directory.

    Scenario 2
    Try to find a file with name test inside the current directory and all directories inside the current directory. For eg. Find test file inside /home/deepak( which is your present working directory)

    # find . -name test -type f
    Now as you can see I have used a single dot "." to tell my system to only look in my current directory.

    So basically single dot "." means current directory which actually is a hardlink to its containing directory.
    You can verify the same using the below command
    [deepak@server work]$ ls -di . "$PWD"
    66232 .  66232 /home/deepak/work
    returns the same inode no.

    and double dot ".." means one step back i.e. the parent directory, that is the only directory where that directory is referenced from
    [deepak@server work]$ ls -di ..  /home/deepak/
    22 ..  22 /opt/fti/

    You can see the size difference between "." and".." accordingly below
    [deepak@server work]$ ls -al
    total 1592
    drwxrws--x  4 deepak deepak  2048 Nov 13 02:22 .
    drwxrws--x 23 deepak deepak  3864 Aug 22 09:57 ..

    Follow the below links for more tutorials

    What is the difference/comparison between Unix and Linux ?
    What are the maximum and minimum limits for RHEL 4 vs 5 vs 6 ?
    Step by Step Linux Boot Process Explained In Detail
    What is the difference between ext3 and ext4 filesystem in Linux ?
    How to configure Private Network in VMware Workstation
    10 examples to help you understand top command usage in Unix/Linux
    Configure Red Hat Cluster using VMware, Quorum Disk, GFS2, Openfiler
    Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
    15 tips to enhance security of your Linux machine
    Why is Linux more secure than windows and any other OS
    Understanding Load Average in Linux and when to be worried about it?
    Disk Attachment Technology FC vs SAS vs iSCSI
    Understanding UMASK value in Linux
    How to keep a track of all the commands run by any user in Linux
    How do you check Linux machine is Physical or Virtual remotely?
    RAID levels 0, 1, 2, 3, 4, 5, 6, 0+1, 1+0 features explained in detail

    What is . and .. in Unix/Linux ? What is . and .. in Unix/Linux ? Reviewed by Deepak Prasad on Wednesday, December 25, 2013 Rating: 5


    Powered by Blogger.