How to Manage Hidden Files with Cinnamon Desktop on Linux Mint

Learn how to efficiently manage hidden files and directories in Linux Mint using the Cinnamon desktop environment.

Linux Mint, a popular Linux distribution known for its ease of use, stability, and elegance, features the Cinnamon desktop environment as its flagship interface. One aspect of Linux Mint that users often need to understand is how to manage hidden files and directories effectively. Hidden files are commonly used for configuration purposes and are prefixed with a dot (.) in their names. These files are usually concealed to prevent accidental modifications but can be accessed and managed when necessary.

This guide will walk you through the various ways to handle hidden files using Cinnamon Desktop, including viewing, editing, and organizing them efficiently.

Understanding Hidden Files and Their Purpose

In Linux, any file or directory whose name starts with a dot (.) is considered hidden. These files are not visible by default when browsing directories using the file manager or listing files in the terminal. Common examples of hidden files include:

  • ~/.bashrc - Configuration file for the Bash shell.
  • ~/.config/ - A directory that contains configuration files for various applications.
  • ~/.ssh/ - Holds SSH keys and related configuration files.
  • ~/.local/ - Contains user-specific application data.

The primary purpose of hidden files is to keep system and user configuration files from cluttering the main directory view, ensuring a cleaner and more organized workspace.

Viewing Hidden Files in the Cinnamon File Manager (Nemo)

The Cinnamon desktop environment comes with the Nemo file manager, which makes managing hidden files straightforward.

Using the GUI

To reveal hidden files in Nemo, follow these steps:

  1. Open Nemo by clicking on the File Manager icon in the panel or pressing Super + E.
  2. Navigate to the directory where you suspect hidden files are located.
  3. Press Ctrl + H to toggle hidden files on and off.
  4. Alternatively, go to the View menu and check the option Show Hidden Files.

Once enabled, all hidden files and directories will appear in a slightly faded color, distinguishing them from regular files.

Using the Terminal

If you prefer the terminal, you can list hidden files using the ls command with the -a (all) or -A (almost all) option:

ls -a  # Shows all files, including . and ..
ls -A  # Shows all files except . and ..

This method is particularly useful when working in a headless environment or troubleshooting via SSH.

Creating Hidden Files and Directories

To create a hidden file or directory, simply prefix the name with a dot (.).

Using the GUI

  1. Open Nemo and navigate to the desired location.
  2. Right-click inside the folder and select Create New Document or Create New Folder.
  3. Name the file or folder with a leading dot, such as .my_hidden_file or .my_hidden_folder.
  4. Press Enter to confirm.

Using the Terminal

Create a hidden file using the touch command:

touch .my_hidden_file

Create a hidden directory using the mkdir command:

mkdir .my_hidden_directory

These files and folders will remain hidden until explicitly displayed using the methods described earlier.

Editing Hidden Files

Many configuration files in Linux Mint are hidden and require editing to tweak system or application settings. You can edit them using a graphical text editor or via the terminal.

Using a GUI Text Editor

  1. Open Nemo and enable hidden files (Ctrl + H).
  2. Navigate to the hidden file you want to edit (e.g., ~/.bashrc).
  3. Right-click the file and select Open With Text Editor.
  4. Make the necessary changes and save the file.

Using the Terminal

To edit a hidden file from the terminal, use a text editor like nano or vim. For example:

nano ~/.bashrc

Make your changes, then press Ctrl + X, followed by Y and Enter to save.

Deleting Hidden Files and Directories

Using the GUI

  1. Enable hidden files in Nemo (Ctrl + H).
  2. Locate the file or directory to delete.
  3. Right-click and select Move to Trash or press Delete.
  4. To permanently delete, empty the Trash.

Using the Terminal

Use the rm command to remove hidden files:

rm .my_hidden_file

To delete a hidden directory and its contents:

rm -r .my_hidden_directory

Be cautious when using rm -r as it permanently removes directories and their files.

Organizing Hidden Files

Backing Up Hidden Files

Since hidden files often contain essential configuration settings, it’s good practice to back them up before making changes. Use the cp command to create a backup:

cp ~/.bashrc ~/.bashrc.backup

For an entire directory:

cp -r ~/.config ~/.config_backup

Restoring Hidden Files

To restore a backed-up hidden file:

mv ~/.bashrc.backup ~/.bashrc

This ensures you can revert changes if needed.

Automating Hidden File Management with Scripts

If you frequently manage hidden files, consider using a script. For example, to toggle hidden file visibility in Nemo, create a script:

#!/bin/bash
gsettings set org.nemo.preferences show-hidden-files \
    $(gsettings get org.nemo.preferences show-hidden-files | grep -q true && echo false || echo true)

Save the script as toggle_hidden.sh, make it executable with chmod +x toggle_hidden.sh, and run it when needed.

Conclusion

Managing hidden files in Linux Mint with the Cinnamon desktop is simple yet powerful. Whether using Nemo’s graphical interface or the terminal, knowing how to view, edit, organize, and delete these files allows you to take full control of your system configuration. By following these best practices, you can ensure a clean and efficient workspace while safely managing critical settings and application preferences.


Last modified 20.02.2025: new kotlin and mint content (93a1000)