Document Sample
linux_cheat_sheet Powered By Docstoc
					                                  < The humble Linux Cheat sheet >
  A small Linux cheat sheet, introducing the very basic and very essential command for surviving the Linux CLI
                                           (Command Line Interface).
                         << >>

           Moving around in the file system
           Command                    Action
           pwd                        Print Working Directory – show what directory you’re in
           ls                         List the contents of a directory
           ls –l                      List the contents of a dir and show additional info on the files
           ls –a                      List all files, including hidden files
           cd                         Change directory
           cd ..                      Go to the parent directory

           Examining Files
           Command                    Action
           file                       Determine the type of a file
           cat                        Concatenate a file
           less                       View text files and paginate them if needed

           Manipulating files and directories
           Command                    Action
           cp                         Copy a file
           cp –i                      Copy a file and ask before overwriting
           cp –r                      Copy a directory with its contents
           mv                         Move or rename a file
           mv –i                      Move or rename a file and ask before overwriting
           rm                         Remove a file
           rm –r                      Remove a directory with its contents
           rm –i                      Ask before removing a file; good to use with the –r option
           mkdir                      Make a directory
           rmdir                      Remove an empty directory

Other useful utilities:
     The manipulate command ( man )
     The echo command ( echo ) – [ echo $HOME ] – [ echo $PATH ]
     VIM text editor
     EMACS text editor
                                Emacs Cheat Sheet

Notation – what the shortcut keys mean
Keyboard Shortcut      Action
C-x                    Hold down CONTROL and press x
                       Press and release ESC, then press x
                       (On some machines, hold down ALT and press x)

Starting, Quitting, and Help
emacs filename         From the Linux CLI, open filename in emacs
C-x C-c                Quit emacs
C-g                    Abort current command
C-x u                  Undo last command
C-h t                  Run tutorial

Moving Around
C-a                    Beginning of a line
C-e                    End of a line
M-v                    Page up
C-v                    Page down
M-<                    Beginning of a file
M->                    End of a file
C-l                    Center window on cursor

Files, Buffers, and Windows
C-x C-f                Open (or create a new file)
C-x C-s                Save
C-x C-w                Save as (write)
C-x b                  Switch to another buffer
C-x 2                  Split window in two
C-x 1                  Return to a single window
C-x 0                  Move to other window

C-s                    Search
M-%                    Find and replace with verification for each instance
M-x replace-string     Find and replace
C-w                    Cut
M-w                    Copy
C-y                    Paste (yank something into existence)
C-k                    Cut rest of current line (use again to cut end-of-line too)

Shared By: