UNIX Basics
UNIX is a powerful and vast operating system that comes in many flavors and
runs on many platforms. Although elaborate window managers have been developed
that ride on top of it, e.g. Gnome, Mac OS X, much of its power can be harnessed
by interacting with it at the command line and through
scripts (as in Matlab).
Essential Commands
Here is a list of commands that are indispensable for navigating around
the filesystem and moving files around in the file system, and for getting
help at the command line. Become familiar and comfortable with using these.
- ls – list the contents of the directory you are in
- pwd – figure out what directory you are in (this command returns a string
indicating your current path)
- exit – logout of your shell/terminal
- man – get help on a particular command.
This is very useful because it lists and explains the command line options
that one can use to tailor the behavior of individual commands. Try reading
the man pages for the commands listed on this page
- cd – change directory
- 'cd ..' – move up one directory
- 'cd matlab', or 'cd ./matlab' – move to the sub-directory called
matlab
- 'cd /home/petr/' or 'cd ~petr' – move to user petr's home directory
- 'cd ~' – move to your own home directory
- mkdir – create a directory, e.g. mkdir data
- cp – copy a file from one location to
another, e.g.
cp subject_info.txt data/
copies the file 'subject_info.txt
into the directory called 'data'
- rm – delete a file
- more – dump the contents of a text file to
the screen
- ln – create a symbolic link (an alias)
to another file or directory. symlinks are very, very useful if you want
to travel great distances in the filesystem via the command line and don't
want to have to type the full path everytime. This command is practically
always used with the -s option.
Useful commands
- apropos – a helpful command that returns commands/functions
and a brief descriptive phrase that contain the keyword you used. Useful
if you don't have a manual and want to try to find a command that you
just know has to exist.
Links
Here is a link to a Google
search for the top UNIX tutorial links. I've browsed the top few links
and found them to be concise and informative.