== Unix Cheat Sheet == To log in to the grid, you need to use PuTTY if you use a PC, or, in the case of a mac, you can log in from the terminal. === How do I abort that command??? === Most commands can be aborted by pressing `ctr-C`. If it looks like you are in a text editor, but can't get out, try the following: * `ctr-X` * Hit `Esc` several times, and then type `:q!`and press enter. === Loggin in to other machines with SSH === The `ssh` command can be used to log in to other machines, or from a mac to the grid: {{{ $ ssh usernam@host }}} === List files === To list the files in the current directory: {{{ $ ls }}} To get more information about every file, do {{{ $ ls -l }}} To get information about a specific file or directory (you could add -l too) {{{ $ ls filename }}} === Change working directory === {{{ $ cd path }}} where path is the directory you want to change to, eg {{{ $ cd /proj/my-project }}} To print the current working directory use `pwd`. There are two "special directories": `.` and `..`. The first corresponds to the current directory, the second corresponds to the directory above the current directory. Finally, {{{ $ cd }}} without any arguments will return you to your home directory. === Copy file === To copy a file use {{{ $ cp source destination }}} You can have more than one source, but then the destination must be a directory. The final argument is always the destination. Eg. {{{ $ cp file1 file2 file3 dest_dir }}} If any of the sourcres is a directory, you have to give copy the `-r` option. {{{ $ cp -r dir1 dest_dir }}} === Removing files or directories === {{{ $ rm file }}} will remove file, If you would like to remove a directory, add the -r option to rm {{{ $ rm -r directory }}} === Create directory === {{{ $ mkdir directory_name }}} === Looking at the content of a file {{{ $ less filename }}} will bring up the content of the file on the screen. Use arrow keys to move up and down. You can search within the file by typing `/`and then what you would like to search for. Leave less by typing `q`. === Getting help on command usage === There is a man page available for most commands. It is accessed with the man command {{{ $ man cp }}} for example. You can browse with arrow keys, and leave the man page by pressing `q`