Useful Unix commands for CS 322 students using lex and yacc
Shamelessly cribbed from
Stanford.
Unix
- ls --- lists your files
- emacs filename & --- is an
editor that lets you create and edit a file. See the emacs
page.
- mv filename1 filename2 --- moves
a file (i.e. gives it a different name, or moves it into a different
directory (see below)
- cp filename1 filename2 ---
copies a file
- rm filename --- removes a file.
It is wise to use the option rm -i, which will ask you for confirmation
before actually deleting anything. You can make this your default by making
an alias in
your .cshrc file.
- chmod options filename --- lets
you change the read, write, and execute permissions on your files. The
default is that only you can look at them and change them, but you may
sometimes want to change these permissions. For example, chmod
o+r filename will make the file
readable for everyone, and chmod o-r filename will
make it unreadable for others again. Note that for someone to be able to
actually look at the file the directories it is in need to be at least
executable. See help
protection for more details.
- mkdir dirname --- make a new
directory
- cd dirname --- change directory.
You basically 'go' to another directory, and you will see the files in that
directory when you do 'ls'. You always start out in your 'home directory',
and you can get back there by typing 'cd' without arguments. 'cd ..'
will get you one level up from your current position. You don't
have to walk along step by step - you can make big leaps or avoid walking
around by specifying pathnames.
- pwd --- tells you where you currently are.