I usually include a date in the filename so that files and directories are listed in chronological order when I use the ls
command, e.g. 2015-08-29_letter_to_santa.txt
.
A drawback is that tab-completion is hampered. For the example above, if I want to open the letter to santa, I first need to get through the date before I can swiftly tab-complete the rest of the filename. This is annoying when many filenames start with a date.
I would like to be able to name the file something like letter_to_santa.2015-08-29.txt
but still have ls
output the files sorted by the date appearing in the filename. Any ideas of how to accomplish this, and at the same time preserving the colourful output that ls
produces?
For the sake of being specific, let's assume that a filename is on the format basename.date.extension
and .
is used exactly twice in the filename.
ls -clt
do what you want without embedding the timestamp in the filename?ls
's behavior for these filenames, it will also change them for files that don't have that filename format...chmod
). Or perhaps the dates aren't creation dates, but the date of the subject matter? That's something I do, so I might today write an article about last year's summer holiday, and I'd use the date of the holiday to help me find it later.*santa
and then ask for glob-complete-word with escape-g, so you dont need to type the start of the filename.