Home > Help Files > Unix > Useful Unix commands

Help Files: UNIX


[Basic Commands] [Advanced Commands] [Fortran]

Useful Unix Commands

Command Description
Interrupt CTRL-C will interrupt almost anything
cd d Change to directory d
cp f1 f2 Copy file f1 to f2
date Display current time and date
mkdir d Create new directory d
rmdir d Remove directory d
ls List the current directory
ls -l List the current directory using long format
ls -F List with executable files starred and directories
man Information on the many options for command
more f1 Display contents of f1
mv f1 [f2...] d Move file f to directory d
mv d1 d2 Rename directory d1 as d2
passwd Change password
ps Process status on the current job
rm file Remove (delete) file
unalias name1[na2...] Remove command alias na
ssh nd Login securely to another machine
exit End terminal session
sentenv name v Set env var to value v (csh/tcsh)

Advanced Commands

Command Description
alias name1 name2 Create command alias (csh/tcsh)
cal 5 1983 Print calendar for May 1983
cal 1984 Print the 1984 calendar
cat Catenate
Ex: cat filename.ext ... List file on terminal
       cat file1 > file2 ... Send listing to file2
id Show user's identification number, group id number and the group names to which they belong
pwd Show current path to working directory
who List the currently logged on users
passwd To change your password
mkdir newdir Make (create) a new directory name
rmdir olddir Remove (delete) an EMPTY directory name
wc < file Word count - lines, words, and characters in file
Pipes Example: cat file | wc
Output from cat is input to wc
Filters Example: cat file | grep string
Prints lines in file which contain string
NICE How to be nice to other users
nice cp file1 file2 cp at a lower priority ... use for long files
nice cp file1 file2 & a really nice person does it in background
nohup cp file1 file2 hanging up will not abort the job
apropos string Find manual references to a given string

Fortran 77


FORTRAN 77 - COMPILING AND EXECUTION

	f77 source1.f source2.o -lsource3 -o exefile

		In this example the source files are of three types: 
                Source1 is main fortran source program which must be compiled and then 
		linked with source2.o, a previously compiled program, and 
		-lsource3 , a subroutine library file in /usr/lib .  The
		executable file is exefile (Default is a.out) .

	f77 source.f

		In this example the source is compiled separately.  If success-
		ful the executable file is sent to a file named a.out.

	f77 -cC source.f  ... The -cC sets some recommended switches.

		Compile and save the object file in source.o wihout calling
		the loader.

	f77  file1.f *.o -lsyslib -o myprog

		Compile source file1.f, load together with all other object
		files in the current directory, and produce an executable
		object file myprog.


 


Comments to consult@newton.berkeley.edu
© 1998-2009 UC Regents