UNIX File and Directory Management

last updated 2/8/08


 

File naming

File names can be any length

Unix is case sensitive. Upper and lower case letters are different. File "A" is different from "a".

Names may include some punctuation: . (period) -(dash), _(underscore), %(percent) and $(dollar sign)

The extension notion is used to some degree. Some common extensions are

A filename prog.1.java is okay although discouraged

 

 

 


Directory Structure

Examples

ls /var/mail
ls /home/rhodes 
cat /etc/hosts 
ls ~rhodes (~ is a shortcut way to someone's login directory)

 

 

 

 

 

 


Some common file management commands

These commands are very basic in function. Be sure you know them well  

cd  change directory
cd ..  change to parent directory
cd ~user  change to user's directory
ls  list filenames
cat file catenate the file contents
rm filegroup remove (be careful, Unix doesn't have file versions) 
cp file1 file2 copy files
mv file1 file2 move files
mkdir dir make a directory
rmdir dir remove an empty directory
cd dir
change working directory to this one (relative or absolute)
pwd  print working directory (actually display it, not to the printer)
lp file print to the default line printer (set to C102)
lp -dmainlasr file

enscript -2r file

enscript -2r -Pmainlasr file

print file to the A214 laser printer  (-ddestination)
print file in enscripted format
mainlasr
mainlasrb
c102 c217

p107 cyber
p223
cancel remove job from line printer
lpstat  check the line printer queue (-t gives a full listing of all queues)
vi filename start the visual editor on the file designated
g++ filename.cpp  compile using the gnu c++ compiler (a.out is the default executable)
g77 filename.for compile using the gnu g77 FORTRAN compiler (a.out is the default exe)
javac file.java
compile a java program
java classfile
execute a java class file

The Unix server does not know about other printers on the network.  Printers are accessible only if they have their own IP address and can print postscript.  Do not expect to print on your personal printer unless you ftp the file to your machine and print it from notepad or the ftp application directly.

You could also use enscript to create a postscript file, and use ftp to pull this file over to a Windows-based machine. Once there, you can use Acrobat Distiller to convert it to a .pdf file.

enscript -2r SOURCEFILE -p OUTPUTFILE
And then, ftp from Windows to pull this file over.