Take the 2-minute tour ×
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
__init__.py     calculus.py     conditional.py      counting.pyc        distributions.pyc   event.pyc       objects.pyc
__init__.pyc        calculus.pyc        counting.py     distributions.py    event.py        objects.py      plots.py
ceasarbautista@hse140:~/Desktop/Statistics/statistics/probability$ ls | grep -v .pyc
__init__.py
calculus.py
conditional.py
counting.py
distributions.py
event.py
objects.py
plots.py
ceasarbautista@hse140:~/Desktop/Statistics/statistics/probability$ ls -C | grep -v .pyc
conditional.py      event.py
share|improve this question
add comment

2 Answers

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
add comment

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: gist.github.com/1308159 –  Ceasar Bautista Oct 24 '11 at 1:14
add comment

Your Answer

 
discard

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.