UA Home
University Information Technology Services

Unix (USS)

USS has limited availability. If you need access, contact the MVS Team at: os390@listserv.arizona.edu

 

Command Index

Directory Commands

File Commands

Misc. Commands

cd cat awk
cp cmp cal
du cp date
ls diff kill
mkdir file man
mv find nice
pwd ftp passwd
rmdir grep ps
  less tee
  more uname
  mv whoami
  pg  
  rm  
  wc  

 

 

Security/Access

Printing

Editors/Formatters

chmod lp oedit
passwd lpstat sed
ssh   vi

Compilers

Shell-Related Cmds

cc printenv
c++ set
c89 sh
dbx tcsh

Compression

Viewer

Special

compress / uncompress head paths & operators
pack / unpack more  
tar pg  
uuencode / uudecode tail  
zcat    



List of Commands, Paths, Shortcuts, Operators

These command descriptions are only intended to provide thumbnail sketches. Command options and examples are provided only for fairly common instances. Otherwise, you're asked to use the man or info utilities for documentation.




. Shortcut for current directory path
usage: . as source or destination path
options: none
example: cp ./temp.txt ../temp.txt copies temp.txt from the current directory.
example: ls ./  --lists all files in the current directory



.. Shortcut for parent of current working directory path
usage: .. as source or destination path
options: none
example: cp ../temp.txt ./temp.txt--copies temp.txt from the parent directory.
example: ls ../  --lists all files in the parent directory
example: cd ..  --move one directory node up



- Symbolizes stdin
usage: - when used as input path, specifies that input will come from stdin which is the keyboard
options: none
example: cat - > newfile--whatever you enter from keyboard will be used as input to create the new file newfile
example: gunzip -c file.tgz | tar xf -  --unzip file.tgz to stdout and send it to stdin of tar



~ (tilde): Shortcut for your home path
usage: ~
options: none
example: cd ~  --change from current directory back to your home



> Redirect stdout to a file
usage: > to destination path (file)
options: none
example: man cat > manfiles--route manpage output for cat to a file called manfiles



>> Append redirected stdout to a file
usage: >> append output to an existing file
options: none
example: man lpr >> manfiles--append manpage output for lpr to the existing file called manfiles



& Place a job in background
usage: & run specified job in background
options: none
example: cc fix32 &  --run the C compiler in background



| (pipe) Route output of command to the left of it to input of the command to the right of it
usage: | followed by a second process
options: none
example: $who | wc -l--count the number of users on the system
example: ls | more--list files in current directory and display them one page at a time ("pipe stdout to more)




awk: Pattern scanning and processing language
usage: awk [options][file]
options: -f progfile read scan patterns from the file progfile
example: awk '{print $1 + $2}' file1--prints sum of first 2 fields of each line in file1



c: OS/390 c89, cc and c++ compiler
usage: See c89 manpage.



cal: Calendar
usage: cal [[month] year]- displays the calendar for the current month
options: none
example: cal 1 2001--displays the January calendar for 2001



cat: Concatenate or display files
usage: cat [options][files]
options: -n number all lines | -b number all non-blank lines | -v output non-printing characters
example: cat -n temp.txt--outputs temp.txt and numbers all lines
example: cat -b temp.txt--outputs temp.txt and numbers all used lines
example: cat file1--displays file1
example: cat file1 file2 > file3--creates file3 containing file1, then file2



cd: Change Directory
usage: cd [directory]
options: none
example: cd public_html--sets public_html as current working directory
example: cd--change working directory to your home directory



chmod: Change access mode (permissions) of a file or directory
usage: chmod [options][files]
options: -f suppress error reporting | -R changes permission recursively--to all subdirectories
example: chmod 777 -R public_html--changes permissions of everything in public_html to read write and execute for everyone
example: chmod -777 temp--removes all permissions of file temp
example: chmod a+x temp--gives All users of file temp execute access
example: chmod go-r temp--removes read access for Group and Others users of file temp



cmp: Compares two files
usage: cmp [options][file1][file2]
options: -l print byte number and difference | -s silent except for return code
example: cmp a.out old-prog.out--compares 2 executables
example: cmp -s a.out old-prog.out--compares 2 executables but only output return codes
example: cmp stat.txt proj-132.txt--compares 2 text files and display the differences



col: Filter out reverse-linefeeds from stdin
usage: col [options]
options: -b remove backspaces
example: man awk | col -b | enscript -P3hole -U2--takes manpage for awk, removes backspace directives and prints the manpage with enscript 2-up on 3-hole paper



compress / uncompress: Compress file using Lempel-Ziv; uncompress file; output placed in file.Z
usage: compress/uncompress [options][file1][file2]
options: -c write to stdout instead of file | -f force compression/decompression
example: compress book.pdf



cp: Copy a file, creating a new file
usage: cp [file1] [file2]
options: -r recursive, copy directory | -i interactive, prompts user to overwrite.
example: cp temp1.txt temp2.txt--copies temp1.txt to new file temp2.txt
example: cp -i temp2.txt temp1.txt--asks if you are sure you want to copy over temp1.txt
See also scp about cross-machine copies.




date: Displays date and time
usage: date - displays the date according to the system clock; returns day, date, time
options: -u display Greenwich Mean (universal) Time date



dbx: Debugger for C, C++ and Fortran
usage: dbx [options][executable, core-file, or process-ID]
options: see manpage



diff: Compares files or whole directories
usage: diff [options] [file1 or dir1] [file2 or dir2]
options: -b ignore trailing blanks | -w ignore whitespace | -i ignore case of letters | -l long format, files summarized | -r recursively compare subdirectories
example: diff -l ../printing ../archive--summarize differences between these two directories



du: Disk Usage summary by file or directory structure
usage: du [options][files]
options: -a make an entry for each file | -s display grand total only
example: du -s--prints summary for current directory



file: Tries to determine the type of file
usage: file [file]
option: -h don't follow symbolic link



find: Find files that match certain criteria
usage: find [criteria] [options] [files]
options: see "info find"
example: find $HOME -name '#*'--find all files with names beginning with pound sign


ftp: Secure file transfer
See examples of FTP JCL and interactive FTP.



grep: Search for a pattern in file or files
usage: grep
options: -b precede each line by the line number | -c count number of times found | -i ignore case of letters | -l print only names of files with line#s | -n print line# with line of text | -x match full lines
example: grep -c alias .cshrc--counts the number of aliases in .cshrc
example: grep -b alias .cshrc--shows where the aliases are in .cshrc
example: grep -l main *--print names of files in current directory containing main



head: Display file to up to point specified
usage: head [end line] [file]
option: -n the first n lines will be displayed on stdout
example: head -3 .cshrc--displays first 3 lines of .cshrc



kill: Terminate a process
usage: kill [options][process-id]
options: -9 to terminate; using "0" for the PID kills all your processes
example: kill -9 0--sends kill signal to processes started since login



lp: Print text or PostScript output to printer; see Printing Webpage for more options and examples
options: -Pqueue; see manpage also
example: lp chap1.pdf--prints PDF file on default print queue



lpstat: Gives status of print jobs generated via the lp command
usage: lpstat [options]
options: see manpage
example: lpstat -pnohole--gives printer status of nohole print queue



ls: Displays information about a directory (including descendants) or files; wildcards supported
usage: ls [options] [names]--names may be file or directory
options: -a lists all entries, including .files (hidden) | -F labels directories(/), binaries(*), links(@) | -l give detailed info on each entry | -R recursively print subdirectories | -t display contents of directory sorted by time-modifi ed | -s display size in KB
example: ls -la ~/  --gives detailed info on all hidden and regular descendants of your home directory
example: ls -F ~/  --flags descendants as subdirectories, executables, links



mail: Send or receive email; reads mail on local machine only; cannot do IMAP
usage: mail [options] [users]
options: see manpage



man: Display "manual" info on a command; there are multiple levels or "sections" of commands--C, Fortran, and their commands, in general, come from the section "(3C++)" but system commands come from section "(1)"; s ee "printenv MANPATH" for the paths searched for manpages
usage: man [options] [command]
options: -k word shows names of all manpages that contain word | -a shows all manpages for this command from all sections | -M manpath shows the manpage from this specific path | -s section# shows the manpage from this specific section
example: man a2ps | lpr--prints the a2ps manpage on the default printer (duplex, nohole)
example: man -s 1 sort--displays info on sort from "section 1" (the Unix system's path) instead of "section 3C++" (the C++ path) which is the default for this command
example: man -M /usr/share/man sort--displays info on sort from this explicit path (which overrides the default and effectively does the same as the previous command)
example: man -a sort--displays info on sort from both section "3C++" and from "section 1" (the Unix system's path)
example: man man--gives the manpage on man for complete information on its use (there's only a single level--no C++ version--of this command)



mkdir: Make directory
usage: mkdir [dir] - makes directory with name dir
options: -m allows you to set properties to the directory | -p allows you to create more then one directory at a time
example: mkdir -p ~/first_dir/new_dir--creates new_dir inside of a new directory first_dir
example: mkdir new_dir--makes new_dir inside the current directory



more / less / pg: Display file
usage: more [file] - displays the contents of a file in ASCII; use spacebar to advance by page, Enter to advance by line
options: -c clear before displaying | -d display error messages | "h" gives help | "b" back
example: more -c temp.txt--clears display then prints contents of file temp.txt



mv: Move file under a directory structure or to new file name; original (source) file will be gone
usage: mv [file] [dir]--moves file under existing directory dir
options: -f force copy over any existing file by that name | -i prompts user to copy over files
example: mv temp.txt dir/  --moves temp.txt into directory dir/
example: mv -f temp.txt dir/  --moves temp.txt into directory dir/ erasing old temp.txt if it exists
example: mv -i temp.txt dir/  --moves temp.txt into directory dir/ but asking before overwriting old temp.txt if it exists

usage: mv [file1] [file2]--moves file1 to file2
example: mv temp.txt temp2.txt--renames temp.txt to temp2.txt
example: mv -f temp.txt temp2.txt--renames temp.txt erasing old temp2.txt if it exists



nice: Run a command with modified priority
usage: nice -n[value] [command]
options: -nn--sets priority to n--value may range from 1 to 19 with 1 being highest priority and 10 the default
example: nice -n 1 mysort--run the mysort program at the highest priority



oedit: Full-screen editor (not GUI) available with OMVS that looks and acts just like the ISPF editor.
usage: oedit [file]


pack / unpack: Compress/expand a file
usage: pack / unpack [options][file]--file may be an entire directory; produces output called file.z (versus ".Z" with compress); use unpack to expand file(s)
options: -f force packing even if some files in directory would not benefit
example: pack pdf.files/--pack the contents of the subdirectory, replacing each file with its compressed ".z" equivalent



passwd: Change password
usage: passwd - brings up dialogue that allows you to change your password
options: see manpage



ping: Sends packets to a network host
usage: ping [host] [timeout] (default for timeout is 20 seconds)
options: timeout period in seconds
example: ping 123.123.123.123 5--ping this IP address but give up after 5 seconds



printenv: Display current settings of environment variables
usage: printenv [variable]--if no environment variable is specified, all are displayed
options: none
example: printenv HOST--displays the name of the host on which you're running
example: printenv MANPATH--displays the hierarchy of paths searched for manpages



ps: Display processes
usage: ps - displays running processes
options: -u [user] display processes for user | -a display all processes
example: ps--displays info about your process
example: ps -u homer--displays all processes owned by homer
example: ps -a--displays all processes running



pwd: Print working directory
usage: pwd - displays current directory path
options: none



rm: Removes file(s)
usage: rm [file]
options: -i confirms erase | -r recursive erase
example: rm -r cs120--deletes everything under cs120 and then cs120 itself



rmdir: Removes empty directory
usage: rmdir [dir] - removes directory same as "rm -r dir"
options: -p remove any parent directories which become empty because of this remove | -s suppress error msgs resulting from -p option
example: rmdir -p cs120-1998/--remove this directory and any of its empty parents



sed: Stream editor for text
usage: sed [options][file]
options: -e efile use edit commands found in efile | -s sfile run script commands found in sfile | -n suppress output
example: sed



set: Set environmental variables
usage: setenv depends on shell
options: see manpage
example: setenv SHELL=/bin/bash--override the default SHELL setting to use the bash shell



sh: Bourne Shell
usage: sh [options] [args]
options: see manpage
example: sh -u--treat unset variables henceforth as errors rather than as nulls



tail: Display file from a certain point
usage: tail [location] [file]
options: +n display n from beginning; -n display n from end of file
example: tail--displays last screen's worth of .cshrc
example: tail -10 .cshrc--displays last 10 lines of .cshrc



tar: "Tape Archiver"; bundles a collection of files into one unit ("tarfile") for archiving or transmitting
usage: tar [options][tarfile][files]
options: see manpage
example: tar cf - . | gzip -c > test.tar.gz--bundles everything in the current directory, compresses it with gzip, creating a file called test.tar.gz
example: tar xvf files.tar--extracts files fromfiles.tar



tcsh: C shell
usage: tcsh [options][args]
options: see manpage



tee: Reproduces stdout in a file so that all the commands you enter and what is displayed as responses are logged
usage: tee [options][file]
options: -a append to output file file
example: tee 6.21-log--begin logging what you enter into the file 6.21-log



touch: Change file access and modification times
usage: touch [options] files - creates a blank file, or updates existing file
options: -c do not create file if it does not exist | -t use time specified
example: touch new.txt creates file new.txt
example: touch -c new.txt--updates new.txt node information to current time but does not create new.txt



uname: Display host name and info of current system
usage: uname
options: -r print OS release level | -a prints basic info | -s prints the name of the OS (default)
example: uname



uuencode / uudecode: Encode/decode binary file for mail transmit; uudecode can process files packaged by uuencode, compress and tar
usage: uuencode / uuencode [source-file] [destination-file]
options:
example: uuencode fin final | mail--encode the file fin, storing the result in final and piping that file to the mail utility



vi: Full-screen editor (not GUI); available when using telnet and rlogin sessions - not OMVS.
usage: vi [file]
options: -r retrieve last version of file after crash | -wn set window size to n
example: vi cleanup-script



wc: Word Count
usage: wc [option] [file]
options: -l count the lines in the file | -w count the words | -c count the bytes | -m count characters | -lwc is the default
example: wc freditor--count the lines, words and bytes of the file



who / whoami: List people logged on to computer or how you are logged on
usage: who
usage: whoami



zcat: Utility to compress/uncompress files
usage: zcat [options][files]
options: see manpages