| 1. | |
| ls | list files in current directory |
| ls -l | long list of files in current directory |
| ls -a | list all files (including hidden) in current directory |
| 2. | |
| pwd | print working directory |
| 3. | |
| cd dirname | moves into the directory with name `dirname' |
| cd | cd on its own takes you back to your home directory |
| cd .. | moves up one level in directory hierarchy (the .. always means the parent directory to the one you presently occupy) |
| 4. | |
| mkdir dirname | makes a new directory with name `dirname' |
| rmdir dirname | removes the (empty) directory with name `dirname' |
| rmdir -r dirname | recursively removes directories and subdirectories |
| 5. | |
| cp file1 file2 | makes a copy of file1 and calls it file2 |
| mv file1 file2 | moves (deletes) file1 to (creates new file) file2 |
| rm file1 | removes (deletes) file1 |
| rm -i file1 | asks for confirmation that you want to delete file1 |
| 6. | |
| history | lists your last 10 (variable) commands and numbers them |
| !! | repeats your last unix command |
| !23 | repeats the command numbered 23 |
| !f90 | repeats the last command beginning with e.g. 'f90' |
| !!addtext | appends 'addtext' to previous command line |
| ^string1^string2 | substitutes 'string2' for 'string1' in previous command |
| 7. | |
| command > file1 | redirects the output of 'command' to 'file1' instead of to standard output (screen) |
| command >> file1 | appends the output of 'command' to 'file1' instead of to standard output (screen) |
| command < file1 | takes input for 'command' from file1 |
| command1 | command2 | pipe standard output of command1 to standard input of command2 |
| 8. | |
| . | working directory |
| .. | parent directory to working directory |
| ~ | home directory |
| / | root directory |
| * | wildcard standing for any string of characters |
| ? | wildcard standing for any single character |
| 9. | |
| more file1 | displays the file 'file1' a page at a time |
| 10. | |
| man utilityname | manual pages for the utility 'utilityname' |
| 11. | |
| ctrl C | interrupts whatever is currently running. (It can get you out of trouble at embarrassing moments) |
| 12. | |
| chmod | changes file and directory permissions (ls -l will show xdrxdrxdrx which means all permissions granted; a dash in any position means a permission denied) (first x indicates a directory, - a file) (next 3 groups of rwx correspond to user(u), group(g), others(o)) |
| chmod u+r file1 | + grants, -removes permission to read(r), write(w) or execute(x) for user(u), group(g), others(o) or all(a) (for directories, ...) |
| 13. | |
| lp -Pprintername file1 | prints file1 to printer `printername' |
| lpq -Pprinternmame | enquiry, print queue |
| lprm -Pprintername jobnumber | removes from print queue |
| 14. | |
| cal month year | displays days/dates of month/year (try cal 1752 and look at September!) |
| 15. | |
| wcfile | counts lines, words, characters |
| 16. | |
| who | display the users who are logged-on |
| 17. | |
| who am i | obvious |
| 18. | |
| cat files | concatenate and display files |
| 19. | |
| grep pattern files | search files for pattern |
| 20. | |
| sort files | sort the specified files |