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?
Asked
Active
Viewed 6,258 times
0
S.L. Barth is on codidact.com
- 8,198
- 71
- 51
- 66
j1nma
- 457
- 3
- 9
- 24
3 Answers
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
-
error jumps up, need to indicate to search inside tmp directory – j1nma Aug 23 '14 at 21:31
-
Is that the precise error? I've just tried it myself to double check and it seems okay. – Jordan Robinson Aug 23 '14 at 21:33
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