Linux Mall - The Linux SuperStore!
Linux books, Linux CDs, Linux toys, you name it, they have it!

W W W . L I N U X D O T . O R G

Newbie's Linux Manual
Files
by Laurence Hunter
[ Home ] [ Contents ] [ Download*] [ Previous ] [ Next ]
* In Linux enter: unzip nlm.zip
Filename Guidelines

* A filename can be between 1 and 256 characters.

* The following characters can be used:

a..z A..Z 0..9 - _ .

* The following characters are not advised:

space < > ' " * { } [ ] ( ) ^ ! \ | & $ ? ~

...although you can use them by enclosing filenames in ' ' or " " whenever filenames contain these characters.

* Filenames are case-sensitive (e.g. The shell sees hello and Hello as two different files).

* Start a filename with a period (.) to make it hidden (to view hidden files enter: ls -a).

Note:

The above 5 rules also hold true for directory names, since technically a directory is just a file that holds special information.

Wildcards
+-------+-----------------------------------------------------+
|   *   | Represents any mix of characters.                   |
+-------+-----------------------------------------------------+
|   ?   | Each ? represents any character, and only one.      |
+-------+-----------------------------------------------------+
| [...] | Represents a range of user-specified characters.    |
+-------+-----------------------------------------------------+

Any time a filename is used, you can replace parts of the filename or all of it with wildcards. Any sensible combination you can think of can be used. You can even use wildcards to specify directories. By far the most frequently used is the asterix (*).

Examples:
Consider the following directory:
cartoon.png   ex2.html   ex10.html    logo.png
ex1.html      ex3.html   index.html

rm e*
Would remove: ex1.html; ex2.html; ex3.html; and ex10.html


ls *.png
Would list: cartoon.png; and logo.png


rm ex[13]*
Would remove: ex1.html; and ex3.html


ls ex[1-3].txt
Would list: ex1.html; ex2.html; and ex3.html


rm ex?.html
Would remove: ex1.html; ex2.html; and ex3.html (but not ext10.html).


rm ex??.html
Would remove ex10.html.

[ Home ] [ Contents ] [ Download*] [ Previous ] [ Next ]
* In Linux enter: unzip nlm.zip
Homepage | The Last 5 Days | The Daily Linux News | The Linux Bits | Newbie's Linux Manual
The Best Linux Sites | Linux Book Reviews | A Windows Vendetta?
Diary of a Linux Newbie | Diary of an Open Source Newbie
The Linux Forum | Just For Fun
Amazon - The World's Biggest Bookstore!
4.7 million books, CDs, videos, and DVDs available to buy!
© MM Linuxdot.org | Webmaster | Manual's Copyright Terms