I would like to hide every .pyc file from Nautilus. I use Ubuntu 10.04.

What could I do?

  • It sounds like you're trying to solve a completely different problem which has nothing to do with hiding files at all. – Ignacio Vazquez-Abrams Oct 18 '10 at 17:32
  • "rm -r *.pyc" would "hide" all those pesky files and free up some space at the same time. Pity they'd reappear next time you ran the program. – Mokubai Oct 18 '10 at 17:32

One option would be to not create these files at all. See this thread https://stackoverflow.com/questions/154443/how-to-avoid-pyc-files

You can also quickly delete these files from Nautilus by pressing ctrl+s, entering *.pyc pattern and hitting delete key.


Just need to open a bash terminal and run:

ls *.py[co] >> .hidden



You can add all the .pyc filenames to a .hidden file in the same directory. Requires some maintenance, but if you're like me you do a lot more modifying of existing files than creating new ones.

  • Does this work on Mac OS or only Linux ? – J4cK Jun 10 '14 at 8:01

I have read all the answers under this question and created a simple script to automate the task:


It allows to hide temporary Python files in the GNOME Files (Nautilus). Searches for the pyc/pyo files recursively and puts it to the .hidden files.

#!/usr/bin/env bash

hide() {
  for d in *.py[co]; do
    if [ -f "$d" ]; then
      echo $d
  done | tee "$(pwd)/.hidden" > /dev/null

recursive() {
  for d in *; do
    if [ -d "$d" ]; then
      (cd -- "$d" && hide)
      (cd -- "$d" && recursive)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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