Friday, November 6, 2009

Filenames and pathnames













Filenames and pathnames

Capital and small letters are different in filenames.


Filenames can contain letters, numbers, periods, and underscores (_). Stay away from other punctuation. Slashes are special (see below).


Filenames shouldn’t contain spaces.


The ? wildcard stands for a single character in a filename. The * wildcard stands for a bunch of characters in a filename. An * by itself stands for all files in the working directory.


A pathname is the path in which you (or UNIX) can find a file or directory. The root (main) directory of the disk is called /.


A pathname consists of directory names separated by slashes (/). If a pathname starts with a slash (/), it begins at the root directory. If a pathname doesn’t start with a slash, it begins at the working directory.




Printing



On System V UNIX:
























To do this



Type this



Print file



lp textfile



Print file on a named printer



lp -dprinter textfile



Cancel a print job



cancel requestid



Check the printer queue



lpstat -a all






On Linux or BSD UNIX:
























To do this



Type this



Print file



lpr textfile



Print file on a named printer



lpr -Pprinter textfile



Cancel a print job



lprm jobnumber



Check the printer queue



lpq -a




Your version of UNIX (see Chapter 2):




  • BSD




  • System V




  • Linux




(NetBSD, FreeBSD, OpenBSD, and BSD/OS are all BSD. Solaris 1, OSF/1, and AIX are similar to BSD. Solaris 2 is similar to System V.)


Your UNIX shell (see Chapter 2):




  • Bourne Shell




  • C Shell




  • Korn Shell




  • BASH Shell








General stuff


Log in before you use UNIX. Remember your user name and password.


When you see a prompt (usually $ or %), you can type a UNIX command.


To back up and correct typos, try pressing Backspace, Delete, # (Shift+3), or Ctrl-H.


To cancel what you have typed and try again, try pressing Ctrl+U or @ (Shift+2).


Type a space between the command name and any other information on the same line.


When typing commands, use the correct capitalization; UNIX distinguishes between CAPITAL and small letters.


When you have typed the command, press Enter (or Return).


When you log in, the working directory is your home directory.


To log out, type exit.


Don’t turn off terminal until you have logged out. Don’t turn off workstations or PCs except by running shutdown or halt.





Lost and found


To find out where you are, type pwd.


To find out who you logged in as, type who am I.


To find a file if you remember its name, type:


find . -name filename -print

To find a file if you know that it contains the word dummies, type:


grep "dummies" *

Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, the For Dummies Bestselling Book Series logo and all related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates. All other trademarks are property of their respective owners.


Copyright � 2004 Wiley Publishing, Inc. All rights reserved.












No comments:

Post a Comment