A Survey of Helpful Unix Commands






Information Commands

which(1)                 - locate a program file in the user's path

	which more

whereis(1)               - locate programs

	whereis more
	whereis pkg_add

file(1)                  - determine file type

	file ~/bin/*

find(1)                  - walk a file hierarchy

	find . -name ".*rc" -print
	find . \( -name "*~" -o -name "*.bak" \) -exec rm {} \;



Text Manipulation Commands

diff(1)                  - find differences between two files

	diff file1 file2
	diff file1 dir2
	diff dir1  dir2

wc(1)                    - word, line, and byte count
	
	wc ~/.login ~/.tcshrc

grep(1), egrep(1), fgrep(1) - print lines matching a pattern

	grep -i path .login .tcshrc
	grep Foo *.c

cut(1), paste(1)         - extract or merge fields or columns from lines

	who | cut -d" " -f1 | paste - -



Packaging and Compression Commands

ar(1)                    - maintain file library

	ar qv project.ar *.c
	ar t project.ar
	ar rvb foob.c project.ar fooa.c
	ar xv project.ar fooa.c foob.c

tar(1)                   - tape archiver; manipulate tar archive files

        tar tf foo.tar
	tar tzf foo.tgz
	tar xvf foo.tar
	tar xvzf foo.tgz
	tar cvzf foo.tgz ~/working

gzip(1), gunzip(1), zcat(1) - compress or expand files

	gzip foo.tar
	gunzip foo.tar.z
	zcat foo.tar.z | tar tvf -

compress, uncompress, zcat - compress and expand data

        compress foo.tar
        uncompress foo.tar.Z

zip, unzip - package and extract compressed archive files



Utility Programs

at(1), batch(1), atq(1), atrm(1) - queue, examine or delete jobs for later execution

	at 5:00pm
	echo "Time to go home!"

	at now + 2 minutes
	echo "Move on to next topic."

crontab - maintain crontab files for individual users

        crontab -e
	crontab -l

bc(1)                    - An arbitrary precision calculator language

	bc
	23+47



Programming Tools

gcc, g++ - GNU project C and C++ Compiler

       gcc -g -c file.c
       g++ -g -c file.cpp
       gcc -o program file1.o file2.o main.o
       g++ -o program file1.o file2.o main.o

make(1)                  - maintain program dependencies

	make foo
	make -f Makefile.Project1 MACRO="Value" program1 program2

touch(1)                 - change file access and modification times

	touch foo.c




Layne Watson <ltw@cs.vt.edu>
Last modified: Thu Sep 18 11:52:46 EDT 1997