user2566808
user2566808

Reputation: 291

How to hide .pyc files when you enter `ls` in bash

When I perform ls in bash, I always see too many *.pyc files. Is there any way to hide these files?

Upvotes: 27

Views: 5579

Answers (1)

Matt Bryant
Matt Bryant

Reputation: 4961

This way lies the dark side, but you could force ls to never show them by adding something like

alias ls='ls --hide="*.pyc"'

to your .bashrc. ls will reveal the hidden files if you use -a or -A.

However, I would recommend just ignoring them in your head, or running this version of ls when you really don't want to see them.

Upvotes: 33

Related Questions