Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Debian GNU/Linux Reference Guide
Prev Home Next

4.3.8 Shell wildcards

Often you want a command to work with a group of files without typing all of them. The filename expansion pattern using the shell wildcards facilitate this needs.

  • *

    • This matches any group of 0 or more characters.

    • This does not match a filename started with ".".

  • ?

    • This matches exactly one character.

  • [...]

    • This matches exactly one character with any character enclosed in brackets

  • [a-z]

    • This matches exactly one character with any character between a and z.

  • [^...]

    • This matches exactly one character other than any character enclosed in brackets (excluding "^").

For example, try the following and think yourself:

     $ mkdir junk; cd junk; touch 1.txt 2.txt 3.c 4.h .5.txt
     $ echo *.txt
     1.txt 2.txt
     $ echo *
     1.txt 2.txt 3.c 4.h
     $ echo *.[hc]
     3.c 4.h
     $ echo .*
     . .. .5.txt
     $ echo .[^.]*
     .5.txt
     $ echo [^1-3]*
     4.h
     $ cd ..; rm -rf junk

Debian GNU/Linux Reference Guide
Prev Home Next

 
 
  Published under the terms of the GNU General Public License Design by Interspire