Linux Directory Starting with Dot

Linux directory starting with dot

Files and directories whose names begin with a dot (.) by default are not displayed in directory listings by the standard command ls. Therefore, they are traditionally used to store settings, preferences, etc.. Directory ~/.vim in particular surely contains personal preferences and settings for the text editor vim.

There are also two special directory names in this class: the directory named simply . is an alias for the same directory in which it appears (a self reference), and the directory named .. refers to the parent directory of ..

Many graphical file browsers ignore the convention of hiding file names beginning with a ., so it is not necessarily correct any longer to call these files "hidden". Nevertheless, that terminology persists.

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)

Directory name created with a dot ,using shell script

Double quote the $dirPath in the last command and add -p to ignore mkdir failures when the directory already exists: mkdir -m 777 -p "$dirPath". Besides this, take care when combining variables and strings: dirName="Test_${temp}" looks better than dirName="Test_$temp".

Also, use this for static analysis of your scripts.


UPDATE: By analyzing the debug output of sh -x, the issue appeared due to DOS-style line-endings in the OP's script. Converting the file to UNIX format solved the problem.

How to list only the dot files and dot folder names (without the content in them)

try:

ls -d .*

fyi

   -d, --directory
list directories themselves, not their contents

if your ls is not alias of other command, the output of above ls -d .* will output files/dirs in same line. If you want to have them each in its own line:

ls -d1 .*

if you want colored output:

ls -d1 --color=auto .*

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.

How to access file start with period '.' in shell

Files and directories whose names start with . are "hidden" only in the sense that (a) ls ignores them by default and (b) wildcard expansion excludes them. In both cases, you can see dot files if you refer to them explicitly. * expands to all non-dot files; .* expands to all dot files.

(Other tools and commands may also treat them as hidden; for example, GUI file managers like Nautilus typically don't show dot files by default, but there's often an option to show them.)

ls -a overrides the special treatment of files whose names start with .. ls -A lists "hidden" files and folders, but excludes . (this directory) and .. (the parent directory); some versions of ls might not support -A.

The du command, as far as I know, doesn't treat dot files as hidden. du -h should show the entire directory tree starting at the current directory. (Try it in a small directory tree to make sure yours behaves this way.)

EDIT :

I've confirmed that at least the GNU coreutils version of du doesn't treat files or directories whose names start with . specially; nothing is hidden.

For example, this script:

#!/bin/sh

mkdir -p .dot/.dot .dot/nodot nodot/.dot nodot/nodot
du -h

produces this output on my system (the specific numbers depend on the nature of the file system, and are irrelevant to the current discussion):

4.0K    ./.dot/.dot
4.0K ./.dot/nodot
12K ./.dot
4.0K ./nodot/.dot
4.0K ./nodot/nodot
12K ./nodot
32K .

Does that meet your requirements? If not, can you explain more clearly just what you're looking for? Do you want to list all directories, whether their names begin with . or not? Do you want to list only "hidden" directories? What output would you like for the directory structure created by the above script?

What is the advantage of prefixing the folder name with (DOT) in android?

Android is a Unix-style operating system. Which means that they are following POSIX style conventions rather than the classic Windows ones we know so dearly.

In simpler terms Windows uses a hidden flag for folders like the "AppData"-folder that usually contain configuration files and should be hidden to the common user.

Unix-systems (Linux, OSX) uses the "dot"-convention which makes it easier to spot/set hidden files/folders by just applying a dot in the name of the file/folder.

Why it's so is probably argued and I think many theories exist. If you are interested check the following link

To answer your question the map is probably created by another app to cache content and in this case images or photos. Check the contents and see if there are thumbnails or similar



Related Topics



Leave a reply



Submit