I understand the tilde (~) at the end of a file displayed in bash is a backup file in the Linux file system. Is there a way to keep these hidden when listing the contents of a directory?

link|improve this question

50% accept rate
1  
That's not defined "in the Linux file system" (there isn't a "Linux file system"). It's just defined by convention, and certain tools assume that's what it means. – Daenyth Jun 7 '11 at 19:04
feedback

migrated from stackoverflow.com Jun 7 '11 at 21:21

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 3 down vote accepted

"ls -B" will ignore backup files, too.

link|improve this answer
feedback

You can use ls --hide='*~' to not show files matching that pattern. You could add an alias for it in your shell's rc file like this:

alias ls="ls --hide='*~'"
link|improve this answer
You mean alias ls="ls --hide='*~'". – Daniel Cassidy Jun 6 '11 at 16:23
Yes, thanks. Remember both questions and answers here are like wiki pages, you can edit them and fix mistakes yourself. That would have been a good candidate for a quick fix. – Caleb Jun 6 '11 at 16:28
feedback

Your Answer

 
or
required, but never shown

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