Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is double dot(..) and single dot(.) in Linux?

The ls -ai command shows that . and .. have their inodes the same as the current directory and parent directory, respectively.

What exactly are . and ..?

Are they real files or even hard links? But as I have known, it's not allowed to create a hard link to a directory.

like image 351
Cubarco Avatar asked Apr 23 '14 10:04

Cubarco


People also ask

What does 2 dots mean in Linux?

Two dots, one after the other, in the same context (i.e., when your instruction is expecting a directory path) means “the directory immediately above the current one“.

What are the difference between single dots and double dots?

Single dot "." stands for current directory and double dots ".." mean parent directory. Similarly "~" stands for home directory. These shortcuts come in very handy because you don't have to type in complete path of any file you want to access in a particular (or current) directory. For Example- typing cd ..

What is double dot in Unix?

On Unix-like operating systems every directory contains, as a minimum, an object represented by a single dot and another represented by two successive dots. The former refers to the directory itself and the latter refers to its parent directory (i.e., the directory that contains it).

What do the dots mean in Linux?

dot) means the current directory you're in. .. (dot dot) means the parent directory of the current directory you're in. For example, if you're in foo/bar/ , . will represent bar/ , .. will represent foo/ .


1 Answers

. represents the directory you are in and .. represents the parent directory.

From the dot definition:

This is a short string (i.e., sequence of characters) that is added to the end of the base name (i.e., the main part of the name) of a file or directory in order to indicate the type of file or directory.

On Unix-like operating systems every directory contains, as a minimum, an object represented by a single dot and another represented by two successive dots. The former refers to the directory itself and the latter refers to its parent directory (i.e., the directory that contains it). These items are automatically created in every directory, as can be seen by using the ls command with its -a option (which instructs it to show all of its contents, including hidden items).

like image 147
Rahul Tripathi Avatar answered Sep 22 '22 00:09

Rahul Tripathi