0

How can I use the ls command to print all of those files with a .doc extension inside the "tmp" directory? (No find neither grep). Perhaps with -X ? How would it be if we used -X?

j1nma
  • 457
  • 3
  • 9
  • 24

3 Answers3

3

If you're adamant on not using grep or find, as outlined here:

https://stackoverflow.com/a/1447974/1666167

You can do something like this:

ls *.{mp3,exe,mp4}

What this looks like for .doc files in the tmp directory is this:

ls /tmp/*.doc
Community
  • 1
  • 1
Jordan Robinson
  • 855
  • 11
  • 25
1

You could do something like: ls *.doc in the directory.

Bey0ndZ
  • 114
  • 3
  • " cannot acces */.doc: No such file or directory" i need to add that it should search on the tmp directory – j1nma Aug 23 '14 at 21:30
1

Try this one, should work:

 ls *.doc