These pages are deprecated (latest changes date from end 2001). More recent information may be found at http://www.coresequence.com/training.php. I leave the old pages here as they are because lots of people are still visiting them (eventhough they aren't spell-checked), and because the basics are still useful.
| Introduction to Basic Unix System Administration | ||
|---|---|---|
| <<< Previous | Next >>> | |
As we discussed earlier, a directory is just a special file, so all naming rules for files apply equally to directories.
File names may contain any character except a /, which is reserved by the system as a separator between files and directories in a pathname. Even spaces are legal in a filename, but they can be hard to spot. Other special characters are allowed as well, but we advice on using only letters, numbers and dots, because the shell has its own interpretation for special characters.
chap1 and 2chap
a.very.long.filename.for.a.very.short.file
another-long-filename
![]() | Unix filenames do not, unlike some other systems, require a dot in the name. |
![]() | On some older systems, the lenght of the filename may be limited to 14 characters. On most modern Unices it is also limited, but within reason. |
![]() | A filename must be unique in its directory. Note that file, File, fILE and FILE are 4 different files (Unix is case-sensitive). |
Wildcards are used to specify a requirement to which filenames should comply. We'll show a practical example using the ls and cd command.
tille:~/files>ls a304.htm abook.ps book1.htm c174.htm c69.htm chap3.xml php-man abook.aux abook.tex c128.htm c18.htm c70.htm chap4.xml test/ abook.dvi abook.xml c129.htm c255.htm chap1.xml f13.htm abook.log app1.xml c17.htm c304.htm chap2.xml f14.htm tille:~/files>ls c* c128.htm c17.htm c18.htm c304.htm c70.htm chap2.xml chap4.xml c129.htm c174.htm c255.htm c69.htm chap1.xml chap3.xml tille:~/files>ls chap* chap1.xml chap2.xml chap3.xml chap4.xml tille:~/files>ls ?h* chap1.xml chap2.xml chap3.xml chap4.xml php-man tille:~/files>ls chap[1-4].xml chap1.xml chap2.xml chap3.xml chap4.xml tille:~/files>cd t* tille:~/files/test> |
The asterix will replace as many characters as possible, while the question mark only replaces a single character. Square brackets match a series of characters, as shown in the example below, which prints all programs in /bin starting with a, b or c:
tille@sprawl:~>ls /bin/[a-c]* /bin/arch* /bin/awk@ /bin/bsh@ /bin/chown* /bin/csh@ /bin/ash* /bin/basename* /bin/cat* /bin/consolechars* /bin/cut* /bin/ash.static* /bin/bash* /bin/chgrp* /bin/cp* /bin/aumix-minimal* /bin/bash2@ /bin/chmod* /bin/cpio* |
| <<< Previous | Home | Next >>> |
| Configuring your graphical environment | Some usefull commands to handle files |