How to view hidden files and folders on Linux
Let's explore how you can view these hidden files on your Linux system.
Why are there hidden files?
The concept of hidden files is simple but very important in Linux. Hidden files are mainly used to store configuration files or user settings. Typically, system services, scripts, or other programs use these files to store and read configurations.
For example, the .bash_logout script executes whenever you log out of your Bash session. Another great example is the .gitignore file , which is used by Git to exclude certain files from being pushed to your remote repository.
You can also use the concept of hidden files to hide certain files from the prying eyes of most non-expert users. A good example is the ~/.ssh directory or directory used to store SSH keys and configuration files.
View hidden files with ls . command
The ls command is a widely used Linux command. In its simplest form, the command lists the files and folders in a directory. However, ls does not list hidden files by default.
To show hidden files, you must use the -a option. This requires the ls command to list "all" files and directories including hidden files and directories, i.e. files that begin with a dot (.).
Navigate to your home directory with the cd command and check for hidden files using ls as follows:
ls -a
Output:
As you can see, there are some files that start with a dot. If you just run the ls command without the -a option, the output will ignore hidden files.
If you don't have any hidden files in your home directory, you can create one with the touch command as follows:
touch .sample_hidden_file.txt
You can also create hidden directories with the mkdir command. You just need to make sure you use a period at the beginning of the folder name. For example, to create a hidden folder named secret in your home directory, run the command:
mkdir ~/.secrets
You can tell the ls command not to list a certain file or directory. For example, if you are in your home directory, you can run the following command to unlist the Desktop directory in the command output:
ls --hide=Desktop
Find hidden files on Linux with the find . command
In addition to ls, you can use the find command as another way to list or check for hidden files and directories on Linux. The find command searches for files in the specified directory hierarchy.
To list or find all hidden files, you must ask the find command to list all files whose names start with a period (.).
find . -name ".*" -maxdepth 1 2> /dev/null
Run the following command to find and list only hidden folders or folders:
find . -name ".*" -maxdepth 1 -type d 2> /dev/null
View hidden files using the GUI
You can also view hidden files from the GUI using your default file manager. GNOME Files is the default file manager on Ubuntu. Previously, the file program was called Nautilus.
You can launch the file by pressing the Super key and then typing the file into the search input that appears. Click on the default Files program , the files in the Home folder will be displayed.
By default, your file manager does not show hidden files. Click on the menu icon located in the upper right corner and select Show Hidden Files . Your hidden files and folders will now be visible.
You can also use the keyboard shortcut Ctrl + H to view hidden files on Linux.
Although you can't view hidden files and folders by default, you can still interact with them just like any other normal file. In fact, at some point you may have to change the configuration in a hidden file.
Knowing how to list and view all files, including hidden files and folders, will come in handy if you use Linux every day. Dot files play an important role in the Linux operating system because they are often used to store configuration settings for programs.
In addition to files, the find command can also efficiently locate directories on Linux. But there are some flags and options that you will have to learn to do this.
You should read it
- How to hide files and folders on Windows / Linux / Mac OS X operating systems
- How to hide files, show hidden files, view hidden folders and file extensions on Windows 7/8/10?
- Restore hidden folders in Windows when infected
- How to show hidden files, hidden folders in Windows 10, Windows 7
- How to display protected operating system files in Windows 11
- How to create hidden folders on Windows 10
- How to Show Hidden Files in Windows 7
- How to synchronize files and folders on Linux
May be interested
- How to Find Hidden Files and Folders in Windowsthis wikihow teaches you how to display and locate hidden files and folders in windows. open the start menu . either click the windows logo in the bottom-left corner of the screen, or press the key.
- How to show hidden files and folders on the USB drivewhen using usb to copy data from one computer to another, usb virus attack is normal, very happening. and once the virus has attacked the usb drive, it can 'eat' or hide any data on your usb drive. so how to display hidden files and folders on the usb drive, please refer to the following article of network administrator.
- Tricks to hide files or folders on Windows, Mac OS X and Linuxhiding, hiding folders or files on your computer partially ensures the security of the information contained in the folder or files that are not found by others.
- Software to open hidden files in USB, computersoftware to open hidden files in usb, computer. have you ever panicked when some important files or folders suddenly disappeared from familiar locations? if not deleted or cut off, the possibility is that they were hidden. the problem is much simpler in case the user (you or someone else) has hidden them.
- How to show hidden files on Windows 11show hidden files on win 11 helps you view all files in usb, hard drive, folder, newly downloaded files... most fully. in this article, software tips shares with you the most detailed way to show hidden files on windows 11.
- How to Show Hidden Files in Linuxjust starting out in linux and can't see your secret/configuration files in the file manager? having the same problem while using the terminal emulator? here's the answer. open the file manager.
- How to Hide a Folder on Windowswindows offers a feature that allows folders to be hidden from view under normal circumstances. this feature is typically used for program files so that they don't clutter up your computer when you are normally using it, but you can...
- 7 files and folders Windows can delete to free up spacewindows contains many unnecessary files and folders from hidden caches, old files you can delete to free up space. but knowing whether it is safe to delete those folders and files seems to be a challenge.
- Manage folders in Unix / Linuxa directory is a file whose only task is to store the name and related file information. all files, which can be regular, special or directory files, are kept in folders.
- How to open folders hidden on the system with the Shell command on Windows?on the operating system there are many hidden system folders that can be identified on the windows registry with the clsid key, the specific folder name and the folder location on your computer.