Unix Commands (PDF file)

 

UNIX Command Explanation
ls List filenames in current directory
cd name Change directory
rm filename Delete file with confirmation
\rm filename Delete file without confirmation
cp oldname newname Copy file
mv oldname newname Rename file
mkdir name Make new directory
\rm -rf dirname Remove directory and all its contents without confirmation
add Lists all available applications
pwd Present Working Directory -- this will identify the complete working address, very useful when outside of root directory. For example, add st512_info ==> pwd ==> /afs/eos.ncsu.edu/info/st/st512_info/ This is the address required to transfer files during an FTP session.
lpr filename Print file
a2ps filename Print 2 up
lpq Lists print queue and all job numbers
lprm jobnumber Removes job number from print queue
fs listquota Lists disk quota
fs la . Shows who has what kind of access to files in current directory ('.' refers to current directory)
zwrite username Sends message to username
zlocate username Fingers username
head filename Displays first 10 lines of file
tail filename Displays last 10 lines of file
lpr -Pps210 filename.ps Prints the postscript file from ps210 (Patterson 210). First, type lpq -Pps210 and see if the system recognizes the printer -- use STAT ACCESS program on NT, this is secure and will recognize all local printers.
printcap Lists all available printers on the network. Helpful for using the lpr funciton above.
setenv PRINTER ps01hlb2416 Sets the environment so that the postscript printer from Hillsborough 2416 will be the default. All lpr, a2ps and other print related commands will be directed towards this printer.
CTRL z; bg Suspends a current process and sends it to the background to allow you to use the Xterm window. Use fg for foreground.
add imagetools Locker for image tools.
add psutils Locker for postscript utilities.
rlogin poole Log in to server POOLE.
xhost +poole Allow access to server POOLE, done BEFORE telnet connection to this server.
setenv DISPLAY poole.statgen.ncsu.edu:0.0 After connection to server POOLE, this allows windows to be displayed onto your current machine.
dvips -Ppdf yourfile.dvi Makes postscript file pretty for PDF conversion.
add goodies, ps2pdf file.ps Convert ps to pdf (need GOODIES first)
add acrobat, distill <file.ps> file.pdf Better way to convert ps to pdf. Avoids funny printout.
add goodies; cd /ncsu/goodies/bin List all the stuff in locker GOODIES
goodies; www; imagetools; psutils; gnu LOCKERS
alias xl '(add goodies;xlock;)' Multiple commands possible in alias.
Shell Script See examples in \bin. When a new script is created, you may need to change permissions. Use chmod 755 filename. Log out and go back in for the commands to take effect (just like AUTOEXEC.BAT).
echo $PATH Lists all paths available (just like AUTOEXEC/CONFIG).
cd /cdrom; eject Change directory to CDROM; eject from XTERM window
Bad PS/PDF file (uncentered) Fix by viewing PDF in Acrobat (PC), crop excess white space from all pages, then PRINT with Fit To Page UNCHECKED ==> This will autocenter the document.
HTML: <!-- STUFF --> Commenting style for HTML
FILE: html_colors.gif Color codings for HTML
du -k > file.txt Disk Use (in KB) stored into file.txt
Using PICO, CTRL-j Auto-justification of funky paragraph while using PICO.
Placing papers in printer. Put printed side up (the to-be-printed side is on bottom); oriented right side up.
          _______
         |       |
         |Abcd   |
         |       |
         |       |
         |_______|
Tape Archive/Compress/Zip/Unzip Complete instructions on how to archive.
cd splus; add Splus; add ess; Sx Adding SPLUS.
a2ps text field length Maximum of 84 characters.
PDF File unviewable (like Morse Code) and printout is awkward (Message "Cannot load font ...") cd \tmp and/or cd \var\tmp
Delete any file having "SAS*...".
df -k
Look for any reference to capacity at or near 100%. Acrobat cannot load fonts successfully to TMP directories that are full. Clearing them will solve the problem of viewing and printing.
ls [A-Z]*; ls a*; ls blah.? Lists all files beginning with an upper-case letter. Lists all files starting with 'a'. Lists all files of the form "blah.x" but nothing else (i.e. will not capture "blah.txt")
command > file.out Sends all output to file.out.
command >> file.out Appends all output to file.out.
time command>/dev/null Calculates time required to complete task. /dev/null is a black hole to consume unwanted output.
who | grep stuff For a sequence of commands, '|' serves to pipeline the process. This command takes the output of 'who' as input where it will search for all occurrences of 'stuff'.
awk '{print NR,$0}' file > outfile Number all lines of file into outfile.
awk '{print "%5d %s\n",NR,$0}' file > outfile Number all lines of file into outfile, each line number has five digits width.
awk '{printf "%s %s\n",$1,$5}' infile > outfile Grab the first and fifth columns of infile and store them in outfile.
paste file2 file3 > file4 Horizontal merge of information in file2 and file3 into file4. Horizontal concatenation.
cat file2 file3 > file4 Vertical merge of information in file2 and file3 into file4. Vertical concatenation.
sort -t: +2 -o outfile infile Sort infile according to the 3rd column, where the file is delimited by ':', output stored in outfile.
perl -p -i -e "s/original/substitution/g " *.txt This will substitute "substitution" everywhere "original" is found in all files in the current directory with a .txt extension.
add psutils Access to Postscript utility locker (for the following 2).
psnup -pletter -4 in.ps out.ps Places pages of postscript file 4UP (indicated by -4).
a2ps -c file1 file2 Places file1 and file2 in sequence for a2ps.
FILE: mlab_data.txt Instructions on reading data into Matlab
add imsl401 Access to IMSL for C and Fortran.
chmod -R o+rx *
or
chmod -R 755 *
Grant permissions recursively to all files in the current directory and all subdirectories. Remove the -R switch to apply the permissions to the current working directory.
time sh -c 'UNIX COMMANDS'
Computation time is recorded based on the UNIX commands.
kreset -l; 1275
Allows user to reset tokens when online too long. 1275 minutes reset is the maximum allowed.
find /afs/unity.ncsu.edu/users/j/jadoi -name "*.tex" > texlist.txt
Stores all files with .TEX extension in root directory and all subdirectories into a newfile called texlist.txt.
@color(red)@b(@i(@font(helvetica)@large(MY MESSAGE)))
Custom Zwrite.