Are the 'Dot' and 'Dot Dot' Files in Unix and Linux Real Files

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 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.

Do dotfiles have a file extension?

You pays your money and you takes your pick: Yes, No, Maybe.

It comes down to your definition of 'extension'.

  • Is it "anything after the last dot in the name"? If so, those files have no name and are all extension.
  • Is it "anything after a dot that isn't the first character in the name"? If so, those files don't have an extension.
  • If you use some other definition, then the answer will need to be adjusted accordingly.

Remember that SCCS files used a prefix s. (amongst others; you'd see p. files too — and there were many transient file names with other prefixes). Does an SCCS file s.something have an extension or a prefix? (With s.source.c, it is reasonably straight-forward; there's a prefix, a name and an extension or suffix, or you could ignore the prefix as a special case and the name is s.source and the extension is .c.) What about the default executable name, a.out? What about a name such as ..dot; does it have an extension, and if so, what is it?

Note that the answer on DOS was more formalized. There the file system used to enforce (once upon another millennium or so) names with 8.3 and the extension was tangible. But that's a bygone era for the most part (and there are few who miss it).

Anthony Arnold and paxdiablo both noted that names ending with .tar.gz exist — what's the extension on such files?

If you treat the extension of somecode-8.76.tar.gz as anything other than .gz, you are opening yourself up to a bag'o'worms. The contained file is somecode-8.76.tar; that itself can be reasonably said to have an extension of .tar. Defining the extension of the whole gzipped tar file as .tar.gz raises the question of "why isn't it .76.tar.gz" and also means that you need to revisit the SCCS file naming convention. Absorbing the .76 portion of the name into either .76.tar.gz or .76.tar as a suffix is making life complex indeed. It's a valid question, but anything other than "an extension is the string from the last dot to the end of the name" is fraught indeed — or requires interpretation of the meaning of the extension, and gets into another complex area that it generally is better to avoid.

Note that Unix at the O/S or file system level doesn't care about the extension on files. Programs can decide they care about extensions, but that's up to the program. The extension is an indicator of the file type; it is not definitive. That's why the file program exists to identify the contents of files. It looks at the contents of the file to identify the content; it doesn't pay attention to the file extension (so it doesn't have to decide what the extension is, either).

Command to list all files except . (dot) and .. (dot dot)

Regarding the ls(1) documentation (man ls):

-A, --almost-all do not list implied . and ..

you need (without any additional argument such as .*):

ls -A

or better yet:

/bin/ls -A

Unix dot command

The dot . command is standard POSIX shell (Bourne, Korn, Bash) notation for 'read the named file as if it was part of the current script'. The big advantage is that the file can set environment variables and define functions and it affects the shell script. Normally, if you run the script as a regular command (using ./dbatools.pro or sh dbatools.pro), then the environment variables affect only the shell that executes the script, not the current shell.

The test looks to see if there is a file called dbatools.pro in the current directory (hence ./dbatools.pro). If there is, it uses that file; if there is not, then it uses the file /app/dbatools/profile/dbatools.pro. It will generate an error if it cannot read the file it 'dots'.

With Bash, there's an alternative notation, source ./dbatools.pro, that can be used instead. It is borrowed from the C shell.

Note that the . (and source, a Bash builtin) commands will search for a plain file (. dbatools.pro, for example) in a directory on $PATH, but the file does not need to be executable — it only needs to be readable.

Why Unix wildcard * does not include .*?

From the Bash manual:

When a pattern is used for filename expansion, the character ‘.’ at the start of a filename or immediately following a slash must be matched explicitly, unless the shell option dotglob is set. When matching a file name, the slash character must always be matched explicitly. In other cases, the ‘.’ character is not treated specially.

As for the rationale, I can only guess. I imagine it's so that you don't accidentally manipulate files you didn't know existed (remember that ls doesn't display .foo).

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

What does rc mean in dot files

It looks like one of the following:

  • run commands
  • resource control
  • run control
  • runtime configuration

Also I've found a citation:

The ‘rc’ suffix goes back to Unix's grandparent, CTSS. It had a command-script feature called "runcom". Early Unixes used ‘rc’ for the name of the operating system's boot script, as a tribute to CTSS runcom.



Related Topics



Leave a reply



Submit