Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I need to display the permissions details for all the files names in a directory that begin with just "_".
I have tried various commands using ls and find and no joy.
ls -l -- -*
The -- indicates that what follows are not command line options.
Based on your update, for underscores you should just be able to do:
ls -l _*
Though the -- option won't hurt (it just won't do anything in that case)
"-" is interpreted as a parameter, but you don't need to suffer, just append the path before the file name or just use ./.
touch ./-badfilename1 ./-badfilename2
ls -l ./-*
ls -l /full/path/for/the/file/-*
And every command will just work (ls, rm, cat, touch etc!).
Required, but never shown