Is there a series of commands that does ls then removes backup files? I want to do something like
ls | grep -v *~
but this shows all the files in different lines, any one to make the output identical to ls?
When I type in "man ls" My man page for ls has this option of -B its
-B Force printing of non-printable characters (as defined by ctype(3)
and current locale settings) in file names as \xxx, where xxx is the
numeric value of the character in octal.
It is not identical to the one you showed and I searched for ignored but no results popped up. Btw I am on a mac, which might have a different version of ls?
Alternatively, can I tell a directory to stop making backup files?
You can list all files ending in ~
with:
ls -d *[^~]
The *[^~]
specifies all files that don't end in ~
. The -d
flag tells ls
not to show the directory contents for any directories that it matches (as with the default ls
command).
Edit: If you alias your ls
to use the command above, it will break the standard ls
usage, so you're better off using ephemient's solution if you want your ls
usage to always exclude backup files.