For example, how can I replicate:
ls *.txt
when my text files are missing the .txt
ending, and as far as extensions go appear the same as many other types of file?
Alternatively, is it possible to list specifically just the files which have NO file extension?
Best Answer
To match files that do not have an extension at all, you can use the command
To match files that do not have a
.txt
extension, you can use the commandThis will pass the list of files in the current directory to
grep
, which will remove all file names that have a.
(or.txt
for the second command) in them.