Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've used DOS for 22 years but I'm new to Linux. So in Linux, when I execute

ls -R *.zip

Why do I receive:

ls: *.zip: No such file or directory

When I'm at the top of a huge folder and file tree? Alternatively, how do I do

Dir /s *.zip

In Linux?

share|improve this question
I hear that this is possible in the zeal shell (with similar syntax): ls **/*.zip – Ярослав Рахматуллин Nov 27 '12 at 14:50
up vote 3 down vote accepted

Try ls -R|grep .zip or for full paths:

find .  -name '*.zip'

This will find any files ending in .zip in current directory and any subdirectories.

It seems a little longer but is much more powerful than the dir /s *.zip way of windows.

share|improve this answer
Okay - I getcha. I sometimes use dir /s/a/b|find /i "blah" which is conceptually the same. – Luke Puplett Nov 27 '12 at 12:42
Exactly; grep matches a string, or if you use "grep -E 'blah'" then you can use regular expressions in it – Justin Nov 28 '12 at 0:09

To expand a bit further on the above answer, on Linux, the wildcards are expanded by the shell, which means that the shell will call the command with a list of matching file names as arguments. And the shell only looks in the current directory for matching files (or in whatever directory you specify prior to the wildcard). For example, a command such as:

ls *.zip

will actually translate into:


And, if there are no .zip files in the current directory, the literal file name *.zip gets passed to the command, in which case it doesn't fine a file called *.zip. (A * is a legal character in a Unix/Linux file name, btw). Now if you don't want the shell to expand the wildcards, but instead if you want the wildcard passed directly to the command you are calling, you will have to enclose it in quotes. This has an interesting effect, in that a command such as:

find . -name *.zip

will give the expected results if you have no .zip files in your current directory (the find command sees *.zip). But if you do have one or more .zip files in the current directory, what gets executed is:

find . -name

which won't find any matches in any subdirectories (unless they happen to be named exactly or, etc). So the moral of the story is, when using find, make sure to use quotes around any file name with wildcards.

share|improve this answer
Wow. Thanks Derek. – Luke Puplett Nov 29 '12 at 21:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .