What Is Double Dot(..) and Single Dot(.) in Linux

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

They are special name-inode maps which do count as hard-links (they do increase the link-count) though they aren't really hard-links, since, as you said, directories can't have hard-links. Read more here: Hard links and Unix file system nodes (inodes)

In unix, are dot and double dot path or directory?

A directory is logically a table used to map names to filesystem objects such as files or directories. Files can have multiple names and can be in multiple directories. The extra directory entries are links to the same file; the file itself is not duplicated. The same is true for directories. The '.' entry is a name which always maps to the directory that it is in. '..' maps to the parent, but in the case of the root directory it maps to itself.

Are the ‘dot’ and ‘dot dot’ files in Unix and Linux real files?

You are correct in your assumption. These files are merely there as an abstraction layer to navigate to and describe a resources location..

What does two dots before a slash mean? (../)

Each directory has two entries in it at the start, with names . (a link to itself) and .. (a link to its parent directory). The exception, of course, is the root directory, where the .. directory also refers to the root directory.

remove double dots from a string and not the single dot using shell script

You can replace multiple dots with none:

sed -E 's/\.\.+//g'

Regarding the Single and the Double Dot within Directories

It's the same for both platforms (and web based programming)

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

In HTML if you have a file e.g.: http://example.com/blog/index.html and you want to link to the image http://example.com/images/image.jpg you would put it in as such:

<img src="../images/image.jpg" />

As that tells the script to look in the PARENT directory and then images/image.jpg.



Related Topics



Leave a reply



Submit