------------------------------------------------------------------ General Unix ------------------------------------------------------------------ After loggin in, you will see a prompt "%" for you to give commands To: Type ------------------------------------------------ logout "exit" or "logout" list directory "ls" list a file "foo" "cat foo" list a multi-screen file "f1" "more f1" Just enough of the file as fills a screen will be shown, at which point you will be prompted, at the bottom of the screen, "more(55%)" (or whatever % of the file you've seen so far). Type "" to see more, or "q" to stop list a multi-screen file "less foo" More sophisticated. , q, work as before; "b" for backing up one page; type "h" for help for a list of commands print the file "shakesp.play" "lpr shakes.play" remove a file "rm foo" re-name a filed "mv file1 file2" copy a file "cp file1 file2" ***WARNING*** regarding "rm","mv", and "cp"************************ Unix will not ask if you're sure when you "rm"; if you loose the file, that's it, except for seeing the system administrator about the backup tapes (if the file's been around for at least a day); for "mv" and "cp", the second file named need not already exist, but if it does, it will be overwritten! If you use "rm -i file", etc, you will be asked if you are sure. This is a pain, so one can put "alias rm rm -i", and similarly for "mv" and "cp", in ones ".login" file, just as soon as we learn about editors. Another good thing to try there is "alias l "ls -stF"" in you ".cshrc" file ****************************************************************** mkdir "make a directory" rmdir "remove a directory" "cd" = change-directory Try "mkdir subdir"; then "cd subdir." You are now in the subdirectory "subdir"; you can create files here which will not show up with "ls" from the main directory, and you can move files to and from directories and subdirectories and subsubdirectories etc. If you are in the subdirectory "birds" of your main directory, and you want to put "foo" in the subdirectory "carnivores" of the subdirectory "mammals", type "mv foo ~/mammals/carnivores/foo" or just "mv foo ~/mammals/carnivotes" If you just want to move yourself there, then "cd ~/mammals/carnivores" works. The "~" stands for the "top level" directory, which is your user name, which is actually a sub...sub directory of the file system. If you are ever lost in that, you can always click your ruby slippers and type just plain "cd" which will put you back in your home directory. ****************************************************************** Unix conventions for commands with options: "command -option1 -option2 .... [argument]" Where the [argument] is not always necessary. E.g. "ls" is a command, the file "foo" is an argument, and "s" is an option. Try "ls"; try "ls foo"; try "ls -s"; try "ls -s foo" Sometimes related options are bunched together if each is only one letter long. E.g. "ls" has also the option "F" which puts "*" at the end of executable files, "/" at the end of files which are really directory names, etc. I'll soon explain how to use the on-line manual, so you can look up the meaning of other "ls" options, e.g. "t", as well as many other things. Try "ls -a"; "ls -s"; "ls -sa"; try using the "l" option, too. ****************************************************************** ****************************************************************** "man" is the on-line manual e.g. "man ls" explains about "ls" HELPFUL: "keyword" option: "man -k screen" will list out for you all the commands it known how you explain, which have `screen' in their description. This is helpful, because often you want to know about, or know what is, a command, but you don't know what its called, so you first do "man -k (some word describing what I want to know about)" also, we can use "pipes", e.g., "more file|spell|sort|lpr" ------------------------------------------------------------------ EMACS ------------------------------------------------------------------ To use the screen editor emacs on a file, type "emacs foo" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MOVING: ^p up ^b backwards * ^f forwards ^n down ^a (move to beginning of line) ^e (to end of current line) [Convention: "^p" means type "p" while holding down the CONTROL key; "ESC-p" means PRESS (don't hold down) the ESCAPE key, then "p"] ESC-< top of file ESC-> bottom of file - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ^u multiple commands; try ^u, then "66", then "-" try ^u, then "10", then ^p ^g "stop"/"get me outta here" (e.g. you accidentally typed a command you don't understand or emacs asks you a question you don't understand) (press more than once if necessary) ^d deletes char to your right ["delete" key, of course, deletes one character to the left of curser] ^k deletes entire line to your right,up to (not incl) "newline" ^L cleans up screen if it gets messed up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ^x^s save the file ^x^c exit emacs ^z "temporarily leaves emacs" then you can "mail" or "ls" or whatever and then "fg" ("foreground") brings you back, so you can have several things "frozen" in teh background, and not have to exit and re-enter each time... [^z works when you are doing other things, e.g. "mail" on unix] ^x^f load a file into a second buffer (emacs will prompt you to give it the name of the file) ^x-b (control-x, followed by b) switch between buffers ^x-^b list all the buffers one can ^x-b to - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ESC-x "I'm about to give you a command" [command prompt appears @bottom] ESC-x auto-fill for automatic carriage returns at end of lines ESC-x spell-buffer ("buffer"/"region"; "spell"/"ispell" try instead) ESC-q fill-paragraph ESC-x "ce li" (for "center-line") [typing SPACE will make emacs guess the rest of the command (also try TAB), or give you a list of possible completions; try ESC-x, "sp "; or ESC-x, "au " then the computer fills this to "auto-", then type "f" followed by a return since this uniquely characterized the command we want. If you hit a return and that's not the case, emacs will politely ask for more; try ESC-x, followed by "sp" and then hit return] ^x 1 makes extra windows go away ^h help......(lots and lots in "tutorial" even MORE in "info") To "mark" (or "shade" or "define") a region, use ^-@ or ^- and you'll be told "mark set"; the region is then defined as the area between the mark and where your curser is. Try ESC-x "pr " (you'll get a list) Try ESC-x "isp " and "spe "; to check the spelling of the work you're on, try ESC-$ Try ESC-x "fill-re" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -