CONTENTS |
at [ csm] [ f script] [ qqueue] time [date] [+ increment]
at l [ job...]
at r job...
batch
at and batch read commands from standard input to be executed at a later time. at allows you to specify when the commands should be executed, while jobs queued with batch will execute when system load level permits. Executes commands read from stdin or a file at some later time. Unless redirected, the output is mailed to the user.
1 at 6:30am Dec 12 < program 2 at noon tomorrow < program 3 at 1945 pm August 9 < program 4 at now + 3 hours < program 5 at 8:30am Jan 4 < program 6 at -r 83883555320.a
EXPLANATION
|
awk [ fprogram file ] [ Fc ] [ prog ] [ parameters ]
[ filename...]
awk scans each input filename for lines that match any of a set of patterns specified in prog.
1 awk '{print $1, $2}' file 2 awk '/John/{print $3, $4}' file 3 awk -F: '{print $3}' /etc/passwd 4 date | awk '{print $6}'
EXPLANATION
|
banner prints its arguments (each up to 10 characters long) in large letters on the standard output.
banner Happy Birthday
EXPLANATIONDisplays in banner format the string Happy Birthday. |
basename string [ suffix ]
dirname string
basename deletes any prefix ending in / (forward slash) and the suffix (if present in string) from string, and prints the result on the standard output.
1 basename /usr/local/bin 2 scriptname="'basename $0'"
EXPLANATION
|
bc [ c ] [ l ] [ filename...]
bc is an interactive processor for a language that resembles C but provides unlimited precision arithmetic. It takes input from any files given, then reads the standard input.
1 bc << EOF scale=3 4.5 + 5.6 / 3 EOF Output : 6.366 ----------------------------- 2 bc ibase=2 5 101 (Output) 20 10100 (Output ^D
EXPLANATION
|
bdiff compares two files that are too large for diff.
cal [ [ month ] year ]
cal prints a calendar for the specified year. If a month is also specified, a calendar just for that month is printed. If neither is specified, a calendar for the present month is printed.
1 cal 1997 2 cal 5 1978
EXPLANATION
|
cat [ bnsuvet ] filename...
cat reads each filename in sequence and writes it on the standard output. If no input file is given, or if the argument is encountered, cat reads from the standard input file.
1 cat /etc/passwd 2 cat -n file1 file2 >> file3
EXPLANATION
|
chmod [ fR ] mode filename...
chmod [ugoa ]{ + | | = }[ rwxlsStTugo] filename...
chmod changes or assigns the mode of a file. The mode of a file specifies its permissions and other attributes. The mode may be absolute or symbolic.
1 chmod +x script.file 2 chmod u+x,g-x file 3 chmod 755 *
EXPLANATION
|
chown [ fhR ] owner filename ...
chown changes the owner of the files to owner. The owner may be either a decimal user ID or a login name found in /etc/passwd file. Only the owner of a file (or the superuser) may change the owner of that file.
1 chown john filex 2 chown -R ellie ellie
EXPLANATION
|
cmp [ l ] [ s ] filename1 filename2
The two files are compared. cmp makes no comment if the files are the same; if they differ, it announces the byte and line numbers at which the first difference occurred.
cmp file.new file.old
EXPLANATIONIf the files differ, the character number and the line number are displayed. |
compress [ cfv ] [ b bits ] [ filename... ]
uncompress [ cv ] [ filename... ]
zcat [ filename... ]
compress reduces the size of the named files using adaptive Lempel-Ziv coding. Whenever possible, each file is replaced by one with a .Z extension. The ownership modes, access time, and modification time will stay the same. If no files are specified, the standard input is compressed to the standard output.
1 compress -v book book:Compression:35.07% -- replaced with book.Z 2 ls book.Z
EXPLANATION
|
cp [ i ] [ p ] [ r ] [ filename ... ] target
The cp command copies filename to another target, which is either a file or directory. The filename and target cannot have the same name. If the target is not a directory, only one file may be specified before it; if it is a directory, more than one file may be specified. If target does not exist, cp creates a file named target. If target exists and is not a directory, its contents are overwritten. If target is a directory, the file(s) are copied to that directory.
1 cp file1 file2 2 cp chapter1 book 3 cp -r desktop /usr/bin/tester
EXPLANATION
|
cpio i [ bBcdfkmrsStuvV6 ] [ C bufsize ] [ E filename ]
[ H header ] [ I filename [ M message ] ] [ R id ]
[ pattern ... ]
cpio o [ aABcLvV ] [ C bufsize ] [ H header ]
[ O filename [ M message ] ]
cpio p [ adlLmuvV ] [ R id ] directory
Copies file archives according to the modifiers given, usually for backup to a tape or directory.
find . -depth -print | cpio -pdmv /home/john/tmp
EXPLANATIONStarting at the current directory, find descends the directory hierarchy, printing each entries of the directory even if the directory does not have write permission, and sends the filenames to cpio to be copied into the john/tmp directory in the /home partition. |
cron executes commands at specified dates and times. Regularly scheduled jobs can be specified in the /etc/crontab file. In order to use cron, one of the following must be true: (1) you are superuser; (2) you are regular user, but your user ID is listed in the /etc/cron.allow file; (3) you are regular user, but your system contains a file /etc/cron.deny, which is empty.
crypt [ password ]
crypt encrypts and decrypts the contents of a file. The password is a key that selects a type of transformation.
cut clist [ filename ... ]
cut flist [ dc ] [ s ] [ filename ... ]
The cut command cuts out columns or characters from a line of a file; if no files are given, uses standard input. The d option specifies the field delimiter. The default delimiter is a tab.
1 cut -d: -f1,3 /etc/passwd 2 cut -d: -f1-5 /etc/passwd 3 cut -c1-3,8-12 /etc/passwd 4 date | cut -c1-3
EXPLANATION
|
[ u ] [ a [ ] sss.fff ] [ yymmddhhmm [ .ss ] ]
[+format ]
Without arguments, the date command displays the date and time. If the command line argument starts with a plus sign, the rest of the argument is used to format the output. If a percent sign is used, the next character is a formatting character to extract a particular part of the date, such as just the year or weekday. To set the date. the command line argument is expressed in digits representing the year, month, day, hours, and minutes.
1 date +%T 2 date +20%y 3 date "+It is now %m/%d /%y"
EXPLANATION
|
Compares two files and displays the differences on a line-by-line basis. Also displays commands that you would use with the ed editor to make changes.
diff file1 file2 1c1 < hello there --- > Hello there. 2a3 > I'm fine.
EXPLANATIONShows how each line of file1 and file2 differs. The first file is represented by the < symbol, and the second file by the > symbol. Each line is preceded by an ed command indicating the editing command that would be used to make the files the same. |
du [ arskod] [name ...]
The du command reports the number of 512-byte blocks contained in all files and (recursively) directories within each directory and file specified.
1 du -s /desktop 2 du -a
EXPLANATION
|
echo [ argument ] ...
echo [ n ] [ argument ]
echo writes its arguments separated by blanks and terminated by a newline on the standard output.
System V echo options:
\b backspace
\c suppress newline
\f form feed
\n newline
\r return
\t tab
\v vertical tab
\\ backslash
\0n n is a 1, 2, or 3, octal value
egrep [ bchilnsv ] [ e special expression ][ f filename ]
[ strings ] [ filename ... ]
egrep (expression grep) searches files for a pattern of characters and prints all lines that contain that pattern. egrep uses full regular expressions (expressions with string values that use the full set of alphanumeric and special characters) to match the patterns.
1 egrep 'Tom|John' datafile 2 egrep '^ [A-Z]+' file
EXPLANATION
|
expr arguments
The arguments are taken as an expression. After evaluation, the result is written to the standard output. The terms of the expression must be separated by blanks. Characters special to the shell must be escaped. Used in Bourne shell scripts for performing simple arithmetic operations.
1 expr 5 + 4 2 expr 5 \* 3 3 num=0 num='expr $num + 1'
EXPLANATION
|
fgrep [ bchilnsvx ] [ e special string ]
[ f filename ] [ strings ] [ filename ... ]
fgrep (fast grep) searches files for a character string and prints all lines that contain that string. fgrep is different from grep and egrep because it interprets regular expression metacharacters as literals.
1 fgrep '***' * 2 fgrep '[ ] * ? $' filex
EXPLANATION
|
file [[ f ffile ] [ cl ] [ m mfile ] filename...
file performs a series of tests on each filename in an attempt to determine what it contains. If the contents of the file appear to be ASCII text, file examines the first 512 bytes and tries to guess its language.
1 file bin/ls /bin/ls:sparc pure dynamically linked executable 2 file go go: executable shell script 3 file junk junk: English text
EXPLANATION
|
find path name list expression
find recursively descends the directory hierarchy for each pathname in the pathname list (i.e., one or more pathnames) seeking files that match options. First argument is the path where the search starts. The rest of the arguments specify some criteria by which to find the files, such as name, size, owner, permissions, etc. Check the UNIX manual pages for different syntax.
1 find . -name \*.c -print 2 find .. -type f -print 3 find . -type d -print 4 find / -size 0 - exec rm "{}" \; 5 find ~ -perm 644 -print 6 find . -type f -size +500c -atime +21 -ok rm -f "{}" \; 7 find . -name core -print 2> /dev/null (Bourne and Korn Shells) ( find . -name core -print > /dev/tty ) >& /dev/null ( C shell) 8 find / -user ellie xdev -print 9 find ~ -atime +31 -exec mv {} /old/{} \; -print
EXPLANATION
|
finger [ bfhilmpqsw ] [ username... ]
finger [ l] username@hostname...
By default, the finger command displays information about each logged-in user, including login name, full name, terminal name (prepended with a * if write permission is denied), idle time, login time, and location if known.
fmt [ c ] [ s ] [ w width | width ] [ inputfile... ]
fmt is a simple text formatter that fills and joins lines to produce output lines of (up to) the number of characters specified in the w width option. The default width is 72. fmt concatenates the input files listed as arguments. If none are given, fmt formats text from the standard input.
fmt -c -w45 letter
EXPLANATIONFormats letter. The c switch preserves the indentation of the first two lines within the paragraph and aligns the left margin of each subsequent line with that of the second line. The w switch fills the output line of up to 45 columns. |
fold [ w width | width ] [ filename ... ]
Fold the contents of the specified filenames, or the standard input if no files are specified, breaking the lines to have maximum width. The default for width is 80. Width should be a multiple of 8 if tabs are present, or the tabs should be expanded.
ftp [ dgintv ] [ hostname ]
The ftp command is the user interface to the Internet standard File Transfer Protocol (FTP). ftp transfers files to and from a remote network site. The file transfer program is not limited to UNIX machines.
1 ftp ftp.uu.net 2 ftp -n 127.150.28.56
EXPLANATION
|
The getopts command supersedes getopt. getopts is used to break up options in command lines for easy parsing by shell procedures and to check for legal options.
grep [ bchilnsvw ] limited regular expression
[ filename ... ]
grep searches files for a pattern and prints all lines that contain that pattern. Uses regular expressions metacharacters to match the patterns. egrep has an extended set of metacharacters.
1 grep Tom file1 file2 file3 2 grep -in '^tom savage' *
EXPLANATION
|
groups [ user... ]
The command groups prints on standard output the groups to which you or the optionally specified user belong.
/usr/bin/id [ a ]
id displays your user ID, username, group ID, and group name. If your real ID and your effective ID's do not match, both are printed.
jsh [ acefhiknprstuvx ] [ argument...]
The command jsh is an interface to the standard Bourne shell which provides all of the functionality of the Bourne shell and enables job control.
line copies one line (up to a newline) from the standard input and writes it on the standard output. It returns an exit code of one on EOF and always prints at least a newline. It is often used within shell files to read from the user's terminal.
lp [ cmsw ] [ ddest ] [ number ] [ ooption ] [ ttitle ] filename ...
cancel [ ids ] [ printers ]
lp, cancel sends or cancels requests to a lineprinter.
1 lp -n5 filea fileb 2 lp -dShakespeare filex
EXPLANATION
|
lpr [ Pprinter ] [ #copies ] [ Cclass ] [ Jjob ]
[ Ttitle ] [ i [ indent ] ] [ 1234font ] [ wcols ]
[ r ] [ m ] [ h ] [ s ] [ filter option ]
[ filename ... ]
lpr creates a printer job in a spooling area for subsequent printing as facilities become available. Each printer job consists of a control job and one or more data files.
1 lpr -#5 filea fileb 2 lpr -PShakespeare filex
EXPLANATION
|
ls [ abcCdfFgilLmnopqrRstux1 ] [ names ]
For each directory argument, ls lists the contents of the directory; for each file argument, ls repeats its name and any other information requested. The output is sorted alphabetically by default. When no argument is given, the current directory is listed.
1 ls -alF 2 ls -d a* 3 ls -i
EXPLANATION
|
Sending mail
mail [ tw ] [ m message_type ] recipient...
rmail [ tw ] [ m message_type ] recipient...
Reading mail
mail [ ehpPqr ] [ f filename ]
Forwarding mail
mail F recipient...
Debugging
mail [ x debug_level ] [ other_mail_options ] recipient...
mail [ T mailsurr_file ] recipient...
A recipient is usually a username recognized by login. When recipients are named, mail assumes a message is being sent. It reads from the standard input up to an end-of-file (Ctrl-D), or if reading from a terminal, until it reads a line consisting of just a period. When either of those indicators is received, mail adds the letter to the mailfile for each recipient.
mailx [ deHiInNUvV ] [ f [ filename|+folder ]]
[ T filename ] [ u user ] [ recipient... ]
mailx [ dFinUv ] [ h number ] [ r address ][ s subject ] recipient...
The mail utilities listed above provide an interactive interface for sending, receiving, and manipulating mail messages. Basic Networking Utilities must be installed for some of the features to work. Incoming mail is stored in a file called mailbox, and after it is read, is sent to a file called mbox.
make [ f makefile ] ... [ d ] [ dd ] [ D ]
[ DD ] [ e ] [ i ] [ k ] [ n ] [ p ] [ P ]
[ q ] [ r ] [ s ] [ S ] [ t ] [ target ... ]
[ macro=value ... ]
make updates files according to commands listed in a description file, and if the target file is newer than the dependency file of the same name, make will update the target file.
mesg [ n ] [ y ]
mesg with argument n forbids messages via write by revoking nonuser write permission on the user's terminal. mesg with argument y reinstates permission. All by itself, mesg reports the current state without changing it.
mkdir [ p ] dirname ...
more [ cdflrsuw ] [ lines ] [ +linenumber ] [ +/pattern ]
[ filename ... ]
page [ cdflrsuw ] [ lines ] [ +linenumber ] [ +/pattern ]
[ filename ... ]
more is a filter that displays the contents of a text file on the terminal, one screenful at a time. It normally pauses after each screenful, and prints More at the bottom of the screen.
mv [ f ] [ i ] filename1 [ filename2 ...] target
The mv command moves a source filename to a target filename. The filename and the target may not have the same name. If target is not a directory, only one file may be specified before it; if it is a directory, more than one file may be specified. If target does not exist, mv creates a file named target. If target exists and is not a directory, its contents are overwritten. If target is a directory the file(s) are moved to that directory.
1 mv file1 newname 2 mv -i test1 test2 train
EXPLANATION
|
nawk [ F re ] [ v var=value ] [ 'prog' ] [ filename ... ]
nawk [ F re ] [ v var=value ] [ f progfile ][ filename ... ]
nawk scans each input filename for lines that match any of a set of patterns. The command string must be enclosed in single quotes (') to protect it from the shell. Awk programs consist of a set of pattern/action statements used to filter specific information from a file, pipe, or stdin.
newgrp [ ] [ group ]
newgrp logs a user into a new group by changing a user's real and effective group ID. The user remains logged in and the current directory is unchanged. The execution of newgrp always replaces the current shell with a new shell, even if the command terminates with an error (unknown group).
news [ a ] [ n ] [ s ] [ items ]
news is used to keep the user informed of current events. By convention, these events are described by files in the directory /var/news. When invoked without arguments, news prints the contents of all current files in /var/news, most recent first, with each preceded by an appropriate header.
nice [ increment ] command [ arguments ]
/usr/bin/nice executes a command with a lower CPU scheduling priority. The invoking process (generally the user's shell) must be in the time-sharing scheduling class. The command is executed in the time-sharing class. An increment of 10 is the default. The increment value must be in a range between 1 and 19, unless you are the superuser. Also a csh built-in.
/usr/bin/nohup command [ arguments ]
There are three distinct versions of nohup. nohup is built in to the C shell and is an executable program available in /usr/bin/nohup when using the Bourne shell. The Bourne shell version of nohup executes commands such that they are immune to HUP (hangup) and TERM (terminate) signals. If the standard output is a terminal, it is redirected to the file nohup.out. The standard error is redirected to follow the standard output. The priority is incremented by five. nohup should be invoked from the shell with & in order to prevent it from responding to interrupts or input from the next user.
nohup lookup &
EXPLANATIONThe lookup program will run in the background and continue to run until it has completed, even if a the user logs off. Any output generated goes to a file in the current directory called nohup.out. |
od [ bcCDdFfOoSsvXx ] [ filename ] [ [ + ] offset [ . ] [ b ] ]
od displays filename in one or more formats, as selected by the first argument. If the first argument is missing, o is default; e.g., the file can be displayed in bytes octal, ASCII, decimal, hex, etc.
pack [ ] [ f ] name ...
pcat name ...
unpack name ...
pack compresses files. Wherever possible (and useful), each input file name is replaced by a packed file name.z with the same access modes, access and modified dates, and owner as those of name. Typically, text files are reduced to 60 75% of their original size. pcat does for packed files what cat does for ordinary files, except that pcat cannot be used as a filter. The specified files are unpacked and written to the standard output. Thus, to view a packed file named name.z, use pcat name.z or just pcat name. Unpack expands files created by pack.
passwd [ name ]
passwd [ d | l ] [ f ] [ n min ] [ w warn ][ x max ] name
passwd s [ a ]
passwd s [ name ]
The passwd command changes the password or lists password attributes associated with the user's login name. Additionally, privileged users may use passwd to install or change passwords and attributes associated with any login name.
paste filename1 filename2...
paste d list filename1 filename2...
paste s [ d list ] filename1 filename2...
paste concatenates corresponding lines of the given input files filename1, filename2, etc. It treats each file as a column or columns of a table and pastes them together horizontally (see cut).
1 ls | paste - - - 2 paste -s -d"\t\n" testfile1 testfile2 3 paste file1 file2
EXPLANATION
|
pg [ number ] [ p string ] [ cefnrs ] [ +linenumber ]
[ +/pattern/ ] [ filename ... ]
The pg command is a filter that allows you to page through filenames one screenful at a time on a terminal. If no filename is specified or if it encounters the file name , pg reads from standard input. Each screenful is followed by a prompt. If the user types a Return, another page is displayed. It allows you to back up and review something that has already passed. (See more.)
pr [[ columns] [ wwidth] [ a]] [ eck] [ ick] [ drtfp]
[+page] [ nck] [ ooffset] [ llength] [ sseparator]
[ hheader] [ F] [filename ...]
pr [[ m] [ wwidth]] [ eck] [ ick] [ drtfp] [+page] [ nck]
[ ooffset] [ llength] [ sseparator] [ hheader] [ F]
[filename1 filename2 ...]
The pr command formats and prints the contents of a file according to different format options. By default, the listing is sent to stdout and is separated into pages, each headed by the page number, the date and time that the file was last modified, and the name of the file. If no options are specified, the default file format is 66 lines with a five-line header and five-line trailer.
pr -2dh "TITLE" file1 file2
EXPLANATIONPrints two columns double sided with header "TITLE" for file1 and file2. |
ps [ acdefjl ] [ g grplist ] [ p proclist ]
[ s sidlist ] [ t term ] [ u uidlist ]
ps prints information about active processes. Without options, ps prints information about processes associated with the controlling terminal. The output contains only the process ID, terminal identifier, cumulative execution time, and the command name. Otherwise, the information that is displayed is controlled by the options. The ps options are not the same for AT&T and Berkeley type versions of UNIX.
1 ps -aux | grep '^linda' # ucb 2 ps -ef | grep '^ *linda' # at&t
EXPLANATION
|
rcp [ p ] filename1 filename2
rcp [ pr ] filename...directory
The rcp command copies files between machines in the following form:
remothostname:path
user@hostname:file
user@hostname.domainname:file
1 rcp dolphin:filename /tmp/newfilename 2 rcp filename broncos:newfilename
EXPLANATION
|
rlogin [ L ] [ 8 ] [ ec ] [ l username ] hostname
rlogin establishes a remote login session from your terminal to the remote machine named hostname. Hostnames are listed in the host's database, which may be contained in the /etc/hosts file, the Network Information Service (NIS) hosts map, the Internet domain name server, or a combination of these. Each host has one official name (the first name in the database entry), and optionally one or more nicknames. Either official hostnames or nicknames may be specified in hostname. A list of trusted hostnames can be stored in the machine's file /etc/hosts.equiv.
rm [ f] [ i] filename...
rm r [ f] [ i] dirname...[filename...]
rm removes the entries for one or more files from a directory if the file has write permission. If filename is a symbolic link, the link will be removed, but the file or directory to which it refers will not be deleted. A user does not need write permission on a symbolic link to remove it, provided they have write permissions in the directory.
1 rm file1 file2 2 rm -i * 3 rm -rf dir
EXPLANATION
|
rmdir [ p] [ s] dirname...
Removes a directory if it is empty. With p, parent directories are also removed.
rsh [ n ] [ l username ] hostname command
rsh hostname [ n ] [ l username ] command
rsh connects to the specified hostname and executes the specified command. rsh copies its standard input to the remote command, the standard output of the remote command to its standard output, and the standard error of the remote command to its standard error. Interrupt, quit, and terminate signals are propagated to the remote command; rsh normally terminates when the remote command does. If a command is not given, then rsh logs you on to the remote host using rlogin.
1 rsh bluebird ps -ef 2 rsh -l john owl ls; echo $PATH;cat .profile
EXPLANATION
|
ruptime [ alrtu ]
ruptime gives a status line like uptime for each machine on the local network; these are formed from packets broadcast by each host on the network once a minute. Machines for which no status report has been received for five minutes are shown as being down. Normally, the listing is sorted by host name, but this order can be changed by specifying one of ruptime's options.
rwho [ a ]
The rwho command produces output similar to who, but for all machines on your network. However, it does not work through gateways and host must have the directory /var/spool/rwho as well as the rwho daemon running. If no report has been received from a machine for five minutes, rwho assumes the machine is down, and does not report users last known to be logged into that machine. If a user has not typed to the system for a minute or more, rwho reports this idle time. If a user has not typed to the system for an hour or more, the user is omitted from the output of rwho, unless the a flag is given.
script [ a ] [ filename ]
script makes a typescript of everything printed on your terminal. The typescript is written to a filename. If no filename is given, the typescript is saved in the file called typescript. The script ends when the shell exits or when Ctrl-D is typed.
1 script 2 script myfile
EXPLANATION
|
sed [ n] [ e script] [ f sfilename] [filename ...]
sed copies the named filename (standard input default) to the standard output, edited according to a script of command. Does not change the original file.
1 sed 's/Elizabeth/Lizzy/g' file 2 sed '/Dork/d' file 3 sed -n '15,20p' file
EXPLANATION
|
size [ f ] [ F ] [ n ] [ o ] [ V ] [ x ] filename...
The size command produces segment or section size information in bytes for each loaded section in ELF or COFF object files. size prints out the size of the text, data, and bss (uninitialized data) segments (or sections) and their total.
sleep time
sleep suspends execution for time seconds. It is used to execute a command after a certain amount of time.
1 (sleep 105; command)& 2 (In Script) while true do command sleep 60 done
EXPLANATION
|
sort [ cmu ] [ ooutput ] [ T directory ] [ ykmem ]
[ dfiMnr ] [ btx ] [ +pos1 [ pos2 ]] [ filename...]
The sort command sorts (ASCII) lines of all the named files together and writes the result on the standard output. Comparisons are based on one or more sort keys extracted from each line of input. By default, there is one sort key, the entire input line, and ordering is lexicographic by bytes in machine collating sequence.
1 sort filename 2 sort -u filename 3 sort -r filename 4 sort +1 -2 filename 5 sort -2n filename 6 sort -t: +2n -3 filename 7 sort -f filename 8 sort -b +1 filename
EXPLANATION
|
spell [ blvx ] [ d hlist ] [ s hstop ] [ +local_file ] [ filename]...
spell collects words from the named filenames and looks them up in a spelling list. Words that neither occur among nor are derivable from (by applying certain inflections, prefixes, and/or suffixes) words in the spelling list are printed on the standard output. If no filenames are named, words are collected from the standard input.
split [ n ] [ filename [ name ] ]
split reads filename and writes it in n line pieces into a set of output files. The first output file is named with aa appended, and so on lexicographically, up to zz (a maximum of 676 files). The maximum length of name is 2 characters less than the maximum filename length allowed by the filesystem. See statvfs. If no output name is given, x is used as the default (output files will be called xaa, xab, and so forth).
1 split -500 filea 2 split -1000 fileb out
EXPLANATION
|
strings [ a ] [ o ] [ number ] [ filename... ]
The strings command looks for ASCII strings in a binary file. A string is any sequence of four or more printing characters ending with a newline or a null character. strings is useful for identifying random object files and many other things.
strings /bin/nawk | head -2
EXPLANATIONPrints any ASCII text in the first two lines of the binary executable /bin/nawk. |
stty [ a ] [ g ] [ modes ]
stty sets certain terminal I/O options for the device that is the current standard input; without arguments, it reports the settings of certain options.
1 stty erase <Press backspace key> or ^h 2 stty -echo; read secretword; stty echo 3 stty -a (AT&T) or stty -everything (BSD)
EXPLANATION
|
su [ ] [ username [ arg ... ] ]
su allows one to become another user without logging off. The default username is root (superuser). To use su, the appropriate password must be supplied (unless the invoker is already root). If the password is correct, su creates a new shell process that has the real and effective user ID, group IDs, and supplementary group list set to those of the specified username. The new shell will be the shell specified in the shell field of username's password file entry. If no shell is specified, sh (Bourne shell) is used. To return to normal user ID privileges, type Ctrl-D to exit the new shell. The option specifies a complete login.
tail +[ number [ lbc ] [ f ] [ filename ]
tail +[ number [ l ] [ rf ] [ filename ]
When a plus sign precedes the number, tail displays blocks, characters, or lines counting from the beginning of the file. If a hyphen precedes the number, tail counts from the end of the file.
1 tail +50 filex 2 tail -20 filex 3 tail filex
EXPLANATION
|
talk username [ ttyname ]
talk is a visual communications program that copies lines from your terminal to that of another user.
talk joe@cowboys
EXPLANATIONOpens a request to talk to user joe on a machine called cowboys. |
tar [ ] c|r|t|u|x [ bBefFhilmopvwX0134778 ] [ tarfile ]
[ blocksize ] [ exclude file ] [ I include file ]
filename1 filename2 C directory filenameN
1 tar cvf /dev/diskette 2 tar tvf /dev/fd0 3 tar xvf /dev/fd0
EXPLANATION
|
tee [ ai ] [ filename ]
tee copies the standard input to the standard output and one or more files, as in ls|tee outfile. Output goes to screen and to outfile.
date | tee nowfile
EXPLANATIONThe output of the date command is displayed on the screen and also stored in nowfile. |
telnet necom.com
EXPLANATIONOpens a session with the remote host necom.com |
test evaluates an expression and returns an exit status indicating that the expression is either true (zero) or false (not zero). Used primarily by Bourne and Korn shell for string, numeric, and file testing. The C shell has most of the tests built-in.
1 test 5 gt 6 2 echo $? ( Bourne and Korn Shells) (Output is 1, meaning the result of the test is not true.)
EXPLANATION
|
timex [ o ] [ p [ fhkmrt ] ] [ s ] command
The given command is executed; the elapsed time, user time, and system time spent in execution are reported in seconds. Optionally, process accounting data for the command and all its children can be listed or summarized, and total system activity during the execution interval can be reported. The output of timex is written on standard error.
touch [ amc ] [ mmddhhmm [ yy ] ] filename...
touch causes the access and modification times of each argument to be updated. The filename is created if it does not exist. If no time is specified the current time is used.
touch a b c
EXPLANATIONThree files, a, b, and c are created. If any of them already exist, the modification time-stamp on the files is updated. |
tput [ Ttype ] capname [ parms...]
tput [ Ttype ] init
tput [ Ttype ] reset
tput [ Ttype ] longname
tput S <<
tput uses the terminfo database to make the values of terminal-dependent capabilities and information available to the shell (see sh), to initialize or reset the terminal, or return the long name of the requested terminal type.
1 tput longname 2 bold='tput smso' unbold='tput rmso' echo "${bold}Enter your id: ${offbold}\c"
EXPLANATION
|
tr [ cds ] [ string1 [ string2 ] ]
tr copies the standard input to the standard output with substitution or deletion of selected characters. Input characters found in string1 are mapped into the corresponding characters of string2. The forward slash can be used with an octal digit to represent the ASCII code. When string2 (with any repetitions of characters) contains fewer characters than string1, characters in string1 with no corresponding character in string2 are not translated. Octal values for characters may be used when preceded with a backslash:
\11 Tab
\12 Newline
\042 Single quote
\047 Double quote
1 tr 'A' 'B' < filex 2 tr '[A-Z]' [a-z]' < filex 3 tr -d ' ' < filex 4 tr -s '\11' '\11' < filex 5 tr -s ':' ' ' < filex 6 tr '\047' '\042'
EXPLANATION
|
true does nothing, successfully, meaning that it always returns a zero exit status, indicating success. Used in Bourne and Korn shell programs as a command to start an infinite loop.
while true
do
command
done
/usr/ccs/bin/tsort [filename]
The tsort command produces, on the standard output, an ordered list of items consistent with a partial ordering of items mentioned in the input filename. If no filename is specified, the standard input is understood. The input consists of pairs of items (nonempty strings) separated by blanks. Pairs of different items indicate ordering. Pairs of identical items indicate presence, but not ordering.
tty [ l ] [ s ]
tty prints the path name of the user's terminal.
umask [ ooo ]
The user file-creation mode mask is set to 000. The three octal digits refer to read/write/execute permissions for owner, group, and other, respectively. The value of each specified digit is subtracted from the corresponding ''digit'' specified by the system for the creation of a file. For example, umask 022 removes write permission for group and other (files normally created with mode 777 become mode 755; files created with mode 666 become mode 644). If 000 is omitted, the current value of the mask is printed. umask is recognized and executed by the shell.
1 umask 2 umask 027
EXPLANATION
|
uname [ amnprsv ]
uname [ S system_name ]
uname prints information about the current system on the standard output. If no options are specified, uname prints the current operating system's name. The options print selected information returned by uname and/or sysinfo.
1 uname -n 2 uname -a
EXPLANATION
|
uncompress [ cFv ] [ file . . . ]
uncompress file.Z
EXPLANATIONRestore file.Z back to its original state; i.e., what it was before being compressed. |
uniq [ [ u ] [ d ] [ c ] [ +n ] [ n ] ] [ input [ output ] ]
uniq reads the input file, comparing adjacent lines. In the normal case, the second and succeeding copies of repeated lines are removed; the remainder is written on the output file. Input and output should always be different.
1 uniq file1 file2 2 uniq -d -2 file3
EXPLANATION
|
units converts quantities expressed in various standard scales to their equivalents in other scales. It works interactively in this fashion:
You have: inch
You want: cm
* 2.540000e+00
/ 3.937008e 01
unpack expands files created by pack. For each filename specified in the command, a search is made for a file called name.z (or just name, if name ends in .z). If this file appears to be a packed file, it is replaced by its expanded version. The new file has the .z suffix stripped from its name, and has the same access modes, access and modification dates, and owner as those of the packed file.
uucp [ c | C ] [ d | f ] [ ggrade ] [ j ] [ m ] [ nuser ] [ r ] [ sfile ] [
xdebug_level ]
source file destination file
uucp copies files named by the source-file arguments to the destination-file argument.
uuencode [ source file ] file label
uudecode [ encoded file ]
uuencode converts a binary file into an ASCII-encoded representation that can be sent using mail. The label argument specifies the output filename to use when decoding. If no file is given, stdin is encoded. uudecode reads an encoded file, strips off any leading and trailing lines added by mailer programs, and recreates the original binary data with the filename and the mode and owner specified in the header. The encoded file is an ordinary ASCII text file; it can be edited by any text editor. But it is best only to change the mode or file-label in the header to avoid corrupting the decoded binary.
1 uuencode mybinfile decodedname > uumybinfile.tosend 2 uudecode uumybinfile.tosend
EXPLANATION
|
wc [ lwc ] [ filename ... ]
wc counts lines, words, and characters in a file or in the standard input if no filename is given. A word is a string of characters delimited by a space, tab, or newline.
1 wc filex 2 who | wc -l 3 wc -l filex
EXPLANATION
|
what [ s] filename
what searches each filename for the occurrence of the pattern @(#), which the SCCS get command substitutes for the %Z% keyword, and prints what follows up to a " >, newline, \, or null character.
which [ filename ]
which takes a list of names and looks for the files that would be executed had the names been given as commands. Each argument is expanded if it is aliased, and searched for along the user's path. Both aliases and path are taken from the user's .cshrc file. Only .cshrc file is used.
whereis [ bmsu ] [ BMS directory ... f ] filename
write username [ ttyname ]
write copies lines from your terminal to another user's terminal.
xargs [ flags ] [ command [ initial arguments ] ]
xargs allows you to transfer contents of files into a command line and dynamically build command lines.
1 ls $1 | xargs -i -t mv $1/{} $2/{} 2 ls | xargs -p -l rm -rf
EXPLANATION
|
zcat [ file . . . ]
zcat book.doc.Z | more
EXPLANATIONUncompresses book.doc.Z and pipes the output to more. |
CONTENTS |