Pedro's Unix Cheat Sheet developed for TASTYTRONIC INDUSTRIES version 1.0 -- 11.22.02 ----------------------------------------------------------------------- Table of Contents: ----------------------------------------------------------------------- 1. Shell Commands -- moving files around and stuff like that 2. The vi Editor -- editing text files and whatnot 3. screen -- have multiple sessions in one window ----------------------------------------------------------------------- 1. SHELL COMMANDS -- moving files around and stuff like that ----------------------------------------------------------------------- DOS is a lot like the shell -- so if you have any experience with DOS in Windows, you'll be a step ahead in UNIX. cd [directory] change to "directory" (directories = "folders") cd .. change up one directory mv [old] [new] move old to new (file/dir) rm [filename] remove filename rm -rf [directory] remove whole directory(!) add -v for "verbose" mkdir [name] make new directory ls list files cp [old] [new] make a copy of "old" called "new" cp -r [old] [new] make a copy of folder "old" called "new" add -v for "verbose" exit or ^d -- quit the shell ----------------------------------------------------------------------- 2. VI EDITOR CHEAT SHEET -- editing text files and whatnot ----------------------------------------------------------------------- vi [filename] -- edit file called "filename" i -- Insert mode for writing ESC -- command mode (for saving and quitting and other fun stuff) To do commands you must be in COMMAND MODE (hit ESC): ----------------------------------------------------- :w -- save the file :q -- quit vi :q! -- quit and *don't save any changes* :wq -- write changes and quit ADVANCED EDITING: dd -- delete this line ndd -- delete n lines including this one (where n is a #) yy -- yank this line (like copy in Windows) nyy -- yank n lines including this one p -- paste back lines or characters deleted or yanked u -- undo last change r -- redo last change ----------------------------------------------------------------------- 3. SCREEN -- have multiple sessions in one window ----------------------------------------------------------------------- Screen is a program that allows you to have several login sessions at once in one terminal window. It also keeps your programs running when you log off and lets you pick them up when you log back in. You do not NEED screen... but if you find out that you're annoyed with having to start everything up again, or logging in multiple times, screen is the tool for you. screen -- start a NEW screen session screen -r -d -- pick up a preexisting screen session screen -ls -- list screen sessions without doing anything screen -r -d [number] -- pick up screen session [number] ^a -- command key ^a ? -- help ^a d -- detach session ^a c -- create new window ^a [0-9] -- change to window 0-9 ^a l -- redraw screen (if it gets messed up) ^a S -- split window ^a X -- destroy split window ^a :resize +5 -- enlarge window 5 lines ^a :resize -5 -- remove 5 lines from window ^a :resize 10 -- make this window exactly 10 lines *** make SURE you use "screen -r -d" if you think you're picking up an old session -- if you just do "screen" you'll start a NEW one and the old one will still be waiting for you to come pick it back up! ***