Search A-Z index Help
University of Cambridge Home Physics Dept Home Mike Roses' Home Page TCM Group Home

UNIX Twiddles

This is a nice one:
rm: cannot unlink `some file thing': Permission denied
usually this is because the user does not have write access to the directory in which the "some file thing" is. A chmod u+w directory then allows rm to do its work.

To spell check words from the command line you can often use: ispell -a to enter interactive mode. On redhat linux systems this command actually uses aspell. Output of time command to a file.

examples that work:

for the builtin bash shell function:
{ time sleep 1 ; } >& outfile

the actual command:
/usr/bin/time sleep 1 >& outfile

How to delete files with a "-" (minus, dash) in front of them?

rm will normally interpret the -xx as an option because it starts with a minus sign. There are two ways to avoid that:

Make sure the file name does not start with a minus: For files this is always possible. You can use the full absolute path to the file or relative:

rm /tmp/-xx (assuming that the file -xx is in /tmp)
rm ./-xx

Most unix commands accept a double minus (--) to indicate that this is the end of the options list.

rm -- -xx

How to delete files that contain white space or other control characters (*)?

Use the \ character to escape them:

rm the\ file\ with\ spaces\ in\ it
rm afilewith\*anasterixinit