Quantcast
Channel: GoLinuxHub
Viewing all articles
Browse latest Browse all 392

What is . and .. in Unix/Linux ?

$
0
0
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?

Answer
# 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)

Answer
# 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 and double dot ".." means one step back and both of them are used accordingly as per the command.

Follow the below links for more tutorials

Configuring iSCSI storage using openfiler
How to install openfiler
iptables rules for Samba 4 in Red Hat Linux
Opnefire installation guide in Linux (Red Hat)
7 Commands to read or view the contents of a file using CLI in Linux
Basic iptables tutorial in Linux I
Basic iptables tutorial in Linux II
Creating an internal network using VMware Workstation

Viewing all articles
Browse latest Browse all 392

Trending Articles