UNIX For Dummies

The UNIX operating system does things in its own UNIX way, so you need to get familiar with shell commands and garner some general tips for dealing with UNIX and finding your place within the system. Of course, you can do everyday things within UNIX, such as name files and print them, but even then, you need to know the UNIX way to accomplish these tasks.






>


>


UNIX Shell Commands


Whether your UNIX uses a Bourne-style shell or the C shell, you can do some simple typing to execute a range of commands. The following list shows a list of commands and what to type to execute them:











































































To Do ThisType ThisTo Do ThisType This
Cancel a commandCtrl+U, Ctrl+X, or @List filenames with sizes and datesls -l
Change the working directory to /usrcd/ usrList hidden files tools -al
Change the working directory back to your home directorycdList files and pause when screen is fullls | more
Copy a filecp oldfile newfileLook at a text filecat letter
Copy a file to another directorycp oldfile dirnameLook at a long text filemore letter
Copy a bunch of files to another directorycp budget* dirnameMake a new link (name) for a fileln oldname newname
Copy all the files in this directory and in all its
subdirectories
cp -r * newdirMake new links (names) for files in a directoryln dirname/* newdir
Erase a filerm junkfileCombine two filescat file1 file2 > newfile
Rename a filemv oldname newnameCompare two filesdiff file1 file2
Move a file to another directorymv oldfile dirnameLook at the manual page for the ls commandman ls
List filenameslsChange your passwordpasswd




>



>


>


How to Print with UNIX


UNIX lets you do everything any other operating system does, and that includes printing files and documents. The following table shows you how to print whether you’re on a System V UNIX or using Linux or BSD UNIX.




























To Do ThisType This on System V UNIXType This on Linux or BSD UNIX
Print filelp textfilelpr textfile
Print file on a named printerlp -dprinter textfilelpr -P printer textfile
Cancel a print jobcancel requestidlprm jobnumber
Check the printer queuelpstat -a alllpq -a

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: Bourne Shell, C Shell, Korn Shell, and BASH Shell.





>



>


>


General UNIX Tips and Lost-and-Found Insight


Working with UNIX isn’t that complicated, but it does mean getting familiar with a whole new set of commands and ways of doing things. Here are some general tips when working in UNIX:



  • 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.




If you forget where you are, how you logged in, and for other lost-and-found tips, use these:



  • 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" *







>



>


>


UNIX Filenames and Pathnames


UNIX isn’t alone in being persnickety about creating and finding filenames and pathnames. Keep the following tips in mind as you create and search through UNIX files:



  • 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.







>






>
dummies


Source:http://www.dummies.com/how-to/content/unix-for-dummies-cheat-sheet.html

No comments:

Post a Comment