All original content is created in Ukrainian. Not all content has been translated yet. Some posts may only be available in Ukrainian.Learn more

What does a dot at the beginning of a file (.gitignore, .DS_Store, .bashrc, etc.) mean?

Post cover: What does a dot at the beginning of a file (.gitignore, .DS_Store, .bashrc, etc.) mean?
This content has been automatically translated from Ukrainian.
A dot at the beginning of a file or folder name in Unix-like operating systems, such as macOS or Linux, indicates that this file or folder is hidden. This is a system convention used to denote files that typically should not be visible to the user during standard browsing in a file manager or command line.
Hidden files are often used to store settings and configurations, such as:
  • .bashrc — configuration file for the Bash shell (terminal)
  • .zshrc — configuration file for the Zsh shell (also terminal)
  • .gitignore — file that tells Git which files or folders to ignore
  • .profile — configuration file for the user shell
  • .DS_Store — hidden system file created and used by the macOS operating system to store metadata about the arrangement of icons and other properties in Finder windows.
Hidden files can be viewed by using certain options in the command line or by enabling the appropriate option in the file manager. For example, in the terminal command line, the command ls -a can be used to display hidden files.

How to show hidden files in the terminal (macOS and Linux)?

What does ls -a mean?
  • ls - comes from list
  • -a - comes from all
That is, with the command ls -a, we can see all files. The command ls (without the -a flag) will show all non-hidden files. Let's check in the terminal (macOS):
We'll create a new folder using the terminal to ensure that there is no .DS_Store file created by Finder. 
mkdir test_ds_store_folder
cd test_ds_store_folder
Let's check the contents of the folder:
~/test_ds_store_folder ls
The ls command shows nothing. Because it is indeed empty. And here is ls -a:
~/test_ds_store_folder ls -a
.	..
What are these dots? Are they files? No. These are special items needed for navigation:)
When you use the ls -a command, it displays all files and directories, including hidden files. Among the displayed items, there are always two special items:
  • . (dot) — this is a reference to the current folder. It points to the folder you are currently in. For example, if you are in /home/user, then . points to it.
  • .. (double dot) — this is a reference to the parent folder. It points to the folder that is one level above the current one. For example, if you are in /home/user, then .. points to the /home directory.
. and .. are part of the file system of Unix-like operating systems and serve for navigation.
Тестуємо ls та ls -a
Тестуємо ls та ls -a
Okay. How will hidden files look in the terminal?
Прихований .DS_Store
Прихований .DS_Store
I'm creating a new folder (untitled folder) in our existing folder (test_ds_store_folder) using the Finder interface. At this moment, Finder will create the .DS_Store file.
To see it in the terminal, you can run ls -a:
~/test_ds_store_folder ls -a
.		.DS_Store
..		untitled folder
As you can see, our new folder and the hidden .DS_Store have been added to the list along with the system dots. Running ls without the -a flag will show only the folder:
~/test_ds_store_folder ls

untitled folder

How to show hidden files in macOS (Finder)?

  • Open Finder.
  • Select any folder you want to view.
  • Press the Command + Shift + . (dot) keys simultaneously to show or hide files.
Exception! The .DS_Store files are configuration files for the Finder application, so by using the key combination (Command + Shift + .), you will activate the display of all hidden files except .DS_Store.
If there are hidden files in the folder, you will see them. The icons of such files are semi-transparent, like ghosts:
Тут ми не бачимо приховані файли
Тут ми не бачимо приховані файли
А тут можна їх побачити (після) натискання Command + Shift + . (крапка) одночасно
А тут можна їх побачити (після) натискання Command + Shift + . (крапка) одночасно
I currently do not have a computer with Linux or Windows to show more examples. But I hope I have covered the topic of the post. Hidden files are needed to store settings, etc. So for the end user, it's magic that allows the file structure to look nice and not confuse with additional files that are undesirable to delete accidentally.

This post doesn't have any additions from the author yet.

Ruby library Gosu for creating 2D games
29 Jun 08:48

Ruby library Gosu for creating 2D games

meme code
meme code@memecode
Gosu Ruby Tutorial - пройдемось по офіційній документації
03 Jul 11:50

Gosu Ruby Tutorial - пройдемось по офіційній документації

meme code
meme code@memecode
We are writing a demo game Drones vs Zombies (Gosu / Ruby)
12 Jul 12:17

We are writing a demo game Drones vs Zombies (Gosu / Ruby)

meme code
meme code@memecode
How to fix a Windows crash caused by CrowdStrike?
19 Jul 13:53

How to fix a Windows crash caused by CrowdStrike?

meme code
meme code@memecode
What does .map(&:name) mean in Ruby?
28 Jul 11:18

What does .map(&:name) mean in Ruby?

meme code
meme code@memecode
How does the map method work in Ruby? Overview of the method's operation with examples
30 Jul 07:33

How does the map method work in Ruby? Overview of the method's operation with examples

meme code
meme code@memecode
What is .gitignore? What is it for and how to use it
02 Aug 14:58

What is .gitignore? What is it for and how to use it

meme code
meme code@memecode
How to remove the .DS_Store file from a Git repository?
02 Aug 19:34

How to remove the .DS_Store file from a Git repository?

meme code
meme code@memecode
What is an idempotent method?
21 Aug 20:57

What is an idempotent method?

meme code
meme code@memecode
What is a repository?
21 Aug 21:25

What is a repository?

meme code
meme code@memecode
What is a commit in the context of programming and SCM / Git?
21 Aug 21:37

What is a commit in the context of programming and SCM / Git?

meme code
meme code@memecode
What is SCM (Source Control Management)?
21 Aug 21:46

What is SCM (Source Control Management)?

meme code
meme code@memecode