prevent accidents while using wildcards

rm *.txt <TAB> <TAB>
alternative for "echo rm *.txt". Just doubletab the command you are willing to use and it will show you the affected files.
Sample Output
linux:/tmp # rm *.txt
wildcard.txt   tab.txt

By: boschi
2010-11-04 13:58:15

1 Alternatives + Submit Alt

What Others Think

This doesn't seem to be working for me in bash. It works in zsh however. Is there a setting to get it to work in bash?
Jacolyte · 568 weeks and 4 days ago
Not working here either, Bash 4.00
kovan · 568 weeks and 3 days ago
It works for me in 4.0.35. Make sure not to put a space after the txt
ProfessorTux · 568 weeks and 3 days ago
There is something in my bashrc that is preventing it from working, but I don't know what it is (my bashrc has 250 lines).
kovan · 568 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: