What is a ‘.DS_Store’ file?
Let’s see what Wikipedia has to say:
In the Apple macOS operating system, .DS_Store is a file that stores custom attributes of its containing folder, such as the position of icons or the choice of a background image.
The name is an abbreviation of Desktop Services Store, reflecting its purpose. It is created and maintained by the Finder application in every folder, and has functions similar to the file desktop.ini in Microsoft Windows.
Starting with a full stop (period) character, it is hidden in Finder and many Unix utilities. Its internal structure is proprietary.Wikipedia
So, a ‘.DS_Store’ file is a hidden file used only by Apple and means nothing to a Windows or a Linux machine.
These files hold the information that control how ‘Finder’, the ‘macOS’ file manager, opens a user’s folders and how those folders appear. They may include information like the size and the position of a folder window when it is open on the computer desktop, its background, the position of its icons, etc…
What if I delete it?
If a mac user deletes a ‘.DS_Store’ file, an other ‘.DS_Store’ file will be created automatically with default preferences the first time the user opens that folder again, or something like that. For all other users, deleting these files is inconsequential. The size of a ‘.DS_Store’ file is small, a few kilobytes.
The simplest way to actually delete a ‘.DS_Store’ file is to throw a couple of simple commands to a terminal. Commands like ‘cd‘, ‘ls‘ and ‘rm‘ should get the job done.