List all the files in ending with several file extensions?

Use this: ls -l /users/jenna/bio/*.{fas,pep}

Or this: find /users/jenna/bio -iname '*.pep' -or -iname '*.fas'


The thing that's most likely to work out of the box is brace expansion. It works in bash, zsh and ksh.

ls -l /users/jenna/bio/*.{fas,pep}

(No spaces anywhere around the braces.)

In bash and ksh, this displays an error if one of the extensions isn't matched, but lists the files matching the other extension anyway. The reason for this is that brace expansion isn't a wildcard matching feature, but a textual replacement: *.{fas,pep} is converted to *.fas *.pep before the shell starts looking up files that match the patterns. In zsh, you'll get an error and the command won't run, but there's a better way: an “or” glob pattern. This one won't error out unless none of the extensions match.

ls -l /users/jenna/bio/*.(fas|pep)

Or patterns are also available with a different syntax: @(…|…); in bash, this syntax needs to be activated with shopt -s extglob, and in zsh, this syntax needs to be activated with setopt ksh_glob.

ls -l /users/jenna/bio/*.@(fas|pep)

(Some of this behavior can be configured. All my statements apply to the shells' default configuration unless explicitly specified.)