Unix Hints
This page lists Unix hints that you might find useful for CMPS 111. Topics include
- Access control lists
- RCS
- CVS
Using AFS access control lists (ACLs) on unix.ic
The main computer system at UC Santa Cruz (unix.ic) uses AFS to store its files. AFS supports, among other things, a flexible way of specifying who can access files in particular directories. This can be useful when you want to share a directory with another user, such as your project partner.
AFS permissions apply to entire directories, not just files. You can allow another user (username in the example) to read and write all of the files in a directory (dir in the example), as well as create and delete files, with the following command:
fs sa dir username rlidw
Note that this will only affect dir, not any directories currently below it. However, new directories created inside dir inherit their access lists from the access list of the parent when the new directory is created.
If you want to remove permissions for a user, use the following command:
fs sa dir username none
You can also list the permissions for a directory with:
fs la dir
tar and gnutar
Often, it's useful to move files around in large numbers. Rather than copy all of the files, it's usually more convenient to use tarballs—compressed tar files. These are files created by the Unix tar program and then compressed using (typically) gzip. The GNU tar program (called gtar on unix.ic) can do compression as part of creating or unpacking a tar file without the need for a second command. Sample gtar commands include:
- gtar czf tarball.tgz file1 file2 file3
This command creates a tarball called tarball.tgz that contains file1, file2, and file3. - gtar czf tarball.tgz dlxos
This command creates a tarball called tarball.tgz that contains the contents of the directory dlxos (assuming it is a directory). Note that it'll contain every file and directory contained in dlxos—it recurses down the directory tree. - gtar tzvf tarball.tgz
This command lists (t means "table of contents) the contents of tarball.tgz. - gtar xzf tarball.tgz
This command extracts (x) files from tarball.tgz. The files are placed in the current directory. Note that it's often a good idea to do this in an empty directory in case the tarball has all its files at the "top level". If so, your directory will have all the files in it directly, rather than in a subdirectory.
RCS (Revision Control System)
Last updated 18 Oct 2004 by Ethan L. Miller (elm at ucsc dot edu)