Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Since I write in Python a lot it's kind of annoying to see .pyc files all the time and I would like to just hide them at this point. I tried the following, but I can't seem to figure out how to get it to print in multiple columns.

ceasarbautista@hse140:~/Desktop/Statistics/statistics/probability$ ls      counting.pyc        distributions.pyc   event.pyc       objects.pyc
__init__.pyc        calculus.pyc
ceasarbautista@hse140:~/Desktop/Statistics/statistics/probability$ ls | grep -v .pyc
ceasarbautista@hse140:~/Desktop/Statistics/statistics/probability$ ls -C | grep -v .pyc
share|improve this question

2 Answers 2

up vote 6 down vote accepted

You can do that like this:

find . ! -name '*.pyc' -exec ls -dC {} +

Or with an advanced shell:

ksh: ls -dC !(*.pyc)

zsh: setopt extendedglob then ls -dC ^*.pyc

bash: shopt -s extglob then ls -dC !(*.pyc)

share|improve this answer

Filter through column.

ls | grep -v '\.pyc$' | column
share|improve this answer
So this works pretty well except that sometimes I get something like this: – Ceasar Bautista Oct 24 '11 at 1:14

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.