Thursday, April 21, 2011

Unix Commands

UNIX is case-sensitive.

Files
ls --- lists your files
ls -l --- lists your files in 'long format', which contains lots of useful information, ls -a --- lists all files, including the ones whose filenames begin in a dot,
more filename --- shows the first part of a file
emacs filename --- is an editor that lets you create and edit a file
mv filename1 filename2 --- moves a file
cp filename1 filename2 --- copies a file
rm filename --- removes a file.
diff filename1 filename2 --- compares files, and shows where they differ
wc filename --- tells you how many lines, words, and characters there are in a file
chmod options filename --- lets you change the read, write, and execute permissions on your files.

File Compression
gzip filename --- compresses files, so that they take up much less space.
gunzip filename --- uncompresses files compressed by gzip.

printing
lpr filename --- print. Use the -P option to specify the printer name if you want to use a printer other than your default printer.
lpq --- check out the printer queue, e.g. to get the number needed for removal, or to see how many other files will be printed before yours will come out
lprm jobnumber --- remove something from the printer queue. You can find the job number by using lpq. Theoretically you also have to specify a printer name, but this isn't necessary as long as you use your default printer in the department.
genscript --- converts plain text files into postscript for printing, and gives you some options for formatting.
dvips filename --- print .dvi files (i.e. files produced by LaTeX). You can use dviselect to print only selected pages.

Directories
mkdir dirname --- make a new directory
cd dirname --- change directory. You basically 'go' to another directory, and you will

No comments:

Post a Comment