In Linux, files and directories can be hidden by adding a dot (.) at the beginning of the name. When a dot is added to the beginning of a file or directory name, it is treated as a hidden file or directory and is not visible in the default directory listing.
- To hide a file in Linux, simply rename the file by adding a dot at the beginning of the name, for example:
mv file.txt .file.txt
- To hide a directory in Linux, simply rename the directory by adding a dot at the beginning of the name, for example:
mv directoryname .directoryname
- To unhide the files or directories, you can remove the dot from the file/directory name.
mv .file.txt file.txt
mv .directoryname directoryname
Note that this method of hiding files and directories is not secure and can be easily circumvented by someone with access to the file system. If you need to protect files and directories from unauthorized access, you should use file permissions and access controls. (https://www.whitestallion.com/)