Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I have a group of files I want hidden to avoid clutter. Is there a command that can simply make multiple files hidden? Is there an application? Is there a single command that will make the files I've listed hidden?


share|improve this question
In case you don't know, to make a file hidden, you will need to rename it to start with a period. So, the first question is... can the files be renamed without causing problems with accessing them? I'm guessing not, as if they could, they could also just be moved into a subdirectory, which would be easy. – Marty Fried Jan 2 '13 at 1:56
MHC's solution seems like the better alternative if avoiding clutter is the only objective. Renaming files may cause undesired behaviour as indicated by Marty in a comment above. – S Prasanth Jan 2 '13 at 6:26

3 Answers 3

up vote 5 down vote accepted

The Linux convention is to rename them to start with a .. Most programs, including Nautilus (the GNOME file browser), Dolphin (KDE), and command-line programs like ls and Bash's shell globbing, will then hide them (by default).

To rename multiple files simultaneously, you could use any of several graphical tools:

In PyRenamer, select your files, activate the "Insert / Delete" tab, and tell it to insert a . at position 1:

Sample pyrenamer

From the command-line, the conventional way is to use mv and find (if needed). If you have only a few specific files you want to hide, run:

for f in file0 file1 file2 file3; do mv "$f" ".$f"; done

to append a . to each file's names.

If you have several similarly-named files you want to hide (e.g. any file starting with hideme), use shell globbing:

for f in hideme*; do mv "$f" ".$f"; done
share|improve this answer
Renaming files is bad when you can just add those filenames to a file called .hidden where Nautilus responds to and makes them hidden ;) – Rinzwind Jan 2 '13 at 8:30
@Rinzwind: That seems to be specific to Nautilus though. The files still show up with ls and in Dolphin, and (worse) with shell globbing. – Mechanical snail Feb 7 '13 at 10:20

There's a nautilus script for that:


# Creator: Inameiname
# Date: 21 June 2011
# Version: 1.0
# This is a simple nautilus script to automatically add file(s)/folder(s)
# to a ".hidden" file so Nautilus will hide them, just like ".*" files
# Instructions:
# - decide what file(s)/folder(s) you want to hide inside a particular folder,
# - highlight them, and right click and select the script
# - it will automatically add the filenames to a created ".hidden" file inside the directory
# - if ".hidden" isn't there, it will add it
# - if you decide to unhide things, simply highlight and select the script again,
# - and it will automatically remove the filenames from the ".hidden" file
# - if ".hidden" contains no filenames, it will remove it
# Optionals:
# - Add the option to change the owner and group for whatever is selected to hide/unhide
# - Add the option to add the permissions for whatever is selected to hide/unhide
# - Add the option to make executable whatever is selected to hide/unhide
# Remember this only works inside the current directory/opened folder and files/folders inside that folder.
# Just comment out or uncomment whatever desired.
# Currently, only the ability to hide/unhide stuff is uncommented,
# but you can always just comment it out, and uncomment one of the "Make Executable" commands,
# and/or one of the "Change the owner and/or group of each file" commands,
# and/or one of the "Add permissions" commands, or mix and match whatever you want.
# For the changes to take effect to the file(s)/folder(s) you hid/unhid, you may have to refresh the folder, or even Nautilus

# Set IFS so that it won't consider spaces as entry separators.
# Without this, spaces in file/folder names can make the loop go wacky.

# See if the Nautilus environment variable is empty
    # If it's blank, set it equal to $1

# Loop through the list (from either Nautilus or the command line)

    # Hide/Unhide file(s)/folder(s) using ".hidden" file within the current folder
      # Copies all selected files/folders filenames to ".hidden"
        echo $FILENAME >> .hidden
      # Sorts and Checks ".hidden" for any duplicates
        sort .hidden | uniq -u > .hidden_temp
        rm .hidden
        mv .hidden_temp .hidden
      # Checks ".hidden" to see if there is anything there; if not, it removes it
        for file in .hidden
          if [ `wc -l < $file` -eq 0 ]; then
             # file is empty
             rm $file
    # Change the owner and/or group of each FILE to OWNER and/or GROUP, if desired
      # chown -R $USER:$USER $ARCHIVE_FULLPATH # set owner:group to current user
      # gnome-terminal -x sudo chown -R root:root $ARCHIVE_FULLPATH # set owner:group to root
      # gnome-terminal -x sudo chown -R $USER:$USER $ARCHIVE_FULLPATH # set owner:group to current user
    # Add permissions, if desired
      # chmod 444 $ARCHIVE_FULLPATH # read-only permissions for all
      # chmod 600 $ARCHIVE_FULLPATH # read/write for you, no permissions for rest
      # chmod 644 $ARCHIVE_FULLPATH # read/write for you, read-only permissions for rest (default)
      # sudo chmod 444 $ARCHIVE_FULLPATH # read-only permissions for all
      # sudo chmod 600 $ARCHIVE_FULLPATH # read/write for you, no permissions for rest
      # sudo chmod 644 $ARCHIVE_FULLPATH # read/write for you, read-only permissions for rest (default)
    # Make executable, if desired
      # chmod +x $ARCHIVE_FULLPATH
      # gnome-terminal -x sudo chmod +x $ARCHIVE_FULLPATH


# Add a notification when finished, if desired
    notify-send -t 2000 -i /usr/share/icons/gnome/32x32/status/info.png "Job Finished"


Copy and paste the contents of the code box above into a new document. Save it and rename it to Hide or Unhide. Make it executable (right click --> Properties --> Permissions --> Allow executing file as program). Then move the file to ~/.gnome2/nautilus-scripts.

You should now be able to access the script from your nautilus context menu. Just right click on any file(s) you want to hide or unhide and select Scripts --> Hide or Unhide. You will have to reload the folder (F5) to see the changes

The advantage of this method (besides it ease of use) is that it doesn't rename the files.

share|improve this answer

To perform the same operation as the Nautilus Script mentioned above, it's also possible to add Hide/Unhide menu to Nautilus by installing the nautilus-actions-extra package via the PPA channel here:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.