BladeLogic Network Shell Command Reference

Version 7.4.3

Property of BladeLogic, Inc. Strictly confidential and proprietary

© 2008 BladeLogic, Inc. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, reproduction, distribution and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of BladeLogic, Inc. BladeLogic, Enabling Continuous Configuration, and Network Shell are registered trademarks or trademarks of BladeLogic, Inc., in the USA and/or other countries. All other brand names, product names, or trademarks belong to their respective holders. BladeLogic reserves the right to alter product offerings and specifications at any time without notice, and is not responsible for typographical or graphical errors that may appear in this document. Restricted Rights Legend: Use, duplication, or disclosure by the government is subject to restrictions asset forth in subdivision (c)(1)(ii) of the Rights in Technical Data and Computer Software Clause at FAR 52.227-7013. BladeLogic, Inc. 10 Maguire Road, Building 3 Lexington, MA 02140 www.bladelogic.com

Property of BladeLogic, Inc. Strictly confidential and proprietary

Network Shell Command Reference

Introduction

The Network Shell (NSH) commands are file manipulation utilities designed to look and feel like their UNIX counterparts. The difference is that the NSH commands are able to access and manipulate both local and remote files without using NFS/RFS or the .rhost remote authentication mechanisms. Using the NSH commands, you can manage your network of UNIX and Windows machines as one large host. You can perform system administrative functions on multiple remote hosts from a single machine. Instead of having to rlogin or telnet to a host to see what is going is on, or to make a quick change, you can just use the NSH commands to access files on local and remote hosts directly from the command line. You can use the NSH commands to write new scripts, or modify existing scripts and make them distributed. The Network Shell Command Reference provides both summarized and complete descriptions of all commands and utilities available in Network Shell. Use this document as follows:

• •

To view summarized descriptions of commands and utilities, see the alphabetized table in Summarized Descriptions of Commands. To view complete descriptions of commands and utilities, see Complete Descriptions of Commands.

Authenticating with Network Shell
When you use Network Shell in conjunction with a Network Shell Proxy Server, you must first authenticate. Once you successfully authenticate, you are issued a session credential, which grants you access to the proxy server. If you are using Network Shell interactively, you can either obtain a session credential using Configuration Manager or Provisioning Manager or you can use the blcred command line utility. If you are running Network Shell in batch mode, you must use blcred to obtain a session credential. For more information about blcred, refer to the blcred man page or see the BladeLogic Administration Guide, which describes typical scenarios for using the utility.

Property of BladeLogic, Inc. Strictly confidential and proprietary

Network Shell Command Reference

Introduction

4

ZSH Support
Network Shell supports both 4_0_4 and 4_3_4 versions of ZSH. By default, Network Shell calls the 4_0_4 version of ZSH. If you want to access the newer version of ZSH, do the following:
Procedure

1 2

Cd to <BladeLogic install directory>\bin. By default, this is C:\Program Files\BladeLogic\OM\bin on Windows and /usr/nsh/bin on UNIX. Do one of the following:

On UNIX, enter the following commands:
mv nsh nsh-4_0_4 ln –s zsh-4_3_4 nsh

On Windows, do the following:
a b

Rename the existing "nsh.exe" executable to "nsh-4_0_4.exe". Copy the "zsh-4_3_4.exe" executable to "nsh.exe".

Summarized Descriptions of Commands
The following table provides a brief description of all Network Shell commands and utilities.
Network Shell Command Description

agentctl agentinfo autolic awk bl_gen_ssl bl_srp_agent blcred blexpr blkeylogman bllogman blquery

Controls the functions of an RSCD agent. Provides information about an RSCD agent. Licenses RSCD agents using a web service. Scans files for specified patterns. Creates an X.509 certificate. Activates a user information cache on UNIX.

Manages authentication profiles, session credentials, and trusted certificates.
Creates and evaluates an expression based on input in the form of arguments. Remotely manages keystroke logfiles on a machine running an RSCD agent. Remotely manages live RSCD agent logfiles. Extends the functionality of blexpr by providing functions that are able to query the asset types supported by the BladeLogic environment.

Property of BladeLogic, Inc. Strictly confidential and proprietary

Network Shell Command Reference

Introduction

5

Network Shell Command

Description

bzip2

Utility for compressing files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. Compression is generally considerably better than that achieved by more conventional compressors. Concatenates and prints files. Sets or changes the agent password on one or more Windows servers that have the BladeLogicRSCD agent running. Changes group (and user) ownership of files. Changes the mode (protection attributes) of a file. Changes user (and group) ownerships of files. Changes the current role. Display file checksums and block counts. Compares the content of two files checking to see if they are identical. Removes columns from a file. Selects or rejects lines common to two files. Compresses data. Copies files. Converts data in a comma-separated value format to XML format. Selects portions of each line of a file. Converts and copies a file. Compares the differences between files and directories. Executes a remote df command. Synchronizes two directories. Displays disk usage information for files. Echoes arguments. Expands tabs to spaces. Extracts specified fields from a data row. Determines file type. Walks a file hierarchy. Filters the contents of files to limit line length. Prints fully qualified domain name of the current or specified host. Extracts files from a ZIP archive in a pipe.

cat chapw chgrp chmod chown chrole cksum cmp colrm comm compress cp csv2xml cut dd diff df dsync du echo expand fields file find fold fdqn funzip

Property of BladeLogic, Inc. Strictly confidential and proprietary

Network Shell Command Reference

Introduction

6

Network Shell Command

Description

getlic grep head hexdump hgrep hostname join lam less lesskey link ln ls man md5sum mkdir mkfifo mknod mv ncp ncpu ndf ndircmp ndsync nexec nlogin nmem nnet nohup

Gets remote license data from RSCD agents. Searches files and selects lines matching specified patterns. Displays the first few lines of a file. Performs an ASCII, decimal, hexadecimal, or octal dump. Highlights the results of a grep. Prints the name of the current host. Provides a relational database operator. Outputs files side by side. Displays files on a CRT. Specifies key bindings that are used by the less command. Creates a link to a file. Creates a link to a file. Lists the contents of a directory. Get man pages from a remote host. Calculate the MD5 checksum of files. Create directories. Creates a named pipe. Creates a special file. Moves or renames files. Copies/synchronizes multiple sources to multiple destinations. Displays CPU information. View usage statistics from one or more hosts. Compares contents of multiple directories. Copies/synchronizes multiple sources to multiple destinations. Provides an interface for running remote commands. Log in to a remote host. View memory and swap statistics from one or more hosts. Displays network adaptor configuration data for one or more servers. Invokes a command immune to hangups.

Property of BladeLogic, Inc. Strictly confidential and proprietary

Network Shell Command Reference

Introduction

7

Network Shell Command

Description

nover nprocsum nps nsh NSH-Perl nshopt nshpath nstats ntop nukecert nunzip order paste pax pkgadd pr prune putcert putlic redi renice rm rmdir rscd rsu runcmd runscript

Displays a system overview in a standardized format independent of the server’s operating system. Displays process summary from one or more hosts. Displays process information from one or more hosts. Outlines the differences between Network Shell and other shells. Describes the use of the Network Shell Perl module. Tests different network write buffer sizes. Shows the path where an nsh executable resides. Displays a system overview in a standardized format independent of the server’s operating system. Provides a collection of commands used to view information and statistics for one or more servers. Removes certificates from servers. Decompresses or compresses files. Sorts a list of strings (or lines) in a specified order. Merges corresponding or subsequent lines of files. Reads and writes file archives and copies directory hierarchies. Provides a Network Shell wrapper to the pkgadd command. Print files. Prunes log files to a specified size. Pushes a certificate generated by bl_gen_ssl to one or more servers. Uses raw licensing data to license remote RSCD agents. Used in conjunction with getlic. Redirects input to a file. Alters the priority of running processes. Removes a file. Removes an empty directory. Describes the Remote System Call Daemon (the RSCD agent). Runs an NSH command with alternate privileges. Runs a Network Shell command on one or more hosts. Runs a Network Shell script on one or more hosts.

Property of BladeLogic, Inc. Strictly confidential and proprietary

Network Shell Command Reference

Introduction

8

Network Shell Command

Description

scriptutil sdiff secadmin sed sort split strings su tail tar tee test touch tr uname uncompress uncp unexpand uniq unlink unzip unzipsfx uuencode uudecode version vi vsh vshview vtree

Copies and executes scripts on remote servers. Compares the differences between files and directories side-by-side. Defines encryption security when modifying the secure file. Provides a stream editor. Sorts or merges text files. Splits a file into pieces. Finds printable strings in a file. Substitutes a user identity. Outputs the last part of files. Reads and writes file archives and copies directory hierarchies. Copies standard input to standard output, making copies of the input. Tests the value of an expression. Changes the last update and modification times of a file. Translates or deletes characters. Prints the operating system name. Expands compressed data. Uncopies files that were backed up during a cp or dsync. Replaces spaces with tabs (see also expand). Reports or filters out repeated lines in a file. Unlinks a file and/or directory. Lists, tests, and extracts compressed files in a ZIP archive. Provides a self-extracting stub for prepending to ZIP archives. Encodes a binary file. Decodes a binary file. Tells what version of BladeLogic software is installed on a server. Provides a text editor. Starts a shell and captures input and output. Views the log files created by vsh. Shows the directory structure of a file system.

Property of BladeLogic, Inc. Strictly confidential and proprietary

Network Shell Command Reference

Introduction

9

Network Shell Command

Description

wc zcat zip zipcloak zipgrep zipinfo zipnote zipsplit zshall

Counts the number of lines, words, and/or characters in a file. Expands compressed data. (zcat is an alias for uncompress.) Packages and compresses (archives) files. Packages and compresses (archives) files. Searches files in an archive for lines matching a pattern. Lists detailed information about an archive. Packages and compresses (archives) files. Packages and compresses (archives) files. Provides man pages for Network Shell’s preferred command interpreter, the Z shell.

Complete Descriptions of Commands
The following pages provide complete documentation for all commands and utilities available in Network Shell other than the BladeLogic configuration files. To view documentation for a particular command, use Adobe Acrobat® to click on the bookmark for that command. When viewed in Acrobat, bookmarks are listed alphabetically on the left.

Property of BladeLogic, Inc. Strictly confidential and proprietary

Network Shell Command Reference

agentctl(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary

agentctl(1)

NAME
agentctl − Control the functions of an RSCD agent

SYNOPSIS
agentctl [-b] [-f] [-q] [-r] [-v] \ list | start | stop | kill | restart | exec cmd [args]

DESCRIPTION
The agentctl command lets you control the running of the RSCD agent. This command is part of the agent distribution and controls only the agent on the local machine. You cannot control remote agents with this command. (Note that you can use the nexec command to remotely control the server agent.) The following actions are supported: list start List the current agent processes that are running. This list uses a style similar to the UNIX ps command. Start the agent on the local server. If the agent is already running, then a warning message is output and the operation is aborted unless you specified the -f or -r options. On UNIX systems, you must have root privileges to use this command. Otherwise the agent will not start. On Windows systems the BladeLogic RSCD Agent service is started. stop Stop all RSCD agent processes on the local machine. If no agent processes are running, a corresponding warning message is output. On UNIX systems, when a sub-agent starts, it creates a new process group. When you issue the stop command, a SIGHUP (hangup) is first sent to all processes in the respective process groups, followed by a SIGINT (interrupt) one second later, followed by a SIGKILL (-9) one second later again. This hopes to allow processes to gently exit before they are forcefully terminated. On Windows systems, the BladeLogic RSCD Agent service is stopped. kill The option is similar to the stop command, except that on UNIX systems it does not try to gently terminate the processes, but rather just sends the SIGKILL (-9) to each respective process group. This option is recommended only when you need to halt immediately. This option is a combination of doing a stop followed by a start. This is not just a convenience command -- the restart command also lets you restart an agent remotely, using the nexec command, as described below. Once you issue a stop command, a remote start is no longer possible, because the agent is no longer running to service the nexec command. However, the restart command has been specifically designed to survive the agent going down while restart is still running. restart accomplishes this by changing its own process group ID, which allows it to run independently of the agent. To use this functionality, invoke restart with the -b option. For example, to remotely restart an agent, use the following syntax: nexec hostname agentctl -b restart The agentctl command attempts to automatically determine if its parent process is an agent. If it determines that its parent process is an agent, it automatically turns on the -b option.

restart

NSH

1

agentctl(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary

agentctl(1)

exec

This option is similar to the restart command, but with the added ability to execute a given command between the stop and the start. When performing a restart create a new sub-process with a separate process group ID to do the actual work and just exit. This operation is necessary to be able to remotely restart an agent, because stopping an agent will also stop all sub-processes of the same process group ID. agentctl will attempt to automatically determine if its parent process is an agent. If it determines that its parent process is an agent, it automatically turns on the -b option.

OPTIONS
-b

-f

When starting an agent, either through the start, restart, or exec command, the default is not to start the agent if agentctl detects than an agent is already running. With this option, agentctl will always try to start the agent. Quiet mode. With this option, agentctl does not output warning messages. stdin, stdout, and stderr are all redirected from/to /dev/null (UNIX) or nul (Windows), so that no messages are displayed when the agent is started. Pass the -r option to the agent (UNIX only). The agent -r option tells the agent to retry (approximately every 10 seconds) listening on the effective TCP port, if the port is already being listened on. Verbose option. With this option, agentctl generates more output to let you know what the program is doing.

-q

-r

-v

EXAMPLES
sol8dev# agentctl list HOSTNAME USER PID CPU MEM VSIZE RSS PRI START TIME COMMAND sol8dev root 6086 0.0 0.8 4520 1840 0 14:45:15 0:00 rscd sol8dev root 6085 0.0 1.2 4656 2968 0 14:45:15 0:00 rscd sol8dev# agentctl -v stop Stopping pid 6086 ... Stopping pid 6085 ... Stopping pid 8488 ... sol8dev# agentctl restart agentctl: Warning - RSCD agent currently not running rscd - Copyright (C) 1996-2003, BladeLogic Inc. sol8dev# nexec winhost agentctl -b restart

EXIT VALUES
agentctl exits with a value of 0 if the requested operation was fulfilled without any problems or issues. Otherwise it exits with a non zero value.

ORIGIN
agentctl was written by Thomas Kraus

SEE ALSO
rscd(1).

NSH

2

nsh% cd //linuxhost/ linuxhost% agentinfo Agent Release : 6.160 solarishost SunOS 5.agentinfo(1) Property of BladeLogic. Strictly confidential and proprietary agentinfo(1) NAME agentinfo − Output information about remote RSCD agents. Inc.0. OPTIONS -? -c -H Displays a general usage message. agentinfo outputs the information in the following manner: Agent Release : Hostname : Operating System: User Permissions: Host ID : # of Processors : License Status : 6. List one host per line.P..3. use either the ncpu or nover commands. the CSV file includes a header line.4. agentinfo outputs data about the current remote host. Configuration Manager Display information about multiple hosts. addresses of the hosts for which you want information.P. addresses of the hosts for which you want information. You can turn off the header line with the -H option. -f filename A flat file containing the names or I.. EXAMPLE Display information about the current remote host. If you need CPU counts which account for hyperthreading.3. By default. SYNOPSIS agentinfo [-?] [-c] [-H] [-f file] [hostname . Tells agentinfo to output the data in a CSV (comma separated value) format. nsh% agentinfo solarishost windowshost solarishost: Agent Release : 6. hostname The names or I. Put a space between each host name. If the current directory is on the local host.0.8 4507/51 (tmk/sw) 80F8EC76 1 Expires Mon May 12 14:58:38 2005 Note that. You can also specify the names or I.2-2 User Permissions: 4507/51 (tmk/man) Host ID : 44434057 # of Processors : 1 License Status : Licensed for NSH.P. Do not output a header. by design.0. With no arguments.3.] DESCRIPTION The agentinfo command gives an overview of generally important information about a remote agent.160 Hostname : linuxhost Operating System: Linux 2. addresses of the hosts for which you want information. agentinfo displays a message to that effect. Put a space between each host name. the number of processors reported by agentinfo does not consider hyperthreading.160 NSH 1 .

version(1) NSH 2 . Configuration Manager ORIGIN The agentinfo utility was written by Thomas Kraus.8 4507/51 (tmk/sw) 80F8EC76 1 Expires Mon May 12 14:58:38 2005 6.agentinfo(1) Property of BladeLogic. nover (1). SEE ALSO ncpu (1).3.160 windowshost WindowsNT 5.0 SYSTEM F454127F 1 Licensed for NSH. Inc. Strictly confidential and proprietary agentinfo(1) Hostname : Operating System: User Permissions: Host ID : # of Processors : License Status : windowshost: Agent Release : Hostname : Operating System: User Permissions: Host ID : # of Processors : License Status : solarishost SunOS 5.0.

-l -u -e -x user password Your registered password for the above user on the BladeLogic support website. Previously the licensing of an agent consisted of three steps: 1 2 3 Run the getlic command to gather data required for licensing. If you do not include any of these four options.. Inc. and then download the generated license. Display license information for hosts that currently have a valid permanent license. hostn] autolic [-proxyHost <host>] [-proxyPort <port>] [-proxyUser <user>] [-proxyPass <pass>] DESCRIPTION The autolic command lets you license RSCD agents in a single step via the BladeLogic licensing web service. upload the license file created by the getlic command. Strictly confidential and proprietary autolic(1) NAME autolic − License RSCD agents via web service SYNOPSIS autolic [-luexvV] [-f file] [-c count] user password [host1 ..autolic(1) Property of BladeLogic. hostn List of hosts for which you want to retrieve license information. In most cases. License hosts that currently have a valid evaluation (timed) license. host1 . autolic processes all the hosts you specify. Login to the BladeLogic support website. Other options include: -f filename Instead of listing your hosts one at a time on the command line as arguments.dat file. -proxyHost host Hostname of the proxy server -proxyPort port Port to connect to on the proxy server -proxyUser user User to connect to the proxy server as -proxyPass pass Password to use to connect to the proxy server NSH 1 . Debug output. The autolic command combines these three steps into a single non-interactive step. you can use this option to point to a file containing a list of hosts for which you want license information. -v -V Verbose output detailing individual steps.. Your registered username on the BladeLogic support website. You can specify more than one option. OPTIONS The following four options allow you to select a subset of hosts based on their current license status. License hosts that are currently un-licensed. do not use this option. -c <count> The number of CPUs in the license request. License hosts that currently have an expired evaluation license. Apply the licenses with the putlic command. List one host per line.. regardless of their license status.

then use the getlic and putlic commands described above to license your agents. Running the following command will Add/Modify the entries in autolic.conf (from the NSH install directory). based on the your current customer/prospect status. If you are going through a non-authenticating proxy. Instead. Inc. Strictly confidential and proprietary autolic(1) USAGE host $ autolic -u username bombay : Licensed for madras : Licensed for bagalore : Licensed for password bombay madras bagalore NSH/CM NSH/CM NSH/CM PROXY If you need to go through a proxy. you must update the autolic configuration file called share/autolic. CAVEATS You cannot select the license type (evaluation or permanent).com proxyport=8080 proxyuser=username proxypassword=password Adjust values as required. For autolic to function properly. NSH 2 . If Internet access is not available or if port 80 is blocked (for example.com -proxyPort \ 8080 -proxyUser username -proxyPass password # # Proxy information # proxyhost=proxy.mycompany. agentinfo(NSH). the host from which you launch autolic must have Internet access through port 80.mycompany.autolic(1) Property of BladeLogic. do not set the proxyuser and proxypassword entries. ORIGIN autolic was written by Thomas Kraus SEE ALSO getlic(NSH). putlic(NSH). by a firewall). the BladeLogic licensing server automatically determines the license type.conf: host $ autolic -proxyHost proxy.

Normally. A pattern-action statement has the form pattern { action } A missing { action } means print the line.. $2.. A value greater than 1 causes awk to dump core on fatal errors. use the -F option with a value of ‘[t]’. or ‘while’ statement. expression) statement for (var in array) statement NSH 1 .. after the ‘do’ or ‘else’ keywords. the input line is split into one field per character.cat(1) Property of BladeLogic. Each line is matched against the pattern portion of every patternaction statement. The file name ‘-’ means the standard input. the associated action is performed for each matched pattern. a logical AND (‘&&’). -V -v var=value Assign value to variable var before prog is executed. In order to set the field separator to a single blank. The options are as follows: -d[n] -F fs Debug mode. print >>). nawk . expression. The input is normally made up of input lines (records) separated by newlines.’). This is a first (and not very reliable) approximation to a ‘‘safe’’ version of . a logical OR (‘||’). a missing pattern always matches. or by the value of RS. Inc. then any number of blank lines are used as the record separator. If RS is null. process creation (cmd | getline. and is executed at the time it would have been opened if it were a filename. any number of blanks separate fields.pattern-directed scanning and processing language SYNOPSIS awk [-safe] [-V] [-d[n]] [-F fs] [-v var=value] [prog | -f progfile] file . system) and access to the environment (ENVIRON. use the -F option with a value of ‘[ ]’. or 1 if n is not specified. If a field separator of ‘t’ is specified.. If FS is null. and newlines are used as field separators (in addition to the value of FS). not a filename. Strictly confidential and proprietary cat(1) NAME awk . see the section on variables below). Print the version number of awk to standard output and exit. an open brace (‘()’). With each pattern there can be an associated action that will be performed when a line of a file matches the pattern. Pattern-action statements are separated by newlines or semicolons.. any number of -v options may be present.. A statement can be one of the following: if (expression) statement [else statement] while (expression) statement for (expression.. . Define the input field separator to be the regular expression fs. ‘for’. An action is a sequence of statements. DESCRIPTION Awk scans each input file for lines that match any of a set of patterns specified literally in prog or in one or more files specified as -f progfile. Additionally. or after the closing parenthesis of an ‘if ’. awk treats it as if ‘’ had been specified and uses <TAB> as the field separator. -safe Disable file output (print >. Set debug level to n. The fields are denoted $1. while $0 refers to the entire line. print |. Any file of the form var=value is treated as an assignment. This is convenient when working with multi-line records. Newlines are permitted after a terminating statement or following a comma (‘. or by the regular expression FS. a backslash (‘´) can be used to escape a newline between tokens. In order to use a literal ‘t’ as the field separator. -f filename Read program code from the specified file filename instead of from the command line. An input line is normally made up of fields separated by whitespace.

cat(1) Property of BladeLogic.k] are permitted. file and cmd may be literal names or parenthesized expressions. Variable names with special meanings: ARGC ARGV Argument count. NSH 2 . a relational expression. and are built using the operators + * / % ˆ (exponentiation).+= -= *= /= %= ˆ= > >= < <= == != ?: are also available in expressions. and concatenation (indicated by whitespace). Variables are initialized to the null string. not necessarily numeric. String constants are quoted "". Variables may be scalars. Array subscripts may be any string. A conditional is an arithmetic expression. array elements (denoted x[i]) or fields. separated by the value of SUBSEP (see the section on variables below)). start delete array[expression]# delete an array element delete array # delete all elements of array exit [expression]# exit immediately.j. Strictly confidential and proprietary do statement while (expression) break continue { [statement . Expressions take on string or numeric values as appropriate. except in the position of an isolated regular expression in a pattern. The print statement prints its arguments on the standard output (or on a file if >file or >>file is present or on a pipe if | cmd is present). Regular expressions may also occur in relational expressions. The operators ! ++ -. the action is performed for all lines from an occurrence of the first pattern through an occurrence of the second. identical string values in different statements denote the same open file. A pattern may consist of two patterns separated by a comma. in this case. expression-list][>expression] return [expression] next # skip remaining patterns on this input line nextfile # skip rest of this file. any string (constant or variable) may be used as a regular expression.. Argument array.. and a matchop is either ˜ (matches) or !˜ (does not match). Isolated regular expressions in a pattern apply to the entire line. separated by the current output field separator.]} expression # commonly var = expression print [expression-list][>expression] printf format [. assignable. status is expression cat(1) Statements are terminated by semicolons. .) inarray-name where a relop is any of the six relational operators in C. or a Boolean combination of these. /re/ is a constant regular expression.. BEGIN and END do not combine with other patterns. non-null members are taken as filenames.. using the operators ˜ and !˜. An empty expression-list stands for $0. Inc. A relational expression is one of the following: expression matchop regular-expression expression relop expression expression in array-name (expr. expr.. with the usual C escapes recognized within (see printf(1) for a complete list of these).. newlines or right braces. open next.. the constituents are concatenated. The special patterns BEGIN and END may be used to capture control before the first input line is read and after the last. assignable. this allows for a form of associative memory. The printf statement formats its expression list according to the format (see printf(3)). Multiple subscripts such as [i. and terminated by the output record separator. Patterns are arbitrary Boolean combinations (with ! || &&) of regular expressions and relational expressions. Regular expressions are as in egrep(1).

Return the sine of x. String Functions gsub(r. FUNCTIONS The awk language has a variety of built-in functions: arithmetic. s) The same as sub() except that all occurrences of the regular expression are replaced. also settable by option -F fs. ENVIRON Array of environment variables. n. Return the square root of x. Return the natural logarithm of x. Return the exponential of x.6g"). the time of day is used instead. FNR FS NF NR OFMT OFS ORS Ordinal number of the current record in the current file. NSH 3 . Regular expression used to separate fields. t.cat(1) Property of BladeLogic. where x is in radians. cat(1) Number of fields in the current record. input/output and general. subscripts are names. RS RSTART The starting position of the string matched by the match() function. Ordinal number of the current record. $NF can be used to obtain the value of the last field in the current record. index(s. Return x truncated to an integer value. such that 0<=n<1.6g"). string. If expr is omitted. Output format for numbers (default "%. SUBSEP Separates multiple subscripts (default 034). srand(expr) Sets seed for rand() to expr and returns the previous seed. cos(x) exp(x) int(x) log(x) rand() sin(x) sqrt(x) Return the cosine of x. Strictly confidential and proprietary CONVFMT Conversion format when converting numbers (default "%. where x is in radians. Arithmetic Functions atan2(y. Input record separator (default newline). Inc. FILENAME The name of the current input file. Output field separator (default blank). x) Return the arctangent of y/x in radians. gsub() returns the number of replacements. or 0 if it does not. Return a random number. t) The position in s where the string t occurs. Output record separator (default newline). RLENGTH The length of the string matched by the match() function.

If the stream is not open. a. cat(1) match(s. expr. If file is not open. file remains open until explicitly closed with a call to close(). getline returns 1 for a successful input. according to the printf(3) format fmt. toupper(str) Returns a copy of str with all lower-case characters translated to their corresponding upper-case equivalents. the variables $0 and NF are set. getline [var] < file Sets $0 to the next record from file. t. cmd | getline [var] Read a record of input from a stream piped from the output of cmd.) The string resulting from formatting expr. a[2]. If var is omitted. getline var Sets $0 to variable var.. subsequent calls will read subsequent records from the stream. 0 for end of file. NSH 4 . subsequent calls will read subsequent records from file. As long as the stream remains open. fflush(expr) Flushes any buffered output for the file or pipe expr. and -1 for an error. 0 for end of file.. a[n] and returns n. Input/Output and General Functions close(expr) Closes the file or pipe expr. The variable RLENGTH is set to the length of the matched string.cat(1) Property of BladeLogic. substr(s. Strictly confidential and proprietary length(s) The length of s taken as a string. sprintf(fmt. Otherwise var is set. This form of getline sets the variables NR and FNR.. or -1 if no match is found. . getline returns 1 for a successful input. Inc. or 0 if it does not. it is opened. An empty string as field separator splits the string into one array element per character. expr should match the string that was used to open the file or pipe. or if n specifies more characters than are left in the string. n) Return at most the n-character substring of s that begins at position m counted from 1. The variable RSTART is set to the starting position of the matched string (which is the same as the returned value) or zero if no match is found. The separation is done with the regular expression fs or with the field separator FS if fs is not given. s) Substitutes t for the first occurrence of the regular expression r in the string s. split(s. m.. fs) Splits the string s into array elements a[1].. If s is not given. expr should match the string that was used to open the file or pipe. and FNR. If var is omitted. sub(r. sub() returns the number of replacements. getline Sets $0 to the next input record from the current input file. NR. An ampersand (‘&’) in t is replaced in string s with regular expression r. The stream remains open until explicitly closed with a call to close(). As long as the stream remains open. it is opened. r) The position in s where the regular expression r occurs. $0 is used. If n is omitted. Otherwise var is set. and -1 for an error.. . A literal backslash can be specified by preceding it with another backslash (‘\’). or of $0 if no argument is given. This form of getline sets the variables NF. tolower(str) Returns a copy of str with all upper-case characters translated to their corresponding lower-case equivalents. the length of the substring is limited by the length of s. the variables $0 and NF are set. A literal ampersand can be specified by preceding it with two backslashes (‘\’).. .

s. printf(3) A. the syntax is worse. c) { . and distribute this software and its documentation for any purpose and without fee is hereby NSH 5 . i++) printf "%s ". To force an expression to be treated as a number add 0 to it. 1988. $1 } Same. Functions may be defined (at the position of a pattern-action statement) thusly: function foo(a. The scope rules for variables in functions are a botch. Addison-Wesley. COPYRIGHT /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved Permission to use. V. copy. return x } cat(1) Parameters are passed by value if scalar. Aho. Thus local variables may be created by providing excess parameters in the function definition. Strictly confidential and proprietary system(cmd) Executes cmd and returns its exit status.. EXAMPLES Print lines longer than 72 characters: length($0) > 72 Print first two fields in opposite order: { print $2. J. /stop/ Simulate echo(1): BEGIN { # Simulate echo(1) for (i = 1. lex(1). Kernighan.. Parameters are local to the function.cat(1) Property of BladeLogic. s/NR } Print all lines between start/stop pairs: /start/.. ISBN 0-201-07981-X. modify. HISTORY An awk utility appeared in Version 7 AT&T UNIX. sed(1). with input fields separated by comma and/or blanks and tabs: BEGIN { FS = ". to force it to be treated as a string concatenate "" to it. Inc. W. printf(1). " average is".[ ]*|[ ]+" } { print $2. b. all other variables are global. i < ARGC. Weinberger. print sum and average: { s += $1 } END { print "sum is". BUGS There are no explicit conversions between numbers and strings. and by reference if array name. ARGV[i] printf "0 exit } Print an error message to standard error: { print "error!" > "/dev/stderr" } SEE ALSO egrep(1). $1 } Add up first column. B. and P. The AWK Programming Language. functions may be called recursively.

NEGLIGENCE OR OTHER TORTIOUS ACTION. Strictly confidential and proprietary granted. DATA OR PROFITS. and that the name Lucent Technologies or any of its entities not be used in advertising or publicity pertaining to distribution of the software without specific. provided that the above copyright notice appear in all copies and that both that the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation. WHETHER IN AN ACTION OF CONTRACT. Inc. ****************************************************************/ cat(1) NSH 6 . INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE. written prior permission. IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY SPECIAL. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.cat(1) Property of BladeLogic. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.

pem is stored in /<home_dir>/. id. On UNIX. id. Inc. Invoking bl_gen_ssl prompts the user to enter a password and confirm it. This password is used to gain access to user’s private key. every time a Network Shell session is invoked.pem is stored in /<user_profile_dir>/Application Data/BladeLogic.509 certificate in a file named id. such as /home/johnk. Strictly confidential and proprietary bl_gen_ssl(1) bl_gen_ssl(1) NAME bl_gen_ssl − create an X. OPTIONS None EXAMPLE bl_gen_ssl ORIGIN bl_gen_ssl was developed by BladeLogic. Once a certificate is created on a client.509 certificate SYNOPSIS bl_gen_ssl DESCRIPTION The bl_gen_ssl command creates an X. Inc.bladelogic.pem.Property of BladeLogic. where <user_profile_dir> specifies a path such as /Documents and Settings/johnk. In Windows. Creating this certificate generates a user’s public and private keys. the user is prompted for a private key password. NSH 1 . where <home_dir> is the user’s home directory.

To reuse this shared memory segment with Network Shell. bl_srp_agent runs in the background with the user information cached in a shared memory segment. This shared memory segment is only usable for the user who ran bl_srp_agent. When you run bl_srp_agent. the system prompts for a user ID. bl_srp_agent runs in the foreground. EXAMPLE bl_srp_agent --background ORIGIN bl_srp_agent was developed by BladeLogic. the system generates a message like the following: set BL_SRP_INFO to <xy> to reuse this private key. Inc. After you provide this information. Strictly confidential and proprietary bl_srp_agent(1) NAME bl_srp_agent − activate a user information cache on UNIX SYNOPSIS bl_srp_agent --background DESCRIPTION The bl_srp_agent command activates a user information cache on UNIX. set the BL_SRP_INFO environment variable by issuing the following command: BL_SRP_INFO=<xy> Export the BL_SRP_INFO environment variable by issuing the following command: export BL_SRP_INFO The bl_srp_agent program remains in the background holding the user information cached in a shared memory segment until you kill it. OPTIONS --background Instructs bl_srp_agent to run in the background. Inc. Other programs can use the information cached by bl_srp_agent whether bl_srp_agent is running in the foreground or background. password. NSH 1 . where <xy> is the hexadecimal value of the location of the shared memory segment.bl_srp_agent(1) Property of BladeLogic. If you do not use this option. After entering your user information. and role.

The blcred utility lets you acquire a session credential when using a command line environment. you must have Operations Manager installed. session credentials. This option overrides whatever is specified by the BL_AUTH_PROFILES_FILE environment variable.e. add.conf file>] | -test [-profile <profile_name>] [-username <username>] [-time <min remaining lifetime (minutes)]] | [authprofile -list | -delete [-profile <profile name>] | -add [-profile <profile name>] [-host <auth_service host>:<auth_service port>] [-type [srp | adk -spn <auth_service SPN>]]] | [cert -list | -delete [-all | -alias <cert alias>]] DESCRIPTION The blcred utility manages authentication profiles. which is an XML file that holds all authentication profile definitions. To use blcred on a client machine.. SYNOPSIS blcred [-p <authentication profiles filename>] [-c <credential cache filename>] [-x <trusted certificates keystore filename>] [cred -list [-verbose] | -destroy | -acquire [-profile <profile_name>] [[-username <username>] | [-password <password>]] | [-i <srp user_info. If neither this option nor the BL_AUTH_PROFILES_FILE environment variable is specified. To obtain a session credential from an Authentication Service. And. and trusted certificates. This session credential can be stored in a credential cache file. blcred lets you review and delete trusted X. the Authentication Service validates you as a user and issues a session credential. you must also provide a user name and password. a user must first acquire a session credential from a BladeLogic Authentication Service. Application Server. Using the information you provide. the default authentication profile configuration file is used. which are used when establishing a TLS connection to an Authentication Service. The authentication profile identifies the Authentication Service you are contacting and your authentication mechanism. and delete authentication profiles. or BLCLI) can connect to a BladeLogic Application Server or Network Shell Proxy Server. you must provide an authentication profile and other information. Network Shell. and trusted certificates.dat file>] | [-loginconf <kerberos login. a BladeLogic client application (i. The utility lets you test whether a valid session credential already exists and determine the lifetime remaining for that credential.509 certificates. a Kerberos TGT). Inc.xml NSH 1 . Configuration Manager. or Network Shell Proxy Server. Provisioning Manager. Using that session credential. If you are using Active Directory/Kerberos authentication. Strictly confidential and proprietary blcred(1) NAME blcred − A command line utility for managing BladeLogic authentication profiles.blcred(1) Property of BladeLogic. session credentials. COMMAND OPTIONS -p <authentication profiles filename> Name and location of the authentication profile configuration file. To log into a BladeLogic system. If you are using SRP authentication. you must possess an AD/Kerberos user credential (that is. This default file resides at <OM install directory>/br/authenticationProfiles. The utility lets you show.

and service ticket. authprofile –delete [-profile <profile_name>] Deletes a profile with the given profile name. The optional -profile argument overrides whatever is specified by the BL_AUTH_PROFILE_NAME environment variable. -x <trusted certificates keystore filename> Name and location of the keystore file. If the time option is present. destination service URLs. and expiration time of session credentials. issuing service URL. Default credential caches are unique per user. blcred tests for the presence of a valid credential with a remaining lifetime equal to or greater than the specified minutes remaining. Strictly confidential and proprietary blcred(1) -c <credential cache filename> Name and location of the credential cache file. the user’s Kerberos credential is loaded from the local Kerberos cache.dat file>] | [-loginconf <kerberos login. This option overrides whatever is specified by the BL_SSO_CRED_CACHE_FILE environment variable. When employing an AD/Kerberos profile. If neither the -profile option nor the BL_AUTH_PROFILE_NAME environment variable is specified. cred –test [-profile <profile_name>] [-username <username>] [-time <min remaining lifetime (minutes)] Tests whether a cache contains a valid credential corresponding to the specified authentication profile.conf file. blcred establishes a TLS connection to the Authentication Service. cred –list [-verbose] Displays the user name. Default trust keystores are unique per user. which presents its X509 certificate to the client.bladelogic/client_keystore. including the client IP address. NSH 2 .dat) using the -i parameter. blcred prompts the user to provide a profile name.blcred(1) Property of BladeLogic. The user is prompted to trust the unrecognized certificate. This file resides at <user_home_dir>/. cred –acquire [-profile <profile_name>][[-username <username>] [-password <password>]] | [-i <srp user_info. If an authentication profile name is not specified.509 certificates. cred –destroy Destroys the contents of the credential cache. the default credential cache file is used.bladelogic/bl_sesscc for UNIX and C:\Documents and Settings\<Windows_user_name>\Application Data\BladeLogic\bl_sesscc for Windows. This option overrides whatever is specified by the BL_SSO_TRUSTED_CERT_KEYSTORE_FILE environment variable.conf file>] Acquires a session credential using the specified profile and stores it in the session credential cache. blcred tests for the presence of a valid credential issued to the named user.pkcs12 for Windows. To acquire a session credential. If neither this option nor the BL_SSO_CRED_CACHE_FILE environment variable is specified. the default keystore file is used.pkcs12 for UNIX and C:\Documents and Settings\<Windows_user_name>\Application Data\BladeLogic\client_keystore. If the username option is present. Using the optional -verbose argument causes the utility to display all information about credentials. If neither this option nor the BL_SSO_TRUSTED_CERT_KEYSTORE_FILE environment variable is specified. the -loginconf parameter can be used to override the default location of the blclient_login. blcred –test can return the exit codes described below in EXIT CODES. When selecting an SRP profile. Inc. authprofile –list Displays information about each of the profiles defined in the authentication profile configuration file. which holds trusted X. If a name is not specified. the SRP credential can be extracted from a persistent credential file (the user_info. The default keystore file resides at <user_home_dir>/. the user is prompted for a user name and password. When an AD/Kerberos profile is employed. Both can be passed on the command line using the optional -username and -password parameters. the user is prompted for a name. authentication type. Alternatively. blcred prompts the user to specify an authentication profile name.

-host. In either case the profile must have a unique name and must be associated with an Authentication Service. Cached credential did not match named authentication profile. the AD/Kerberos service principal name can be specified using the –spn parameter. EXAMPLES See the BladeLogic Administration Guide for some typical scenarios that use blcred. cert –list Lists all X. NSH 3 .) EXIT CODES 0 1 2 3 4 Successful test result. Authentication Service. Users are prompted for omitted information. Additionally. Lifetime remaining for the cached credential is less than minimum lifetime specified. cert –delete [-all | -alias <cert alias>]] Deletes X. There are two types of authentication profiles: SRP and AD/Kerberos. BL_SSO_TRUSTED_CERT_KEYSTORE_FILE Location of the TLS certificate store (override with -x).) ORIGIN blcred was written by Denis Knjazihhin. AD/Kerberos profiles must also specify a service principal name. and -type parameters. The -alias lets you provide an alias for the certificate you want to delete. such as -acquire -profile profile_name.509 certificates in the trusted certificate store. The -all parameter deletes all certificates. ENVIRONMENT VARIABLES BL_AUTH_PROFILES_FILE Location of the authentication profile configuration file (override with -p). BL_SSO_CRED_CACHE_FILE Location of the session credential cache file (override with -c).509 certificates in the trusted certificate store. The profile name. BL_AUTH_PROFILE_NAME Name of the selected BladeLogic authentication profile (override using the -profile option in conjunction with another option. Cached credential issued to user is different than named user. (Use the -list option to obtain aliases for all certificates in the store. Inc. cache contained credential with desired properties. and authentication type can be specified on the command line through the -profile.blcred(1) Property of BladeLogic. Strictly confidential and proprietary blcred(1) authprofile –add [-profile <profile name>] [-host <auth_service host>:<auth_service port>] [-type [srp | adk -spn <auth_service SPN>]]] Adds a new profile to the authentication profile configuration file. Named authentication profile did not exist.

P.c. Strictly confidential and proprietary blexpr(1) NAME blexpr − BladeLogic Expression SYNOPSIS blexpr expr . CR. OPERATOR TYPES blexpr supports the following operator types: Integers NSH 1 .b. TAB. DESCRIPTION blexpr is generic expression evaluator. An expression consists of operands and operators.. OPERATORS blexpr supports the following operators. It prints the result to stdout.. If you do not specify any arguments.d "abc" ´abc´ $name function() Name Decimal Number Octal Number Percentage Floating point number Hex Number I. You can nest these (multiple levels) using parentheses ´(´ and ´)´.blexpr(1) Property of BladeLogic. then creates and evaluates an expression. Lower priorities have higher precedence: Operator % / * + > >= != = <= < ! && || & | ˆ ˜ Name REMAINDER DIVIDE MULTIPLY SUBTRACT ADD GREAT GREAT THAN OR EQUAL NOT EQUAL EQUAL LESS THAN OR EQUAL LESS NOT AND OR BINARY AND BINARY_OR BINARY_XOR BINARY NOT Priority 1 1 1 2 2 3 3 3 3 3 3 4 5 6 6 6 6 6 OPERANDS blexpr supports the following operands: Operand nnn 0nnn nnn% nn. You can use whitespaces (SPACE. LF) as optional operand/operator separators. It takes all of its arguments as input.mm 0xABC a. blexpr reads the expression from stdin. Inc. address (converted to integer) String supporting \ for special characters String (no special character support) Variable name (see set_variable() function) Supported function.

5000 atoi (val) Convert val into an integer value. It detects octal numbers (strings starting with a zero). If the argument is a string. 3. then proceeds with the operation. In the case of the three numeric types.5") * 2. it returns 0 (false). hex numbers (strings starting with 0x). . 2. decimal numbers. blexpr adds the arguments. Example: $ blexpr ’equals_any (atoi ("3. then this function uses the same function as the internals of the API to detect a numeric value. Example: $ blexpr ’atoi ("4") * atoi (3. 2.. 7... 5)’ 1 $ blexpr ’equals_any (atoi ("3. blexpr will make the appropriate conversions as necessary. then blexpr returns an appropriate error value. 1.14)’ 12 equals_any (val. arg1. 12)’ 1 NSH 2 . Example: $ blexpr ’equal_range (strlen ("Hello world"). The function also checks for a trailing % which will cause the value to be treated as a percentage (meaning divide by 100). FUNCTIONS blexpr also supports functions to determine operand values. Example: $ blexpr ’average (1.blexpr(1) Property of BladeLogic. If it is. Strictly confidential and proprietary Floating point numbers 64 bit integers Strings blexpr(1) Here are some examples of how blexpr handles operations between two different operator types. with the resulting value also being a floating point value. If atoi cannot convert val to an integer. 3. max_val) This functions returns true (value of 1) if the value of val is greater than or equal to the value of min_val and less than or equal to the value of max_value.) This function returns true (value of 1) if val equals any of the remaining function arguments.. 7)’ 0 equals_range (val.0.14").) Return the average of all arguments given. min_val. If one operator is a floating point value and the other is an integer or a 64 bit integer then blexpr converts the integer values to floating point. blexpr converts the string to the respective numeric type. 5. arg2. and floating point numbers. then divides by the number of arguments. 4)’ 2. it first checks to see if the string is a recognizable numeric value. When blexpr encounters an operation between a string and a non-string value. blexpr handles operations between a string and a non-string value such that the operation does not just automatically fail. 3. If one value is a 64 bit integer and the other is regular integer value then blexpr converts the (regular) integer value to a 64 bit integer. If the string is not a recognizable numeric value. 4)’ 2 $ blexpr ’average (1. . Inc. The supported functions are: average (arg1. with the result also being a 64 bit integer value.

Example: $ blexpr ’sprintf ("%12..%s %s --\n". 14.) Both these functions generate a formatted output.m]. it returns true_val. "Pan") sprintf ("Name = -. $FIRSTNAME. "Peter") set_variable ("LASTNAME". 10. "Hello " + "world")’ Hello wor $ blexpr ’ set_variable ("FIRSTNAME". The printf function just prints the output to stdout and returns the number of bytes it wrote.Peter Pan -$ blexpr ’set_variable ("IP". The functions work in a similar way to the C-library printf function call but without all the bells and whistles.. If val is true. false_val) The if function evaluates the value of val. true_val. otherwise it returns false_val Example: $ blexpr ’if (atoi ("3"). Strictly confidential and proprietary blexpr(1) get_date () This function returns the date and time on the local system. $LASTNAME)’ Name = -.P. args .blexpr(1) Property of BladeLogic.30. while the sprintf function returns the formatted output as a string. Inc. 27)’ 14 printf (format.40) printf ("ADDRESS:\n DEC = %11u\n HEX = %11X\n IP = %p\n". The functions support the following argument types: string (%s) floating point (%f) integer The functions support the following output format types: decimal (%d) unsigned int (%u) octal (%o) hex (%x or %X) I.9s".20. Use the show_date () function to turn this value into a more meaningful string format.) sprintf (format. args ..after the % as well as output precision in the form of n[. address notation (%p or %P) The functions also support left justification with the optional . Example: $ blexpr ’get_date ()’ 1060378146 $ blexpr ’show_date (get_date ())’ Tue Jan 14 11:56:02 2003 if (val. NSH 3 .. The date and time is expressed as the value in seconds since the epoch (00:00:00 Jan 1 1970).

In val is of type integer then the function returns the string with an offset of val bytes.’ ADDRESS: DEC = 169090600 HEX = A141E28 IP = 10. "Hello " + "world") toupper ($FOO)’ HELLO WORLD show_date (date. "%b %d %Y %H:%M:%S")’ Jan 14 2003 11:56:02 strstr (string. val) strstr can be used in one of two ways. you can use the variable in a subsequent expression by prefixing the variable name with a ’$’ symbol. $IP). 6)’ world strlen (string) Return the length of value string. then the generated date is in the form of Fri Nov 08:31:22 2001. Example: $ blquery -h linux -e ’show_date (get_date())’ Tue Jan 14 11:56:02 2003 $ blquery -h win2k -e ’show_date (get_date (). Example: $ blexpr ’strstr ("Hello world". $IP.blexpr(1) Property of BladeLogic. If you do not specify a format. Inc. If you supply a value that is not a string.20. Example: $ blexpr ’strlen ("Hello") + strlen ("World")’ 10$ NSH 4 . "bar") $FOO’ bar $ blexpr ’ set_variable ("FOO". The optional format arguments specifies output format.40 blexpr(1) set_variable (string. format) This function takes the numeric date argument and converts it into a string representation. Example: $ blexpr ’ set_variable ("FOO". expr) You can use the set_variable function to create an addressable variable.30. and you define the value of the variable with expr. you should use the respective macros supported by the call. strlen returns a length of 0. "ll")’ llo world $ blexpr ’strstr ("Hello world". You define the name of the variable with string. If val is a string then the function returns the first occurrence of val in the string. Once you have created a variable this way. The function uses the C-library strftime function to convert the value and therefore. Strictly confidential and proprietary $IP.

bladelogic. Inc. every time a Network Shell session is invoked. Inc. In Windows. where <user_profile_dir> specifies a path such as /Documents and Settings/johnk. Creating this certificate generates a user’s public and private keys. OPTIONS None EXAMPLE bl_gen_ssl ORIGIN bl_gen_ssl was developed by BladeLogic. This password is used to gain access to user’s private key. On UNIX. Invoking bl_gen_ssl prompts the user to enter a password and confirm it.pem is stored in /<user_profile_dir>/Application Data/BladeLogic.Property of BladeLogic. Once a certificate is created on a client. id. id. where <home_dir> is the user’s home directory.pem is stored in /<home_dir>/. the user is prompted for a private key password. NSH 1 .509 certificate in a file named id. such as /home/johnk.509 certificate SYNOPSIS bl_gen_ssl DESCRIPTION The bl_gen_ssl command creates an X.pem. Strictly confidential and proprietary bl_gen_ssl(1) bl_gen_ssl(1) NAME bl_gen_ssl − create an X.

." An "Inconsistent" status indicates that the log file may have been tampered with. //<hostname>/<Path to keystroke logfile> localfile Path to local file cat [-t 0123] [-s <session id>] [-h <clienthost>] [-u <clientuser>] [-a <time>] [-b <time>] [-p] <hostname>|<keystroke_logfile> Output remote logfile -t List specified type of entries.. Inc. [TARGET]. the status displays as "Unknown. [COMMAND] [COMMAND_OPTION]. blkeylogman provides a limited set of functionality that can be used in conjunction with existing.. [COMMAND] [COMMAND_OPTION]. e.g. This option displays the status of each keystroke file as either "Consistent". traditional logfile management systems to provide a complete solution.. You can request the status of all the keystroke files on a host." hostname Name of host for which to list keystroke logfiles keystroke_logfile Full NSH Path to remote keystroke logfile. or specify a full NSH path to an individual keystroke file to request just that file’s status. bllogkeyman [GLOBAL_OPTION]. Strictly confidential and proprietary blkeylogman(1) blkeylogman(1) NAME blkeylogman − remotely manage keystroke logfiles on a machine running an RSCD agent SYNOPSIS blkeylogman [GLOBAL_OPTION]. and TARGETS NSH 1 . If the signature file needed for verification is missing on the target host. "Inconsistent".. This option takes a combination of the following characters as input: 0 1 2 3 List live keystroke logfiles for a specific host Copy remote keystroke logfiles Concatenate remote keystroke logfiles View a list of nexec sessions logged in remote keystroke logfiles COMMANDS... COMMAND_OPTIONS.. DESCRIPTION blkeylogman allows a system administrator to manage live keystroke logfiles on the RSCD agent to accomplish basic tasks.g. [TARGET]. There are four primary functions provided by blkeylogman. //<hostname>/<Path to keystroke logfile> copy keystroke_logfile localfile Copy remote keystroke logfile to local host keystroke_logfile Full NSH path to remote keystroke logfile. as follows: list copy cat listsessions list <hostname> list --verify <hostname>|<keystrokelogfile> List (and optionally verify) keystroke logfiles for host --verify This option is useful only when you have enabled keystroke logging on a remote host..... or "Unknown. and the resulting keystroke files have been digitally signed. e.Property of BladeLogic.

-b Show entries where "entry timestamp" < "specified timestamp".Property of BladeLogic.log To list all keystroke logfiles on host "linux1": $ blkeylogman list linux1 To list all keystroke logfiles with verification status on host "solaris10": NSH 2 . As a result. makes blkeylogman process the special terminal control characters to printable ones.mmm" or "MM/DD/YY HH:MM:SS" Process non-printable output characters before printing Sometimes. The format of the timestamp is "MM/DD/YY HH:MM:SS.mmm" or "MM/DD/YY HH:MM:SS" Show sessions that were in progress before the specified timestamp. The format of the timestamp is "MM/DD/YY HH:MM:SS. Inc. Strictly confidential and proprietary blkeylogman(1) blkeylogman(1) 0 Show STDIN entries 1 Show STDOUT entries 2 Show STDERR entries 3 Show STARTSESSION and ENDSESSION entries. //<hostname>/<path to keystroke log file> Show the session specified by <session id> Show sessions for the specified client host Show sessions for the specified client user Show sessions that were in progress after specified timestamp. The format of the timestamp is "MM/DD/YY HH:MM:SS. the display gets garbled or sometimes even cleared. The format of the timestamp is "MM/DD/YY HH:MM:SS. Exercising the p option. executing a blkeylogman cat command causes the terminal to process and interpret special terminal handling control characters (contained in the log data). e.mmm" or "MM/DD/YY HH:MM:SS" EXAMPLES The following will cat the logfile "keystroke.mmm" or "MM/DD/YY HH:MM:SS" keystroke_logfile Full NSH Path to remote keystroke log file listsessions [-s <session id>] [-h <clienthost>] [-u <clientuser>] [-a <time>] [-b <time>] <hostname>|<keystroke_logfile> List all nexec sessions on a particular host or keystroke logfile -s -h -u -a -b hostname Name of the host whose sessions you want to list keystroke_logfile Full NSH path to remote keystroke logfile whose sessions you want to list.log" on the remote host "host1": $ blkeylogman cat //host1/usr/nsh/log/keystroke. if output of interactive commands is logged inside a keystroke log file.g. -s -h -u -a -p Show entries for the session specified by <session id> Show entries for the specified client host Show entries for the specified client user Show entries where "entry timestamp" > "specified timestamp".

SEE ALSO bllogman (1) exports (5) NSH 3 .log1 ORIGIN blkeylogman was written by Rajesh Jangam of BladeLogic.log1" on host "solaris10": $ blkeylogman listsessions //solaris10/usr/nsh/log/keystroke.Property of BladeLogic.log2 To list nexec sessions on host "solaris10": $ blkeylogman listsessions solaris10 To list nexec sessions from file "keystroke. Inc. Inc. Strictly confidential and proprietary blkeylogman(1) blkeylogman(1) $ blkeylogman list --verify solaris10 To list only one log file with verification status on host "solaris10": $ blkeylogman list --verify //solaris10/usr/nsh/log/keystroke.

[TARGET]. [COMMAND] [COMMAND_OPTION]. [TARGET]. Strictly confidential and proprietary bllogman(1) bllogman(1) NAME bllogman − remotely manage live RSCD agent logfiles SYNOPSIS bllogman [GLOBAL_OPTION]. and there are command-specific options affecting only particular commands. logman [GLOBAL_OPTION]... [COMMAND] [COMMAND_OPTION]. as follows: -? -v Generate run-time usage Be verbose when performing functions COMMANDS... COMMAND_OPTIONS.. as follows: tail copy list cat rotate verify Tail remote logfiles Copy remote logfiles or signature files List live logfiles for a specific host Concatenate remote logfiles Rotate remote logfiles or signature files Verify a digitally signed log file locally GLOBAL OPTIONS There are global options which affect all functions. traditional logfile management systems to provide a complete solution... Inc. DESCRIPTION bllogman allows a system administrator to manage live RSCD agent logfiles to accomplish basic tasks.. and TARGETS tail [-f -v] target Output the last part of a logfile -f -n n target Tail forever Tail n lines Name of remote logfile you want to tail copy [-S] logfile|signature_file localfile Copy remote logfile/signature_file to local host -S Indicates that the file you are copying is a signature file. Use only when copying a signature file. logfile/signature_file Full NSH path to remote logfile/signature_file localfile Path to local file cat [-1|-2] [-d] [-l file] <-h host> | logfile Output remote logfile logfile -1 -2 Path to remote logfile Show INFO/INFO1 logfile entries only (default is all) Show INFO2 logfile entries only (default is all) NSH 1 .Property of BladeLogic.... but rather provides a limited set of functionality that can be used in conjunction with existing. bllogman is not intended to be a feature-complete logfile management solution. There are six primary functions provided by bllogman..

and private key file on the local host.log." hostname Name of host for which to list logfiles rotate [-S] logfile/signature_file Rotate provides a simple.log" on the remote host "host1": $ bllogman cat //host1/usr/nsh/log/rscd. EXAMPLES The following will cat the logfile "rscd. This command is intended to be used for client side verification. or "Unknown.1." assuming "rscd." An "Inconsistent" status indicates that the log file may have been tampered with. You can request the status of all the log files on a host. For example. To execute this command. privateKey_file Full path to the local privateKey file that was used to sign the log file.log. This option displays the status of each log file as either "Consistent".Property of BladeLogic. and the resulting log files have been digitally signed. or specify a full NSH path to an individual log file to request just that file’s status. Note: All files needed for this command should be local. Inc. iterative rotation function which simply increments the filename extension by one until an available filename is found. logfile/signature_file Full NSH path to remote logfile/signature_file verify logfile signature_file certificate_file privatekey_file Verify log file consistency at local host. certificate_file Full path to the local certificate file that was used to sign the log file. "Inconsistent". certificate file.log NSH 2 . Strictly confidential and proprietary bllogman(1) bllogman(1) -d -h host -l file -s file Output selected fields in tab separated values format Show all logfiles for host Create a tab delimited ’last entry timestamp’ file Use the ’last entry timestamp’ file to determine start of searching list [--verify] hostname list --verify //hostname/Full_NSH_Path_To_logfile List logfiles on a host --verify This option is useful only when you have enabled secure agent logging on a remote host. signature_file Full path to corresponding local signature file.log" to "rscd. logfile Full path to local log file. this option returns a status as "Unknown. Use only when rotating a signature file. the rotate option will rename the file "rscd. -S Indicates that the file you are rotating is a signature file.1" does not already exist. If you have not enabled secure agent logging on the remote host. you must have the corresponding signature file.

log. You cannot use this command for remote logfiles. Strictly confidential and proprietary bllogman(1) bllogman(1) To retrieve a list of tail-specific options and usage: bllogman tail -h For general usage: bllogman -h To list all logfiles on host "linux1": bllogman list linux1 To list all logfiles with verification status on host "solaris10": $ bllogman list --verify solaris10 To list only one log file with verification status on host "solaris10": $ bllogman list --verify //solaris10/usr/nsh/log/rscd.pem" and the private key stored in "privateKey.log" on host "sun1": bllogman tail -f //sun1/usr/nsh/log/rscd.sig3" using the certificate stored in file "certificate.log. Inc. Inc.log To rotate a signature file on host solaris10: $ bllogman rotate -S //solaris10/usr/nsh/log/rscd.log.pem": $ bllogman verify /usr/tmp/rscd.sig2 To tail forever (or watch) logfile "rscd.pem All files need to be on the local host.sig3 /usr/tmp/certificate.log2 To copy a signature file from host solaris10 to local host: $ bllogman copy -S //solaris10/usr/nsh/log/rscd.sig2 To verify the consistency of logfile "rscd.0 release.log3 /usr/tmp/rscd. For backwards compatibility purposes a logman command is still included.log3" against its corresponding signature file "rscd.pem /usr/tmp/privateKey. NOTE Logman was renamed bllogman as part of the 6. ORIGIN bllogman was written by Damon Miller of BladeLogic. logman is just a copy or symlink of bllogman.3.log.Property of BladeLogic. bllogman should be the preferred utility moving forward as logman may be fully removed in the future. SEE ALSO exports (5) NSH 3 .

If you do not specify a host name. The default output format for each server is: hostname: value OPTIONS -l -h Generate output only for hosts that resolve to true.. Strictly confidential and proprietary blquery(1) blquery(1) NAME blquery − Evaluate expression to query BladeLogic assets SYNOPSIS blquery [ -h -l ] [ host1 . NSH 1 . You can query against the local host (see CAVEATS). To query the local host. This is the default behavior if you specify only a single host. and the subsequent escaping thereof. otherwise it returns 0. See the CAVEATS section for limitations on local servers. Example: $ blquery -h solaris8 -e ’file_is_regular ("/etc")’ 0 $ blquery solaris8 -e ’file_is_regular ("/etc/passwd")’ 1 file_is_symlink (path) This function returns 1 if the given path exists on the host and is a symbolic link. or against any number of remote servers. To help avoid some of the shell special character handling issues. Inc. just omit any server names. otherwise it returns 0. Instead. hostn | -f file ] { -e expr | -E file } DESCRIPTION The blquery utility is an extension to the blexpr utility. If file is a . then blquery will query against each of the given servers. you can also use the -f option to specify a hosts file. output only the resulting value. If you specify server names. host1 . Expression to run against the given hosts. blquery provides additional functions that can query various asset types in the BladeLogic environment.Property of BladeLogic.. you can also use the -E option to define a file containing your expression. To create comment lines. A file containing the expression you want to run. In addition to specifying host names on the command line. start them with a hash (#) and blquery will ignore them.. blquery works by applying the given expression to each host and then outputting the results to stdout.then blquery reads input from stdin. otherwise it returns 0. hostN The hosts you want to query. Do not include the hostname as part of the output.. blquery will query the local server. -E file FILE AND DIRECTORY FUNCTIONS file_is_directory (path) This function returns 1 if the given path exists on the host and is a directory. Example: $ blquery -h solaris8 -e ’file_is_directory ("/etc")’ 1 $ blquery solaris8 -e ’file_is_directory ("/etc/passwd")’ 0 file_is_regular (path) This function returns 1 if the given path exists on the host and is a regular file. -f file -e expr A flat file containing the list of hosts you want to query.

patches. If the file does not exist then it returns a zero length string with the appropriate error set. Example: $ blquery -h solaris8 -e ’file_size ("/etc/passwd")’ 635 file_uid (path) This function returns the path’s ownership as a numeric UID. Example: $ blquery -h solaris8 -e ’file_uid ("/etc/passwd")’ 0 file_gid (path) This function returns the path’s group ownership as a numeric GID. and bundles. Example: $ blquery -h solaris8 -e ’file_exists ("/etc/passwd")’ 1 $ blquery solaris8 -e ’file_exists ("/etc/PASSWD")’ 0 file_size (path) This function returns the size of the file path.Property of BladeLogic. Strictly confidential and proprietary blquery(1) blquery(1) Example: $ blquery -h solaris8 -e ’file_is_symlink ("/etc/passwd")’ 0 $ blquery solaris8 -e ’file_is_symlink ("/etc/hosts")’ 1 file_exists (path) This function returns 1 if the given path exists on the host. Example: $ blquery -h solaris8 linux -e ’file_gid ("/etc/passwd")’ solaris8: 3 linux: 0 file_mode (path) This function returns the path’s file permissions. If the path does not exist or is not accessible it returns the value of -1. If the path does not exist or is not accessible it returns the value of -1. they mostly support the general concept of software installations. Example: $ blquery -h solaris8 linux -e \ ’sprintf ("0%o". If the path does not exist or is not accessible it returns the value of -1. Example: $ blquery -h solaris8 -e ’file_md5sum ("/etc/passwd")’ f59c3bfa14ac178b4098e03f9afe64fe SOFTWARE INSTALLATIONS Although the various supported platforms all have their own concept of what a software package is. otherwise it returns 0. If the path does not exist or is not accessible it returns the value of -1. NSH 2 . file_mode ("/etc/passwd") & 07777)’ solaris8: 0444 linux: 0644 file_md5sum (file) This function returns the 32 byte string representation of the file’s MD5 checksum. Inc.

patch_record_count (expr) package_record_count (expr) bundle_record_count (expr) rpm_record_count (expr) Return the number of installed patch/software/bundle/rpm components that match the expression expr. These functions take an expression as their argument. so the values are not guaranteed to be set. Example: $ blquery -h linux -e ’package_installed ("cracklib-2. Strictly confidential and proprietary blquery(1) blquery(1) The following three functions abstract this concept for the various platforms and will automatically adapt to the type of server you are dealing with. because the function automatically determines the platform type at runtime. NAME VERSION VENDOR DATE Installable name Installable version Installable vendor Installable date of installation (0 if you do not know the date) CATEGORY Installable software category (On AIX the install status) DESCRIPTION Installable short description SIZE Size of installable in KB (0 if you do not know the size) All the above variables are of type string with the exception of SIZE which is an integer. with the exception of Linux. The NSH 3 . Inc.Property of BladeLogic. where the following dynamic variables are initialized for each software/patch entry. Example: $ blquery -h solaris8 -e ’patch_installed ("109608-*")’ 1 $ blquery -h win2k -e ’patch_installed ("Q811493")’ 1 package_installed (software) This function will check if the software package software is installed on the given server. patch_installed (patch) This function will check if the software patch patch is installed on the given server. which does not support patches. All platforms support the concept of installed patches and software components (the names however differ from OS to OS). Note that not all platforms furnish all the above data. Example: blquery -h authpux11agt3 -e ’bundle_installed ("Base*")’ 1 You can use the next three functions to scan/search through the list of patches and software. Bundles exist only on HPUX machines. Note that the concept of patches is not supported on RedHat Linux systems. and that bundles are HP-UX specific.7-8")’ 1 $ blquery -h win2k -e ’package_installed ("Norton AntiVirus*")’ 1 bundle_installed (software) This function will check if the software bundle software is installed on the given server. You do not need to specify the type of machine you dealing with.

blq cracklib-2. Because these functions scan through all entries.Property of BladeLogic.7-8 .blq package_record_count (’NAME = "cracklib*" && printf ("%s . you can find the name of the patch that has the highest version number. these functions may still have a universal appeal.A password-checking library. Not all software has a version number.7-8 . To do this. you may have the same patch installed twice but with different versions. these functions return a zero length string. NAME)’). patch_version (software) package_version (software) bundle_version (software) rpm_version (software) Return the software’s version number. Inc. "Unknown install date". By using these functions. NAME.blq patch_record_count (’NAME = "109793-*" && printf ("%s\n". Example: $ cat patch. The idea is that because the patch name also incorporates a version number (which is also stored in the VERSION field). Install date: Nov 16 2001 The following functions let you extract individual fields from a given piece of software. DESCRIPTION. Strictly confidential and proprietary blquery(1) blquery(1) concept of bundles however is supported only by HP-UX machines. include the printf call inside of the given expression. show_date (DATE.The standard CrackLib dictionaries. making it seem like two different patches are installed. patch_latest (software) package_latest (software) bundle_latest (software) rpm_latest (software) Although specifically designed for Solaris patches. Install date: Nov 16 2001 cracklib-dicts-2. if (DATE <= 0. In this case. Example: # # Number of hotfixes installed on Windows server # $ blquery win2k -e ’patch_record_count ()’ 25 # # Show install date of the "cracklib" RPMS # $ cat expr. you can also use them for reporting.%s\n Install date: %s\n\n". "%b %d %Y"))) $ blquery linuxdev -E expr. $ blquery solaris8 -E patch.blq NSH 4 .

If you omit the expression.’ root daemon sys nobody noaccess nobody4 config_record_number (configfile. Because you often want to match against specific fields within a record. If you use it. this function automatically recognizes and interprets specific variable names. $1 . The variable $FIELDS indicates the number of fields in the record. $0)"). Inc. For Windows systems. As its second parameter. The variable $RECORD indicates the current record number you are dealing with.. The grammar to be used to scan a given config file is automatically determined by consulting the index file. skip) This function returns the record number of the first record in configfile that matches the expression expr. The variable names matching the (string) fields are $0. Example: # # Number of records in password file # $ blquery -h solaris8 -e ’config_record_count ("/etc/passwd")’ 15 # # # # # $ Field 5 is the HOME directory field and as such we are finding all entries in the password file that have "/" as the HOME directory and outputting their user names blquery -h solaris8 -e ’ set_variable ("HOME"..Property of BladeLogic. the file is found in <install dir>/om/scripts. The first record/field is 0. This function is often used with the config_field_value() function to identify the particular record you need a field value for. it will skip over the first skip matched records allowing one to find alternate records to the first matching one. "/"). this function accepts an expression that it matches against each record. expr. Strictly confidential and proprietary blquery(1) blquery(1) 109793-12 109793-03 $ blquery solaris8 -e ’patch_latest ("109793-*")’ 109793-12 $ blquery solaris8 -e ’patch_version (patch_latest ("109793-*"))’ 12 CONFIG FILE FUNCTIONS The following functions let you access the BladeLogic config files. The supported functions are: config_record_count (configfile. NSH 5 . expr) This function returns the total number of records in the configfile that match the expression expr. "$5 = $HOME && printf (\"%s\n\". Config files are generally treated as a series of sequential records that contain a number of fields. The expr argument is optional. For UNIX and Linux systems. $N for each respective field in the current record. The skip parameter is optional. the file is found in /usr/nsh/scripts. config_record_count ("/etc/passwd". the function returns the total number of records.

config_record_number ($INI. "/etc/passwd") set_variable ("USRBIN". config_record_number ($PASSWD. In many cases. Inc. then you can use the config_record_number () function to search for a particular record. 0. field) This function returns the value of field field from record record of the config file configfile. 0)’ bin NSH 6 . "$5 = $USRBIN"). "$5 = \"/usr/bin\"")’ 2 # # Scan the Windows INI file and get the value of the entry # "Access" in the "connect CustomerDatabase" section # $ blquery -h win2k -e ’ set_variable ("INI". "connect CustomerDatabase") config_field_value ($INI. 0) = $CUSTDB)"). "/usr/bin") config_field_value ($PASSWD. 1) ’ ReadWrite config_field_value (configfile. If you do not know the specific record number you need a field value from. 4)’ Super-User # # # # # $ Output the username of the first account in the password file that has "/usr/bin" as it’s HOME directory blquery -h solaris8 -e ’ set_variable ("PASSWD". Strictly confidential and proprietary blquery(1) blquery(1) Example: # # Record number for first entry in the passwd file with a HOME # directory of "/usr/bin" # $ blquery -h solaris8 -e \ ’config_record_number ("/etc/passwd". records occur in a config file in no particular order. $RECORD.Property of BladeLogic. "Access") set_variable ("CUSTDB".BNI") set_variable ("ACCESS". "($0 = $ACCESS) && (config_parent_field_value ($INI. Example: # # Return the GCOS field of the first record in the # passwd file # $ blquery -h solaris8 -e \ ’config_field_value ("/etc/passwd". record. "/c/WINNT/MSDFMAP.

there is an implicit hierarchy by which particular records may point to a parent record. HOME SHELL TYPE The user’s HOME directory. "connect CustomerDatabase") config_field_value ($INI. Example: $ blquery -h win2k -e ’ config_parent_record_number ("/c/WINNT/MSDFMAP. Not all config files have a hierarchy. The user’s initial shell (UNIX) or script (Windows) program. 1) ’ ReadWrite config_parent_record_number (configfile. 0) = $CUSTDB)"). "Access") set_variable ("CUSTDB". then the record does not have a parent record. "($0 = $ACCESS) && (config_parent_field_value ($INI. Strictly confidential and proprietary blquery(1) blquery(1) config_parent_field_value (configfile. config_record_number ($INI. FULLNAME The configured name of the user. NAME GROUP UID GID The username. and returns the value of field field. however you can use it in conjunction with the config_record_number() function to find particular records in a file. 3)’ 2 LOCAL USER AND GROUP ACCOUNTS These functions let you access local user and group accounts. This is the type of account which can be one of: NSH 7 .BNI files and Linux Xinetd config files. Details are included below. On its own this function has limited value. Inc. These functions work cross platform (UNIX type systems and Windows systems) however some of the available data may be OS specific. Example: # # Scan the Windows INI file and get the value of the entry # "Access" in the "connect CustomerDatabase" section # $ blquery -h win2k -e ’ set_variable ("INI".Property of BladeLogic. The numeric GID of the primary group the user is a member of.BNI". For the user based functions that take a expression as an argument. record) This function returns the parent record number of record record in the config file configfile. Although config files are generally treated as flat files. $RECORD.BNI") set_variable ("ACCESS". COMMENT The comment associated with the user account. but ones that do include Windows . The name of the primary group the user is a member of. "/c/WINNT/MSDFMAP. field) This function looks at the parent record of record record in the config file configfile. the following dynamic variable are supported. The numeric UID of the user. record. If the function returns a negative number (-1).

This value is expressed as a time in seconds since the epoch. If the date and time is not known this value is 0. accounts that are Administrator accounts are of this type. BUA_GUEST_ACCOUNT (3) UNIX systems do not have the concept of guest user accounts and therefore will never be of this type. Example: $ blquery linux1 linux2 linux3 -e ’user_exits ("toor")’ linux1: 1 linux2: 0 linux3: 1 NSH 8 . accounts that are Normal accounts are of this type. The supported functions are: user_record_count (expr) This function enumerates through all local user accounts and returns the number of users that match the expression. \"Super User Account\". NAME. This value is a space separated list of the groups to which the user belongs. BUA_NORMAL_ACCOUNT (2) One UNIX systems. If the date and time is not known this value is 0.’ root : Super User Account (uid = 0) daemon : Normal Account (uid = 1) bin : Normal Account (uid = 2) sys : Normal Account (uid = 3) adm : Normal Account (uid = 4) lp : Normal Account (uid = 71) . This value is expressed as a time in seconds since the epoch. On Windows systems. \"Normal Account\"). expr. LASTLOGIN The date and time of the user’s last login. EXPIRES GROUPS The date and time of the user’s password expiration. On Windows systems. If the date and time is not known this value is 0. account have this type if they are not root accounts (UID != 0). On Windows systems. user_exists (user) This function returns 1 if the given user exists as a local user account. If the local account does not exist it returns 0. accounts that are Guest accounts are of this type.Property of BladeLogic. accounts that are root (UID = 0) accounts are considered to be of this type. LASTCHANGE The date and time of the user’s last password change. . Inc. UID)"). This value is expressed as a time in seconds since the epoch. Example: blquery -e ’user_record_count ()’ 15 $ blquery -e ’user_record_count ( "printf (\"%-8s: %s (uid = %d)\n\". if (TYPE = BUA_ADMIN_ACCOUNT. Strictly confidential and proprietary blquery(1) blquery(1) BUA_ADMIN_ACCOUNT (1) On UNIX systems.

Example: $ blquery win2k solaris -e ’user_fullname ("Administrator")’ win2k: Local Administrator Account solaris: Bad argument type: Unknown local user "Administrator" user_comment (user) This function returns the comment associated with the user. Strictly confidential and proprietary blquery(1) blquery(1) user_uid (user) This function returns the UID of the user. When it is set. the function returns an error message. the function returns an error message. On Windows this value is most often not set and therefore has limited value. On Windows. For UNIX systems the GECOS field is returned. that field is returned. If the user does not exist then this function returns an error message. Example: $ blquery linux1 linux2 linux3 -e ’user_uid ("toor")’ linux1: 0 linux2: Bad argument type: Unknown local user "toor" linux3: 2 user_gid (user) This function returns the GID of the user. Example: $ blquery solaris linux -e ’user_gid ("root")’ solaris: 1 linux: 0 user_fullname (user) This function returns the fullname associated with the user. If the user does not exist then it returns an error message. If the user does not exist then this function returns an error message. For UNIX systems the GECOS field is returned. If the user does not exist then it returns an error message. local user accounts have such a field associated with the account and therefore. If the user does not exist. If the user does not exist. On Windows.Property of BladeLogic. Example: $ blquery linux solaris -e ’user_shell ("lp")’ solaris: /bin/sh linuxdev: /sbin/nologin NSH 9 . On Windows this value is most often not set and therefore has limited value. Note that the user_fullname () and user_comment () functions also return the GECOS field for UNIX systems. local user accounts have such a field associated with the account and therefore. the function refers to a start script. Example: $ blquery linux solaris -e ’user_homedir ("bin")’ linux: /bin solaris: /usr/bin user_shell (user) This function returns the start program (shell) for when the user logs in. that field is returned. Example: $ blquery win2k -e ’user_comment ("Administrator")’ win2k: Built-in account for administering the computer/domain user_homedir (user) This function returns the HOME directory of the user. Inc.

and guest.6.9. To display the date of last login in human readable form. There are no guest accounts for UNIX systems.7. use the show_date () function.Property of BladeLogic. or 3. The default separator is a SPACE character. Otherwise it is a normal account. the function returns an error message. Example: $ blquery solaris8 -e ’user_group_names ("root")’ other root bin sys adm uucp mail tty lp nuucp daemon user_group_gids (user. The default separator is a SPACE character.2.3. For UNIX systems. If the user does not exist.5. an account is considered to be locked if you can unlock it without having to provide a new password. The optional argument sep must be a string whose first character will be used as the separator for the list of values. Example: $ blquery win2k -e ’user_last_login ("Guest")’ 1067983862 $ blquery solaris -e ’show_date (user_last_login ("root"))’ Fri Feb 13 13:30:48 2004 user_locked (user) This function returns value of 1 if the user’s account is locked. normal. The optional argument sep must be a string whose first character will be used as the separator for the list of values. Example: $ blquery solaris8 -e ’user_group_gids ("root". with respective return values of 1. account type is one of the inherent account properties while for Unix systsems an account is an administrator account if the UID is 0. Example: $ blquery win2k -e ’user_locked ("Administrator")’ 0 $ blquery solaris -e ’user_locked ("Oracle")’ 1 user_group_names (user. ". Example: $ blquery linux solaris -e ’user_type ("root")’ solaris: 1 linuxdev: 1 $ blquery win2k -e ’user_type ("Guest")’ 3 user_last_login (user) This function returns the date and time of last login (as expressed in seconds since the epoch) of user user. 2.12 user_group_count (user) This function returns the number of groups to which the user belongs. Inc.")’ 1. For Windows systems.4. Example: $ blquery solaris8 -e ’user_group_count ("root")’ 11 NSH 10 .0. the function returns 0. For Windows. sep) This function returns a string representing a list of GIDs to which the user belongs. administrator. sep) This function returns a string representing a list of user groups to which the user belongs. If the function cannot determine a date of last login for the user. these are inherent attributes of a user account.8. Strictly confidential and proprietary blquery(1) blquery(1) user_type (user) This function returns the type of user account user is. There are three types of possible accounts: . otherwise it returns 0.

. GID)’). $ cat showgroups. The optional argument sep must be a string whose first character will be used as the separator for the list of values.Property of BladeLogic. the following dynamic variables are supported. The group related functions are: group_exists (group) This function returns 1 if the given group exists as a local group account. Example: blquery -e ’group_record_count ()’ 18 $ cat showgroups.blq printf ("Group GID\n"). NAME. sep) This function returns a string representing a list of users who are members of the given local user group. group_gid (group) This function returns the GID of the given local user. NAME GID MEMBERS The groupname. If the local account does not exist it returns 0. The users who are members of the group (space separated) COMMENT The comment string associated with the group. The default separator is a SPACE character. Strictly confidential and proprietary blquery(1) blquery(1) For the group based functions that take an expression as an argument. Example: $ blquery win2k -e ’group_comment ("Administrators")’ Administrators have complete and unrestricted access to the computer/dom group_members (group. Example: NSH 11 .blq | blquery solaris -E Group GID ----------------root 0 other 1 bin 2 . printf ("-----------------\n"). group_record_count (’printf ("%-10s %d\n". Example: $ blquery linux solaris win2k -e ’group_exits ("uucp")’ linux: 1 solaris: 1 win2k: 0 group_record_count (expr) This function returns the number of groups that match the expression expr. The numeric GID of the user. group Example: $ blquery solaris -e ’group_gid ("other")’ 1 group_comment (group) This function returns the comment field of the given local user group. Inc.

address of the first interface that matches the expression expr as a string in the standard 4 octet notation.P.*\"")’ solaris: hme0 linux: eth0 net_mac_address (expr) This function enumerates the available adapters.20.0 NSH 12 . Each hex value is treated as a two character value using lower case alpha characters.255.uucp group_member_count (group) This function returns the number of users who are members of the local user group. Example: $ blquery solaris8 -e ’net_ip_address ("NAME = \"hme0\"")’ 10. and returns the subnet mask of the first interface that matches the expression expr as a string in the standard 4 octet notation. IN OUT The number of bytes received by the adapter (supported only on Solaris and Linux) The number of bytes sent by the adapter (supported only on Solaris and Linux) The name of the adapter (for example "hme0") The adapter’s MAC address.P.40\"")’ 255.")’ root. and returns the MAC address of the first interface that matches the expression expr.30. address in the standard 4 octet notation. and returns the I.30.255.40 net_subnet_mask (expr) This function enumerates the available adapters. The adapter’s I. The supported network functions are: net_interface_name (expr) This function enumerates the available adapters. All of these functions take an expression as an argument. Within these expressions.30. Example: $ blquery win2k -e ’group_member_count ("Administrator")’ 6 NETWORK ADAPTERS The following functions let you query against the configured network adapters and their respective settings. you can use the following dynamic variables. Strictly confidential and proprietary blquery(1) blquery(1) $ blquery solaris8 -e ’group_members ("uucp".20. The adapter’s subnet mask in the standard 4 octet notation. Example: $ blquery solaris linux -e ’net_interface_name ("IP = \"10.20. NAME MAC IP SUBNET BROADCAST The adapter’s broadcast address in the standard 4 octet notation. Inc. This argument identifies the particular adapter you want to query. and returns the name of the first interface that matches the expression expr.Property of BladeLogic. Example: $ blquery solaris8 -e ’net_mac_address ("NAME = \"hme0\"")’ 08:00:20:c1:d6:8c net_ip_address (expr) This function enumerates the available adapters. ". Example: $ blquery solaris8 -e ’net_subnet_mask ("IP = \"10.

4.30. The interface is running at a speed of 100Mb/sec.30. if ($FLAGS & 64. "1Gb". Example: $ blquery solaris8 -e ’net_broadcast_address ("IP = \"10. "10 Mb". the function matches all adapters. Example: $ blquery solaris8 -e ’net_bytes_in ("NAME = \"hme0\"")’ 651703216 net_bytes_out (expr) This function enumerates the available adapters. The status flag of an interface is a series of bits that may have the following values (available only on Solaris) 1 2 4 32 64 The interface is running at a speed of 10Mb/sec.20.40\"")’ 10. "Half Duplex". The return value is a 64 bit integer. The interface is running at a speed of 1000Mb/sec (1 Gb/sec). This function returns useful information for Solaris and Linux servers only.255 net_bytes_in (expr) This function enumerates the available adapters. Example: $ cat speed. NSH 13 . net_flags (’NAME = "hme0"’)) printf if if if ("SPEED ($FLAGS ($FLAGS ($FLAGS = & & & %s/sec (%s)0. The interface is running in full duplex mode. "Full Duplex". if ($FLAGS & 32. Example: $ blquery solaris8 -e ’net_bytes_in ("NAME = \"hme0\"")’ 330533685 net_flags (expr) This function enumerates the available adapters.blq SPEED = 100 Mb/sec (Auto) net_record_count (expr) This function enumerates all available adapters and returns the number of adapters that match the expression expr. and returns the status flag for the first interface that matches the expression expr. and returns the broadcast address of the first interface that matches the expression expr as a string in the standard 4 octet notation. The interface is running in half duplex mode.Property of BladeLogic. "100 Mb". "Auto"))). and returns the number of bytes sent by the first interface that matches the expression expr. $ blquery solaris8 -E speed. Inc. 2. This function returns useful information for Solaris and Linux servers only. If you do not specify expr. The return value is a 64 bit integer.20. 1. Strictly confidential and proprietary blquery(1) blquery(1) net_broadcast_address (expr) This function enumerates the available adapters. "NA"))).blq set_variable ("FLAGS". and returns the number of bytes received by the first interface that matches the expression expr.

2-2 win2k: SP3 sys_cpu_count () This function returns the number of CPUs on the system. Inc.0. Different operating systems deal with this in different ways. Example: $ blquery solaris8 linux win2k hpux11 -e ’os_release ()’ solaris8: 5.255.0. On Windows. $ blquery solaris8 -E adapters. the function returns the maintenance release. It also has a series of pre-defined wrapper functions where you do not need to know any ntop details to get the information.8 linux: 7. Strictly confidential and proprietary blquery(1) blquery(1) Example: $ blquery solaris8 -e ’net_record_count ()’ 2 $ cat adapters.0.21. such as Solaris and HPUX return a zero length string (meaning no value). Other platforms.Property of BladeLogic. NAME.101 255. SUBNET)’). Example: $ blquery -h solaris8 linux win2k -e ’sys_cpu_count ()’ solaris8: 4 linux: 2 win2k: 1 NSH 14 . followed by the generic functions. The wrapper functions are described first.255. IP. net_record_count (’printf ("%-10s %12s %15s\n". os_name () This function return the name of the operating system of each host. On Linux.1 255.0 SYSTEM STATISTICS FUNCTIONS (NTOP VALUES) blquery has a generic mechanism to access ntop data. Example: $ blquery solaris8 linux win2k hpux11 -e ’os_name ()’ solaris8: SunOS linux: RedHat win2k: WindowsNT hpux11: HP-UX os_release () This function return the OS release for each host.00 os_patch () This function returns the maintenance release of the each host.1 win2k: 5. On AIX.0 hpux11: B. Example: $ blquery -h solaris8 linux win2k -e ’os_patch ()’ solaris8: linux: 2. the function returns the Service Pack.0.4.11. the function returns the kernel release number.20.blq printf ("INTERFACE IP ADDRESS SUBNET MASK\n").blq INTERFACE IP ADDRESS SUBNET MASK lo0 127.0 hme0 10.

Example: $ blquery -h solaris8 linux win2k -e ’sys_memory ()’ solaris8: 256 linux: 128 win2k: 511 sys_swap () This function returns the total amount of swap space in MB as reported by the OS.Property of BladeLogic. Example: $ blquery -h solaris8 linux win2k -e ’stat_swap_capacity ()’ solaris8: 0. Example: $ blquery -h solaris8 linux win2k -e ’stat_mem_capacity ()’ solaris8: 0. Example: $ blquery -h solaris8 linux win2k -e ’sys_cpu_speed ()’ solaris8: 440 linux: 2386 win2k: 797 sys_memory () This function returns the total amount of main memory in MB as reported by the OS.5100 linux: 0.1400 stat_mem_capacity () This function returns the percentage of memory used on the system.1000 stat_proc_count () This function returns the number of processes running on the system. Inc. Strictly confidential and proprietary blquery(1) blquery(1) sys_cpu_speed () This function returns the CPU speed in MHz.0800 win2k: 0. Example: $ blquery -h solaris8 linux win2k -e ’sys_swap ()’ solaris8: 513 linux: 258 win2k: 2047 stat_load_average () This function returns the systems load average as a floating point value.0100 linux: 0.0300 win2k: 0. Not all systems return a value.0100 linux: 0.4100 stat_swap_capacity () This function returns the percentage of swap space used on the system.9100 win2k: 0. Example: $ blquery -h solaris8 linux win2k -e ’stat_load_average ()’ solaris8: 0. Example: $ blquery -h solaris8 linux win2k -e ’stat_proc_count ()’ solaris8: 43 linux: 57 win2k: 38 NSH 15 .

column. "STATS". "/usr"))’ solaris8: 2056211 linux: 1035660 win2k: 39045982 df_used (partition) This function returns the number of used blocks (in KB) of the named partition. Example: $ blquery -h solaris8 linux win2k -e ’stat_uptime ()’ solaris8: 2524551 linux: 598933 win2k: 107898 df_total (partition) This function returns size in KB of the named partition. "/C". Example: $ blquery -h solaris8 linux win2k -e \ ’df_capacity (if (os_name () = "WindowsNT". NSH 16 . "/usr"))’ solaris8: 775191 linux: 829532 win2k: 9579678 df_free (partition) This function returns the number of free blocks (in KB) of the named partition.8000 win2k: 0. "/C".2500 The following functions are generic functions to access ntop data. "NET".3800 linux: 0. "DF". Strictly confidential and proprietary blquery(1) blquery(1) stat_uptime () This function returns the number seconds that the machine has been running (meaning the number of seconds since it was booted). "/usr"))’ solaris8: 0. Inc. Example: $ blquery -h solaris8 linux win2k -e \ ’df_total (if (os_name () = "WindowsNT". the first line of output consists of the column names.Property of BladeLogic. use the first word of the name to identify the column. expr) This function calls up the ntop data of type type (one of "PS". In this case. or "MEM") and returns the value the field named by column of the first record that matches the expression expr. Check the individual ntop commands for more details. A quick guideline is that if you run the corresponding ntop command. "OVER". ntop_value (type. Example: $ blquery -h solaris8 linux win2k -e \ ’df_free (if (os_name () = "WindowsNT". Column names are specific to the particular ntop data type. Example: $ blquery -h solaris8 linux win2k -e \ ’df_used (if (os_name () = "WindowsNT". Some columns have a two word name. "/C". "/C". "/usr"))’ solaris8: 1281020 linux: 206128 win2k: 29466303 df_capacity (partition) This function returns the percentage of used disk space of the named partition.

0100 # # Same as calling df_capacity ("/usr") # $ blquery linux -e ’ntop_value ("DF".3800 ntop_sum (type. Inc.1200 linux: 0. the function will loop through all records and apply the expression to each record.Property of BladeLogic. "DF" and "PS"). Example: # # For each server. "(USER = $APACHE_USER) && (COMMAND = $APACHE_PROCNAME)") ’ linux1: 0. a value of -1 means the last record). "MEM". expr) This function returns the sum of a series of ntop fields (named by column) of type type that match the expression expr. "MOUNTED = \"/usr\"")’ linux: 0. the function considers the numeric to be the specific record number you want to access.1f MB". the sum of memory usage (as %) # of all apache processes # $ blquery linux1 linux2 linux3 -e ’ set_variable ("APACHE_USER". ntop_sum ("DF". column.2 MB NSH 17 . If you specify an expression as a string. "FREE") / 1024. the total amount of free disk space # $ blquery -h linux solaris8 win2k -e ’ sprintf ("Total free space on %-9s: %8. "apache") set_variable ("APACHE_PROCNAME". "CAPACITY". "*httpd*") ntop_sum ("PS". the function returns the field value of the first record. Column names and ntop data types are equivalent to the workings of the ntop_value function (see above). Negative numbers tell the function to start looking from the back of the list (for example. Strictly confidential and proprietary blquery(1) blquery(1) The expression argument (third argument) is useful for ntop data that consists of more than a single output record (such as. You may use column names to construct the expression. "SWAP")’ solaris8: 0.0) ’ Total free space on linux : 7911.0890 # # For each server.1480 linux2: 0. the function returns the appropriate field value (based on column name). If you do not specify an expression. Records that do not match the expression are not included in the summary. If the expression is a numeric.0560 linux3: 0. $HOSTNAME. Example: # # Same as stat_swap_capacity () # $ blquery solaris8 linux -e ’ntop_value ("STATS". If the function does not find any matching records. it returns a value of -1. The first record is 0. When a record matches the expression (expression evaluates to true).

for example: "HKEY_LOCAL_MACHINE\\SOFTWARE". Whenever you want to use a backslash in an expression string in NSH.6% ntop_record_count (type. Example: $ blquery win2k -e \ ’reg_key_exists ("HKEY_LOCAL_MACHINE\\SOFTWARE")’ 1 NSH 18 . you need to escape it.0 MB ntop_average (type. separate your registry key paths with two backslashes.8 MB 36208. Inc. Example: # # Average free disk space of several servers # $ blquery -h linux solaris8 win2k -e ’ sprintf ("Average disk capacity on %-9s: %4. Therefore. expr) This function returns the number of entries in the ntop data type that match the expression expr. within an expression string. then it return the total number of entries. otherwise it returns 0. Example: # # Total number of processes running # $ blquery linux solaris8 win2k -e ’ntop_record_count ("PS")’ linux: 46 solaris8: 48 win2k: 44 # # Total number of java processes running # $ blquery linux solaris8 win2k -e ’ ntop_record_count ("PS". $HOSTNAME.1% Average disk capacity on win2k : 7. Registry paths must always be absolute including the root hive name (for example.Property of BladeLogic.1f%%". "COMMAND = \"*java*\"")’ linux: 8 solaris8: 13 win2k: 16 WINDOWS REGISTRY FUNCTIONS The following functions let you query a Windows registry. column. expr) This function works just like the ntop_sum function with the exception that it returns the average value of the matched entries instead of the sum of the values. "CAPACITY") * 100) ’ Average disk capacity on linux : 45.4% Average disk capacity on solaris8 : 13. "HKEY_LOCAL_MACHINE"). If expr is not given. All registry key paths in Windows are backslash (\) separated. ntop_average ("DF". reg_key_exists (keypath) This function returns 1 if the registry key keypath exists. Strictly confidential and proprietary blquery(1) blquery(1) Total free space on solaris8 : Total free space on win2k : 12101.

REG_BINARY. REG_SZ. The supported types are: REG_DWORD. REG_NONE Returns a zero length string. etc. string. REG_LINK. and all others Returns a string consisting of the hex values of each item in the array of values. when storing the results of a reg_value command in a variable (as shown in the following examples). you need to escape the backslashes (\) in the path of the registry value as follows: • Use two backslashes when using the $() form • Use four backslashes when using the ‘‘ form (back-tick form) $ LANG=$(blquery -h win2k -e ’reg_value("HKEY_LOCAL_MACHINE \\SOFTWARE\\INTEL\\CurrentLanguage")’) $ echo $LANG $ ENU $ LANG=‘blquery -h win2k -e ’reg_value("HKEY_LOCAL_MACHINE \\\\SOFTWARE\\\\INTEL\\\\CurrentLanguage")’‘ $ echo $LANG $ ENU The return type (for example. use this function in conjunction with the reg_value_exists function to determine if the registry value exists. Since -1 is a possible valid value of a registry value. If valpath is not a valid registry path then the function returns -1.Property of BladeLogic. Examples: $ blquery -h win2k -e ’ reg_value ("HKEY_LOCAL_MACHINE\\SOFTWARE\\INTEL\\CurrentLanguage")’ ENU $ blquery -h win2k -e ’reg_value ( "HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Lsa\\bounds" )’ 0030000000200000 Note. REG_DWORD_BIG_ENDIAN Returns a 32 bit integer value. Strictly confidential and proprietary blquery(1) blquery(1) reg_value_exists (valpath) This function returns 1 if the registry value valpath exists. There are no NSH 19 . Inc. Example: $ blquery -h win2k -e ’ reg_value_exists ("HKEY_LOCAL_MACHINE\\SOFTWARE\\INTEL\\CurrentLanguage")’ 1 reg_value (valpath) This function returns the value of registry value valpath. Each hex value consists of two (zero filled) hex characters. int. REG_EXPAND_SZ Returns a string. otherwise it returns 0. REG_MULTI_SZ Returns a string containing all strings in the multi string space separated.) depends on the registry value type.

If accessing a non Windows server or if the service does not exist. service_exists (name) This function returns 1 if the Windows service name (as defined by the service’s display name) exists. "AUTO_START". PROGRAM Name of executable used by service.Property of BladeLogic. the function returns 0. it is taken to be a record number as returned by service_record_number (). Example: $ blquery -h win2k -e ’service_running ("MySql")’ 1 # # Check if the service that runs "mysqld-nt. "*\\mysqld-nt. "STOPPED". "DISABLED") NSH 20 . DESCRIPTION Description of service. WINDOWS SERVICES FUNCTIONS The following functions let you query Windows services. These (sub) expressions support the following dynamic variable names: NAME DISPLAY STATUS STARTUP LOGON Name of service (short name). One of "RUNNING". "SYSTEM_START". "MANUAL". service is taken to be a service name (as defined by the service’s display name). If service is an integer. if it is not running. or "DISABLED". If the service does not exist. See the top of this section for dynamic variable names and their possible values. If you do not specify expr. Inc. In the case of a string.exe") service_running (service_record_number ("PRORGAM = $EXE"))’ 1 service_record_count (expr) This function returns the number of services that match the expression expr. or if you are not accessing a Windows server then the function returns 0. There are several functions that let you pass an expression to find a matching service. if you specified an out of range record number. Example: $ blquery -h win2k -e ’service_exists ("MySql")’ win2k: 1 service_running (service) This function returns 1 if the named service exists and is currently running. Account name service is run as. Strictly confidential and proprietary blquery(1) blquery(1) spaces between the array values. One of "BOOT_START". Display name of service (long name). the function returns the total number of configured services. Example: # # Total number of services currently disabled # $ blquery win2k -e ’ set_variable ("DISABLED".exe" is running # $ blquery -h win2k -e ’ set_variable ("EXE". service can be either a string or an integer. or "PENDING".

you can use it in other services functions. Returns the display name of service (long name). $RUNNING). or "PENDING". "*\\mysqld-nt. field) This function returns the string value of a particular service field. Returns one of the following strings: "BOOT_START". service_record_count (’STATUS = "RUNNING"’)) set_variable ("STOPPED". DESCRIPTION Returns the description of the service. to access particular service records. service_record_count (’STATUS = "PENDING"’)) printf printf printf printf ("Total services: %d\n". NSH 21 .blq Total services: 63 RUNNING: 35 STOPPED: 28 PENDING: 0 service_record_number (expr. This function is useful when you do not yet know the name of the service that you will be dealing with. $STOPPED). # $ blquery -h win2k -e ’ set_variable ("EXE". or "DISABLED". Returns one of the following strings:"RUNNING". (" STOPPED: %d\n". (" PENDING: %d\n". (" RUNNING: %d\n".exe") service_running (service_record_number ("PRORGAM = $EXE")) ’ 1 service_field_value (service.exe" is running or not. NAME DISPLAY STATUS STARTUP LOGON Returns the name of service (short name). $PENDING). "MANUAL". Returns the account name service is run as. "AUTO_START". "SYSTEM_START".blq set_variable ("RUNNING". service_record_count (’STATUS = "STOPPED"’)) set_variable ("PENDING". See the top of this section for dynamic variable names that can be used in this expression. Example: # # Find out if the service using the executable # "mysqld-nt.Property of BladeLogic. "STOPPED". Inc. skip) This function returns the record number for the first service that matches the expression expr. $ blquery win2k -E expr. The optional skip parameter tells the function to skip the first skip number of matched records. Once you get this record number. service_record_count ()). field should be one of the following string values. Strictly confidential and proprietary blquery(1) blquery(1) service_record_count ("STARTUP = $DISABLED")’ 1 # # Services summary # $ cat expr.

nmem (NSH).exe # # The same again # $ blquery win2k -e ’ set_variable ("MYSQL". ntop (NSH). Inc. "PROGRAM")’ C:\nsh\mysql\bin\mysqld-nt. ndf (NSH). The argument service can be either a string or an integer.Property of BladeLogic. "MySql") service_field_value ( service_record_number ("NAME = $MYSQL"). nnet (NSH) NSH 22 . "PROGRAM") ’ C:\nsh\mysql\bin\mysqld-nt. If service is an integer. ORIGIN blquery was written by Thomas Kraus SEE ALSO blexpr (NSH). service is taken to be a service name (as defined by the service’s display name). Strictly confidential and proprietary blquery(1) blquery(1) PROGRAM <other> Returns the name of the executable used by the service.exe CAVEATS Windows Services queries against the local server are not supported. Example: # # Get the name of the executable associated with # the MySql service # $ blquery win2k -e ’ service_field_value ("MySql". Returns zero length string. nps (NSH). it is taken to be a record number as returned by service_record_number (). In the case of a string. nover (NSH). NOTES The blquery utility itself is a very short program. It just interfaces the underlying blquery API. nstats (NSH).

the system generates a message like the following: set BL_SRP_INFO to <xy> to reuse this private key. EXAMPLE bl_srp_agent --background ORIGIN bl_srp_agent was developed by BladeLogic. When you run bl_srp_agent. bl_srp_agent runs in the background with the user information cached in a shared memory segment. and role.bl_srp_agent(1) Property of BladeLogic. If you do not use this option. the system prompts for a user ID. Other programs can use the information cached by bl_srp_agent whether bl_srp_agent is running in the foreground or background. OPTIONS --background Instructs bl_srp_agent to run in the background. After you provide this information. where <xy> is the hexadecimal value of the location of the shared memory segment. Inc. password. set the BL_SRP_INFO environment variable by issuing the following command: BL_SRP_INFO=<xy> Export the BL_SRP_INFO environment variable by issuing the following command: export BL_SRP_INFO The bl_srp_agent program remains in the background holding the user information cached in a shared memory segment until you kill it. Inc. NSH 1 . This shared memory segment is only usable for the user who ran bl_srp_agent. bl_srp_agent runs in the foreground. After entering your user information. Strictly confidential and proprietary bl_srp_agent(1) NAME bl_srp_agent − activate a user information cache on UNIX SYNOPSIS bl_srp_agent --background DESCRIPTION The bl_srp_agent command activates a user information cache on UNIX. To reuse this shared memory segment with Network Shell.

where <xy> is the hexadecimal value of the location of the shared memory segment. Other programs can use the information cached by bl_srp_agent whether bl_srp_agent is running in the foreground or background. password. To reuse this shared memory segment with Network Shell. Inc. After entering your user information. If you do not use this option.bl_srp_agent(1) Property of BladeLogic. the system generates a message like the following: set BL_SRP_INFO to <xy> to reuse this private key. Strictly confidential and proprietary bl_srp_agent(1) NAME bl_srp_agent − activate a user information cache on UNIX SYNOPSIS bl_srp_agent --background DESCRIPTION The bl_srp_agent command activates a user information cache on UNIX. the system prompts for a user ID. NSH 1 . bl_srp_agent runs in the background with the user information cached in a shared memory segment. bl_srp_agent runs in the foreground. This shared memory segment is only usable for the user who ran bl_srp_agent. and role. When you run bl_srp_agent. OPTIONS --background Instructs bl_srp_agent to run in the background. EXAMPLE bl_srp_agent --background ORIGIN bl_srp_agent was developed by BladeLogic. set the BL_SRP_INFO environment variable by issuing the following command: BL_SRP_INFO=<xy> Export the BL_SRP_INFO environment variable by issuing the following command: export BL_SRP_INFO The bl_srp_agent program remains in the background holding the user information cached in a shared memory segment until you kill it. After you provide this information. Inc.

The command-line options are deliberately very similar to those of GNU gzip.bz becomes filename filename.. Multiple files may be compressed and decompressed like this.bz2. such as MS-DOS.bz. You can also compress or decompress files to the standard output by giving the −c flag. bunzip2 (or bzip2 −d) decompresses all specified files...tbz becomes filename. Strictly confidential and proprietary bzip2(1) NAME bzip2. Integrity testing (−t) of concatenated compressed files is also supported. Each compressed file has the same modification date. The resulting outputs are fed sequentially to stdout. Inc. Each file is replaced by a compressed version of itself. bzip2 will decline to write compressed output to a terminal. and.out appended.. File name handling is naive in the sense that there is no mechanism for preserving original file names. . Compression is generally considerably better than that achieved by more conventional LZ77/LZ78-based compressors. bzip2 and bunzip2 will by default not overwrite existing files. as this would be entirely incomprehensible and therefore pointless. supplying no filenames causes decompression from standard input to standard output. v1. and Huffman coding.tar anyothername becomes anyothername... bzip2 attempts to guess the filename for the decompressed file from that of the compressed file as follows: filename. and a warning issued.tbz2 becomes filename. but they are not identical. so that these properties can be correctly restored at decompression time. .0 bzcat − decompresses files to stdout bzip2recover − recovers data from damaged bzip2 files SYNOPSIS bzip2 [ −cdfkqstvzVL123456789 ] [ filenames . and uses the original name with . ownerships or dates in filesystems which lack these concepts. bzip2 expects a list of file names to accompany the command-line flags. and approaches the performance of the PPM family of statistical compressors. bunzip2 − a block-sorting file compressor.tbz.tar filename. with the name "original_name. ] bunzip2 [ −fkvsVL ] [ filenames . ] bzcat [ −s ] [ filenames . If no file names are specified. permissions. ownership as the corresponding original.out If the file does not end in one of the recognised endings. bzip2 complains that it cannot guess the name of the original file.bz2 becomes filename filename. In this case. specify the −f flag. bunzip2 will correctly decompress a file which is the concatenation of two or more compressed files. If you want this to happen. As with compression. 1 . ] bzip2recover filename DESCRIPTION bzip2 compresses files using the Burrows-Wheeler block sorting text compression algorithm.bz2". . permissions.tbz2 or . or have serious file name length restrictions. when possible. The result is the concatenation of the corresponding uncompressed files. bzip2 compresses from standard input to standard output.bzip2(1) Property of BladeLogic. Files which were not created by bzip2 will be detected and ignored.

Files of less than about one hundred bytes tend to get larger. so it can only tell you that something is wrong. Also forces bzip2 to break hard links to files. invalid flags. even if the compressed file is slightly larger than the original. if your machine is low on memory (8 megabytes or less). bzcat (or bzip2 -dc) decompresses all specified files to the standard output. −s --small Reduce memory usage. I/O errors. which limits memory use to around the same figure. Earlier versions of bzip2 will stop after decompressing the first file in the stream. −k --keep Keep (don’t delete) input files during compression or decompression. since the compression mechanism has a constant overhead in the region of 50 bytes. and against undetected bugs in bzip2 (hopefully very unlikely). Be aware. It can’t help you recover the original uncompressed data. Inc. Normally. bunzip2 and bzcat are really the same program. Files are decompressed and tested using a modified algorithm which only requires 2. use −s for everything. Strictly confidential and proprietary bzip2(1) Compression of multiple files in this manner generates a stream containing multiple compressed file representations. Compression is always performed. This guards against corruption of the compressed data. bug) which caused bzip2 to panic. 3 for an internal consistency error (eg. and forces bzip2 to decompress. but don’t decompress them. The chances of data corruption going undetected is microscopic. −z --compress The complement to −d: forces compression. 1 for environmental problems (file not found. This really performs a trial decompression and throws away the result.bzip2(1) Property of BladeLogic. in that order. that the check occurs upon decompression. −t --test Check integrity of the specified file(s). about one chance in four billion for each file processed. 2 to indicate a corrupt compressed file. This gives a convenient way to supply default arguments. This means any file can be decompressed in 2300k of memory. See MEMORY MANAGEMENT below. bzip2 will read arguments from the environment variables BZIP2 and BZIP. Such a stream can be decompressed correctly only by bzip2 version 0. During compression. at the expense of your compression ratio.5%. This flag overrides that mechanism. −f --force Force overwrite of output files.0 or later.5 bytes per block byte. −s selects a block size of 200k. bzip2 uses 32-bit CRCs to make sure that the decompressed version of a file is identical to the original. which it otherwise wouldn’t do. &c). OPTIONS −c --stdout Compress or decompress to standard output. and will process them before any arguments read from the command line. You can use bzip2recover to try to recover data from damaged files. decompression and testing. albeit at about half the normal speed.05 bits per byte. −d --decompress Force decompression.9. for compression. 2 . giving an expansion of around 0. As a self-check for your protection. bzip2. Random data (including the output of most file compressors) is coded at about 8. bzip2 will not overwrite existing output files. and the decision about what actions to take is done on the basis of which name is used. In short. Return values: 0 for a normal exit. though. regardless of the invokation name.

and the amount of memory needed for compression and decompression. Most of the compression comes from the first two or three hundred k of block size. but only touch 400k + 20000 * 8 = 560 kbytes of it. The amount of real memory touched is proportional to the size of the file. or 100k + ( 2. bunzip2 has an option to decompress using approximately half this amount of memory. At decompression time. They provided some coarse control over the behaviour of the sorting algorithm in earlier versions. Compression and decompression requirements. and bunzip2 then allocates itself just enough memory to decompress the file. the block size used for compression is read from the header of the compressed file. Compression and decompression speed are virtually unaffected by block size.that means most files you’d encounter using a large block size. −v --verbose Verbose mode -. which was sometimes useful. since that maximises the compression achieved. in bytes. Decompression speed is also halved. bunzip2 will require about 3700 kbytes to decompress. MEMORY MANAGEMENT bzip2 compresses large files in blocks. −1 to −9 Set the block size to 100 k.9. license terms and conditions.000 bytes through 900. since the file is smaller than a block. it follows that the flags −1 to −9 are irrelevant to and so ignored during decompression. The block size affects both the compression ratio achieved.5 and above. To support decompression of any file on a 4 megabyte machine.. Another significant point applies to files which fit in a single block -. The relevant flag is -s.000 bytes long with the flag -9 will cause the compressor to allocate around 7600k of memory. 200 k . try and use the largest block size memory constraints allow. compressing a file 20. Strictly confidential and proprietary bzip2(1) −q --quiet Suppress non-essential warning messages. spewing out lots of information which is primarily of interest for diagnostic purposes.000 bytes (the default) respectively. −L --license -V --version Display the software version.bzip2(1) Property of BladeLogic. The flags −1 through −9 specify the block size to be 100.show the compression ratio for each file processed. For files compressed with the default 900k block size. even if they start with a dash. Inc. Messages pertaining to I/O errors and other critical events will not be suppressed. Further −v’s increase the verbosity level. so you should use this option only where necessary. −-repetitive-fast --repetitive-best These flags are redundant in versions 0. Has no effect when decompressing. for example: bzip2 −. It is also important to appreciate that the decompression memory requirement is set at compression time by the choice of block size. −Treats all subsequent arguments as file names. For example. Similarly. Since block sizes are stored in compressed files. See MEMORY MANAGEMENT below. the decompressor will allocate 3700k but only touch 100k + 20000 * 4 = 180 kbytes.−myfilename. 3 . about 2300 kbytes. a fact worth bearing in mind when using bzip2 on small machines. 900 k when compressing.9. 0.5 and above have an improved algorithm which renders these flags irrelevant. This is so you can handle files with names beginning with a dash.5 x block size ) Larger block sizes give rapidly diminishing marginal returns. In general. can be estimated as: Compression: 400k + ( 8 x block size ) Decompression: 100k + ( 4 x block size ).

bzip2(1) Property of BladeLogic. Also recorded is the total compressed size for 14 files of the Calgary Text Compression Corpus totalling 3..bz2 file. which makes it possible to find the block boundaries with reasonable certainty. usually 900kbytes long. The compressed representation of each block is delimited by a 48-bit pattern. as these will contain many blocks. this figure was more like 100:1. like "aabaabaabaab . Because of this.bz2 > recovered_data" -. since the Corpus is dominated by smaller files. Versions 0. the name of the damaged file. "rec0002file.bz2 file to become damaged. "bzip2 -dc rec*file. small changes to the 4 . This column gives some feel for how compression varies with block size.bz2 files. bzip2recover takes a single argument. and decompress those which are undamaged. bzip2recover should be of most use dealing with large .622 bytes. bzip2recover is a simple program whose purpose is to search for blocks in . both for compressing and decompressing. If a media or transmission error causes a multi-block . if you want." (repeated several hundred times) may compress more slowly than normal.bz2 files. is largely determined by the speed at which your machine can service cache misses. For previous versions. so damaged blocks can be distinguished from undamaged ones. Each block also carries its own 32-bit CRC.5 and above fare much better than previous versions in this respect. etc.bz2". It is clearly futile to use it on damaged single-block files.141. it may be possible to recover data from the undamaged blocks in the file.bz2". This means that performance. and write each block out into its own . and then charges all over it in a fairly random fashion. you might consider compressing with a smaller block size. Decompression speed is unaffected by these phenomena. The output filenames are designed so that the use of wildcards in subsequent processing -. bzip2 usually allocates several megabytes of memory to operate in. The ratio between worst-case and average-case compression time is in the region of 10:1. Compress Decompress Decompress Corpus Flag usage usage -s usage Size -1 -2 -3 -4 -5 -6 -7 -8 -9 1200k 2000k 2800k 3600k 4400k 5200k 6100k 6800k 7600k 500k 900k 1300k 1700k 2100k 2500k 2900k 3300k 3700k 350k 600k 850k 1100k 1350k 1600k 1850k 2100k 2350k 914704 877703 860338 846899 845160 838626 834096 828642 828642 RECOVERING DATA FROM DAMAGED FILES bzip2 compresses files in blocks.. files containing very long runs of repeated symbols.lists the files in the correct order. containing the extracted blocks. and writes a number of files "rec0001file.9. You can use the −vvvv option to monitor progress in great detail. You can then use bzip2 −t to test the integrity of the resulting files. PERFORMANCE NOTES The sorting phase of compression gathers together similar strings in the file. Because of this. Strictly confidential and proprietary bzip2(1) Here is a table which summarises the maximum memory usage for different block sizes. Inc. These figures tend to understate the advantage of larger block sizes for larger files.for example. since a damaged block cannot be recovered. Each block is handled independently. If you wish to minimise any potential data loss through media or transmission errors.

http://sourceware. CAVEATS I/O error messages are not as helpful as they could be. gave advice and were generally helpful.org. so it cannot handle compressed files more than 512 megabytes long. See the manual in the source distribution for pointers to sources of documentation.1pl2 cannot do this. Compressed data created by this version is entirely forwards and backwards compatible with the previous public releases.bzip2(1) Property of BladeLogic. Christian von Roques encouraged me to look for faster sorting algorithms. Strictly confidential and proprietary bzip2(1) code to reduce the miss rate have been observed to give disproportionately large performance improvements.demon. but with the following exception: 0. 0.9.9. AUTHOR Julian Seward. Bela Lubkin encouraged me to improve the worst-case compression performance. I am much indebted for their help.0 and above can correctly decompress multiple concatenated compressed files. helped with portability problems. This could easily be fixed.9. I imagine bzip2 will perform best on machines with very large caches. Many people sent patches.0 and 0. support and advice. and Alistair Moffat.co.uk The ideas embodied in bzip2 are due to (at least) the following people: Michael Burrows and David Wheeler (for the block sorting transformation). but the details of what the problem is sometimes seem rather misleading. David Wheeler (again.cygnus. and many refinements).muraroa. jseward@acm. 0. lent machines. bzip2 tries hard to detect I/O errors and exit cleanly. versions 0. for the Huffman coder). Radford Neal and Ian Witten (for the arithmetic coder in the original bzip). it will stop after decompressing just the first file in the stream. 5 . bzip2recover uses 32-bit integers to represent bit positions in compressed files. so as to speed up compression. Peter Fenwick (for the structured coding model in the original bzip.0 of bzip2.1pl2. This manual page pertains to version 1.com/bzip2 http://www.5. Inc.

control-I. The file operands are processed in command-line order. The options are as follows: −b −e −n −s −t −u −v Implies the −n option but doesn’t count blank lines. with the exception of the tab and EOL characters. since the entire contents of the file would have already been read and printed by cat when it encountered the first ‘-’ operand. then finally output the contents of file3.2-1992 (“POSIX. Control characters print as ‘ˆX’ for control-X. sh(1)) for more information on redirection. Number the output lines. See the manual page for your shell (e. or cat -v Considered Harmful". The tab character.] DESCRIPTION The cat utility reads files sequentially. print data it receives from the standard input until it receives an EOF ( ‘ˆD’ ) character. The output is guaranteed to be unbuffered (see setbuf(3)). writing them to the standard output. $ cat file1 file2 > file3 Print the contents of file1. cat reads from the standard input. tail(1).g.2”) specification. Squeeze multiple adjacent empty lines. can be made visible via the −t option. Non-ASCII characters (with the high bit set) are printed as ‘M-’ (for meta) followed by the character for the low 7 bits. $ cat file1 . . STANDARDS The cat utility is compliant with the IEEE Std 1003. pr(1). print the contents of file2.file2 . Strictly confidential and proprietary CAT (1) NAME cat − concatenate and print files SYNOPSIS cat [ −benstuv] [file . . Implies the −v option and also prints tab characters as ‘ˆI’. USENIX Summer Conference Proceedings. Note that if the standard input referred to a file. more(1). BSD May 2. If file is a single dash ( ‘-’ ) or absent.file3 SEE ALSO head(1). The cat utility exits 0 on success or >0 if an error occurred. starting at 1. 1983. Inc. which are displayed normally. vis(1). 1995 1 . setbuf(3) Rob Pike.CAT (1) Property of BladeLogic. causing the output to be single spaced.. the second dash on the command-line would have no effect. truncating file3 if it already exists. less(1). "UNIX Style. read and output contents of the standard input again. The DEL character (octal 0177) prints as ‘ˆ?’. Displays non-printing characters so they are visible. EXAMPLES Print the contents of file1 to the standard output: $ cat file1 Sequentially print the contents of file1 and file2 to the file file3. Implies the −v option and also prints a dollar sign ( ‘$’ ) at the end of each line. sh(1).

1995 2 . Strictly confidential and proprietary CAT (1) The flags [ −benstv] are extensions to the specification.CAT (1) PropertyGeneral Commands Manual System of BladeLogic. HISTORY A cat utility appeared in Version 1 AT&T UNIX. BUGS Because of the shell language mechanism used to perform output redirection. the command cat file1 file2 > file1 will cause the original data in file1 to be destroyed! BSD May 2. Inc.

. To determine which password to use. Servers that are not Windows servers are not updated and an appropriate error message is output... -p passwd By default one is prompted to enter (and confirm) the desired password. In addition. then the user should remove the RSCD registry location from the registry and delete the BladeLogicRSCD user. Inc.. SEE ALSO rscd (1) NSH 1 . The name of the hosts to be updated. OPTIONS The following options are supported: -f file Specify a flat file containing the list of hosts whose RSCD Agent password one wishes to update. If the registry location is not found/set.chapw(1) Property of BladeLogic. To this end. With this option only error messages are output. If for some reason the user decides to revert back to the default value with which the BladeLogic agent was shipped. the RSCD Agent uses a default password shipped with the agent.] DESCRIPTION This command is used to set / change the agent password on one or more Windows hosts that have BladeLogic agent running. one can also use the -f file option to specify additional hosts from the file content. the RSCD Agent looks at a pre-determined registry location (see below) in which a password may be set. one can also name additional hosts as arguments on the command line. REGISTRY The password is kept encrypted in the following registry key: SECURITY\SAM\BladeLogic\Operations Manager\RSCD\P CAVEATS The specified hosts for this command should all be Windows systems and should have the agent running with the "Local System" privileges. If a password was not specified with the -p option. By default chapw displays information about the progress of the update. -r -q host . Strictly confidential and proprietary chapw(1) NAME chapw − Change RSCD Agent password on remote Windows servers SYNOPSIS chapw [-r] [-p passwd] [-q] [-f file] host1 [host2 . then this option will cause chapw to automatically randomly generate a 16 character password. it needs to impersonate the BladeLogicRSCD user (created at install time) in order to have the privileges it requires to run properly. In addition. With this option one can specify the desired password as an argument. the RSCD Agent needs to supply a password to the OS. This command does not prompt for the old password as the default password with which the agent was shipped is unknown to the user. When the RSCD Agent comes up on a Windows server.

chgrp: Unknown group ID groupname The groupname groupname is unknown. then chgrp changes the user ownership as well. this message will appear if chgrp is unable to access the directory dirname.. However. New group owner of the file (group name or GID). use the -l option.’). OPTIONS -f -h -l -r Do not report any errors that occur.chgrp(1) Property of BladeLogic. Instead.. and therefore will not be resolved on the local system. Always resolve the groupname and optional username on the local system. By default. New owner of the file (user name or UID). and consequently a GID is not available for this group. $ chgrp bin myprog $ chgrp -R adm //paris/u1/myapps DIAGNOSTICS chgrp: Unable to access file filename chgrp was unable to access the file filename. NSH 1 . By default. chgrp will resolve the username and groupname on the system on which the change of ownership is to take place. this option is turned on. and consequently a UID is not available for this user. change the ownership of the link itself rather than the file it is pointing to.. chgrp: Unable to access directory dirname When changing ownerships of a file (directory) recursively. -R -v -? group user If any of the named arguments is a directory. then chgrp will recursively descend the directory and change the appropriate ownerships of all files and sub-directories below it. The second example changes the group ownership of all files in the directory /u1/myapps to group adm on host paris. When changing the ownership of a file that is a symbolic link.group file . To turn it off. chgrp: Unknown user ID username The username username is unknown. Output a brief summary of available options and then exit with a zero status without changing any ownerships. Strictly confidential and proprietary chgrp(1) NAME chgrp − Change group (and user) ownerships of files SYNOPSIS chgrp [-fhRv?] group file . chgrp [-fhRv?] user. Indicates that the groupname and the (optional) username are not numeric. Output a message for each file whose ownership is being changed. See the -r option. EXAMPLE The first example changes the group ownership of the file myprog to bin. chgrp changes only the group ownership. DESCRIPTION chgrp changes the group or the group and user ownership of the named files.. chgrp: Unable to change group ownership of file filename An error has occurred when changing the ownership of the file filename. if you precede the group name by a user name and a period (’. This can be useful for monitoring progress in recursive file ownership changes. Inc.

The -h option may have no effect on systems that do not support the appropriate system call to perform this action (lchown(2)). chgrp was unable to access one of the directories in a recursive change of ownership. NSH 2 . Unknown option or missing file argument. Strictly confidential and proprietary chgrp(1) EXIT CODES 0 1 2 3 4 255 No errors detected. ORIGIN chgrp was written by Thomas Kraus SEE ALSO chown(1). chgrp was unable to access the file it was trying to change ownership of. Unable to get a license to use the software. Inc. chgrp resolves the groupname/username to the GID/UID on the local machine. you may not achieve the ownership change you want. CAVEATS If you do not specify either the -l option or the -r option. and you use a groupname/username (as opposed to a GID/UID). You specified an unknown GID or UID. If the GID/UID of the group/user differs on the host on which you are making the change.chgrp(1) Property of BladeLogic.

See the DESCRIPTION section above.. regular files. mode can be an absolute octal value. This option tells chmod to change the permissions of a file ONLY if the file is not a directory (i. This option tells chmod to change the permissions of a file ONLY if the file is a directory. Output a brief summary of available options and then exit with a zero status without changing any permissions. Output a message for each file whose permissions are being changed..chmod(1) Property of BladeLogic. If chmod encounters a directory. . etc). chmod silently skips it. This can be a useful option in a recursive change of permissions if you only want to change the permissions of directories. The permissions changes you want to make. DESCRIPTION chmod changes the mode or access permissions of the named file(s) to mode. it defaults to the value of a u Modify the user permissions g Modify the group permissions o Modify the other permissions a Modify all permissions (same as ugo) You must specify one of the following values for the op section: + Add the specified permissions to the existing permissions of the file Subtract the specified permissions from the existing permissions of the file = Set the specified value as the file permissions Set the new permissions using any combination of the following characters r Modify the read permissions for who w Modify the write permissions for who x Modify the execute permissions for who s Modify the set UID/GID permissions for who t Modify the set sticky bit permissions for who If any of the named arguments is a directory.e. each having the following format: [who][op][perms] The who section determines whose permissions are to be changed. This includes both files specifically named in the command argument list. File whose mode you want to change. then chmod will recursively descend the directory and change the appropriate permissions of all files and sub-directories below it. If chmod encounters a file that is not a directory. chmod silently skips it. This can be a useful option in a recursive change of permissions if one does not want to change the permissions of any directories.. and files encountered while doing a recursive (-R) permissions change. or a series of comma separated instructions. and files encountered while doing a recursive (-R) permissions change.. This includes both files specifically named in the command argument list. who can be one or a combination of two or more characters from the following set: who If you do not specify a value for who . op perms OPTIONS -R -d -f -v -? mode file NSH 1 . This can be useful to monitor the progress of a recursive permissions change. Strictly confidential and proprietary chmod(1) NAME chmod − Change the mode (protection attributes) of a file SYNOPSIS chmod [-Rdfv?] mode file . special files. since directories usually have different permissions than files. Inc.

chmod was unable to access the directory dirname chmod: Cannot change ownership of file filename An error occurred when changing the permissions of the file filename EXIT CODES 0 1 2 3 255 No errors detected. The second example adds execute permission to other users and read. chmod was unable to access the file it was trying to change ownership of. execute for user. execute for both the group and other users). chmod: Unable to access the file filename chmod was unable to access the filename chmod: Unable to access directory dirname When changing permissions of a file (directory) recursively. write. execute permissions for the owner of the file. and read. NSH 2 . Inc.chmod(1) Property of BladeLogic. Unknown option or missing file argument.u+rwx //madrid/u1/myprog DIAGNOSTICS chmod: Invalid mode (mode) The mode you specified contained unknown characters. Unable to get a license to use the software. Strictly confidential and proprietary chmod(1) EXAMPLE The first example changes the permissions of the file myprog to 755 (read. $ chmod 0755 myprog $ chmod o+x. ORIGIN chmod was written by Thomas Kraus. write. chmod was unable to access one of the directories in a recursive change of permissions.

Always resolve the username and optional groupname on the local system. this option is turned on. OPTIONS -f -h -l -r Do not report any errors if they occur. then chown will recursively descend the directory and change the appropriate ownerships of all files and sub-directories below it. -R -v -? user group If any of the named arguments is a directory. this message will appear if chown is unable to access the directory dirname. and consequently a GID is not available for this group. Indicates that the username and the (optional) groupname are not numeric. chown: Unknown user ID username The username username is unknown.. this command changes only the user ownership.’) and a group name to the user name. $ chown bin myprog $ chown -R adm //bern/u1/myapps DIAGNOSTICS chown: Unable to access file filename chown was unable to access the file filename. EXAMPLE The first example changes the user ownership of the file myprog to bin. See the -r option. You can turn it off with the -l option. you can also change the group ownership of a file by appending a period (’. chown: Unable to change user ownership of file filename An error has occurred when changing the ownership of the file filename. Instead. By default. and therefore will not be resolved on the local system. Output a brief summary of available options and then exit with a zero status. chown: Unable to access directory dirname When changing ownerships of a file (directory) recursively.. New owner of the file (user name or UID). DESCRIPTION This command changes the user or the user and group ownership of the named files.group file . Strictly confidential and proprietary chown(1) NAME chown − Change user (and group) ownerships of files SYNOPSIS chown [-fhlrRv?] user file .. without changing any ownerships. and consequently a UID is not available for this user. chown: Unknown group ID groupname The groupname groupname is unknown. However. New group owner of the file (group name or GID). By default. change the ownership of the link itself rather than the file it is pointing to..chown(1) Property of BladeLogic. The second example changes the group ownership of all files in the directory /u1/myapps to user adm on host bern. Useful for monitoring progress in recursive file ownership changes. the username and groupname will be resolved on the system on which the change of ownership is to take place. NSH 1 . Inc. When changing the ownership of a file that is a symbolic link. chown [-fhlrRv?] user. Output a message for each file whose ownership is being changed.

the UID and GID of the user/group as defined on the local host is used. Unknown option or missing file argument. NSH 2 . SEE ALSO chgrp(1). Consequently. ORIGIN chown was written by Thomas Kraus. Inc. chown was unable to access the file it was trying to change ownership of. Strictly confidential and proprietary chown(1) EXIT CODES 0 1 2 3 4 255 No errors detected.chown(1) Property of BladeLogic. The -h option may have no effect on systems that do not support the appropriate system call to perform this action (lchown(2)). the change of ownership may not reflect the desired effect if the UID/GID of the user/group differ on the host on which the change is being made. chown encountered an unknown GID or UID. When a user or group name is explicitly used (as opposed to numeric values). Unable to get a license to use the software. chown was unable to access one of the directories in a recursive change of ownership.

$ cd // # Make no connection the active context. disconnect from the host where you are currently connected. To set up a new role for agents with which you already have proxy connections. SYNOPSIS chrole [role] DESCRIPTION The chrole command changes the role preference for the current NSH session.chrole(1) Property of BladeLogic. $ chrole WindowsAdmins The following example shows the procedure that is necessary to change roles for existing connections to agents. If you do not provide a role preference when entering the chrole command. $ disconnect # Disconnect from all servers. Strictly confidential and proprietary chrole(1) NAME chrole − Change the active role for the current Network Shell session. Entering a chrole command only changes the role for new connections with Network Shell Proxy Servers. you must specify a new role preference. provided the active user is authorized for that role. $ cd //host1 # Reconnect to host1. $ cd //host1 # Connect to host1. and then reconnect. you must disconnect. DIAGNOSTICS If the user attempts to chrole to an unauthorized role. Inc. $ chrole role2 # Change to role2. you are presented with a numbered list of authorized roles and prompted to make a selection from that list. All subsequent NSH commands issued from within that session are executed within the context of the new role. COMMAND OPTIONS None EXAMPLES The following example changes the active role to WindowsAdmins. Because the chrole command does not change the role for the current session. ORIGIN chrole was developed by BladeLogic. Note that this command will not # disconnect from host1 if the current working directory is //host1. NSH 1 . CAVEATS The chrole command is a "built-in" Network Shell command and can only be issued from within an active NSH session. See the EXAMPLES section below for a demonstration of the required procedure. EXIT CODES 0 Always returns with a 0 exit code. The user is presented with a list of roles to choose from. the role selection is ignored. Your current role is role1. when you have an existing connection.

. Sum is a link to cksum and is provided for compatibility. Output a brief summary of available options and then exit with calculating any checksums. the standard input is used and no file name is written. See description below. Strictly confidential and proprietary cksum(1) NAME cksum. the block size is 1024 for algorithm 1 and 512 for algorithm 2. These n bits are the bits from the file. This is a 16-bit checksum. NSH 1 .. overflow is discarded. The default CRC used is based on the polynomial used for CRC error checking in the networking standard ISO 8802-3: 1989 The CRC checksum encoding is defined by the generating polynomial: G(x) = xˆ32 + xˆ26 + xˆ23 + xˆ22 + xˆ16 + xˆ12 + xˆ11 + xˆ10 + xˆ8 + xˆ7 + xˆ5 + xˆ4 + xˆ2 + x + 1 Mathematically. Using this interface. cksum = (r % 2ˆ16) + r / 2ˆ16. the CRC value corresponding to a given file is defined by the following procedure: The n bits to be evaluated are considered to be the coefficients of a mod 2 polynomial M(x) of degree n-1. producing a remainder R(x) of degree <= 31. least significant octet first. M(x) is multiplied by xˆ32 (i. The bit sequence is complemented and the result is the CRC. The coefficients of R(x) are considered to be a 32-bit sequence. ALGORITHMS Algorithm 1 is the algorithm used by historic BSD systems as the sum(1) algorithm and by historic AT&T System V UNIX systems as the sum algorithm when using the -r option. Algorithm 2 is the algorithm used by historic AT&T System V UNIX systems as the default sum algorithm. and >0 if an error occurs.] sum [-?] [-r] [-o [1 | 2]] [file . shifted left 32 bits) and divided by G(x) using mod 2 division. If no file name is specified. sum − display file checksums and block counts SYNOPSIS cksum [-?] [-r] [-o [1 | 2]] [file . and is defined as follows: s = sum of all bytes. These fields are a checksum CRC. one only has access to the historic algorithms ( -o 1 | 2 ). r = s % 2ˆ16 + (s % 2ˆ32) / 2ˆ16.e. The cksum utility exits 0 on success. The smallest number of octets capable of representing this integer are used. with a right rotation before each addition. OPTIONS The following options may modify the behavior of cksum. Partial blocks are rounded up. For historic reasons. with the most significant bit being the most significant bit of the first octet of the file and the last bit being the least significant bit of the last octet. Use historic algorithms instead of the (superior) default one. followed by one or more octets representing the length of the file as a binary value. -r -o 1 | 2 -? Same as -o 1. Inc.. the total number of octets in the file and the file name. Both algorithm 1 and 2 write to the standard output the same fields as the default algorithm except that the size of the file in bytes is replaced with the size of the file in blocks. This is a 32-bit checksum... Please read the UNIVERSE BEHAVIOR section to determine the default behavior of this command.] DESCRIPTION The cksum utility writes to the standard output three whitespace separated fields for each input file.cksum(1) Property of BladeLogic. padded with zero bits (if necessary) to achieve an integral number of octets.

Strictly confidential and proprietary cksum(1) EXAMPLE The first example prints out the checksum for two password files using the new improved checksum algorithm. algorithm 1 is used. Inc. EXIT CODES 0 1 2 255 No errors detected An unknown option was given One of the files to be checksummed was not accessible Unable to get a license to use the software.cksum(1) Property of BladeLogic. algorithm 2 is used. UNIVERSE BEHAVIOR The universe setting only takes affect when the sum version of the command is used and no checksum type has been selected. $ cksum /etc/passwd //ottawa/etc/passwd $ cksum -o 2 //ottawa/home/data/* DIAGNOSTICS cksum: Cannot open file filename The file for which the checksum was to be calculated was not accessible. cksum(1). When the P_BSD variable is set (Berkeley behavior). NSH 2 . SEE ALSO sum(1). COPYRIGHT Please read the Copyright notice in intro(1) section of documentation. Please see the intro section for complete acknowledgments. Berkeley and its contributors. With the P_ATT variable set. ORIGIN Cksum includes software developed by the University of California. A system error message follows the output of the error message. The second example uses the historic AT&T algorithm for all files in the directory /home/data on host ottawa.

If the standard input is being used ( file1 is ’-’). Inc. cmp: EOF on filename If one of the two files is shorter than the other. cp rhosts.rhosts file on host oslo has changed. Strictly confidential and proprietary cmp(1) NAME cmp − Compare two files SYNOPSIS cmp [-ls?] file1 file2 [skip1] [skip2] DESCRIPTION cmp compares the content of two files. $ $ > > > > > > $ cmp -s rhosts. This option tells cmp not to output any message when it finds a difference. the proper one is copied back over it with the proper permissions and ownerships. cmp: Illegal option xyz The given option xyz is not a valid option. cmp always considers the files not to be identical. Start comparing at skip1 bytes from first file by seeking to that position in the file.master //oslo/. Start comparing at skip2 bytes from second file by seeking to that position in the file. OPTIONS -l Do not stop checking after finding the first difference. and the two different character values found in the files. -s -? file1 file2 skip1 skip2 EXAMPLE The following example checks to see the .cmp(1) Property of BladeLogic. NSH 1 . then the offset is read instead of being seeked over. The first file in the comparison.rhosts fi DIAGNOSTICS cmp: Cannot access file filename cmp was unable to access the file filename. Instead.master //oslo/. cmp outputs an appropriate message indicating which file is shorter. If one of the files is shorter in length than the other. EXIT CODES 0 Files are identical. checking to see if they are identical. even with the -l option. find all differences in the files. cmp will just exit with the appropriate exit code. cmp outputs an appropriate message and stops the comparison. By default. Output a brief summary of available options and then exit with a zero status without doing any comparing. then cmp uses the standard input. If file1 is ’-’. When this happens. For each difference it finds. If it has. cmp outputs a line consisting of the character number.root //oslo/. The second file in the comparison.rhosts if test $? -eq 1 then echo .rhosts chmod 0700 //oslo/.rhosts chown root. cmp exits with an exit code that indicates whether or not the files are identical. cmp stops processing after it finds the first difference.rhosts file on a remote host has changed from the expected contents.

Inc. Strictly confidential and proprietary 1 2 255 Files are not identical.cmp(1) Property of BladeLogic. NSH 2 . or cmp encountered a bad or missing argument. One of the files was not accessible. Unable to get a license to use the software. cmp(1) ORIGIN cmp was written by Thomas Kraus.

columns numbered less than the start column or greater than the stop column will be written.8 Last change: NSH 1 . Backspace characters decrement the column count by one. not zero. Tab characters increment the column count to the next multiple of eight. paste(1) SunOS 5.User Commands Property of BladeLogic. Input is read from the standard input. Strictly confidential and proprietary colrm ( 1 ) NAME colrm . SEE ALSO column(1). Output is written to the standard output. cut(1). If both start and stop columns are specified. Berkeley and its contributors. A column is defined as a single character in a line. Please see the intro section for complete acknowledgements. If only the start column is specified. Column numbering starts with one. ORIGIN Colrm includes software developed by the University of California. columns numbered less than the start column will be written. Inc.remove columns from a file SYNOPSIS colrm [start [stop]] DESCRIPTION Colrm removes selected columns from the lines of a file.

Each column will have a number of tab characters prepended to it equal to the number of lower numbered columns that are being printed. if column number two is being suppressed. lines printed in column number one will not have any tabs preceding them. Please see the intro section for complete acknowledgements. The filename ‘‘-’’ means the standard input. and lines printed in column number three will have one. SEE ALSO cmp(1). uniq(1) SunOS 5. and produces three text columns as output: lines only in file1. Berkeley and its contributors.User Commands Property of BladeLogic. The following options are available: -1 -2 -3 Suppress printing of column 1. Comm assumes that the files are lexically sorted. Suppress printing of column 2. and lines in both files. Strictly confidential and proprietary comm ( 1 ) NAME comm . sort(1). Comm exits 0 on success. all characters participate in line comparisons. Suppress printing of column 3. lines only in file2. For example. ORIGIN Comm includes software developed by the University of California.8 Last change: NSH 1 . Inc. >0 if an error occurred. which should be sorted lexically.select or reject lines common to two files SYNOPSIS comm [-123] file1 file2 DESCRIPTION The comm utility reads file1 and file2.

“-taz”. If renaming the files would cause files to be overwritten and the standard input device is a terminal.tgz”. −c −d −f Compressed or uncompressed output is written to the standard output. Compression factor −9 provides the best level of compression. copy the input data without change to the standard BSD April 3. . . “-Z”. −b bits Specify the bits code limit ( see below ) . 2008 1 . “_tgz”. As many of the modification time.. zcat − compress and expand data (compress mode) SYNOPSIS compress [ −123456789cdfghLlNnOqrtVv] [ −b bits] [ −o filename] [ −S suffix] [file . file flags. Instead. renaming the files by removing the extension (or by using the stored name if the −N flag is specified). when compressing using the deflate scheme ( −g). .Property of BladeLogic. . the checks for reduction in size and file overwriting are not performed. access time. instead they are converted to “tar”. Each file is renamed to the same name plus the extension “. the original file name and time stamp are stored in the compressed file. If prompting is not possible or confirmation is not received.] DESCRIPTION The compress utility reduces the size of the named files using adaptive Lempel-Ziv coding. “_Z”. the uncompressed file inherits the time stamp of the compressed version and the uncompressed file name is generated from the name of the compressed file as described above. the standard input is compressed or uncompressed to the standard output. These defaults may be overridden by the −N and −n flags. “.Z”. The options are as follows: −1. file mode. By default. described below. the input file is not removed. but is relatively slow. “-tgz”. . and “_taz”. Extensions ending in “tgz” and “taz” are not removed when decompressing. recognising the following extensions: “. in compress mode. and group ID as allowed by permissions are retained in the new file. the file is ignored (unless −f is used). If either the input or output files are not regular files. Strictly confidential and proprietary COMPRESS (1) System General Commands Manual COMPRESS (1) NAME compress. “.Z”. If no files are specified. The uncompress utility restores compressed files to their original form. The zcat command is equivalent in functionality to uncompress −c. If the input data is not in a format recognized by compress and if the option −c is also given. Additionally. but provides a poorer level of compression.9 Use the deflate scheme. When uncompressing. the deflate mode of compression is chosen. user ID. with compression factor of −1 to −9. .] uncompress [ −cfhlNnqrtv] [ −o filename] [file . the user is prompted (on the standard error output) for confirmation.taz”. uncompress. files are overwritten without prompting for confirmation. Inc.] zcat [ −fghqr] [file .. this information is not used. No files are modified (force zcat mode). Compression factor −1 is the fastest.gz”. Force compression of file. This option implies −g. even if it is not actually reduced in size. “. If invoked as compress −g. “-gz”. It has the ability to restore files compressed by both compress and gzip(1). The default is −6. the files are not overwritten. Decompress the source files instead of compressing them (force uncompress mode). and the attributes of the input file are not retained. If compression would not reduce the size of a file. see gzip(1) for more information. “_gz”.

2008 2 . Name the file will be saved as when uncompressing. compress discards the table of substrings and rebuilds it from scratch. Display the program version ( RCS IDs of the source files ) and exit. Recursive mode: compress will descend into specified directories. −q −r Be quiet: suppress all messages. Use compress mode (the default). if the compression ratio decreases. Inc. Ratio of the difference between the compressed and uncompressed sizes to the uncompressed size. compress periodically checks the compression ratio. Common substrings in the file are first replaced by 9-bit codes 257 and up. −N When uncompressing or listing. −S suffix Set the suffix for compressed files.Property of BladeLogic. −t −V −v Test the integrity of each file leaving any files intact. Print the percentage reduction of each file and other information. When compressing. if any. for the uncompressed version. which reportedly provides better compression rates (force gzip(1) mode). bits must be between 9 and 16 ( the default is 16 ) . −g −h −L −l Use the deflate scheme. If the −v option is specified. However. After the bits limit is reached. If it is increasing. List information for the specified compressed files. BSD April 3. 32-bit CRC ( cyclic redundancy code ) of the uncompressed file. The following information is listed: compressed size uncompressed size compression ratio uncompressed name Size of the compressed file. the following additional information is printed: compression method crc time stamp Name of the method used to compress the file. −n −O −o filename Set the output file name. the time stamp stored in the compressed file is printed instead). Size of the file when uncompressed. do not store the original file name and time stamp in the header of the compressed file. Print a short help message. compress continues to use the existing code dictionary. use the time stamp and file name stored in the compressed file. Strictly confidential and proprietary COMPRESS (1) System General Commands Manual COMPRESS (1) output: let zcat behave as cat(1). This allows the algorithm to adapt to the next “block” of the file. When code 512 is reached. This information is only available when the deflate scheme ( −g) is used. the algorithm switches to 10-bit codes and continues to use more bits until the limit specified by the −b flag is reached. Date and time corresponding to the last data modification time (mtime) of the compressed file (if the −n option is specified. compress uses a modified Lempel-Ziv algorithm ( LZW ) . Print the license.

Strictly confidential and proprietary COMPRESS (1) System General Commands Manual COMPRESS (1) The −b flag is omitted for uncompress since the bits parameter specified during compression is encoded within the output. Typically. along with a magic number to ensure that neither decompression of random data nor recompression of compressed data is attempted. and the zcat flags [ −fghqr] are extensions to that specification. and zcat utilities are compliant with the specification. uncompress flags [ −hlNnqrt]. uncompress. 2008 3 . 17:6. 1984..1. The compress flags [ −123456789dghLlNnOqrtV]. and takes less time to compute. uncompress. 1 if an error occurred. Deflate compression support was added in OpenBSD 2. and the distribution of common substrings. 8−19. "A Technique for High Performance Data Compression". HISTORY The compress command appeared in 4. pp. Compression is generally much better than that achieved by Huffman coding (as used in the historical command pack). STANDARDS The compress. the number of bits per code. SEE ALSO Welch. BSD April 3. text such as source code or English is reduced by 50 − 60% using compress.3 BSD. The amount of compression obtained depends on the size of the input. or adaptive Huffman coding (as used in the historical command compact).Property of BladeLogic. Inc. June. or 2 if a warning occurred. IEEE Computer. The compress. and zcat utilities exit with 0 on success. Terry A.

if the target file already exists. before copying over the new source file. By default. Inc. cp creates it and copies the content into it. Strictly confidential and proprietary cp(1) NAME cp − Copy files SYNOPSIS cp [-bifnpPtuvBCLST?] [-s suf] file1 file2 cp [-bifnpPrtuvBCLPRST?] [-s suf] [-IX wildcarded path] file . With this option. See UNIVERSE BEHAVIOR for details on how this option interacts with the -f option. then cp overwrites the file. If the user confirms with an entry beginning with the letter y.c˜) This option alone does not turn on the file backup feature. it will retain its current file permissions after cp overwrites it.. This option deletes the target file before the copy begins. then cp recursively copies all files and sub-directories from the directory into the target directory. cp appends the target file name with the suffix "˜". If the destination directory does not exist. cp always acts as if the destination directory does not exist. Synchronize file permissions. If a target file already exists. If the target file already exists. two consecutive copies to the same destination directory will always produce the same result. In the second form. This also applies to new directories being created. then cp will create the directory as required. This option turns off the -i option. if it exists. Even if the file itself does not get copied to the destination (conditional copy and no changes in file) the cp command will still update the destination file’s user/group ownerships to match the source file’s user/group ownerships. Don’t actually make any changes. cp creates a new directory inside of the existing directory. cp will attempt to give the target file the same ownerships (UID/GID).. if one of the files to be copied is a directory. and access and modification times as the source file. When copying to a directory. This option automatically turns on the verbose option -v and just lists the copies that cp would make if you had not turned on the -n option. With the -P option. then cp will prompt the user to see if the user wants cp to overwrite the file. You can use the -s suf option to specify a different suffix. use the -b command. If the destination directory does exist. cp creates copied files with the same names as the source files. dir DESCRIPTION cp makes copies of files. When the destination directory does exist. it behaves differently depending on whether or not the destination (directory) already exists. In the first form. Set the suffix for backup files to suf. when cp copies a directory. -f -m -n -o -p -P -r -s suf NSH 1 . so that the target file inherits the same file permissions as the source file. and copies the content into it. and is consequently overwritten. cp does not create or remove any files or directories. This option is useful when you are performing a conditional copy and you just want to see what files would be copied if you were doing a real copy. Even if the file itself does not get copied to the destination (conditional copy and no changes in file) the cp command will still update the destination file’s permissions to match the source file’s permissions. permissions. cp copies the contents of one file to a second file. To turn on the file backup feature. If the target directory does already exist. By default. and inherits the ownership of the calling user. then cp will create the new target directory within the (existing) target directory. With his option.cp(1) Property of BladeLogic. then it retains its current permissions and ownerships. OPTIONS -b -i Backup the target file.c becomes foo. so that. cp overwrites it. If the target directory does not already exist. the new file gets the same permissions as the source file. for example. when cp creates a new file. cp copies multiple files into a directory. By default. Preserve parent. By default. Synchronize file ownerships. The default suffix for files being backed up is "˜" (foo.

write. Useful for monitoring progress in a recursive copy. The default action of the cp command would be to re-create the source directory in the destination directory. and execute. Inc. Conditional copy. These options cause the target file to be overwritten only if either the file sizes differ or if the source file has a newer modification date than the target file.cp(1) Property of BladeLogic. This option is the same as the -r option. Output a message for each file being copied. -v -B -C -I (wildcarded path) This option includes the specified files/directories in the sync operation. this message will appear if cp is unable to access the target directory (last argument). EXAMPLE The first example copies the file myprog to the directory /usr/local/bin on the host brussels. -R -S -T -X (wildcarded path) This option excludes the specified files/directories from the sync operation. except that it applies only to the top level file. -K -L -P This option is like the -L option. If the file sizes are the same. This option can be very resource intensive. This option tells cp to overwrite target files only if the modification date of the source file is newer than the modification date of the target file. then the -R option is treated as a -r option. See the -u option. -? Output a brief summary of available options and then exit with a zero status without copying any files. If you use this option with the -p option. Conditional copy. The target file will be overwritten only if its content differs from the source file. the content of the source directory is re-created in the target directory essentially overlaying the source directory on to the destination instead of creating the subdirectory. This option is useful when (recursively) copying the content of one directory to another existing directory. follow symbolic links. This is the no parent option. NSH 2 . See the -u option. Conditional copy. $ cp -p myprog //brussels/usr/local/bin $ rm -fr //brussels/usr/local $ cp -rvf datadir //brussels/usr/local DIAGNOSTICS cp: Target directory (dirname) not found When copying multiple files to a directory. This option tells cp to overwrite target files only if source and target file sizes differ. This option will ensure proper handling of the <CR><LF> issues. This option is useful when copying text files to or from a Windows based system. With the -P option. except that newly created directories automatically get the user permissions read. The -u option is equivalent to using the -T and -S options. The second example copies the contents of the directory datadir to the directory /usr/local/datadir which is first created. Strictly confidential and proprietary -t -u cp(1) Make a textual copy of the file. This option implies the -S option. When recursing through directories. There are three options you can use to perform conditional copies. especially on a large file. They are -T. Like -b except that if a backup version of the file already exists. then the backup will not be overwritten. -S and -C. should it be a symbolic link. cp will perform a byte for byte analysis of the source and target files to determine if a difference exists.

cp was unable to copy all files requested. the -f option will override the -i option. this message will appear. then with the P_BSD variable set (Berkeley behavior). cp: Error writing to file filename If an error occurs while copying a file into the new target file. ORIGIN cp was written by Thomas Kraus. Unknown option or missing file argument. this message will appear indicating that the copy may not be complete. it will display this message. this message will appear if the target directory (last argument) is not a directory. cp: file filename is a directory (not copied) If one of the files to be copied is a directory and you did not specify the recursive option (-r) . this message will appear. cp traverses the source directory hierarchy.cp(1) Property of BladeLogic. cp: Unable to create file filename If the new target file cannot be created. Strictly confidential and proprietary cp(1) cp: Target file (filename) must be a directory When copying multiple files to a directory. cp may need to create new directories in the target directory tree. along with a possible reason why cp was not able to create the file filename. UNIVERSE BEHAVIOR If both the -i and -f options are used. indicating that cp cannot copy directories. ncp(1). cp: Unable to access directory dirname When copying a directory recursively. EXIT CODES 0 1 2 255 No errors detected. If cp has a problem accessing a directory. Inc. With the P_ATT variable set. uncp(1). cp will display this message. cp: Unable to create directory dirname When copying a directory recursively. SEE ALSO dsync (1). If cp is not able to create one of these directories. the -i option will override the -f option. cp: Unable to access file filename cp: Unable to read file filename If cp is unable to access the source file filename. NSH 3 . then this message appears. along with a possible reason why it was not able to access the file. Unable to get a license to use the software.

Do not output the XML header entry. -n name By default the master XML tag is called csv2xml. csv2xml generates column names. Output a usage message and exit with a 0 exit code. It uses this header line to name the columns of input. The -n option lets you specify name as the master XML tag. The -q option lets you specify the first character of quote as a string delimiter. Inc.EL</MAINT> <CPUS>1</CPUS> <SPEED>797</SPEED> <ARCH>i686</ARCH> <MEMORY>121</MEMORY> <SWAP>251</SWAP> <DISK>18</DISK> </record> <record name="rome"> <HOSTNAME>rome</HOSTNAME> <OS>SunOS 5. Do not output the root node tag.csv2xml(1) Property of BladeLogic. -q quote By default csv2xml uses the double quote (’"’) character as a string delimiter. -s sep By default csv2xml uses the comma (’. The -s option lets you specify the first character of sep as the field separator. This option is often used in conjunction with the -x option.21-4. and in turn XML tags. Strictly confidential and proprietary csv2xml(1) NAME csv2xml − Convert CSV input to an XML output SYNOPSIS csv2xml [-?] [-<number>] [-h] [-n name] [-s sep] [-q quote] [-r] [-x] DESCRIPTION The csv2xml utility is a filter that converts a CSV input stream to an XML output stream. hostname) that can be used as an identifier. record names are numbered sequentially starting from 1. csv2xml uses the value of column (field) <number> of the respective line as the record name. This can be useful if the CSV input contains a unique field (for example. With this option.4. With this option.’) character as the field separator. OPTIONS -<number> By default.8</OS> <MAINT></MAINT> <CPUS>1</CPUS> <SPEED>440</SPEED> <ARCH>sparcv9</ARCH> <MEMORY>256</MEMORY> <SWAP>513</SWAP> <DISK>17</DISK> -r -x -? EXAMPLE NSH 1 . in the format of column-<record number>. -h By default csv2xml assumes that the first line of the CSV input is a header line.0" encoding="ISO-8859-1" standalone="yes"?> <csv2xml name="Host Overview"> <record name="london"> <HOSTNAME>london</HOSTNAME> <OS>RedHat ES3</OS> <MAINT>2. athens% nover -c -h london rome | csv2xml -1 -n "Host Overview" <?xml version="1. Use this option only if you will be embedding the output into another XML document.

nover(1). csv2xml will not display these additional fields. it converts it to an underscore (’_’) character. If csv2xml finds an unsupported character. nstats(1). csv2xml will add empty fields to the record. Because csv2xml generates XML tag names based on the fields in the first line of input. nnet(1). Inc. If subsequent records have fewer fields than the first record. ndf(1). ORIGIN csv2xml was written by Thomas Kraus SEE ALSO The following commands are able to output in CSV format (-c option): nps(1). ncpu(1). Strictly confidential and proprietary </record> </csv2xml> csv2xml(1) CAVEATS The first record (line of input) determines the number of fields that csv2xml will display. NSH 2 . If subsequent records have more fields than the first record. csv2xml may need to modify these fields to ensure that they do not contain unsupported characters. XML has certain restrictions as to which characters are allowed in an XML tag. nmem(1).csv2xml(1) Property of BladeLogic.

If you do. Numbers or number ranges may be preceded by a dash. Consequently the command: cut -d : -f 2is equivalent to: cut -d: -f2- EXIT CODES The cut utility exits 0 on success. inclusively. The items specified by list can be in terms of column position or in terms of fields delimited by a special character. a dash (-). Column numbering starts from 1. The cut utility includes software developed by the University of California. which selects all fields or columns from 1 to the first number. SEE ALSO paste(1) NSH 1 . -d string Specifies that the first character of the string should function as the field delimiter character instead of the tab character. Numbers or number ranges may be followed by a dash. and a second number and select the fields or columns from the first number to the second. Berkeley and its contributors.. lines with no delimiters are passed through unmodified. that character is used to separate output fields. -s The arguments following the options -c. overlapping. and writes them to the standard output. Number ranges consist of a number. DESCRIPTION The cut utility selects portions of each line (as specified by list) from each file (or the standard input by default). cut -f list [-d string] [-s] file . Please see the intro section for complete acknowledgements.. delimited in the input by a single tab character. Unless specified.cut(1) Property of BladeLogic. Output fields are separated by a single tab character unless you use -d to specify a different field delimiter. and -f must not be separate arguments and can also be defined directly after the option.. -f list Indicates that the list specifies fields. List is a comma or whitespace separated set of increasing numbers and/or number ranges.. Numbers and number ranges may be repeated. which selects all fields or columns from the last number to the end of the line. Suppresses lines with no field delimiter characters. 1 if an error occurred. Strictly confidential and proprietary cut(1) NAME cut − select portions of each line of a file SYNOPSIS cut -c list file . Inc. OPTIONS The cut utility accepts the following options: -c list Identifies the list specifying character positions. and in any order. -d. It is not an error to select fields or columns not present in the input line.

Input records longer than the conversion record size are truncated. Otherwise. This operand is only applicable when the input device is a tape. On input which supports seeks. Each input record is converted to a fixed length output record where the length is specified by the cbs operand. dd displays the number of complete and partial input and output blocks and truncated input records to the standard error output.. files=n ibs=n if=file obs=n of=file seek=n skip=n conv= value[. The value oldascii specifies the one used in historic AT&T and pre-4. The conversion record size is required by the record oriented conversion values. then each input block is copied to the output as a single block without any aggregation of short blocks. ascii. For pipes. cbs=n count=n Copy only n input blocks. existing blocks are read and the data discarded. If no conversion values other than noerror. (These values imply unblock if the operand cbs is also specified.. Input records shorter than the conversion record size are padded with spaces. Any trailing newline character is discarded. The number of truncated input records. Otherwise. If the user does not have read permission for the tape. For all other devices. NSH 1 . Set the input block size to n bytes instead of the default 512. notrunc or sync are specified. Any regular output file is truncated unless the notrunc conversion value is specified. Skip n blocks from the beginning of the input before copying. If input reads are short. Inc. If the seek operation is past the end of file.] DESCRIPTION The dd utility copies the standard input to the standard output. Read input from file instead of the standard input. Set the conversion record size to n bytes. a lseek(2) operation is used.dd(1) Property of BladeLogic. When finished. Strictly confidential and proprietary dd(1) NAME dd . Write output to file instead of the standard output. superseding the ibs and obs operands.. space from the current end of file to the specified offset is filled with blocks of NUL bytes. block Treats the input as a sequence of newline or end-offile terminated variable length records independent of input and output block boundaries. oldascii The same as the unblock value except that characters are translated from ECBDIC to ASCII before the records are converted.) There are two conversion maps for ASCII.3BSD-reno systems.. The value ascii specifies the recommended one which is compatible with System V. value . If an initial portion of the output file is skipped (see the seek operand) the output file is truncated at that point. On non-tape devices. are reported to the standard error output at the completion of the copy. Input data is read and written in 512-byte blocks. the correct number of blocks is read without distinguishing between a partial or complete block being read. Copy n input files before terminating. input data is read and discarded. Seek n blocks from the beginning of the output before copying. The following operands are available: bs=n Set both input and output block size. Set the output block size to n bytes instead of the default 512.] Where value is one of the symbols from the following list. if any. a lseek(2) operation is used. it is positioned using the tape ioctl(2) function calls. the correct number of bytes is read. input from multiple reads are aggregated to form the output block.convert and copy a file SYNOPSIS dd [operands .

3BSD-reno systems. 1024 (1K). swab sync ucase unblock Treats the input as a sequence of fixed length records independent of input and output block boundaries. otherwise NUL bytes are used. respectively. Otherwise. After the end of input is reached. the input block is omitted from the output. Strictly confidential and proprietary dd(1) ebcdic. Swap every pair of input bytes. Partial output blocks to tape devices are considered fatal errors. The value ibm is a slightly different mapping. The length of the input records is specified by the cbs operand. the current input and output block counts will be written to the standard error output in the same format as the standard completion message. any remaining output is written as a block. Do not stop processing on an input error. Inc. ‘‘m’’ or ‘‘w’’. the current input and output block counts will be written to the standard error output in the same format as the standard completion message and dd will exit. the last byte will be ignored during swapping. This means that the final output block may be shorter than the output block size. On input files which are not tapes or pipes.dd(1) Property of BladeLogic. Where sizes are specified. this conversion forces the final output block to be the same size as preceding blocks for use on devices that require regularly sized blocks to be written. lcase noerror Transform uppercase characters into lowercase characters. Any trailing space characters are discarded and a newline character is appended.) There are four conversion maps for EBCDIC. If an input buffer has an odd number of bytes. A partial input block is one where less than the input block size was read. the rest of the block will be written. When finished. oldibm The same as the block value except that characters are translated from ASCII to EBCDIC after the records are converted. 1048576 (1M) or the number of bytes in an integer. any missing input data will be replaced with NUL bytes (or with spaces if a block oriented conversion value was specified) and processed as a normal input buffer. ‘‘k’’. notrunc Do not truncate the output file. The values oldebcdic and oldibm are maps used in historic AT&T and pre-4. If the input file is not a multiple of the output block size after conversion. Transform lowercase characters into uppercase characters. Spaces are used for pad bytes if a block oriented conversion value is specified. ibm. The value ebcdic specifies the recommended one which is compatible with AT&T System V UNIX. oldebcdic. Normally. a decimal number of bytes is expected. If the number ends with a ‘‘b’’. the number is multiplied by 512. NSH 2 . A partial output block is one where less than the output block size was written. If the sync conversion is not specified. This will preserve any blocks in the output file not explicitly written by dd The notrunc value is not supported for tapes. which is compatible with the AT&T System V UNIX ibm value. truncated input records and odd-length byte-swapping blocks to the standard error output. the file offset will be positioned past the block in which the error occurred using lseek(2). If dd receives a SIGINFO (see the ‘‘status’’ argument for stty(1)) signal. (These values imply block if the operand cbs is also specified. This option is incompatible with use of the bs=n block size specification. osync Pad the final output block to the full output block size. Two or more numbers may be separated by an ‘‘x’’ to indicate a product. When an input error occurs. data resulting from input or conversion or both are aggregated into output blocks of the specified size. A truncated input block is one where a variable length record oriented conversion value was specified and the input line was too long to fit in the conversion record or was not newline terminated. If the sync conversion is also specified. Pad every input block to the input buffer size. dd displays the number of complete and partial input and output blocks. Partial output blocks to character devices will produce a warning message. If dd receives a SIGINT signal. a diagnostic message followed by the current input and output block counts will be written to the standard error output in the same format as the standard completion message.

Berkeley and its contributors.dd(1) Property of BladeLogic. tr(1) STANDARDS The dd utility is expected to be a superset of the IEEE Std1003.2 (‘‘POSIX’’) standard. Please see the intro section for complete acknowledgements. oldebcdic and oldibm values are extensions to the POSIX standard. Inc. oldascii. ebcdic. ibm. dd(1) ORIGIN Dd includes software developed by the University of California. The files operand and the ascii. NSH 3 . SEE ALSO cp(1). Strictly confidential and proprietary The dd utility exits 0 on success and >0 if an error occurred.

Strictly confidential and proprietary df(1) NAME df − Execute remote df command SYNOPSIS df [df options] [target . df will execute a remote df command on the appropriate host and then print the returned output. this header line will be included for each named target. paris $ df -k //athens paris $ df . ORIGIN df was written by Thomas Kraus NSH 1 . If you do not specify any targets. Since a remote df command is executed for each named target. EXAMPLE The first example displays the disk usage of a remote host..] DESCRIPTION For each named target. df again uses the current host. OPTIONS df on its own does not support any options. then df uses the current host (as directed by nsh) as the remote host.. The second example displays the disk usage of the current directory of the current host and also the disk usage of a remote directory. //rome/tmp CAVEATS Remote df commands typically output a one line header as part of the disk usage report.df(1) Property of BladeLogic. Inc. which may be a directory or host name. If one of the targets is a directory name only. Any options it does find are passed to the remote df command.

With −c the output format is modified slightly: the output begins with identification of the files involved and their creation dates and then each change is separated by a line with fifteen ∗’s. −e −C number Like −c but produces a diff with number lines of context. but in the opposite order and with a count of changed lines on each insert or delete command. −D string Creates a merged version of file1 and file2 on the standard output. However. . This is the form used by rcsdiff(1). Output options (mutually exclusive): −c Produces a diff with 3 lines of context. Inc. Changes which lie within 3 lines of each other are grouped together on output. . A unified diff is similar to the context diff produced by the −c option. all lines to be changed (added and/or removed) are present in a single section. while defining string will yield file2. ed(1).’. those added to file2 are marked ‘+ ’. Use of this option forces diff to produce a diff. BSD July 21. but in reverse order. so that the result is a sh(1) script for converting text files which are common to the two directories from their state in dir1 to their state in dir2. Just print a line when the files differ. Produces output in a form suitable as input for the editor utility. −f −n −q −u Identical output to that of the −e flag. Produces a script similar to that of −e. Strictly confidential and proprietary DIFF (1) NAME diff − differential file and directory comparator SYNOPSIS diff diff diff diff diff [ −abdilpqtTw] [ −I pattern] [ −c | −e | −f | −n | −u] [ −L label] file1 file2 [ −abdilpqtTw] [ −I pattern] [ −L label] −C number file1 file2 [ −abdilqtw] [ −I pattern] −D string file1 file2 [ −abdilpqtTw] [ −I pattern] [ −L label] −U number file1 file2 [ −abdilNPpqtTw] [ −I pattern] [ −c | −e | −f | −n | −u] [ −L label] [ −r] [ −s] [ −S name] [ −X file] [ −x pattern] dir1 dir2 DESCRIPTION The diff utility compares the contents of file1 and file2 and writes to the standard output the list of changes necessary to convert one file into the other. unlike with −c. with C preprocessor controls included so that a compilation of the result without defining string is equivalent to compiling file1. Does not output a list of changes. Produces a unified diff with 3 lines of context. Extra commands are added to the output when comparing directories with −e. The lines removed from file1 are marked with ‘. Comparison options: −a Treat all files as ASCII text. −U number Like −u but produces a diff with number lines of context.DIFF (1) PropertyGeneral Commands Manual System of BladeLogic. which can then be used to convert file1 into file2. differ” if files contain binary characters. It cannot be digested by ed(1). Lines which are changed from one file to the other are marked in both files with ‘! ’. No output is produced if the files are identical. 2003 1 . Normally diff will simply print “Binary files .

act as if it was found in the other directory too but was of zero size. context or unified output formats. diff sorts the contents of the directories by name. Normal or −c output adds character(s) to the front of each line which may screw up the indentation of the original source lines and make the output listing difficult to interpret.. All lines in the change must match some pattern for the change to be ignored. −I pattern Ignores changes. If a file is found only in dir2.DIFF (1) PropertyGeneral Commands Manual System of BladeLogic. In directory mode only regular files and directories are compared. −x pattern Exclude files and subdirectories from comparison whose basenames match pattern. Binary files which differ. If a file is found in only one directory. an underscore or a dollar sign..g. −p With unified and context diffs. Multiple −X options may be specified. −X file Exclude files and subdirectories from comparison whose basenames match lines in file. if this option is specified twice) file name and time in the context or unified diff header. act as if it was found in dir1 too but was of zero size. Try very hard to produce a diff as small as possible. E. Multiple −x options may be specified. Patterns are matched using shell-style globbing via fnmatch(3). −i −l Ignores the case of letters. each text file diff´d is piped through pr(1) to paginate it. 2003 2 . Will expand tabs in output lines. Causes diff to report files which are the same. this will show the prototype of the function the change applies to. beginning with file name. Is similar to −b but causes whitespace (blanks and tabs) to be totally ignored. Inc. −t −T −w Directory comparison options: −N −P −r −s −S name Re-starts a directory diff in the middle. See re_format(7) for more information on regular expression patterns. other differences are remembered and summarized after all text file differences are reported. common subdirectories. If a non-regular file such as a device special file or BSD July 21. which are otherwise not mentioned. “if ( a == b )” will compare equal to “if(a==b)”. −L label Print label instead of the first (and second. Long output format. show with each change the first 40 characters of the last line before the context beginning with a letter. This may consume a lot of processing power and memory when processing large files with many changes. and then runs the regular file diff algorithm. Strictly confidential and proprietary DIFF (1) −b −d Causes trailing blanks (spaces and tabs) to be ignored. “A” will compare equal to “a”. This option will preserve the original source’s indentation. insertions. producing a change list. Print a tab rather than a space before the rest of the line for the normal. E. and files which appear in only one directory are described as such.g. and other strings of blanks to compare equal. Causes application of diff recursively to common subdirectories encountered. on text files which are different. If both arguments are directories. Multiple −I patterns may be specified. This makes the alignment of tabs in the line consistent. For C source code following standard layout conventions. and deletions whose lines match the extended regular expression pattern.

Differences were found.YYdZZ Delete the range of lines XX through YY in file1. append the contents of line YY of file2 to make them equal. Thus. and then decides to run the diff algorithm if they are not equal. diff3(1). At (the end of) line XX of file1. YY through ZZ of file2 to line XX of file1. or −n options) output contains lines of these forms. diff first compares the files ala cmp(1). As in ed(1). 2003 3 .XXXXXXXX Temporary file used when comparing a device or the standard input. where XX. An error occurred. This may cause a small amount of BSD July 21. Note that the temporary file is unlinked as soon as it is created so it will not show up in a directory listing. −c. ed(1). comm(1).1-2001 specification. XXcYY Change the line XX in file1 to the line YY in file2. Strictly confidential and proprietary DIFF (1) FIFO is encountered. XX. fnmatch(3). pr(1). If only one of file1 and file2 is a directory. XXaYY These lines resemble ed(1) subcommands to convert file1 into file2. diff is applied to the non-directory file and the file contained in the directory file with a filename that is the same as the last component of the non-directory file. but append the range of lines. XX. re_format(7) STANDARDS The diff utility is expected to be a superset of the 1003. by exchanging a for d and reading the line in reverse order. BUGS When comparing directories with the −b. identical pairs (where num1 = num2) are abbreviated as a single number. Inc. XXdYY At line XX delete the line. The line numbers before the action letters pertain to file1. HISTORY A diff command appeared in Version 6 AT&T UNIX. If either file1 or file2 is ‘ − ’. −w or −i options specified.YY from file1 with the range ZZ. YY.QQ Replace the range XX. a diagnostic message is printed. ZZ. Output Style The default (without −e. the standard input is used in its place. DIAGNOSTICS The diff utility exits with one of the following values: 0 1 >1 No differences were found. XXaYY. XX.QQ from file2.YYcZZ.YYcZZ Replace the range of specified lines with the line ZZ. those after pertain to file2. diff will use the directory specified by TMPDIR as the temporary directory. SEE ALSO cmp(1). FILES /tmp/diff. ENVIRONMENT TMPDIR If the environment variable TMPDIR exists. one can also determine how to convert file2 into file1.ZZ Same as above. The value YY tells to which line the change would bring file1 in line with file1. QQ are line numbers respective of file order.DIFF (1) PropertyGeneral Commands Manual System of BladeLogic.

Strictly confidential and proprietary DIFF (1) spurious output if the files then turn out to be identical because the only differences are insignificant whitespace or case differences. BSD July 21. 2003 4 . Inc.DIFF (1) PropertyGeneral Commands Manual System of BladeLogic.

while preserving the file ownerships. -b -i Backup the target file. Be careful about using this option when you are copying between UNIX and Windows type systems. -f. If the target directory dir2 does not exist. permissions. cp appends the target file name with the suffix "˜". because the security models for file ownerships may differ. Also. it leaves it alone. by default. Inc. -d Use this option with care. it has same behavior as if -P had been turned on). If a target file already exists. then it will be created. before copying over the new source file. OPTIONS The dsync command has the same options as the cp command with the addition of the -d option. then cp overwrites the file. if dsync finds a file that does not need to be updated. -o Synchronize file ownerships for files that do not need to be updated. -p. This option however does a further check on the file’s ownership (UID and GID) and (if necessary) updates the destination file’s user/group ownerships to match the source file’s user/group ownerships. The ownership comparisons are based on the respective numeric UID and GID and not the respective user/group name that a particular UID/GID may be mapped to on a particular system. The default behavior of dsync is equivalent to making a conditional copy with the cp command. By default. Strictly confidential and proprietary dsync(1) NAME dsync − Synchronize two directories SYNOPSIS dsync [-bdifmnopPrtuvBCLPRST?] [-s suf] [-IX wildcarded path] dir1 dir2 DESCRIPTION The dsync command is a link to the cp command. All options are described here. Synchronize file permissions for files that do not need to be updated. however when running dsync. (The -P option is not turned on by default. and access times. If the user confirms with an entry beginning with the letter y. -m NSH 1 . See UNIVERSE BEHAVIOR for details on how this option interacts with the -f option. and -u. if it exists. $ dsync dir1 dir2 is equivalent to: $ cp -fpru dir1 dir2 This does a copy of all files and directories in the directory dir1 to directory dir2 only if the file size or date of last modification are different. The following options are the common options between cp and dsync with dsync having.dsync(1) Property of BladeLogic. Note that you need root permissions to change file ownerships. because the security models for file permissions may differ. This option however does a further check on the file’s permissions and makes sure that the target file has the same permissions as the source file. By default. if dsync finds a file that does not need to be updated. be careful about using this option when you are copying between UNIX and Windows type systems. turned on the following options: -r. it attempts to synchronize the contents of two directories. When you run cp as dsync. because it deletes any files/directories in the target (dir2) directory that are not in the source (dir1) directory. then cp will prompt the user to see if the user wants cp to overwrite the file. it leaves it alone. You can use the -s suf option to specify a different suffix. By default. This lets you make sure that there are no extra files in the target directory and is conceptually equivalent to first removing the target directory and then recreating it from the source directory. changing the target file’s permissions if necessary.

then cp will create the new target directory within the (existing) target directory. This option is useful when copying text files to or from a Windows based system. -n -p -r -s suf -t -u -v -B -C -I (wildcarded path) This option includes the specified files/directories in the sync operation. follow symbolic links. This option is useful when you are performing a conditional copy and you just want to see what files would be copied if you were doing a real copy.c˜) Make a textual copy of the file. especially on a large file. They are -T. -R -S -T -X (wildcarded path) This option excludes the specified files/directories from the sync operation. There are three options you can use to perform conditional copies. Conditional copy. Conditional copy. If the target directory does already exist. if the target file already exists. -S and -C. This option is useful when (recursively) copying the content of one directory to another existing directory. See the -u option. Strictly confidential and proprietary -f dsync(1) By default. If the file sizes are the same. except that newly created directories automatically get the user permissions read. cp will overwrite the target file only if its content differs from the source file. The default suffix for files being backed up is "˜" (foo. Output a message for each file being copied. The -u option is equivalent to using the -T and -S options. This option implies the -S option. write. the content of the source directory is re-created in the target directory essentially overlaying the source directory on to the destination instead of creating the subdirectory. cp will perform a byte for byte analysis of the source and target file to determine if a difference exists. The default action would be to re-create the source directory in the destination directory. then the -R option is treated as a -r option. This option can be very resource intensive. it will retain its current file permissions after cp overwrites it. If you use this option with the -p option. Conditional copy. and access and modification times as the source file. cp will attempt to give the target file the same ownerships (UID/GID). This option will ensure proper handling of the <CR><LF> issues. These options cause the target file to be overwritten only if either the file sizes differ or if the source file has a newer modification date than the target file. then cp recursively copies all files and sub-directories from the directory into the target directory. -L -P When recursing through directories. Inc. With the -P option. This option tells cp to overwrite target files only if source and target file sizes differ. if one of the files to be copied is a directory. Set the suffix for backup files to suf. If the target directory does not already exist. Don’t actually make any changes. Like -b except that if the backup version of the file already exists then the backup will not be overwritten. With this option. NSH 2 .c becomes foo. Useful for monitoring progress in a recursive copy. and execute. then cp will create the directory as required. See the -u option. This option automatically turns on the verbose option -v and just lists the copies that cp would make if you had not turned on the -n option. This is the no parent option. This option deletes the target file before the copy begins. This option tells cp to overwrite target files only if the modification date of the source file is newer than the modification date of the target file.dsync(1) Property of BladeLogic. permissions. This option turns off the -i option. This also applies to new directories being created. so that the target file inherits the same file permissions as the source file. cp does not create or remove any files or directories. This option is the same as the -r option. With this option.

it outputs this message. dsync: Unable to access file filename dsync: Unable to read file filename If dsync is unable to access the source file filename. dsync: Unable to access directory dirname When dsync is recursively copying a directory. this message will appear if dsync is unable to access the target directory (last argument). dsync was unable to copy all files requested. dsync: Error writing to file filename If an error occurs while copying a file into the new target file. $ dsync www //webserver/www $ dsync -vd www //webserver/www DIAGNOSTICS dsync: Target directory (dirname) not found When copying multiple files to a directory. it may need to create new directories in the target directory tree. then with the P_BSD variable set (Berkeley behavior). it will output this message. the -f option will override the -i option. Inc. Unknown option or missing file argument. along with the possible reason as to why it was not able to access the file. EXAMPLE The first example synchronizes the content of the www directory with the www directory on the machine webserver. then dsync outputs this message. The second example does the same as the first. dsync: Unable to create directory dirname When dsync is recursively copying a directory. dsync outputs this message. dsync: file filename is a directory (not copied) If one of the files to be copied is a directory and you did not specify the recursive option (-r). dsync: Unable to create file filename If dsync cannot create the new target file. ORIGIN dsync was written by Thomas Kraus. NSH 3 . dsync: Target file (filename) must be a directory When copying multiple files to a directory. but it gives verbose output and it deletes any files and directories on the webserver which do not exist in the local www directory. it outputs this message. Unable to get a license to use the software. With the P_ATT variable set. UNIVERSE BEHAVIOR If you specify both the -i and -f options. Strictly confidential and proprietary -? dsync(1) Output a brief summary of available options and then exit with a zero status without copying any files. EXIT CODES 0 1 2 255 No errors detected. If dsync has a problem accessing a directory. this message will appear if the target directory (last argument) is not a directory. it will output this message. indicating that the copy may not be complete.dsync(1) Property of BladeLogic. If dsync is not able to create one of these directories. it traverses the source directory hierarchy. along with the possible reason as to why it could not create the file filename. indicating that it cannot copy directories. the -i option will override the -f option.

NSH 4 . Strictly confidential and proprietary dsync(1) SEE ALSO cp(1).dsync(1) Property of BladeLogic. Inc.

du ignores this option if you also specify the -s option. This gives you a grand total of disk usage for the named directories. This option has meaning only when the P_ATT variable is set. Inc. then do not include the contents of that directory in the disk usage summary. findings are already reported in KB. With this option. (By default. OPTIONS -a -d -f -k -o Output a disk usage statement for each file encountered in the directory hierarchy. output only a summary for all directories searched. Report disk usage totals in KB instead of blocks. If you do not specify any files or directories. NSH 1 . Output a brief summary of available options and then exit with a zero status without doing disk usage summarizing.. The second example will give the total amount of disk usage of the root partition on host vilnius in KB. while traversing a directory. This effectively causes du to count only the disk usage of files in the directory. -S -s -r -u -x -? EXAMPLE The first example will output the amount of disk usage of the directory src giving sub-totals of all its subdirectories. du searches directories recursively. Same as -d. This option tells du not to count the disk usage of sub-directories when calculating the disk usage of a directory. Same as -d. du counts linked files only once.du(1) Property of BladeLogic. $ du src $ du -fsk //vilnius/ DIAGNOSTICS du: Unable to access directory dirname Unable to descend into the directory dirname to determine its size. du comes across a directory that is not in the same partition as the source directory. EXIT CODES 0 No errors detected.. Report the directories that du cannot search. du: Unable to access file filename Unable to determine the status (size) of file filename. Display a grand total at the end of all computations. Strictly confidential and proprietary du(1) NAME du − Display disk usage information for files SYNOPSIS du -[adfkosrux?] [filename . du displays disk usage information for the current directory. and outputs a sub-total for all sub-directories. See the UNIVERSE BEHAVIOR section for information on how du handles this option. When the P_BSD variable is set. By default. du ignores this option if you also specify the -a option.) If. Instead of outputting a disk usage statement for each directory encountered.] DESCRIPTION du calculates the number of blocks that the file system has allocated for all named files and directories. du outputs a disk usage statement for directories only. du ignores all files with more than one link. du counts files with multiple links only once.

With the P_BSD variable set (Berkeley behavior). Unable to get a license to use the software. du assumes that a block is 1K large. Strictly confidential and proprietary 1 2 255 You specified an unknown option. NSH 2 . du automatically reports any errors encountered while trying to access a directory. du assumes that a block is 512 bytes large. du(1) UNIVERSE BEHAVIOR With the P_BSD variable set (Berkeley behavior).du(1) Property of BladeLogic. Furthermore. Inc. du was unable to access to access a directory or determine the size of a file. unless you specify the -r option. With the P_ATT variable set. the universe flag determines the size of a block. With the P_ATT variable set. du does not report errors. ORIGIN du was written by Thomas Kraus.

echo(1) Property of BladeLogic. Argument to be echoed. Output a brief summary of available options and then exit with a zero status without echoing any arguments. tab (OCT 011. HEX D). File wildcards interpreted by sh(1) are for local files only. You specified an unknown option.. Inc. then it looks at the next character and interprets it as follows: b c f n r t v \ Backspace (OCT 010. Unable to get a license to use the software. Form feed (OCT 014. HEX 8). HEX B). HEX A). DEC 92. new line (OCT 012. ORIGIN echo was written by Thomas Kraus. DEC 11.. DEC 10. NSH 1 . HEX 5C). DEC 13. $ echo "Hello world\c" $ echo //stockholm/etc/p* EXAMPLE EXIT CODES 0 1 255 No errors detected. vertical tab (OCT 013. The main advantage of using echo over the built in echo command in the sh(1) is that it understands file wildcarding on remote hosts. HEX C). carriage return (OCT 015.] DESCRIPTION echo outputs each of its arguments separated by a space and then outputs a new-line character. backslash (OCT 0134. HEX 9). DEC 12. DEC 9. If echo finds a backslash ’\’ in an argument. Do not output a new-line at the end. Notice the different outputs when accessing remote files. $ echo //stockholm/etc/pa* //stockholm/etc/p* $ echo //stockholm/etc/pa* //stockholm/etc/password //stockholm/etc/password.old OPTIONS -n -? arg Output a line without a new-line character. DEC 8. Strictly confidential and proprietary echo(1) NAME echo − Echo arguments SYNOPSIS echo [-?] [-n] [arg .

Berkeley and its contributors... unexpand . Expand is useful for pre-processing character files (before sorting. Unexpand puts tabs back into the data from the standard input or the named files and writes the result on the standard output. looking at specific columns... Strictly confidential and proprietary expand(1) NAME expand. Option (with unexpand only): -a By default. Please see the intro section for complete acknowledgements. If a single tabstop argument is given. then tabs are set tabstop spaces apart instead of the default 8. and vice versa SYNOPSIS expand [-tabstop] [-tab1.) that contain tabs. unexpand [-a] file . only leading blanks and tabs are reconverted to maximal strings of tabs.. etc. Backspace characters are preserved into the output and decrement the column count for tab calculations. If multiple tabstops are given then the tabs are set at those specific columns. Inc.expand(1) Property of BladeLogic..tab2. DESCRIPTION Expand processes the named files or the standard input writing the standard output with tabs changed into blanks. If the -a option is given. NSH 1 ..expand tabs to spaces.tabn] file .. then tabs are inserted whenever they would compress the resultant file by replacing two or more characters. ORIGIN Expand and unexpand includes software developed by the University of California.

% cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/bin/bash daemon:x:2:2:Daemon:/sbin:/bin/bash lp:x:4:7:Printing daemon:/var/spool/lpd:/bin/bash mail:x:8:12:Mailer daemon:/var/spool/clientmqueue:/bin/false games:x:12:100:Games account:/var/games:/bin/bash wwwrun:x:30:8:WWW daemon apache:/var/lib/wwwrun:/bin/false ftp:x:40:49:FTP account:/srv/ftp:/bin/bash nobody:x:65534:65533:nobody:/var/lib/nobody:/bin/bash ldap:x:76:70:User for OpenLDAP:/var/lib/ldap:/bin/bash sshd:x:71:65:SSH daemon:/var/lib/sshd:/bin/false ntp:x:74:65534:NTP daemon:/var/lib/ntp:/bin/false postfix:x:51:51:Postfix Daemon:/var/spool/postfix:/bin/false at:x:25:25:Batch jobs daemon:/var/spool/atjobs:/bin/bash blade:x:1000:100::/home/blade:/bin/bash smbguest:x:4000:4000::/dev/null:/bin/false man:x:13:62:Manual pages viewer:/var/cache/man:/bin/bash news:x:9:13:News system:/etc/news:/bin/bash uucp:x:10:14:Unix-to-Unix CoPy system:/etc/uucp:/bin/bash +:::::: % fields -d : 1 5 6 -1 < /etc/passwd root root /root /bin/bash bin bin /bin /bin/bash daemon Daemon /sbin /bin/bash lp Printing daemon /var/spool/lpd /bin/bash mail Mailer daemon /var/spool/clientmqueue /bin/false games Games account /var/games /bin/bash wwwrun WWW daemon apache /var/lib/wwwrun /bin/false ftp FTP account /srv/ftp /bin/bash nobody nobody /var/lib/nobody /bin/bash ldap User for OpenLDAP /var/lib/ldap /bin/bash sshd SSH daemon /var/lib/sshd /bin/false ntp NTP daemon /var/lib/ntp /bin/false postfix Postfix Daemon /var/spool/postfix /bin/false NSH 1 . the entire data row is extracted. such as -2. Inc. If you specify a negative field number. If you specify a positive field number. If this option is not provided. such as 5.fields(1) Property of BladeLogic. It contains fields separated by the ’:’ character. EXAMPLES Consider the following input file. the space character (’ ’) is used as the default separator. Strictly confidential and proprietary fields(1) NAME fields − extracts specified fields from a data row SYNOPSIS fields [-d c | -D c] <field#> DESCRIPTION The fields command extracts specified fields from a data row. If the field number is 0. the fifth field from the start of the data row is extracted. OPTIONS -d or -D Specifies the separator character used to distinguish the individual fields. A field separator distinguishes the fields in each row. the second field from the end of the data row is extracted.

Strictly confidential and proprietary at Batch jobs daemon /var/spool/atjobs /bin/bash blade /home/blade /bin/bash /bin/bash smbguest /dev/null /bin/false /bin/false man Manual pages viewer /var/cache/man /bin/bash news News system /etc/news /bin/bash uucp Unix-to-Unix CoPy system /etc/uucp /bin/bash + + fields(1) ORIGIN fields was developed by BladeLogic. Inc. Inc.fields(1) Property of BladeLogic. NSH 2 .

Exceptions are well-known file formats (core files. The concept of magic number has been applied by extension to data files. file attempts to guess its language. preserve these keywords. The language test routines also test for some miscellany (such as tar(1) archives) and determine whether an unknown file should be labelled as “ASCII text” or “data”. If an argument appears to be an ASCII file. . or if it’s some sort of special file.h〉.br indicates that the file is most likely a troff(1) input file. For each magic number file. Inc. The options are as follows: −b −C −c Do not prepend filenames to output lines (brief mode). .mgc output file that contains a preparsed (compiled) version of it. magic number tests. This is usually used in conjunction with −m to debug a new magic file before installing it. performed in this order: filesystem tests. or “data” meaning anything else (data is usually binary or non-printable).FILE (1) PropertyGeneral Commands Manual System of BladeLogic.out file. 2004 1 . The information in these files is read from the magic file /etc/magic. Cause a checking printout of the parsed form of the magic file. The magic number tests are used to check for files with data in particular fixed formats. and language tests. The language tests look for particular strings (cf names. Any known file types appropriate to the system you are running on (sockets. so they are performed last. “executable” (the file contains the result of compiling a program in a form understandable to some UNIX kernel or another).out(5). whose format is defined in 〈a. the keyword . write a magic. Don’t do as Berkeley did.h〉 in the standard include directory and is explained in a. There are three sets of tests. change “shell commands text” to “shell script”.out. Strictly confidential and proprietary FILE (1) NAME file − determine file type SYNOPSIS file [ −bckLNnrsvz] [ −F separator] [ −f namefile] [ −m magicfiles] file . file [ −m magicfiles] −C DESCRIPTION The file utility tests each argument in an attempt to classify it. and which of several types thereof. When modifying the file /etc/magic or the program itself. The first test that succeeds causes the file type to be printed.h) that can appear anywhere in the first few blocks of a file. People depend on knowing that all the readable files in a directory have the word “text” printed. or named pipes (FIFOs) on those systems that implement them) are intuited if they are defined in the system header file 〈sys/stat. These tests are less reliable than the previous two groups. The type printed will usually contain one of the words “text” (the file contains only ASCII characters and is probably safe to read on an ASCII terminal).h〉 and possibly 〈exec. just as the keyword struct indicates a C program. The filesystem tests are based on examining the return from a stat(2) system call. symbolic links. These files have a “magic number” stored in a particular place near the beginning of the file that tells the UNIX operating system that the file is a binary executable. The program checks to see if the file is empty. The canonical example of this is a binary executable (compiled program) a. Any file with some invariant identifier at a small fixed offset into the file can usually be described in this way. tar archives) that are known to contain binary data. BSD December 4. For example.

2004 2 . because reading special files may have peculiar consequences. Inc. to test the standard input. FILES /etc/magic default list of magic numbers SEE ALSO compress(1). Don’t translate unprintable characters to ‘\ooo’. ls(1).FILE (1) PropertyGeneral Commands Manual System of BladeLogic. magiclist. −f namefile Read the names of the files to be examined from namefile (one per line) before the argument list.out(5). If a compiled magic file is found alongside. of files containing magic numbers. which are block special files. so it will produce different (albeit more accurate) output in many cases. as the like-named option in ls(1) (on systems that support symbolic links). Either namefile or at least one filename argument must be present. For example. Defaults to ‘:’. −k −L Don’t stop at the first match. since on some systems it reports a zero size for raw disk partitions. This prevents problems. This option also causes file to disregard the file size as reported by stat(2). keep going. This is useful for determining the filesystem types of the data in raw disk partitions. Try to look inside files that have been run through compress(1). Force stdout to be flushed after checking each file. The one significant difference between this version and System V is that this version treats any white space as a delimiter. strings(1). Strictly confidential and proprietary FILE (1) −F separator Use the specified string as the separator between the filename and the file result returned. It is intended to be used by programs that want filetype output from a pipe. file adds “. use ‘-’ as a filename argument. separated by colon characters. BSD December 4. Cause symlinks to be followed. Normally file translates unprintable characters to their octal representation (raw mode). Specifying the −s option causes file to also read argument files which are block or character special files. This version knows more magic. −v −z ENVIRONMENT MAGIC Default magic number files. hexdump(1). −m magiclist Specify an alternate list. Its behaviour is mostly compatible with the System V program of the same name. od(1). −N −n −r −s Don’t pad filenames so that they align in the output. Normally. as near as one can determine from the vague language contained therein. Print the version of the program and exit. This is only useful if checking a list of files. so that spaces in pattern strings must be escaped. a. it will be used instead. file only attempts to read and determine the type of argument files which stat(2) reports are ordinary files. magic(5) STANDARDS CONFORMANCE This program is believed to exceed the System V Interface Definition of FILE(CMD). however.mgc” to the value of this variable as appropriate. This can be a single file or a colon-separated list of files.

The System V version introduced one significant major change: the external list of magic number types.c were written by John Gilmore from his public-domain tar program. Geoff Collyer found several inadequacies and provided some magic file entries. Depending on what system you are using. This slowed the program down slightly but made it a lot more flexible. The order of entries in the magic file is significant. 1989. LEGAL NOTICE Copyright (c) Ian F.uk〉.orig).com〉 without looking at anybody else’s source code. July. BSD December 4. Altered by Chris Lowth 〈chris@lowth. HISTORY There has been a file command in every UNIX since at least Research Version 4 (man page dated November.com〉 made many changes from 1993 to the present. It includes the extension of the ‘&’ operator. Strictly confidential and proprietary FILE (1) >10 >10 0 0 string language impress string language\ impress string string \begindata (imPRESS data) (imPRESS data) in an existing magic file would have to be changed to In addition. based on the System V version. You know who you are. if a pattern string contains a backslash. 2000. 1986-1999. making it better than the first version. was written by Ian F. keep the old magic file around for comparison purposes (rename it to /etc/magic. For example Andrew Toolkit document in an existing magic file would have to be changed to \\begindata Andrew Toolkit document SunOS releases 3.h and is_tar. 2004 3 . it must be escaped. mainly USENET. My version differs from Sun’s only in minor ways. A consolidation of magic file entries will be distributed periodically.NOTICE in the distribution. Primary development and maintenence from 1990 to the present by Christos Zoulas 〈christos@zoulas.com〉. Toronto.com〉. see the file LEGAL. used as. 1973).com〉. Contributions to the ‘&’ operator by Rob McMahon 〈cudcv@warwick. Darwin 〈ian@darwinisys. the order that they are put together may be incorrect.ac. Christos Zoulas (address below) will collect additional or corrected magic file entries. Altered by Eric Fischer 〈enf@pobox.FILE (1) PropertyGeneral Commands Manual System of BladeLogic. The files tar. thank you. Covered by the standard Berkeley Software Distribution copyright. This program. and are not covered by the above license. in this version. but with some extensions. Darwin. Guy Harris 〈guy@auspex. Inc.2 and later from Sun Microsystems include a file command derived from the System V one. Canada. John Gilmore revised the code extensively. >16 long&0x7fffffff >0 not stripped MAGIC DIRECTORY The magic file entries have been collected from various sources. If your old file command uses a magic file. 2000: Handle the −i option to output mime type strings and using an alternative magic file and internal logic. and contributed by various authors. The list of contributors to the “magdir” directory (source for the /etc/magic file) is too long to include here. for example. to identify character codes and attempt to identify the languages of non-ASCII files.

What is it? Better yet. 2004 4 .. Regular expression support would make this easy. inefficient and requires recompilation to update..g. with the flexibility of the System V version. The magic file and keywords should have regular expression support. first long. It might be advisable to allow upper-case letters in keywords for e.YY. the magic file should be compiled into binary (say. fixed-length ASCII strings for use in heterogenous network environments) for faster startup. The list of keywords in ascmagic probably belongs in the Magic file. troff(1) commands vs man page macros. Strictly confidential and proprietary FILE (1) BUGS There must be a better way to automate the construction of the Magic file from all the glop in Magdir. Make a rule that the magic entries sort based on file offset rather than position within the magic file? The program should provide a way to give an estimate of “how good” a guess is. This program is slower than some vendors’ file commands. “From ” as first 5 chars of file) because they are not as good as other guesses (e.com in the directory /pub/file/file-X. Still. once we have fetched it..gz. We end up removing guesses (e. thus it can be misled about the contents of ASCII files. file uses several algorithms that favor speed over accuracy. There should be an “else” clause to follow a series of continuation lines. ndbm(3) or. first word. and particularly this section. BSD December 4. The program doesn’t grok FORTRAN.g. but is entrenched. is too long. Complain about conflicts in the magic file entries. Another optimization would be to sort the magic file so that we can just run down all the tests for the first byte. Their use of ASCII TAB as a field delimiter is ugly and makes it hard to edit the files. The support for ASCII files (primarily for programming languages) is simplistic.astron. This manual page. if the others don’t pan out. etc.tar.g. better yet. It should be able to figure FORTRAN by seeing some keywords which appear indented at the start of line. This could be done by using some keyword like ‘∗’ for the offset value. Inc.FILE (1) PropertyGeneral Commands Manual System of BladeLogic. it should be possible to use the first guess. Regular expression support would make this easy. AVAILABILITY You can obtain the original author’s latest version by anonymous FTP on ftp. “Newsgroups:” versus "Return-Path:"). Then the program would run as fast as the Version 7 program of the same name.

File hierarchies may also be specified as the operands immediately following the options. rounded up to the next full minute. backslash ( ‘\’ ) . −h −L −X −x PRIMARIES -amin n True if the difference between the file last access time and the time find was started. not the link itself. the file information and type will be for the link itself. Causes the file information and file type (see stat(2)) returned for each symbolic link to be those of the file referenced by the link. If a file name contains any of the delimiting characters used by xargs. space. and newline ( ‘\n’ ) characters.. rounded up to the next full 24-hour period. BSD December 4. all entries in a directory will be acted on before the directory itself. [expression] DESCRIPTION find recursively descends the directory tree for each path listed. The delimiting characters include single ( ‘’’ ) and double ( ‘"’ ) quotes. is n minutes. evaluating an expression (composed of the “primaries” and “operands” listed below) in terms of each file in the tree.FIND (1) PropertyGeneral Commands Manual System of BladeLogic. This option exists for backwards compatibility. allowing all file names to be processed safely. is n minutes. a diagnostic message is displayed on standard error. The options are as follows: −d Causes find to visit directories in post-order i. Permit find to be safely used in conjunction with xargs(1). In the absence of an expression. Strictly confidential and proprietary FIND (1) NAME find − walk a file hierarchy SYNOPSIS find [ −dHhLWXx] [ −f path] path . If the referenced file does not exist.e. -cmin n True if the difference between the time of last change of file status information and the time find was started. tab. not the link itself. Prevents find from descending into directories that have a device number different than that of the file from which the descent began. −H Causes the file information and file type (see stat(2)) returned for each symbolic link encountered on the command line to be those of the file referenced by the link. −f path Specifies a file hierarchy for find to traverse. the file information and type will be for the link itself. the −print0 primary may be used in conjunction with the −0 option to xargs(1).. By default. rounded up to the next full minute. Inc. and the file is skipped. Alternatively. is n 24-hour periods. before their contents. -print is assumed. find visits directories in pre-order i. File information of all symbolic links not on the command line is that of the link itself. -anewer file True if the current file has a more recent last access time than file. -atime n True if the difference between the file last access time and the time find was started. If the referenced file does not exist. An alias for the −L option.e. 1999 1 .

owner. group. and pathname. -mmin n True if the difference between the file last modification time and the time find was started. The following information for the current file is written to standard output: its inode number. If gname is numeric and there is no such group name. number of hard links. is n 24-hour periods. These do not describe actual file system types. Two special file system types are recognized: “local” and “rdonly”. the former matches any file system physically mounted on the system where find is being executed whereas the latter matches any file system which is mounted read-only.’ ) . The format is identical to that produced by “ls −dgils”. BSD December 4. -mindepth n True if the current search depth is at least what is specified in n. -fstype type True if the file is contained in a file system of type type. utility will be executed from the directory from which find was executed. rounded up to the next full minute.]. -maxdepth n True if the current search depth is less than or equal to what is specified in n. last modification time. . -ctime n True if the difference between the time of last change of file status information and the time find was started. . -group gname True if the file belongs to the group gname. Identical to the -exec primary with the exception that utility will be executed from the directory that holds the current file. -iname pattern True if the last component of the pathname being examined matches pattern. Strictly confidential and proprietary FIND (1) -cnewer file True if the current file has a more recent last change time than file. -follow Follow symbolic links. then gname is treated as a group ID. the major and minor numbers will be displayed instead of the size in bytes. the pathname of the linked-to file will be displayed preceded by “−>”. 1999 2 . -exec utility [argument . -ls This primary always evaluates to true. -empty True if the current file or directory is empty. rounded up to the next full 24-hour period. is n minutes. -inum n True if the file has inode number n. size in bytes. If the file is a symbolic link. -execdir utility [argument . Case insensitive.]. True if the program named utility returns a zero value as its exit status. Optional arguments may be passed to the utility. size in 512-byte blocks. -links n True if the file has n links. The filename substituted for the string "{}" is not qualified. If the string "{}" appears anywhere in the utility name or the arguments it is replaced by the pathname of the current file. . Inc. If the file is a block or character special file. file permissions.FIND (1) PropertyGeneral Commands Manual System of BladeLogic. . The expression must be terminated by a semicolon ( ‘.

and ‘?’) may be used as part of pattern. -ls. followed by a newline ( ‘\n’ ) character. These characters may be matched explicitly by escaping them with a backslash ( ‘\’ ) . ‘]’. 1999 3 . -perm [ − ] mode The mode may be either symbolic (see chmod(1)) or an octal number. followed by a null character.]. rounded up. Special shell pattern matching characters (‘[’. a starting value of zero is assumed and the mode sets or clears permissions without regard to the process’s file mode creation mask. -ok utility [argument . If the mode is preceded by a dash ( ‘−’ ) . -path pattern True if the pathname being examined matches pattern. is n 24-hour periods. -name pattern True if the last component of the pathname being examined matches pattern. It prints the pathname of the current file to standard output. If neither -exec. ‘∗’. -prune This primary always evaluates to true. the given expression shall be effectively replaced by (given expression) -print. It causes find to not descend into the current file. and ‘?’) may be used as part of pattern. If the mode is not preceded by a dash. this primary evaluates to true if at least all of the bits in the mode are set in the file’s mode bits. Note. -print This primary always evaluates to true. These characters may be matched explicitly by escaping them with a backslash ( ‘\’ ) . this primary evaluates to true if the bits in the mode exactly match the file’s mode bits. Identical to the -exec primary with the exception that find requests user affirmation for the execution of utility by printing a message to the terminal and reading a response. in 512-byte blocks is n. Slashes ( ‘/’ ) are treated as normal characters and do not have to be matched explicitly. only bits 07777 (S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO) of the file’s mode bits participate in the comparison. Note. If the mode is octal. -size n[c] True if the file’s size. ‘]’. . the first character of a symbolic mode may not be a dash. -print0 This primary always evaluates to true. Strictly confidential and proprietary FIND (1) -mtime n True if the difference between the file last modification time and the time find was started. -nogroup True if the file belongs to an unknown group. -nouser True if the file belongs to an unknown user. .FIND (1) PropertyGeneral Commands Manual System of BladeLogic. nor -print0 is specified. -newer file True if the current file has a more recent last modification time than file. It prints the pathname of the current file to standard output. If n is followed by a ‘c’. If the mode is symbolic. -ok. then the primary is true if the file’s size is n bytes. the -prune primary has no effect if the −d option was specified. Special shell pattern matching characters (‘[’. rounded up to the next full 24-hour period. ‘∗’. If the response is other than ‘y’ the command is not executed and the value of the ok expression is false. Inc. BSD December 4.

Primaries which themselves take arguments expect each argument to be a separate argument to find. The second expression is not evaluated if the first expression is false.FIND (1) PropertyGeneral Commands Manual System of BladeLogic. then uname is treated as a user ID. expression -or expression The -or operator is the logical OR operator. The expression evaluates to true if both expressions are true.c’ -print Print out a list of all the files owned by user “wnj” that are newer than the file “ttt”: $ find / -newer ttt -user wnj -print Print out a list of all the files which are not both newer than “ttt” and owned by “wnj”: $ find / \! \( -newer ttt -user wnj \) -print Print out a list of all the files that are either owned by “wnj” or that are newer than “ttt”: BSD December 4. A preceding plus sign means “more than n”. The operators are listed in order of decreasing precedence. If uname is numeric and there is no such user name. a preceding minus sign means “less than n”. OPERATORS The primaries may be combined using the following operators. Possible file types are as follows: b c d f l p s block special character special directory regular file symbolic link FIFO socket -user uname True if the file belongs to the user uname. Inc. EXAMPLES Print out a list of all the files whose names do not end in “. The expression evaluates to true if either the first or the second expression is true. It evaluates to true if the expression is false. As it is implied by the juxtaposition of two expressions it does not have to be specified. (expression) This evaluates to true if the parenthesized expression evaluates to true. Strictly confidential and proprietary FIND (1) -type t True if the file is of the specified type. !expression This is the unary NOT operator. and neither means “exactly n”.c”: $ find / \! -name ’∗. All primaries which take a numeric argument allow the number to be preceded by a plus sign ( ‘+’ ) or a minus sign ( ‘−’ ) . expression -and expression expression expression The -and operator is the logical AND operator. 1999 4 . All operands and primaries must be separate arguments to find. The second expression is not evaluated if the first expression is true.

-follow. -mindepth. the −d. -cmin. the characters ‘∗’. 1999 5 . Historically. strmode(3). whereis(1).2 (“POSIX.[0-9] SEE ALSO chflags(1). getpwent(3). stat(2). xargs(1). some legal expressions could have unexpected results.2”) standard. Strictly confidential and proprietary FIND (1) $ find / \( -newer ttt -or -user wnj \) -print Print out a list of all core files on local file systems: $ find / \! -fstype local -prune -or -name ’∗. These problems are handled by the −f option and the getopt(3) “−−” construct. ‘)’. ‘\’. locate(1).2”). As they were really global variables that took effect before the traversal began. -maxdepth. -inum. -fstype. This version replaces it no matter where in the utility name or arguments it appears. BSD December 4. and -xdev. but skip directory /usr/src/gnu: $ find /usr/src -path /usr/src/gnu -prune -or -name \∗\. This is not the case.core’ -print Find all files in /usr/src ending in a dot and single digit. and ‘. which(1). −H. -ls. BUGS The special characters used by find are also special characters to many shell programs. ‘[’. ‘(’. As −print always evaluates to true. symlink(7) STANDARDS The find utility syntax is a superset of the syntax specified by the IEEE Std 1003. ‘]’. As there is no delimiter separating options and file names or file names and the expression. -iname. and the operator -and was implemented as −a. The -iname option was inspired by GNU find. fts(3). the standard order of evaluation implies that −depth would never be evaluated. it is difficult to specify files named “-xdev” or “!”. and −x options were implemented using the primaries -depth. chmod(1). ‘?’. -execdir. The options and primaries -amin. Historic implementations of the -exec and -ok primaries did not replace the string "{}" in the utility name or the utility arguments if it had preceding or following non-whitespace characters. and -print0 are extensions to IEEE Std 1003.2 (“POSIX. These primaries always evaluated to true.’ may have to be escaped from the shell. Inc. -mmin. ‘!’. -empty.FIND (1) PropertyGeneral Commands Manual System of BladeLogic. In particular. HISTORY A find command appeared in Version 1 AT&T UNIX. getgrent(3). The operator -or was implemented as −o. -follow. -links. An example is the expression “−print −o −depth”.

Berkeley and its contributors. SunOS 5. ORIGIN Fold includes software developed by the University of California.. Width should be a multiple of 8 if tabs are present.User Commands Property of BladeLogic. breaking the lines to have maximum of 80 characters. Strictly confidential and proprietary fold ( 1 ) NAME fold .fold long lines for finite width output device SYNOPSIS fold [-w width] file . expand(1) BUGS If underlining is present it may be messed up by folding. Please see the intro section for complete acknowledgements. DESCRIPTION Fold is a filter which folds the contents of the specified files. Inc. or the tabs should be expanded using expand(1) before using fold.8 Last change: NSH 1 . or the standard input if no files are specified.. OPTIONS The options are as follows: -w SEE ALSO Specifies a line width to use instead of the default 80 characters.

.. DNS.. <dns> .domaincomponent2.conf like file.. <dns> .. Strictly confidential and proprietary fqdn(1) fqdn(1) NAME fqdn − print fully qualified domain name of the current or specified host SYNOPSIS fqdn [ [ -u ] | [ -a ] [ <hostname> ] ] DESCRIPTION fqdn prints out the fully qualified domain name (fqdn) of the current or specified host.com <nis> .. <local> <dns> .. Inc.conf like file.domaincomponent2.conf like file.Property of BladeLogic..domaincomponent1....conf like file on the operating system. No Argument Print the first fqdn resolved name of the current hostname resolved by any one of the name resolution database specified along the hosts stanza of the nsswitch. If multiple hostnames are specified. -a Print fqdn of the current hostname resolved using all the name resolution databases specified along the hosts stanza of the nsswitch. <local> . Example 2 [host3] $ fqdn -a host2 <local> . only the first hostname from the left in the given hostname list is considered.domaincomponent1. Empty sections signify either absence of the hostname in the name resolution database or unavailability of the database. <local> .com The following example shows host2 being resolved from host3’s local name resolution database (/etc/hosts). and NIS.conf like file.. -a <hostname> Print fqdn of <hostname> resolved using all the name resolution databases specified along the hosts stanza of the nsswitch. <dns> host2. <nis> . OPTIONS -u Print usage. in that particular sequence.. EXAMPLES Example 1 [host1] $ fqdn host1 host1.. <hostname> Print the first fqdn resolved name of <hostname> resolved using any one of the name resolution databases specified along the hosts stanza of the nsswitch. in that particular sequence. <nis> ..... <nis> NSH 1 . This command typically determines the host’s corresponding fqdn by querying the name resolution database entries specified along the hosts stanza of the nsswitch.

.domaincomponent2.com host4.domaincomponent2.domaincomponent1..com ORIGIN fqdn was written by Jaswinder Bhamra...domaincomponent3. NSH 2 .. Inc.. Strictly confidential and proprietary fqdn(1) fqdn(1) Example 3 [host4] $ fqdn -a <local> .com loghost <dns> . SEE ALSO hostname(1). <dns> . <dns> host4.domaincomponent1. <local> host4 host4. <local> . <local> . <dns> ......Property of BladeLogic.domaincomponent2..

A password for encrypted zip files can be specified on the command line (preceding the file name. zipcloak(1L). This would be useful in the case where a ZIP archive is included within another archive.g.z i p .zip (any errors will be reported on standard error): funzip test. o r g / p u b / i n f o z i p / f t p: / / f t p. The following section includes an example illustrating this usage in the case of disk backups to tape. and command-line histories can be read. if any) by prefixing the password with a dash. i n f o . Inc. . .zip > /dev/null To use zip and funzip in place of compress(1) and zcat(1) (or gzip(1L) and gzcat(1L)) for tape backups: tar cf – . that is. ps(1) under Unix). zipsplit(1L) URL The Info-ZIP home page is currently at h t t p : / / www. SEE ALSO gzip(1L). then the input comes from the specified file instead of from stdin. or Info-ZIP Last change: 14 January 2001 (v3. . unzipsfx(1L). zipinfo(1L).z i p. To recover.93) 1 .zip  [. DESCRIPTION funzip acts as a filter.. after prompting again for the password.gz  [. i nf o. nrst0 is a SCSI tape drive). funzip will reset the terminal properly. funzip changes the terminal mode to non-echo before more reads its state.Misc. run funzip on the same file but redirect to /dev/null rather than piping into more.] funzip [–password] input. the terminal may sometimes be reset to a non-echo mode. and it extracts the first member from the archive to stdout. it assumes that a ZIP archive (or a gzip’d(1) file) is being piped into standard input. Decryption may not be supported at some sites. Note that this constitutes a security risk on many systems.] ARGUMENTS [–password] Optional password to be used if ZIP archive is encrypted. | zip –7 | dd of=/dev/nrst0 obs=8k dd if=/dev/nrst0 ibs=8k | funzip | tar xf – (where. Strictly confidential and proprietary FUNZIP ( 1L ) NAME funzip – filter for extracting from a ZIP archive in a pipe SYNOPSIS [. . and more then ‘‘restores’’ the terminal to this mode before exiting. . . funzip is most useful in conjunction with a secondary archiver program such as tar(1). There is presently no way to extract any member but the first from a ZIP archive. or g/ pub/ i nf oz i p/ . In the case where the first member is a directory. If there is an argument.zip | more To use funzip to test the first member file of test.] funzip [–password] input. for example. BUGS When piping an encrypted file into more and allowing funzip to prompt for password. funzip simply creates the directory and exits. currently running processes are often visible via simple commands (e. If the first entry of the zip file is encrypted and no password is specified on the command line. . zipnote(1L). unzip(1L). Given the limitation on single-member extraction. See DESCRIPTION for more details. This is apparently due to a race condition between the two programs. zip(1L).]  funzip [–password]  [.zip and to pipe it into more(1): funzip test. The functionality of funzip should be incorporated into unzip itself (future release). then the user is prompted for a password and the password is not echoed on the console. EXAMPLES To use funzip to extract the first member file of the archive test. . Reference Manual Pages Property of BladeLogic.

Misc.93) 2 . Reference Manual Pages Property of BladeLogic. Strictly confidential and proprietary FUNZIP ( 1L ) AUTHOR Mark Adler (Info-ZIP) Info-ZIP Last change: 14 January 2001 (v3. Inc.

The license.dat file can contain multiple entries. The basic idea is to let you remotely license multiple servers. you can use this option to point to a file containing a list of hosts (one per line) from which you want to obtain license information.raw bombay 1 AF23B1C9 madras 1 2F23B1C4 CAVEATS This command works even if the remote agent is currently not licensed. Inc. getlic gets license data from all the hosts you specify. The putlic command uses license. and an optional expiration key. If you do not specify any of these four options. See the -v option for more details. ORIGIN getlic was written by Thomas Kraus NSH 1 .raw. Each entry consists of a hostname. Get license data from hosts that currently have an expired evaluation license. putlic sends this data to each remote host specified in the first (hostname) field of each entry..dat.. and writes this data to a file called license. Get license data from hosts that are currently un-licensed. Other options include: -f filename Instead of listing your hosts one at a time on the command line as arguments. You can specify multiple options. OPTIONS The following four options let you select a subset of hosts based on their current license status.getlic(1) Property of BladeLogic. The getlic command gathers necessary license data from each remote host. host1 . hostn List of hosts whose license information you want to retrieve. a license key. putlic creates an appropriate license based on the data. one entry per line.. USAGE host $ getlic -n -v bombay madras bagalore Host bombay is not licensed Host madras has a valid evaluation license Host bagalore has a valid permanent license host $ getlic bombay madras host $ cat license. BladeLogic’s licensing web page takes this file and generates a file called license. Displays the status of each host. regardless of license status. hostn] DESCRIPTION The getlic command is meant to be used in conjunction with the putlic command. a product code. Get license data from hosts that currently have a valid evaluation (timed) license. -l -u -e -x -n -v Get license data from hosts that currently have a valid permanent license.raw file..dat to license the remote agents. Do not create a license. This is useful when you just want to get an overview of your licensing situation. Verbose output. Strictly confidential and proprietary getlic(1) NAME getlic − Get remote license data from agents SYNOPSIS getlic [-luenxv] [-f file] [host1 .

. If you specified -R. Select the input files that do NOT contain lines that match the pattern(s). -C -E -F -G -H -I -L Print two lines of leading context and two lines of trailing context after each match. an input line matches a pattern if any regular expression (RE) in the pattern matches the input line without its trailing newline. selecting lines that match one or more patterns. Inc. -B num Print num lines of leading context before each match. If you specified the -R option. Newlines are not considered part of a pattern.file pattern searcher SYNOPSIS grep [-AB num] [-CEFGHILPRSUVabchilnoqsvwx] [-e pattern] [-f file] [pattern] [file . An empty expression matches every line. Force grep to behave as egrep. When displaying a matching line. NSH 1 . Ignore binary files. it writes the pathname ‘-’. fgrep . follow symbolic links only if they were explicitly listed on the command line. Strictly confidential and proprietary grep(1) NAME grep. grep does not follow symbolic links. If you specified the -R option. but do not attempt to print them. Search binary files. The fgrep utility is quick but can handle only fixed patterns consisting of one or more lines. Treat all files as text. Display version information. Write only a count of matching lines.grep(1) Property of BladeLogic. If grep searched the standard input. Perform case insensitive matching. grep selects an input line if it matches any of the specified patterns. allowing any of the pattern lines to match a portion of the input.] DESCRIPTION The grep utilities search the given input files. -h -i Never print filename headers with output lines. You can specify multiple -e options to specify multiple patterns. The egrep utility can handle extended regular expressions and multi-line patterns. OPTIONS -A num Print num lines of trailing context after each match. -P -R -S -U -V -a -b -c -e expression Specify a pattern to use to search the input. By default. display the offset in bytes of the matching pattern. Equivalent to -A 2 -B 2. Recursively search the subdirectories you specify. and write the names of these files to standard output. follow all symbolic links. The grep utility is used for simple patterns and ex(1) or ed(1) style regular expressions. Force grep to behave as grep. Force grep to behave as fgrep. -f pattern_file Read one or more newline separated patterns from pattern_file. in front of the matching line. Each input line that matches at least one of the patterns is written to the standard output. egrep.. List the pathname for each file.

If grep searched the standard input. RETURN VALUES grep exits with one of the following values: 0 1 >1 One or more lines were selected. Align the match from the beginning of the line. Only input lines selected against an entire fixed string or regular expression are considered to be matching lines. Match 1 or less sequential repetitions of the pattern. and the ‘\’ escapes the ‘. grep uses the standard input. -n -o -q -s -v -w -x If you do not specify any file arguments. EXTENDED REGULAR EXPRESSIONS The following characters are interpreted by egrep: $ ˆ | ? + * {} [] \ Align the match from the end of the line. An error occurred. ‘$. Suppress normal output. Precede each output line with its relative line number in the file.Pp’ at the beginning of a line: grep’ˆ\. Match 1 or more sequential repetitions of the pattern. Search for the expression as a word (as if surrounded by ‘[[:<:]]’ and ‘[[:>:]]’). -l. it writes the pathname ‘-’. Always print filename headers with output lines.’ which would otherwise match any character. and write the names of these files to standard output. The caret ‘ˆ’ matches the null string at the beginning of a line. Match any single character or range of characters enclosed in the brackets. Ignore nonexistent and unreadable files. No lines were selected. Select lines that do not match any of the specified patterns. grep ignores this option if you specify -c.Pp’ The apostrophes ensure the entire expression is evaluated by grep instead of by your shell. Match 0 or more sequential repetitions of the pattern. These special characters are: EXAMPLES To find all occurrences of the word patricia in a file: grep patricia myfile To find all occurrences of the pattern ‘. Match specified number of sequential repetitions of the pattern. Strictly confidential and proprietary -l grep(1) Select the input files that contain lines that match the pattern(s). List the pathname for each file. To find all lines in a file that do not contain the words foo or bar: NSH 2 . Escape special characters that have meaning to egrep.grep(1) Property of BladeLogic. or -q.ˆ[]|?+*{}()\’. grep resets the line number counter for each file it processes. Add another pattern (see example below). The first line of each file is 1. Silent mode. Inc.

Strictly confidential and proprietary $ grep -v -e foo -e bar myfile A simple example of an extended regular expression: $ egrep ’19|20|25’ calendar Peruses the file calendar looking for either 19. Inc.grep(1) Property of BladeLogic. NSH 3 . 20 or 25. grep(1) HISTORY The grep command appeared in Version 6 AT&T UNIX.

If you do not specify any files. Output a brief summary of available options and then exit with a zero status without doing any viewing. You specified an unknown option.. This is done for compatibility purposes. One of the files you want to view was not accessible. CAVEATS There are two ways in which to define the number of lines/characters to be output. head outputs the file "as is.c $ head -c -n 1024 //vienna/etc/passwd DIAGNOSTICS head: Cannot open file filename This message is output if head is unable to access the file filename. if you are using the -c option) to be count. $ head -20 *. -c -l -n count Set the number of lines to be output (or characters to be output. -n -? file Set the number of lines to be output (or characters to be output. the head command by default reads lines of text in TEXTUAL mode. Measure quantities in lines. 10 lines) from the named file(s) to the standard output.c files. Unable to get a license to use the software. This is the default. head displays the first few lines from the standard input. head displays the first few lines from the standard input. ORIGIN head was written by Thomas Kraus SEE ALSO tail(1) NSH 1 . EXIT CODES 0 1 2 255 No errors detected. EXAMPLE The first example views the first 20 lines of all .. meaning that lines of text are terminated with a <LF> rather than the Windows standard <CR><LF>. if you are using the -c option) to be n.] DESCRIPTION head displays the first few lines (by default. The second example views the first 1024 characters in the password file on the host vienna. display count number of characters.head(1) Property of BladeLogic. When you specify the -B option. If you do not specify any file names. Inc. Strictly confidential and proprietary head(1) NAME head − Display first few lines of a file SYNOPSIS head [-?] [-l | -c | -n count | -n] [file . OPTIONS -B On Windows systems. Instead of displaying count number of lines." meaning <CR><LF> remains <CR><LF>. File whose first few lines you want to display.

With a leading 0x or 0X. -s offset Skip offset bytes from the beginning of the input. xd . Any whitespace before or after the slash is ignored. in octal. Each format is applied iteration count times. with the following exceptions: NSH 1 . followed by eight space-separated. five column. By default. three column. Display the input offset in hexadecimal. three column. 1024. Display the input offset in hexadecimal. decimal. and a format. zero-filled. space-filled. octal dump SYNOPSIS hexdump [-bcdovx] [-e format_string] [-f format_file] [-n length] [-s skip] file . or 1048576. or m to offset causes it to be interpreted as a multiple of 512. two-byte quantities of input data. respectively. two-byte units of input data. with a leading 0. Display the input offset in hexadecimal. otherwise. offset is interpreted as a decimal number. space separated. four column. in a user specified format. followed by eight space-separated. per line. per line.. -v The -v option causes hexdump to display all input data. in octal. Two-byte decimal display. The iteration count is an optional positive integer. in unsigned decimal. Two-byte hexadecimal display.. The byte count is an optional positive integer. -f format_file Specify a file that contains one or more newline separated format strings. six column. per line. zero-filled. It is interpreted as a fprintfstyle format string (see fprintf(3)). or the standard input. If specified it defines the number of bytes to be interpreted by each iteration of the format. -x FORMATS A format string contains any number of format units. DESCRIPTION The hexdump utility is a filter which displays the specified files. -o Two-byte octal display. Display the input offset in hexadecimal. The format is required and must be surrounded by double quote (" ") marks. in the order that they were specified. For each input file. Inc. hexdump sequentially copies the input to standard output.ascii. which would be identical to the immediately preceding group of output lines (except for the input offsets). transforming the data according to the format strings specified by the -e and -f options. hexadecimal. OPTIONS The options are as follows: -b -c -d One-byte octal display. Strictly confidential and proprietary hexdump(1) NAME hexdump. followed by sixteen space-separated. k. are replaced with a line comprised of a single asterisk. followed by eight. Display the input offset in hexadecimal. zero-filled. a single slash must be placed after the iteration count and/or before the byte count to disambiguate them. zero-filled. offset is interpreted as an octal number. bytes of input data. separated by whitespace. two byte quantities of input data. followed by sixteen spaceseparated. If an iteration count and/or a byte count is specified. characters of input data per line. Empty lines and lines whose first non-blank character is a hash mark (#) are ignored. offset is interpreted as a hexadecimal number. Without the -v option. -e format_string Specify a format string to be used for displaying data. in hexadecimal. Appending the character b. which defaults to one. od.hexdump(1) Property of BladeLogic. A format unit contains up to three items: an iteration count. -n length Interpret only length bytes of input. One-byte character display. a byte count. if no files are specified. any number of groups of output lines. per line.

hexdump(1) A byte count or field precision is required for each ‘‘s’’ conversion character (unlike the fprintf(3) default which prints the entire string if the precision is unspecified). Output characters in the default character set. 000 nul 001 soh 002 stx 003 etx 004 eot 005 enq 006 ack 007 bel 008 bs 009 ht 00A lf 00B vt 00C ff 00D cr 00E so 00F si 010 dle 011 dc1 012 dc2 013 dc3 014 dc4 015 nak 016 syn 017 etb 018 can 019 em 01A sub 01B esc 01C fs 01D gs 01E rs 01F us 0FF del The default and supported byte counts for the conversion characters are as follows: %_c. Nonprinting characters are displayed in three character. The appended characters d. four byte counts supported. Characters greater than 0xff. except for those representable by standard escape notation (see above). The single character escape sequences described in the C standard are supported: NUL \0 <alert character> \a <backspace> \b <form-feed> \f <newline> \n <carriage return> \r <tab> \t <vertical tab> \v Hexdump also supports the the following additional conversion strings: _a[dox] Display the input offset. %f. ‘‘l’’.hexdump(1) + + + + Property of BladeLogic. or the iteration count times the number of bytes required by the format if the byte count is not specified. Output US ASCII characters. zero-padded octal. where a block is defined as the largest amount of data specified by any format string.’’. ‘‘p’’ and ‘‘q’’ are not supported. names. of the next byte to be displayed. %X. %G. %x %E. when all of the input data has been processed. o. Eight byte default. Format strings interpreting less than an input block’s worth of data. %e. which is the iteration count times the byte count. Four byte default. _p _u The amount of data interpreted by each format string is the sum of the data required by each format unit. Strictly confidential and proprietary An asterisk (*) may not be used as a field width or precision. %i. ‘‘n’’. lower-case. %g One byte counts only. %_u. _c Output characters in the default character set. octal or hexadecimal respectively. _A[dox] Identical to the _a conversion string except that it is only performed once. are displayed as hexadecimal strings. Inc. and x specify the display base as decimal. with the exception that control characters are displayed using the following. have the iteration count incremented until the entire input block has been processed or there is not enough data remaining in NSH 2 . two and four byte counts supported. %_p. whose last format unit both interprets some number of bytes and does not have a specified iteration count. one. Nonprinting characters are displayed as a single ‘‘. The input is manipulated in ‘‘blocks’’. %o. hexadecimal. %u. %c %d. cumulative across input files. The conversion characters ‘‘h’’. which are displayed as two character strings.

If no format strings are specified. and referencing a NULL string. If. input data only partially satisfies a format string. hexdump exits 0 on success and >0 if an error occurred.7_Ax\n" "%07.hexdump(1) Property of BladeLogic.7_ax " 8/2 "%04x " "\n" Hexdump includes software developed by the University of California.e. an iteration count is greater than one. the input block is zero-padded sufficiently to display all available data (i. If.6_ao " 12/1 "%3_u " "\t\t" "%_p " "\n" Implement the -x option: "%07. as a result of the specification of the -n option or end-of-file being reached. ‘‘#’’ conversion flag characters removed. ‘‘ ’’. Strictly confidential and proprietary hexdump(1) the block to satisfy the format string. SEE ALSO od(1) NSH 3 . Inc. EXAMPLES Display the input in perusal format: "%06. An equivalent number of spaces is defined as the number of spaces output by an s conversion character with the same field width and precision as the original conversion character or conversion string but with any ‘‘+’’. It is an error to specify a byte count as well as multiple conversion characters or strings unless all but one of the conversion characters or strings is _a or _A. the default display is equivalent to specifying the -x option. Berkeley and its contributors. no trailing whitespace characters are output during the last iteration. Further output by such format strings is replaced by an equivalent number of spaces. Please see the intro section for complete acknowledgements. either as a result of user specification or hexdump modifying the iteration count as described above. any format units overlapping the end of data will display some number of the zero bytes).

It takes the results of the grep and highlights the word that was searched for.8 Last change: 23 October 1988 1 . front-end for grep. DESCRIPTION SEE ALSO grep(1) BUGS Meta-characters are not handled. SunOS 5. Strictly confidential and proprietary HGREP ( 1 ) NAME hgrep .User Commands Property of BladeLogic.highlight results of a grep SYNOPSIS hgrep <grep args> Hgrep is a trivial. Quoting is not handled. but cute. Inc.

NSH 1 . OPTIONS hostname has no options. Strictly confidential and proprietary hostname(1) NAME hostname − print name of current host SYNOPSIS hostname DESCRIPTION hostname prints out the name of the host on which your current directory resides. Inc.hostname(1) Property of BladeLogic. This command does NOT let you set the name of the current host. ORIGIN hostname was written by Thomas Kraus SEE ALSO uname(1).

OPTIONS -a file_number In addition to the default output. the remaining fields from file1 and then the remaining fields from file2. the following options are available: -a In addition to the default output. For example. For example. A a simpler approach is to use multiple -o options. Otherwise. but display a line for each unpairable line in file file_number. -j1 field In file 1.field’.join(1) Property of BladeLogic. join on the field specified by field. Strictly confidential and proprietary join(1) NAME join . Multiple tabs and spaces count as a single field separator. -e string Replace empty output fields with string. The default input field separators are tab and space characters. meaning the first file on the command line is file number 1 and the first field is field number 1. produce a line for each unpairable line in file file_number. -1 3 means join on the third field in file 1. When you specify the field delimiter characters with the -t option. Each element of the list has the form ‘file_number. NSH 1 . -1 field -2 field In file 1. the collating sequence should be the same as sort without the -b option. The join utility exits 0 on success. Every occurrence of char in a line is significant. join uses the standard input. The elements of list must be either comma (‘‘. and >0 if an error occurs. For example.relational database operator SYNOPSIS join [-a file_number | -v file_number] [-e string] [-j file_number field] [-o list] [-t char] [-1 field] [-2 field] file1 file2 DESCRIPTION The join utility performs an ‘‘equality join’’ on the specified files and writes the result to the standard output. There is one line in the output for each pair of lines in file1 and file2 that have identical join fields. If one of the arguments file1 or file2 is ‘‘-’’. -o list The -o option specifies the fields that will be output from each file for each line with matching join fields. COMPATIBILITY For compatibility with historic versions of join.’’) or whitespace separated. -2 3 means join on the third field in file 2. you should order the files you are joining in the collating sequence of sort(1). Inc. You can specify options -v 1 and -v 2 at the same time. and leading tabs and spaces are ignored.using the -b option. join on the field specified by field. The ‘‘join field’’ is the field in each file by which the files are compared. Many of the options use file and field numbers. For example. -j2 field In file 2. (The latter requires quoting to protect it from the shell. -j2 3 means join on the third field in file 2. where file_number is a file number and field is a field number. Each output line consists of the join field. join may not report all field matches. -t char -v file_number Do not display the default output. on the fields on which they are to be joined. Both file numbers and field numbers are 1 based.) Use character char as a field delimiter for both input and output. produce a line for each unpairable line in both file 1 and file 2. In file 2. The default output field separator is a single space character. join on the field specified by field. The first field in each line is used by default. -j1 3 means join on the third field in file 1. When you are using the default field delimiter characters. join on the field specified by field.

2’’. These options are available only so historic shellscripts do not require modification. sort(1). comm(1). join on the field specified by field. Berkeley and its contributors. ORIGIN join includes software developed by the University of California. SEE ALSO awk(1). This has obvious difficulties in the presence of files named ‘‘1. In general... join(1) -o list . uniq(1) NSH 2 . Strictly confidential and proprietary -j field In both file 1 and file 2. do not use these options. paste(1). These arguments were of the form ‘‘file_number. Historical implementations of join permitted multiple arguments to the -o option.join(1) Property of BladeLogic. Inc.field_number’’ as described for the current -o option.

each option affects only the file after it. –f min. Inc. Berkeley and its contributors..max ] [ –s sepstring ] [ –t c ] file . The options are described below. The newline normally appended to each output line is omitted. and if it begins with a ‘–’. This option may appear after the last file. The name ‘–’ means the standard input.User Commands Property of BladeLogic. SunOS 5. –s sepstring Print sepstring before printing line fragments from the next file. but pad this file’s field when end-of-file is reached and other files are still active. –p min.max Like –f. and may be repeated. To print files simultaneously for easy viewing use pr(1). SEE ALSO join(1). If min begins with a zero.8 Last change: NSH 1 . the fragment will be left-adjusted within the field. If the option letter is capitalized it affects all subsequent files until it appears again uncapitalized. pr(1). To merge the lines from four different files use lam file1 –S " \ " file2 file3 file4 Every 2 lines of a file may be joined on one line with lam – – < file and a form letter with substitutions keyed by ‘@’ can be done with lam –t @ letter changes ORIGIN Lam includes software developed by the University of California. DESCRIPTION Lam copies the named files side by side onto the standard output. zeros will be added to make up the field width. EXAMPLES The command lam file1 file2 file3 file4 joins 4 files together along each line. Strictly confidential and proprietary lam ( 1 ) NAME lam – laminate files SYNOPSIS lam [ –[fp] min. The n-th input lines from the input files are considered fragments of the single long n-th output line into which they are assembled. Please see the intro section for complete acknowledgements. where min is the minimum field width and max the maximum field width.max..max Print line fragments according to the format string min. Normally. –t c The input line terminator is c instead of a newline.

more − view files on a CRT SYNOPSIS less more less more less more less more less more | −? | −-help | −V | −-version | [ −[+]aBcCdeEfFgGiIJLmMnNqQrRsSuUVwWX˜] [ −b space] [ −h lines] [ −j line] [ −k keyfile] [ −o | −O logfile] [ −p pattern] [ −P prompt] [ −t tag] [ −T tagsfile] [ −x tab. . but which allows backward movement in the file as well as forward movement. so it can run on a variety of terminals. The number is used by some commands. lines which should be printed at the top of the screen are prefixed with a caret.] DESCRIPTION less is a program similar to the traditional more(1). default one window (see option -z below). (On a hardcopy terminal. There is even limited support for hardcopy terminals. even if N is more than the screen size. In this mode. then "v". ESC stands for the ESCAPE key. COMMANDS In the following descriptions. less does not have to read the entire input file before starting.. .. Commands may be preceded by a decimal number. h | H Help: display a summary of these commands.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. only the final screenful is displayed. but if N is specified. but scrolls a full screensful. the differences are in the prompt and that more exits by default when it gets to the end of the file. Strictly confidential and proprietary LESS (1) NAME less. The entire N lines are displayed. ESC-SPACE Like SPACE. so with large input files it starts up faster than text editors like vi(1). z Like SPACE. default one half of the screen size.] [ −y lines] [ −[z] lines] [ −# shift] [+[+] cmd] [ −− ] [filename .) This version of less also acts as more(1) if it is called as more. BSD January 17. for example ESC-v means the two character sequence "ESCAPE". If N is specified. Commands are based on both traditional more and vi(1). Also. default 1. If N is more than the screen size. Warning: some systems use ˆV as a special literalization character. as indicated. ˆX means control-X. 2003 1 . d | ˆD Scroll forward N lines. RETURN | ˆN | e | ˆE | j | ˆJ Scroll forward N lines. remember this one. it becomes the new default for subsequent d and u commands. it becomes the new window size.. SPACE | ˆV | f | ˆF Scroll forward N lines. less uses termcap (or terminfo on some systems). Inc. even if it reaches end-of-file in the process. If you forget all the other commands. called N in the descriptions below.

u | ˆU Scroll backward N lines. R F Repaint the screen. y | ˆY | ˆP | k | ˆK Scroll backward N lines. If a number N is specified. it becomes the new window size. it becomes the new default for subsequent d and u commands.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. If there is more than one right curly bracket on the top line. discarding any buffered input. but applies to parentheses rather than curly brackets. the } command will go to the matching left curly bracket. even if N is more than the screen size. it acts as though the -S option (chop lines) were in effect. (Warning: this may be slow if N is large. Strictly confidential and proprietary LESS (1) b | ˆB | ESC-v Scroll backward N lines. or if N is not specified and standard input. only the final screenful is displayed. default the end of the file. default half the screen width (see the -# option).) p | % { Go to a position N percent into the file. If a right curly bracket appears in the bottom line displayed on the screen. The matching left curly bracket is positioned on the top line of the screen. Like }.) G | > | ESC-> Go to line N in the file.) g | < | ESC-< Go to line N in the file. r | ˆR | ˆL Repaint the screen. If N is more than the screen size. If a left curly bracket appears in the top line displayed on the screen. (The behavior is similar to the "tail -f" command. default 1. default one half of the screen size. 2003 2 . The matching right curly bracket is positioned on the bottom line of the screen. w Like ESC-v. ESC-( | LEFTARROW Scroll horizontally left N characters. is being read. If there is more than one left curly bracket on the top line. but if N is specified. Useful if the file is changing while it is being viewed. default 1 (beginning of file). N should be between 0 and 100. a number N may be used to specify the N-th bracket on the line. Warning: some systems use ˆY as a special job control character. It is a way to monitor the tail of a file which is growing while it is being viewed. Scroll forward. Inc. ESC-) | RIGHTARROW Scroll horizontally right N characters. default half the screen width (see the -# option). it becomes the default for future RIGHTARROW and LEFTARROW commands. Like {. default one window (see option -z below). rather than a file. it becomes the default for future RIGHTARROW and LEFTARROW commands. but applies to parentheses rather than curly brackets. (Warning: this may be slow if N is large. If N is specified. The entire N lines are displayed. } ( ) BSD January 17. a number N may be used to specify the N-th bracket on the line. If a number N is specified. and keep trying to read when the end of file is reached. the { command will go to the matching right curly bracket. While the text is scrolled. Normally this command would be used when already at the end of the file.

) Followed by any lowercase letter. they modify the type of search rather than become part of the pattern: ˆN | ! ˆE | ∗ Search for lines which do NOT match the pattern. acts like }. jumps to the beginning or end of the file respectively. The search starts at the second line displayed (but see the -a and -j options. Followed by a ˆ or $. Search multiple files. do a simple textual comparison. Begin the search at the first line of the FIRST file in the command line list. Like }. ESC-ˆB Followed by two characters. Certain characters are special if entered at the beginning of the pattern. but applies to square brackets rather than curly brackets. That is. Don’t interpret regular expression metacharacters. but uses the two characters as open and close brackets. For example. Inc. For example. Highlight any text which matches the pattern on the current screen. ˆF | @ ˆK ˆR ?pattern Search backward in the file for the N-th line containing the pattern. "ESC ˆB < >" could be used to go backward to the < which matches the > in the bottom displayed line. returns to the position at which the last "large" movement command was executed. so the ’ command can be used to switch between input files. respectively. the search continues in the next file in the command line list. as in the / command: ˆN | ! ˆE | ∗ Search for lines which do NOT match the pattern. The pattern is a regular expression. returns to the position which was previously marked with that letter. that is. ESC-ˆF Followed by two characters. N defaults to 1. That is. Certain characters are special. if the search reaches the END of the current file without finding a match. but applies to square brackets rather than curly brackets. "ESC ˆF < >" could be used to go forward to the > which matches the < in the top displayed line. BSD January 17. /pattern Search forward in the file for the N-th line containing the pattern. as recognized by ed(1). m ’ Followed by any lowercase letter. The search starts at the line immediately before the top line displayed. Search multiple files. 2003 3 . which change this). respectively. Strictly confidential and proprietary LESS (1) [ ] Like {. but don’t move to the first match (KEEP current position). the search continues in the previous file in the command line list. but uses the two characters as open and close brackets. (Single quote. ˆXˆX Same as single quote. if the search reaches the beginning of the current file without finding a match. marks the current position with that letter. acts like {. Followed by another single quote.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. regardless of what is currently displayed on the screen or the settings of the -a or -j options. Marks are preserved when a new file is examined.

the "current" file (see the :n and :p commands below) from the list of files in the command line is re-examined. 2003 4 . If the previous search was modified by ˆR. Inc. BSD January 17. two consecutive percent signs are simply replaced with a single percent sign. Turn off highlighting of strings matching the current search pattern. As in forward searches. If a number N is specified. for N-th line containing the last pattern. The effect is as if the previous search were modified by ∗. Similarly. turn highlighting back on. N ESC-n Repeat previous search. but in the reverse direction and crossing file boundaries. ˆK ˆR ESC-/pattern Same as "/∗". If the previous search was modified by ˆN. the search continues in the next (or previous) file if not satisfied in the current file. A percent sign (%) in the filename is replaced by the name of the current file. the search is done without using regular expressions. they are all inserted into the list of files and the first one is examined.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. the N-th next file is examined. in that case search commands do not turn highlighting back on. (Highlighting can also be disabled by toggling the -G option. but crossing file boundaries. A pound sign (#) is replaced by the name of the previously examined file. If the filename contains one or more spaces. the search is made for the N-th line NOT containing the pattern. the entire filename should be enclosed in double quotes (also see the -" option). ESC-N Repeat previous search. If a number N is specified. ˆXˆV | E Same as :e. There is no effect if the previous search was modified by ˆF or ˆK. As in forward searches. n Repeat previous search. Examine the previous file in the command line list. Warning: some systems use ˆV as a special literalization character. you may not be able to use ˆV. regardless of what is currently displayed on the screen or the settings of the -a or -j options. This allows you to enter a filename that contains a percent sign in the name. The filename is inserted into the command line list of files so that it can be seen by subsequent :n and :p commands. ESC-u Undo search highlighting. the N-th previous file is examined. If highlighting is already off because of a previous ESC-u command.) :e [filename] Examine a new file. Any search command will also turn highlighting back on. ESC-?pattern Same as "?∗". but in the reverse direction. :n :p Examine the next file (from the list of files given in the command line). If the filename consists of several files. Repeat previous search. Strictly confidential and proprietary LESS (1) ˆF | @ Begin the search at the last line of the last file in the command line list. two consecutive pound signs are replaced with a single pound sign. However. On such systems. If the filename is missing. If the previous search was modified by ˆE.

but takes a long option name rather than a single option letter. − Followed by one of the command line option letters (see OPTIONS below). A ˆP immediately after the second dash suppresses printing of a message describing the new setting. including its name and the line number and byte offset of the bottom line being displayed. or a string value (such as -P or -t). You must press RETURN after typing the option name. V Prints the version number of less being run. q | Q | :q | :Q | ZZ Exits less. Examine the first file in the command line list. Remove the current file from the list of files. Like the −! command. v Invokes an editor to edit the current file being viewed. (The "−+X" command does the same thing as "−+X" on the command line. Inc. Go to the next tag. but takes a long option name (see OPTIONS below) rather than a single option letter. if there were more than one matches for the current tag. This does not work for numeric or string-valued options. If a ˆP (CONTROL-P) is entered immediately after the dash. if defined. BSD January 17. but takes a long option name rather than a single option letter. Strictly confidential and proprietary LESS (1) :t :x :d t T Go to the specified tag. a message describing the current setting is printed and nothing is changed. this will reset the option to the "opposite" of its default setting and print a message describing the new setting. If a number N is specified. See also the discussion of LESSEDIT under the section on PROMPTS below. as in the − command. (Double underscore. −− −+ −−+ −! −−! _ __ +cmd Causes the specified cmd to be executed each time a new file is examined. if there were more than one matches for the current tag.) Followed by one of the command line option letters. Go to the previous tag. or EDITOR if VISUAL is not defined. The setting of the option is not changed. 2003 5 . See the −t option for more details about tags. Like the − command. it also prints the length of the file. the number of lines in the file and the percent of the file above the last displayed line. = | ˆG | :f Prints some information about the file being viewed. The following four commands may or may not be valid. or defaults to "vi" if neither VISUAL nor EDITOR is defined. For example. You must press RETURN after typing the option name. If no new value is entered. (Underscore.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. but takes a long option name rather than a single option letter. +G causes less to initially display each file starting at the end rather than the beginning. a new value may be entered after the option letter. this will print a message describing the current setting of that option. Like the −+ command.) This does not work for string-valued options. the N-th file in the list is examined.) Like the _ (underscore) command. this will change the setting of that option and print a message describing the new setting. Followed by one of the command line option letters. If possible. The editor is taken from the environment variable VISUAL. the setting of the option is changed but no message is printed. Followed by one of the command line option letters this will reset the option to its default setting and print a message describing the new setting. depending on your particular installation. If the option letter has a numeric value (such as -b or -h).

For example. For options like -P which take a following string. a dollar sign ($) must be used to signal the end of the string. This only works if the input is a pipe. (Depending on how your shell interprets the question mark. The shell is taken from the environment variable SHELL. Most options may be given in one of two forms: either a dash followed by a single letter. The section of the file to be piped is between the first line on the current screen and the position marked by the letter. Inc. Some long option names are in uppercase. export LESS The environment variable is parsed before the command line. to avoid typing "less -options . For example. to separate a prompt value from any other options with dollar sign between them: LESS="-Ps--More--$-C -e" −? | −-help This option displays a summary of the commands accepted by less (the same as the h command). such as --QUIT-AT-EOF.. in units of kilobytes (1024 bytes). see the -B option). Such option names need only have their first letter capitalized. so command line options override the LESS environment variable. For example. or two dashes followed by a long option name. "!" with no shell command simply invokes a shell. Pipes a section of the input file to the given shell command. or from the environment variable MORE if the command is more. it may be necessary to quote the question mark. or newline. For example. A percent sign (%) in the command is replaced by the name of the current file. By default. OPTIONS Command line options are described below. or defaults to "sh". <m> may also be ˆ or $ to indicate beginning or end of file respectively.) −a | −-search-skip-screen Causes searches to start after the last line displayed on the screen. but not --qui. 2003 6 ." each time less is invoked. Most options may be changed while less is running. since both --quit-at-eof and --quiet begin with --qui. thus skipping all lines displayed on the screen. --Quit-at-eof is equivalent to --QUIT-AT-EOF. --quit-at-eof may be abbreviated --quit. see the -j option). A pound sign (#) is replaced by the name of the previously examined file. Strictly confidential and proprietary LESS (1) ! shell-command Invokes a shell to run the shell-command given. thus: "-\?". the remainder of the name may be in either case. −bn | −-buffers=n Specifies the amount of buffer space less will use for each file. The BSD January 17.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. it can be reset to its default value on the command line by beginning the command line option with "−+". Options are also taken from the environment variable LESS if the command is less. s filename Save the input to a file. the current screen is piped. you might tell csh(1): setenv LESS -options or if you use sh(1): LESS="-options". If an option appears in the LESS variable. via the "−" command. as distinct from --quit-at-eof. If <m> is . not an ordinary file. searches start at the second line on the screen (or after the last found line. A long option name may be abbreviated as long as the abbreviation is unambiguous. | <m> shell-command <m> represents any mark letter. "!!" repeats the last shell command. By default 64K of buffer space is used for each file (unless the file is a pipe..

any earlier data is lost.) BSD January 17. full screen repaints are done by scrolling from the bottom of the screen. Warning: use of -B can result in erroneous display.) Also suppresses the warning message when a binary file is opened. lacks some important capability. This option is useful in environments where users may not be experienced with pagers. the only way to exit less is via the "q" command. when data is read from a pipe. −hn | −-max-back-scroll=n Specifies a maximum number of lines to scroll backward. −c | −-clear-screen Causes full screen repaints to be painted from the top line down. −d (more only) The -d option causes the default prompt to include the basic directions ‘‘[Press space to continue. Strictly confidential and proprietary LESS (1) -b option specifies instead that n kilobytes of buffer space should be used for each file. The -g option changes this behavior to highlight only the particular string which was found by the last search command. This can cause less to run somewhat faster than the default. −G | −-HILITE-SEARCH The -G option suppresses all highlighting of strings found by search commands. The -B option disables this automatic allocation of buffers for pipes. but the screen is cleared before it is repainted. −E | −-QUIT-AT-EOF Causes less to automatically exit the first time it reaches end-of-file. −F | −-quit-if-one-screen Causes less to automatically exit if the entire file can be displayed on the first screen. By default. −C | −-CLEAR-SCREEN The -C option is like -c. If n is -1. If a large amount of data is read from the pipe. buffer space is unlimited. This option is on by default when invoked as more. -h0 is implied. The -d option also causes the message ‘‘[Press ’h’ for instructions. −g | −-hilite-search Normally. −B | −-auto-buffers By default. such as the ability to clear the screen or scroll backward. −d | −-dumb (less only) The -d option suppresses the error message normally displayed if the terminal is dumb.]’’ to be displayed when an invalid command is entered (normally. that is. the screen is repainted in a forward direction instead. since only the most recently viewed part of the file is kept in memory. If it is necessary to scroll backward more than n lines. (A non-regular file is a directory or a device special file. (If the terminal does not have the ability to scroll backward. The -d option does not otherwise change the behavior of less on a dumb terminal. Inc. By default. 2003 7 . that is. the bell is rung). By default. less will refuse to open non-regular files. this can cause a large amount of memory to be allocated. the entire file is read into memory. ’q’ to quit. less will highlight ALL strings which match the last search command. −e | −-quit-at-eof Causes less to automatically exit the second time it reaches end-of-file. so that only 64K (or the amount of space specified by the -b option) is used for the pipe.]’’. −f | −-force Forces non-regular files to be opened.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. buffers are allocated automatically as needed.

in other words. uppercase and lowercase are considered identical. −n | −-line-numbers Suppresses line numbers. −N | −-LINE-NUMBERS Causes a line number to be displayed at the beginning of each line in the display. This applies only when the input file is a pipe. For example. BSD January 17. −L | −-no-lessopen Ignore the LESSOPEN environment variable (see the INPUT PREPROCESSOR section below). −jn | −-jump-target=n Specifies a line on the screen where the "target" line is to be positioned. The status column shows the lines that matched the current search. This option can be set from within less. and so on. −m | −-long-prompt Causes less to prompt verbosely (like more). but it will overwrite an existing file without asking for confirmation. tag search. less will ask for confirmation before overwriting it.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. Multiple -k options may be specified. If the -j option is used. Inc. −ofilename | −-log-file=filename Causes less to copy its input to the named file as it is being viewed. −M | −-LONG-PROMPT Causes less to prompt even more verbosely than more. searches begin at the line immediately after the target line. 2003 8 . −Ofilename | −-LOG-FILE=filename The -O option is like -o. −kfilename | −-lesskey-file=filename Causes less to open and interpret the named file as a lesskey(1) file. not an ordinary file. but searches ignore case even if the pattern contains uppercase letters. and so on. and the v command will pass the current line number to the editor (see also the discussion of LESSEDIT in PROMPTS below). jump to a file percentage. jump to a line number. Strictly confidential and proprietary LESS (1) −i | −-ignore-case Causes searches to ignore case. Suppressing line numbers with the -n option will avoid this problem. so searches begin at the fifth line on the screen. Using line numbers means: the line number will be displayed in the verbose prompt and in the = command. it is also used as a lesskey file. then that search does not ignore case. less prompts with a colon. −J | −-status-column Displays a status column at the left edge of the screen. if "-j4" is used. The default (to use line numbers) may cause less to run more slowly in some cases. If the file already exists. This option is ignored if any uppercase letters appear in the search pattern. the next is 2. A target line is the object of a text search. −I | −-IGNORE-CASE Like -i. with the percent into the file. The status column is also used if the -w or -W option is in effect. the LESSOPEN environment variable is ignored by default. If the LESSKEY or LESSKEY_SYSTEM environment variable is set. the second to the bottom is -2. that is. if a pattern contains uppercase letters. When invoked as more. but it will apply only to files opened subsequently. or if a lesskey file is found in a standard place (see KEY BINDINGS). especially with a very large input file. The screen line is specified by a number: the top line on the screen is 1. or jump to a marked position. By default. not to the file which is currently open. The number may be negative to specify a line relative to the bottom of the screen: the bottom line on the screen is -1. the target line is the fourth line on the screen.

" is zero or more characters other than "m". which are sequences of the form: ESC [ . but tries to keep track of the screen appearance where possible. The default is to ring the terminal bell in all such cases. See the section on PROMPTS for more details. BSD January 17. the portion of a long line that does not fit in the screen width is not shown. Inc. -P= changes the message printed by the = command. rather than being typed in with each less command.. This option would normally be put in the LESS environment variable. -PM changes the long (-M) prompt. Thus. or be terminated by a dollar sign. they will simply report the name of the log file. m where the ". the -o and -O options can be used from within less to specify a log file. it tells less to start at the first occurrence of pattern in the file. for example. Strictly confidential and proprietary LESS (1) If no log file has been specified. −Pprompt | −-prompt=prompt Provides a way to tailor the three prompt styles to your own preference. Warning: when the -r option is used.. −r | −-raw-control-chars Causes "raw" control characters to be displayed. such as long lines being split in the wrong place. such as typing an invalid character. The bell will be rung on certain other errors. Without a file name. This works only if the input consists of normal text and possibly some ANSI "color" escape sequences. −R | −-RAW-CONTROL-CHARS Like -r. −Q | −-QUIET | −-SILENT Causes totally "quiet" operation: the terminal bell is never rung. -Ph changes the prompt for the help screen.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. −ppattern | −-pattern=pattern The -p option on the command line is equivalent to specifying +/pattern. −q | −-quiet | −-silent Causes moderately "quiet" operation: the terminal bell is not rung if an attempt is made to scroll past the end of the file or before the beginning of the file. −S | −-chop-long-lines Causes lines longer than the screen width to be chopped rather than folded. -Pm changes the medium (-m) prompt. Such an option must either be the last option in the LESS variable. -Pw changes the message printed while waiting for data (in the F command). All prompt strings consist of a sequence of letters and special escape sequences. various display problems may result. display the remainder on the next line. The default is to fold long lines.. You can make less think that characters other than "m" can end ANSI color escape sequences by setting the environment variable LESSANSIENDCHARS to the list of characters which can end a color escape sequence. If the terminal has a "visual bell". −s | −-squeeze-blank-lines Causes consecutive blank lines to be squeezed into a single blank line. 2003 9 . that is. The "s" command is equivalent to specifying -o from within less. That is. This is useful when viewing nroff(1) output. a control-A (octal 001) is displayed as "ˆA".. that is. The default is to display control characters using the caret notation. -Ps followed by a string changes the default (short) prompt to that string. For the purpose of keeping track of screen appearance. it is used instead. less cannot keep track of the actual appearance of the screen (since this depends on how the screen responds to each type of control character). all control characters and all ANSI color escape sequences are assumed to not move the cursor.

2003 10 .17 will set tabs at positions 9. along with the preceding character.. The command ":t" is equivalent to specifying -t from within less. −W | −-HILITE-UNREAD Like -w. 33. will edit the file containing that tag. -x9. For this to work. −-no-keypad Disables sending the keypad initialization and deinitialization strings to the terminal. etc. Other backspaces are deleted. followed immediately by a TAG. tab stops are set at multiples of n. Carriage returns immediately followed by a newline are deleted. The highlight is removed at the next command which causes movement. Also. and then continue with the same spacing as the last two. 17. BSD January 17. that is. If the environment variable LESSGLOBALTAGS is set. (See http://www.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. −w | −-hilite-unread Temporarily highlights the first "new" line after a forward movement of a full page. for example. Sets tab stops. Strictly confidential and proprietary LESS (1) −ttag | −-tag=tag The -t option. backspaces which appear adjacent to an underscore character are treated specially: the underlined text is displayed using the terminal’s hardware underlining capability. which was previously built by ctags(1) or an equivalent command. Text which is overstruck or underlined can be searched for if neither -u nor -U is in effect. Also highlights the target line after a g or p command. unless the -J option is in effect. This is sometimes desirable if the deinitialization string does something unnecessary. tab stops are set at those positions. 25. The entire line is highlighted. and that command is executed to find the tag. Other carriage returns are handled as specified by the -r option. that is. −Ttagsfile | −-tag-file=tagsfile Specifies a tags file to be used instead of "tags".. in which case only the status column is highlighted. The default for n is 8.. By default.. | −-tabs=n. there may be a file in the current directory called "tags". For example. it is taken to be the name of a command compatible with global. tag information must be available. −u | −-underline-special Causes backspaces and carriage returns to be treated as printable characters. like clearing the screen. If multiple values separated by commas are specified. −U | −-UNDERLINE-SPECIAL Causes backspaces. if neither -u nor -U is given. backspaces which appear between two identical characters are treated specially: the overstruck text is printed using the terminal’s hardware boldface capability. If only one n is specified. This is sometimes useful if the keypad strings make the numeric keypad behave in an undesirable manner. The first "new" line is the line immediately following the line previously at the bottom of the screen.. −X | −-no-init Disables sending the termcap initialization and deinitialization strings to the terminal. tabs and carriage returns to be treated as control characters. −xn. but temporarily highlights the first new line after any forward movement command larger than one line. −V | −-version Displays the version number of less. they are sent to the terminal when they appear in the input. The -t option may also be specified from within less (using the − command) as a way of examining a new file. Inc.html).org/software/global/global.gnu. they are handled as specified by the -r option..

-cc | −-quotes=cc Changes the filename quoting character. 2003 11 . The default is one screenful. +<number> acts like +<number>g. Filenames containing a space should then be surrounded by that character rather than by double quotes. certain keys can be used to manipulate the command line.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. If the option starts with ++. If the number n is negative. not just the first one. BSD January 17. and +/xyz tells it to start at the first occurrence of "xyz" in the file. −# | −-shift Specifies the default number of positions to scroll horizontally in the RIGHTARROW and LEFTARROW commands. −˜ | −-tilde Normally lines after end of file are displayed as a single tilde (˜). If the screen is resized to 40 lines. Filenames containing a space should then be preceded by the open quote character and followed by the close quote character. As a special case. it starts the display at the specified line number (however. For example. that is. see the caveat under the "g" command above). +G tells less to start at the end of the file rather than the beginning. the initial command applies to every file being viewed. a filename for the :e command. This option causes lines after end of file to be displayed as blank lines. the remainder of that option is taken to be an initial command to less. If it is necessary to scroll forward more than n lines. For example. This may be necessary if you are trying to name a file which contains both spaces and quote characters. Any arguments following this are interpreted as filenames. or the pattern for a search command). RIGHTARROW [ESC-l] Move the cursor one space to the right. If a command line option begins with +. The -c or -C option may be used to repaint from the top of the screen if desired. Strictly confidential and proprietary LESS (1) −yn | −-max-forw-scroll=n Specifies a maximum number of lines to scroll forward. −− A command line argument of "--" marks the end of option arguments. this changes the quote character to that character. Any of these special keys may be entered literally by preceding it with the "literal" character. LEFTARROW [ESC-h] Move the cursor one space to the left. By default. Most commands have an alternate form in [ brackets ] which can be used if a key does not exist on a particular keyboard. −[z]n | −-window=n Changes the default scrolling window size to n lines. the scrolling window automatically changes to 36 lines. Inc. it sets the default number of positions to one half of the screen width. + LINE EDITING When entering command line at the bottom of the screen (for example. Followed by two characters. This can be useful when viewing a file whose name begins with a "-" or "+". The z and w commands can also be used to change the window size. Followed by a single character. the screen is repainted instead. changes the open quote to the first character. If the number specified is zero. and the close quote to the second character. The + command described previously may also be used to set (or change) an initial command for every file. A backslash itself may also be entered literally by entering two backslashes. this option remains -" (a dash followed by a double quote). either ˆV or ˆA. it indicates n lines less than the current screen size. any forward movement causes scrolling. if the screen is 24 lines. Note that even after the quote characters are changed. -z-4 sets the scrolling window to 20 lines. The "z" may be omitted for compatibility with more.

If a key is defined in both a local lesskey file and in the system-wide file. less uses that as the name of the system-wide lesskey file. BACKSPACE Delete the character to the left of the cursor. END [ESC-$] Move the cursor to the end of the line. or cancel the command if the command line is empty. all matches are entered into the command line (if they fit). Repeated TABs will cycle through the other matching filenames. You may also use lesskey to change the line-editing keys (see LINE EDITING). If it matches more than one filename. key bindings in the local file take precedence over those in the system-wide file. TAB Complete the partial filename to the left of the cursor. ˆBACKSPACE [ESC-BACKSPACE] (That is. ˆRIGHTARROW [ESC-w or ESC-RIGHTARROW] (That is. ˆDELETE [ESC-X or ESC-DELETE] (That is. UPARROW [ESC-k] Retrieve the previous command line. Delete the entire command line. or cancel the command if the command line is empty. the system-wide lesskey file is /etc/sysless. CONTROL and BACKSPACE simultaneously. Inc. If the completed filename is a directory. BACKTAB [ESC-TAB] Like TAB. less looks in a standard place for the system-wide lesskey file: On OpenBSD. Otherwise. that character is used instead of ˆU. BSD January 17. DOWNARROW [ESC-j] Retrieve the next command line. CONTROL and LEFTARROW simultaneously. If the environment variable LESSKEY is set. 2003 12 .) Move the cursor one word to the right.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. If it matches more than one filename. KEY BINDINGS You may define your own less commands by using the program lesskey(1) to create a lesskey file.) Move the cursor one word to the left. If you have changed your line-kill character to something other than ˆU.less". Otherwise. DELETE or [ESC-x] Delete the character under the cursor. HOME [ESC-0] Move the cursor to the beginning of the line. If the environment variable LESSKEY_SYSTEM is set. This file specifies a set of command keys and an action associated with each key. Strictly confidential and proprietary LESS (1) ˆLEFTARROW [ESC-b or ESC-LEFTARROW] (That is. and to set environment variables. the first match is entered into the command line. CONTROL and RIGHTARROW simultaneously. CONTROL and DELETE simultaneously. A system-wide lesskey file may also be set up to provide key bindings. See the lesskey(1) manual page for more details. but cycles in the reverse direction through the matching filenames. a "/" is appended to the filename. less looks for a lesskey file called "$HOME/. The environment variable LESSSEPARATOR can be used to specify a different character to append to a directory name.) Delete the word under the cursor. less uses that as the name of the lesskey file.) Delete the word to the left of the cursor. ˆL ˆU Complete the partial filename to the left of the cursor.

It should create the replacement file.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. It may include two occurrences of the string "%s". If the input pipe does not write any characters on its standard output. it will appear to the user as if the original file is opened. make the first character in the LESSOPEN environment variable a vertical bar (|) to signify that the input preprocessor is an input pipe. put them both where they can be executed and set LESSOPEN="lessopen.$$ else rm -f /tmp/less. the first is replaced with the original name of the file and the second with the name of the replacement file. For example. less uses the original file. To use an input pipe.Z) uncompress -c $1 >/tmp/less. and LESSCLOSE="lessclose. which writes the contents of the file to a different file. and so on. it will call another program.$$ fi . 2>/dev/null BSD January 17. as normal. instead of writing the name of a replacement file on its standard output. An input pipe. less will display the original filename as the name of the current file. 2003 13 . This avoids the need to decompress the entire file before starting to view it. the original filename as entered by the user.sh %s". Inc. which will be replaced by the filename when the input preprocessor command is invoked. To set up an input postprocessor.sh %s %s". called the replacement file. Before less opens a file. called the input postprocessor. then there is no replacement file and less uses the original file. and the name of the replacement file. then echo /tmp/less. as entered by the user. An input preprocessor that works this way is called an input pipe. that is. When less closes a file opened in such a way. Strictly confidential and proprietary LESS (1) INPUT PREPROCESSOR You may define an "input preprocessor" for less. which may perform any desired clean-up action (such as deleting the replacement file created by LESSOPEN). it first gives your input preprocessor a chance to modify the way the contents of the file are displayed. and when finished print the name of the replacement file to its standard output. rather than putting the data into a replacement file. set the LESSOPEN environment variable to a command line which will invoke your input preprocessor.. An input preprocessor is simply an executable program (or shell script).$$ ]. An input preprocessor receives one command line argument. However.$$ if [ -s /tmp/less. these two scripts will allow you to keep files in compressed format. but still let less view them directly: lessopen. set the LESSCLOSE environment variable to a command line which will invoke your input postprocessor. If the input preprocessor does not output a replacement filename. esac lessclose. This command line should include one occurrence of the string "%s". To set up an input preprocessor.sh: #! /bin/sh rm $2 To use these scripts. This program receives two command line arguments. More complex LESSOPEN and LESSCLOSE scripts may be written to accept other types of compressed files. The input preprocessor is not called when viewing standard input. writes the entire contents of the replacement file on its standard output.sh: #! /bin/sh case "$1" in ∗. which was output by LESSOPEN. It is also possible to set up an input preprocessor to pipe the file data directly to less. The contents of the replacement file are then displayed in place of the contents of the original file. as normal. the original filename.

In this case. and all others are binary. A "character set" is simply a description of which characters are to be considered normal. The LESSCHARSET environment variable may be used to select a character set. so characters 9 through 255 would be normal. CR. Selects an ISO 8859 character set. and does not necessarily represent any real character set. 1. Selects an EBCDIC character set. A decimal number may be used for repetition. Strictly confidential and proprietary LESS (1) For example. All characters after the last are taken to be the same as the last. except characters between 160 and 255 are treated as normal characters. but are expected to be found in ordinary text files (such as backspace and tab)." is used for a normal character. and "b" for binary. this script will work like the previous example scripts: lesspipe." would mean character 0 is binary. 4. Same as iso8859. Should not be displayed directly and are not expected to be found in text files. Inc. and binary. In this case. When an input pipe is used. (This is an example. it may be desired to tailor less to use a character set other than the ones definable by LESSCHARSET.sh %s". Should not be displayed directly. Selects a Russian character set. "c" for control. and 8 is normal.. esac 2>/dev/null To use this script.) BSD January 17. Selects an EBCDIC character set used by OS/390 Unix Services. NL.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. Selects the UTF-8 encoding of the ISO 10646 character set. Selects a character set appropriate for NeXT computers. control. TAB. the replacement file name passed to the LESSCLOSE postprocessor is "-". koi8-r next utf-8 In special cases. 2 and 3 are control. the environment variable LESSCHARDEF can be used to define a character set. Possible values for LESSCHARSET are: ascii iso8859 latin1 latin9 dos ebcdic IBM-1047 BS.Z) uncompress -c $1 . This is the EBCDIC analogue of latin1. 5. The character ".sh: #! /bin/sh case "$1" in ∗. Same as iso8859. 2003 14 . Selects a character set appropriate for MS-DOS. all chars with values between 32 and 126 are normal. and formfeed are control characters. "bccc4b. but it is usually not necessary since there is no replacement file to clean up. NATIONAL CHARACTER SETS There are three types of characters in the input file: normal characters control characters binary characters Can be displayed directly to the screen. put it where it can be executed and set LESSOPEN="|lesspipe. For example. This is the same as ASCII. You get similar results by setting either LESSCHARSET=IBM-1047 or LC_CTYPE=en_US in your environment. a LESSCLOSE postprocessor can be used. 6 and 7 are binary. It should be set to a string where each character in the string represents one character in the character set.

Caret notation is used only if inverting the 0100 bit results in a normal printable character.bb125.33b. "∗s" is standout. 8bcccbcc18b95. the byte offset of the top line in the display is used. 5bc6bcc7bcc41b. 2003 15 .8b8.b 8bcccbcc12bc5b95. Replaced by the size of the current input file. as with the %b option. normal attribute is assumed. Replaced by the page number of a line in the input file. PROMPTS The -P option allows you to tailor the prompt to your preference.3b9.b. 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc 191. The prompt mechanism is rather complicated to provide flexibility.g. X. A percent sign followed by a single character is expanded according to what the following character is: %bX Replaced by the byte offset into the current input file. a "B" means use the line just after the bottom line. The string given to the -P option replaces the specified prompt string. but your system supports the setlocale interface. LESSBINFMT may begin with a "∗" and one character to select the display attribute: "∗k" is blinking.33b.b. The line to be used is determined by the X. Finally. The default if no LESSBINFMT is specified is "∗s<%X>". setlocale is controlled by setting the LANG or LC_CTYPE environment variables.9b7.6b10. and "∗n" is normal.b.b.). Otherwise. binary characters are displayed in underlined hexadecimal surrounded by brackets. Control and binary characters are displayed in standout (reverse video).b128. then the default character set is utf-8. o. 8bcccbcc18b95. ˆA for control-A). and a "j" means use the "target" line.17b3. "∗d" is bold.8b6. The remainder of LESSBINFMT is a string which may include one printf-style escape sequence (a % followed by x. Replaced by the column number of the text appearing in the first column of the screen. If LESSBINFMT does not begin with a "∗". but the string "UTF-8" is found in the LC_ALL.9b5. a "b" means use the bottom line. if the setlocale interface is also not available. Certain characters in the string are interpreted specially.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. The b is followed by a single character (shown as X above) which specifies the line whose byte offset is to be used. Each such character is displayed in caret notation if possible (e. LC_TYPE or LANG environment variables. %B %c %dX %D BSD January 17. if LESSBINFMT is "∗u[%x]". etc. the default character set is latin1. d. the character is displayed as a hex number in angle brackets. This format can be changed by setting the LESSBINFMT environment variable. If the character is a "t".b. less will use setlocale to determine the character set. Replaced by the number of pages in the input file. 8bcccbcc18b95.10b6.bb If neither LESSCHARSET nor LESSCHARDEF is set. For example. If that string is not found. as specified by the -j option. but the ordinary user need not understand the details of constructing personalized prompt strings.b9. Inc. or equivalently. Strictly confidential and proprietary LESS (1) This table shows the value of LESSCHARDEF which is equivalent to each of the possible values for LESSCHARSET: ascii dos ebcdic IBM-1047 iso8859 koi8-r latin1 next 8bcccbcc18b95.b 8bcccbcc18b95.8b8. "∗u" is underlined.7b 9.7b9. the page number of the last line in the input file. an "m" means use the middle line..

Same as %B. Replaced by the total number of input files. If any item is unknown (for example. True if there is more than one input file. The format of the prompt string can be changed depending on certain conditions. True if the text is horizontally shifted (%c is not zero). any characters following the question mark and condition character. a condition is evaluated. based on byte offsets. based on byte offsets. as with the %b option. such characters are not included. or the EDITOR environment variable if VISUAL is not defined). True if the percent into the current input file. True if the line number of the specified line is known. True if this is the first prompt in a new input file. 2003 16 . Replaced by the name of the current input file. A question mark followed by a single character acts like an "IF": depending on the following character. of the specified line is known.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. Condition characters (which follow a question mark) may be: ?a ?bX ?B ?c ?dX ?e ?f ?lX ?L ?m ?n ?pX ?PX True if any characters have been included in the prompt so far. See the discussion of the LESSEDIT feature below. as with the %b option. if and only if the IF condition is false. Replaced by the percent into the current input file. True if the line number of the last line in the file is known. Replaced by the index of the current file in the list of input files. up to a period. If the condition is true. are included in the prompt. Replaced by the percent into the current input file. True if there is an input filename (that is. based on line numbers. The line used is determined by the X. The line used is determined by the X. True if the percent into the current input file. Strictly confidential and proprietary LESS (1) %E %f %i %lX %L %m %pX %PX %s %t %x Replaced by the name of the editor (from the VISUAL environment variable. but may appear anywhere. Inc. If the condition is false. True if the size of the current input file is known. based on line numbers. Replaced by the name of the next input file in the list. True if at end-of-file. The line to be used is determined by the X. the file size if input is a pipe). as with the %b option. Usually used at the end of the string. Causes any trailing spaces to be removed. Replaced by the line number of the last line in the input file. True if the page number of the specified line is known. of the specified line is known. True if the byte offset of the specified line is known. BSD January 17. a question mark is printed instead. A colon appearing between the question mark and the period can be used to establish an "ELSE": any characters between the colon and the period are included in the string. Replaced by the line number of a line in the input file. if input is not a pipe).

byte %bB?s/%s. the LESSEDIT variable can be changed to modify this default. : byte %bB?s/%s. followed by the file name.%t The prompt expansion features are also used for another purpose: if an environment variable LESSEDIT is defined. ?f%f . and backslash) become literally part of the prompt. otherwise the string "Standard input"..Next\: %x.%t ?f%f . if known.?ltlines %lt-%lb?L/%L. a dash is printed. %f Note that this expands to the editor name. 2003 17 . BSD January 17. ?e(END) :?pB%pB\%.LESS (1) PropertyGeneral Commands Manual System of BladeLogic.. followed by a + and the line number. period.. This prompt would print the filename.?e(END) ?x. The filename is followed by the line number... if known.%t And here is the default message produced by the = command: ?f%f .. Finally. The default value for LESSEDIT is: %E ?lm+%lm. any trailing spaces are truncated. Inc. otherwise the byte offset if known. Any of the special characters may be included in the prompt literally by preceding it with a backslash. if the current input file is not the last one). . ?n?f%f . Strictly confidential and proprietary LESS (1) ?s ?x Same as "?B". SECURITY When the environment variable LESSSECURE is set to 1.. followed by the "file N of N" message if there is more than one input file.%t This prints the filename if this is the first prompt in a file. The pipe command. .?m(file %i of %m) . Any characters other than the special ones (question mark. if we are at end-of-file. Each is broken into two lines here for readability only.: ?pB%pB\%:byte %bB?s/%s.?m(file %i of %m) . True if there is a next input file (that is. if there is one. it is used as the command to be executed when the v command is invoked. This is the default prompt. less runs in a "secure" mode.?e(END) ?x. Then.?n?m(file %i of %m) . Some examples: ?f%f:Standard input. The LESSEDIT string is expanded in the same way as the prompt strings.?e(END) ?x.. the string "(END)" is printed followed by the name of the next file. ?n?f%f . For reference. here are the defaults for the other two prompts (-m and -M respectively). This prompt prints the filename.?m(file %i of %m) . Notice how each question mark has a matching period.?ltlines %lt-%lb?L/%L.Next\: %x.Next\: %x. otherwise the percent if known. If your editor does not accept the "+linenumber" syntax. or has other differences in invocation syntax. This means these features are disabled: ! | The shell command. Otherwise. colon. percent...?ltLine %lt:?pt%pt\%:?btByte %bt:-. and how the % after the %pt is included literally by escaping it with a backslash.:?pB%pB\%. if known.

Language for determining the character set. See discussion under PROMPTS. or in a lesskey(1) file. Log files. LESS Options which are passed to less automatically. LESSANSIENDCHARS Characters which are assumed to end an ANSI color escape sequence (default "m"). variables defined in a local lesskey file take precedence over variables defined in the system environment. LESSCHARSET Selects a predefined character set. COLUMNS Sets the number of columns on the screen.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. such as "∗". the window system’s idea of the screen size takes precedence over the LINES and COLUMNS environment variables. 2003 18 . LESSCHARDEF Defines a character set. Filename completion (TAB. Normally should be set to "global" if your system has the global command. LESSCLOSE Command line to invoke the (optional) input-postprocessor. Inc. which take precedence over variables defined in the system-wide lesskey file. If not set. LESSBINFMT Format for displaying non-printable. Use of tags files. Metacharacters in filenames. HOME LANG Name of the user’s home directory (used to find a lesskey file). (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD. The editing command. BSD January 17. Use of lesskey files. LESSGLOBALTAGS Name of the command used by the -t option to find global tags. If environment variables are defined in more than one place. Strictly confidential and proprietary LESS (1) :e v s -o -k -t The examine command. LC_CTYPE Language for determining the character set. ENVIRONMENT Environment variables may be specified either in the system environment as usual. ˆL). non-control characters. LESSEDIT Editor prototype string (used for the v command).) EDITOR The name of the editor (used for the v command). Takes precedence over the number of columns specified by the TERM variable. Less can also be compiled to be permanently in "secure" mode. global tags are not used.

the new files may be entered into the list in an unexpected order. commands containing metacharacters will not be passed to the shell. TERM The type of terminal on which less is being run. LESSMETAESCAPE Prefix which less will add before each metacharacter in a command sent to the shell. LESSOPEN Command line to invoke the (optional) input-preprocessor. search highlighting will cause an erroneous display.greenwoodsoftware. On such terminals.org〉. CAVEATS The = command and prompts (unless changed by -P) report the line numbers of the lines at the top and bottom of the screen. see the less homepage at http://www. and one of the named files has been viewed previously. In certain cases. 2003 19 . SEE ALSO lesskey(1) AUTHORS Mark Nudelman 〈markn@greenwoodsoftware.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. On certain older terminals (the so-called "magic cookie" terminals). when search highlighting is enabled and a search pattern begins with a ˆ. For more information. LESSSECURE Runs less in "secure" mode. If LESSMETAESCAPE is an empty string.) SHELL The shell used to execute the ! command. VISUAL The name of the editor (used for the v command).) BSD January 17. Takes precedence over the number of lines specified by the TERM variable. LESSSEPARATOR String to be appended to a directory name in filename completion. LESSMETACHARS List of characters which are considered "metacharacters" by the shell. the window system’s idea of the screen size takes precedence over the LINES and COLUMNS environment variables. If the :e command is used to name more than one file. (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD. Inc.com/less. but the byte and percent of the line after the one at the bottom of the screen. search highlighting is disabled by default to avoid possible problems. (This problem does not occur when less is compiled to use the POSIX regular expression package. See discussion under SECURITY. LESSKEY_SYSTEM Name of the default system-wide lesskey(1) file. Strictly confidential and proprietary LESS (1) LESSKEY Name of the default lesskey(1) file.com〉 Send bug reports or comments to the above address or to 〈bug−less@gnu. LINES Sets the number of lines on the screen. more text than the matching string may be highlighted. as well as to expand filenames.

Inc. On some systems. search highlighting may change the color of some of the text which follows the highlighted text.greenwoodsoftware. See http://www. BSD January 17. 2003 20 . set the environment variable LESSCHARSET to "ascii" (or whatever character set is appropriate). Strictly confidential and proprietary LESS (1) When viewing text containing ANSI color escape sequences using the -R option.com/less for the latest list of known bugs in this version of less. setlocale claims that ASCII characters 0 through 31 are control characters rather than binary characters. searching will not find text containing an embedded escape sequence. This causes less to treat some binary files as ordinary.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. Also. To workaround this problem. non-binary files.

less is used. If a key is defined in both a local lesskey file and in the system-wide file. The input file consists of one or more sections. The characters in the string may appear literally. The string may be a single command key. lesskey will overwrite it. Otherwise.LESSKEY(1) LESSKEY(1) NAME lesskey − specify key bindings for less SYNOPSIS lesskey [ o output | −− output = output ] [ input ] lesskey -V | --version DESCRIPTION lesskey is used to specify a set of key bindings to be used by less(1). by default $HOME/. The action is the name of the less action. A backslash followed by one to three octal digits may be used to specify a character by its octal value. the value of LESSKEY is used as the name of the output file. and the environment variable LESSKEY is set. #line-edit Defines new line-editing keys. Otherwise. The output file is a binary file which is used by less(1). #env Defines environment variables. If the environment variable LESSKEY_SYSTEM is set. a standard filename is used as the name of the output file. Blank lines and lines which start with a pound sign (#) are ignored. The string is the command key(s) which invoke the action. COMMAND SECTION The command section begins with the line #command If the command section is the first section in the file. or a sequence of up to 15 keys. less(1) looks in a standard place for the system-wide lesskey file: On NSH the system-wide lesskey file is /etc/sysless . The command section consists of lines of the form: string <whitespace> action [extra-string] <newline> Whitespace is any sequence of one or more spaces and/or tabs. from the list below. except for the special section header lines. A system-wide lesskey file may also be set up to provide key bindings. If −V or −−version is present. a standard filename is used as the name of the input file. or be prefixed by a caret to indicate a control key. Possible sections are: #command Defines new command keys. If the input file is ‘-’. If the output file already exists. If no output file is specified. standard input is read.lesskey . other options and arguments are ignored. The input file is a text file which describes the key bindings. Each section starts with a line that identifies the type of section. If no input file is specified. this line may be omitted. less(1) uses that as the name of the system-wide lesskey file. The −V or −−version option causes lesskey to print its version number and immediately exit. by default $HOME/. key bindings in the local file take precedence over those in the system-wide file. A backslash followed by certain characters specifies input characters as follows: \b \e \n \r \t \ku \kd \kr BACKSPACE ESCAPE NEWLINE RETURN TAB UP ARROW DOWN ARROW RIGHT ARROW NSH 1 .

An action may be followed by an "extra" string. see the ‘{’ and ‘:t’ commands in the example below. This feature can be used in certain cases to extend the functionality of a command.LESSKEY(1) \kl \kU \kD \kh \ke \kx LEFT ARROW PAGE UP PAGE DOWN HOME END DELETE LESSKEY(1) A backslash followed by any other character indicates that character is to be taken literally. The extra string has a special meaning for the "quit" action: when less quits. the action is performed. just as if it were typed in to less. For example. space. Characters which must be preceded by backslash include caret. tab and the backslash itself. and then the extra string is parsed. The following input file describes the set of default command keys used by less: #command \r forw-line \n forw-line e forw-line j forw-line \kd forw-line ˆE forw-line ˆN forw-line k back-line y back-line ˆY back-line ˆK back-line ˆP back-line J forw-line-force K back-line-force Y back-line-force d forw-scroll ˆD forw-scroll u back-scroll ˆU back-scroll \40 forw-screen f forw-screen ˆF forw-screen ˆV forw-screen \kD forw-screen b back-screen ˆB back-screen \ev back-screen \kU back-screen z forw-window w back-window \e\40 forw-screen-force F forw-forever R repaint-flush r repaint ˆR repaint ˆL repaint \eu undo-hilite g goto-line NSH 2 . When such a command is entered while running less. first character of the extra string is used as its exit status.

LESSKEY(1) \kh < \e< p % \e[ \e] \e( \e) { } ( ) [ ] \eˆF \eˆB G \e> > \ke = ˆG :f / ? \e/ \e? n \en N \eN m ´ ˆXˆX E :e ˆXˆV :n :p t T :x :d :t s _ | v ! + H h goto-line goto-line goto-line percent percent left-scroll right-scroll left-scroll right-scroll forw-bracket {} back-bracket {} forw-bracket () back-bracket () forw-bracket [] back-bracket [] forw-bracket back-bracket goto-end goto-end goto-end goto-end status status status forw-search back-search forw-search * back-search * repeat-search repeat-search-all reverse-search reverse-search-all set-mark goto-mark goto-mark examine examine examine next-file prev-file next-tag prev-tag index-file remove-file toggle-option toggle-option t toggle-option o display-option pipe visual shell firstcmd help help LESSKEY(1) NSH 3 .

a key may be defined to do nothing by using the action "noaction". one per line as in the example below. In addition. ALL default commands may be disabled by adding this control line to the input file: #stop This will cause all default commands to be ignored. For example. LINE EDITING SECTION The line-editing section begins with the line: #line-edit This section specifies new key bindings for the line editing commands. The following input file describes the set of default line-editing keys used by less: #line-edit \t forw-complete \17 back-complete \e\t back-complete ˆL expand ˆV literal ˆA literal \el right \kr right \eh left \kl left \eb word-left \e\kl word-left \ew word-right \e\kr word-right NSH 4 . Be aware that #stop can be dangerous. "noaction" is similar to "invalid" but less will give an error beep for an "incalid" command. Since all default commands are disabled. A default command key may be disabled by including it in the input file with the action "invalid". in a manner similar to the way key bindings for ordinary commands are specified in the #command section. you must provide sufficient commands before the #stop line to enable all necessary actions. The line-editing section consists of a list of keys and actions. The #stop line should be the last line in that section of the file. but not for a "noaction" command. failure to provide a "quit" command can lead to frustration. Alternatively.LESSKEY(1) V 0 1 2 3 4 5 6 7 8 9 q Q :q :Q ZZ version digit digit digit digit digit digit digit digit digit digit quit quit quit quit quit LESSKEY(1) PRECEDENCE Commands specified by lesskey take precedence over the default commands.

variables defined in a local lesskey file take precedence over variables defined in the system environment. FILES $HOME/. Each line consists of an environment variable name.less Default lesskey file. If environment variables are defined in more than one place. an equals sign (‘=’) and the value to be assigned to the environment variable. NSH 5 .LESSKEY(1) \ei \ex \kx \eX \ekx \e\b \e0 \kh \e$ \ke \ek \ku \ej insert delete delete word-delete word-delete word-backspace home home end end up up down LESSKEY(1) ENVIRONMENT SECTION The environment variable section begins with the line #env Following this line is a list of environment variable assignments. $HOME/. Variables assigned in this way are visible only to less. in a keyboard-independent manner. and specifies the character set to be "latin1" : #env LESS = -i LESSCHARSET = latin1 ENVIRONMENT LESSKEY Name of the default lesskey file. The only way to specify such keys is to specify the escape sequence which a particular keyboard sends when such a key is pressed. /etc/sysless Default system-wide lesskey file. which take precedence over variables defined in the system-wide lesskey file. Although the lesskey file can be used to override variables set in the environment. The following input file sets the -i option whenever less is run. SEE ALSO less(1) CAVEATS It is not possible to specify special keys. such as uparrow. Whitespace before and after the equals sign is ignored. LESSKEY_SYSTEM Name of the default system-wide lesskey file.lesskey Default lesskey input file. the main purpose of assigning variables in the lesskey file is simply to have all less configuration information stored in one file.

CAVEATS Since link does not perform any error checking. change the ownership of the file to root and the mode to 500. We strongly suggest that you use the ln command instead of the link command. do not use it except in exceptional cases. Links to directories. since improper use may adversely affect the consistency of the file systems. link always exits with an exit code of 0.link(1) Property of BladeLogic. links to files on different partitions. SEE ALSO ln(1) ORIGIN link was written by Thomas Kraus NOTES On some systems. This is not the default for link. OPTIONS link has only one option. $ link foo bar $ link //reykjavik/u1/data/mydata //reykjavik/u1/data/yourdata DIAGNOSTICS Since link errors are ignored. only the super user can use the link command. Existing file to be linked. Errors of any kind in creating the link are silently ignored. Unable to get a license to use the software. -? file1 file2 Output a brief summary of available options and then exit with a zero status without linking any files. Inc. Normally. file2 must be on the same disk partition as file1. NSH 1 . Strictly confidential and proprietary link(1) NAME link − Create a link to a file SYNOPSIS link [-?] file1 file2 DESCRIPTION The link command creates a link from the existing file file1 to the file file2 which will be newly created. you should use the ln command instead. EXIT CODES 0 255 Besides license problems. Newly created link file. The link command creates file2 without doing any type of error checking. and links across hosts will not work. EXAMPLE The first example links the file foo to the file bar. there are no diagnostic messages to be output except for network and licensing messages. The second example creates a new file /u1/data/yourdata which is linked to the file /u1/data/mydata on the host reykjavik. If you want this behavior.

$ ln foo bar $ ln -s //belgrade/u1/file1 //belgrade/u1/file2 $ ls -li foo bar //belgrade/u1/file2 total 3 113380 -rw-r--r-. Create symbolic links instead of hard links.ln(1) Property of BladeLogic. You can create hard links only between files (not directories) residing on the same disk partition. It simply deletes the current version of the target file. links to the named (existing) files are made in the named directory. In the output of the ls command. Furthermore.. If you use the -f option with the -i option. You cannot create a symbolic link if the file (symbolic link to be created) already exists. With this option. ln creates either hard links (the default) or symbolic links. The advantage of symbolic links over hard links is that symbolic links can cross disk partitions. notice that both files have the same inode number and have two links to them (first and third column). You cannot create hard links or symbolic links between files on different hosts.] directory DESCRIPTION In the first case.. containing the name of the file to which it is linked. The second example creates the symbolic link /u1/file2 which points to the file /u1/file1 on the host belgrade. the name of the file to which the symbolic link points does not need to exist at the time that you create the link. OPTIONS -f By default. if the target file of a link already exists. With this option. Inc. and it does not have appropriate write permissions. consist of a special file.2 tmk 328 Nov 7 14:43 foo 113380 -rw-r--r-. Existing file to be linked. Strictly confidential and proprietary ln(1) NAME ln − Create a link to a file SYNOPSIS ln [-?fins] file1 file2 ln [-?fins] file1 [file2 . In the second case. then the target file must be a directory. -i -n -s EXAMPLE The first example links the file foo to the file bar.2 tmk 328 Nov 7 14:43 bar 385299 lrwxrwxrwx 1 tmk 3 Nov 7 14:43 //belgrade/u1/file2 -> /u1/file1 DIAGNOSTICS ln: Target directory (dirname) not found When linking more than one file. and you can make symbolic links to directories. ln will not ask for confirmation before overwriting the target file. Newly created link file. ln will ask for confirmation to unlink the file. The named directory (last argument) does not seem to exist. This allows you to create symbolic links to directories and between files on different disk partitions. Symbolic links however. if the target file already exists. the ln command creates a link from the existing file file1 to the file file2 which will be newly created. NSH 1 . ln does not ask for this confirmation. then ln will NOT create the link which would have overwritten the current target file. if the target file already exists. With this option. -? file1 file2 Output a brief summary of available options and then exit with a zero status without linking any files. then ln will first ask for confirmation to overwrite the file.

The -n option causes ln not to overwrite existing target files. This message is followed my an appropriate system error message. avoid using it except in exceptional cases. An unknown option was given. then the target file must be a directory. Inc. ln: Unable to link files across hosts You tried to create a link to a file that is not on the same host as the file to which the link should be created. and the target file already exists. SEE ALSO link(1). One of the files to be removed was not removable. ORIGIN ln was written by Thomas Kraus NOTES With regards to the available options for the ln command. Unable to get a license to use the software. CAVEATS Since link does not perform any error checking. it has many varying implementations on the supported platforms. Strictly confidential and proprietary ln(1) ln: Target file (filename) must be a directory When linking more than one file. This message is followed my an appropriate system error message. NSH 2 . ln: Unable to create symbolic link to file filename An error occurred while trying to create a symbolic link to the file filename. You should normally use the ln command. This is not possible to do. EXIT CODES 0 1 2 255 No errors detected. The target file is not a directory. ln: Unable to create link to file filename An error occurred while trying to create a hard link to the file filename. This implementation was selected to closely resemble System V.ln(1) Property of BladeLogic. ln: Will not create link file filename: File exists You used the -n option.4 and also to be behave in a similar way as other NSH commands.

l lc lf lr lx Automatically turns on the option -l Automatically turns on the option -C Automatically turns on the options -C and -F Automatically turns on the options -C and -R Automatically turns on the option -x For each directory argument." (current directory) and ". See UNIVERSE BEHAVIOR for details on how this option works. then ls usually will list the contents of that directory. if a file contains special characters in the name. This may be the default." (parent directory). ls uses a single column output (like with the -1 option). If one of the file arguments to ls is a directory. Inc. This option tells ls to output the a multi-column listing sorted by column. If you use the -c option with the -t option (sort the listing by time). lc. Strictly confidential and proprietary ls(1) NAME ls. ls displays the name of the file itself along with any other requested information. When using a multi-column output.. or a stream listing (see the -m option)." and ". If ls is still not able to determine the width of the screen. Consequently. then ls will try to determine the width of the screen by using the value of the TERM variable to consult the terminfo or termcap database (depending on the type of system the command is running on).ls(1) Property of BladeLogic. depending on the universe setting. and -1 options). lx − List the contents of a directory SYNOPSIS ls [-1aAbcCdfFgilLmnopqrRstux?] [filename . The output format of the listing can also be in the form of a long listing (see the -l. OPTIONS -1 -a This option tells ls to produce a single column output instead of a multi-column output. a multi-column listing (see the -C. then ls outputs the listing in a single column. If you do not specify any file arguments. lf. This option is similar to the -a option. then ls sorts the listing by date of last modification.).. then the default universe behavior determines the output format. and -g options). or if it has a value less than 20.". then ls uses the current directory (. With this option. If you do not specify an output format. ls will output all non-printable characters in the form \nnn where nnn is the octal value of the unprintable character (also see the -q option). If the output is going to a terminal. This option tells ls to include all files beginning with a period. Before ls displays a listing. then ls includes the date of last modification in the listing. the output may look jumbled and/or unreadable. -o. With this option. l.). -x.) If you use the -c option with the -l option (or other options that produce a long listing). ls does not display files beginning with a period (. lr. ls outputs the name of the files as it finds them.. ls uses a multi-column output (like with the -x option). By default. Each derivative has a specific option turned on. if it is being redirected or piped). This often includes the directories ". The remaining programs are derivatives of ls.. then the default format depends on two things. it sorts the listing (by default) alphabetically. however it does not include the directories ". -A -b -c -C -d NSH 1 .] DESCRIPTION The ls program family outputs listings of the named files. (This is the default behavior. ls tries to determine the width of the screen by looking at the value of the COLUMNS variable. ls is the standard program. If the COLUMNS variable is not set. With the P_ATT variable set. If the output is not going to a terminal (for example. For each file argument. By default. ls displays the contents of the directory. ls will output a listing for the directory itself and not its contents. With the P_BSD variable set. it uses the default value of 80.

ls treats it as such and does not follow it. This option tells ls to output the a multi-column listing sorted by rows. putting a comma and a space between file names. ls surrounds directories with square brackets ([ and ]). use the numeric values of the UID and GID instead of their associated names. A stream format means that ls will display as many file names as it can fit on a line. See the -t option and the -u option for more information.. ls does not display the owner name/ID field. Each line contains detailed information about the file. tells ls to output the date of last access instead of the date of last modification. -t. files with the user execute bit set are marked with a ’*’. except that ls does not display the group name/ID. Directories are marked with a ’/’. By default. With this option turned on. This option tells ls to output a long listing. For each file found. the output may look jumbled and/or unreadable. symbolic links are marked with a ’@’. but instead of marking directories with a slash (/). . does a reverse sort by time stamp. Include the md5 checksum of the file as a field in the output. etc. By default. -s. With this option.ls(1) Property of BladeLogic. while the -a option is turned on.) When outputting a long listing. ls sorts the listing by file name. With this option. When used with the -l option (or other options producing a long listing). the options -l. A long listing consists of a single line for each file. This option tells ls to dereference (follow) arguments that are symbolic links. This option causes ls to mark certain file types with an identifying character after the file name. does a reverse sort by user name. ls outputs the name of the files as it finds them. ls treats each file argument as a directory. See the options -c and -u for more information. With this option. If ls comes across a directory. When used with the -u option. ls sorts the listing by file size. The block size can either be 1024 (P_BSD) or 512 (P_ATT) depending on the universe setting. ls also displays the owner name/ID field. with the contents of each directory being listed as found (no sorting). For each file found. block/character special. With the P_ATT variable set. When used with the -t option. This option tells ls to output a long listing. This option causes ls to put a slash (’/’) after each file that is a directory. when an argument is a symbolic link. See UNIVERSE BEHAVIOR for details on how this option works. and -r are turned off. This makes it easy to identify directories. ls will output the file’s inode number in a separate field before the name of the file. ls sorts the listing by file name. if a file contains special characters in the name. then sort the listing by the date of last access instead of the date of last modification. This option is like the -F option. ls sorts the listing by time stamp. then ls will recursively descend the directory and produce a listing for that directory. The default time stamp is date of last modification. If sorting the listing by time with the -t option. Consequently. This option causes ls to output the files in a stream format. With the P_BSD variable set. Strictly confidential and proprietary -f ls(1) With this option. and sockets are marked with a ’=’. Inc. By default. ls produces blank output for otherwise non-regular files (directories. By default. ls will output the file’s size in blocks in a separate field before the name of the file. The checksum of a symlink is the checksum of its target. -F -g -i -l -L -m -M -n -o -p -q -r -R -s -S -t -u -v -x NSH 2 .. ls will output all non-printable characters as question marks (?). This option is similar to the -l option.

The second example produces a long listing sorted in reverse by time of last modifications of all files/directories beginning with the letter ’a’ in the directory bin on the host berlin. With the P_BSD variable set. ls aligns columns to the nearest 8 character interval with columns separated by TAB characters. The -g flag has two very different meanings depending on your universe setting. -C. EXAMPLE The first example outputs a multi-column listing of the current directory. With the P_ATT variable set. the group name field is also included in long listings. With the P_ATT variable set ls assumes block sizes to be 512 bytes large. ls assumes block sizes to be 1024 bytes large. ls: %s: Unable to access directory dirname Ls was unable to access the directory dirname to determine its contents. a long listing is automatically made with the group name file not shown. Instead. the default behavior is to output the group name field. Any directories found in the current directory have a ’/’ appended to their names. When using the -s option to display file sizes in blocks. EXIT CODES 0 1 2 255 No errors detected An unknown option was given One of the files to be listed was not accessible Unable to get a license to use the software. With the P_ATT variable set ls defaults to a single column output equivalent to the -1 option. then with the P_BSD variable set. then with the P_BSD variable set ls will default to a multi-column output equivalent to the -x option. ls ignores column settings less than 20.ls(1) Property of BladeLogic. Inc. Multi-column listings are presented differently depending on your universe setting. $ ls -pC $ ls -lrt //berlin/bin/a* DIAGNOSTICS ls: filename <system error message> Ls was unable to determine detailed information about the file filename. There are 25 options for this command. If a long listing is not being produced. ORIGIN ls was written by Thomas Kraus NSH 3 . If a long listing is being output. ls uses the default screen width of 80. With the P_BSD variable set. With the P_ATT variable set. With the P_ATT variable set. or -x options). then with the P_BSD variable set the default behavior is not to output the group name field. and the user has not selected an output format (-1. UNIVERSE BEHAVIOR Because of the large number of options for this command. ls calculates column widths based on the longest file name with an interval of two spaces between columns. there are several option conflicts. Strictly confidential and proprietary -? ls(1) Output a brief summary of available options and then exit with a zero status without doing any listing.

you specify the name of the host that contains the man page. You must use the command syntax for the host from which you are retrieving the man page. The second example prints the man page for the command wait in section 2 of the man pages. found on the host dublin (as defined by the P_MANHOST variable). man was unable to determine where to look for the man page. Because of this. Inc. If you do not specify this option. EXAMPLE The first example prints the man page for the command man which is found on the host dublin. using the -h host option. This version of man does not. man: Error in starting remote program This error message is output when no data was received back from the remote host when executing the man command on it. EXIT CODES 0 1 2 255 No errors detected. man will check the shell variable P_MANHOST for the name of a host. thus letting you effectively access the man page on the remote host. The available options for the man command differ from system to system. Normally. CAVEATS Some versions of man automatically redirect their output to the more command for easier browsing. man does not know on which host to look for man pages. $ man -h dublin man $ P_MANHOST=dublin $ export P_MANHOST $ man -s 2 wait DIAGNOSTICS man: Do not know on which host to look for man pages on This message is output if you did not specify the -h option and the P_MANHOST variable was not set. OPTIONS -h -? The name of the host that contains the man page. Output a brief summary of available options and then exit with a zero status without displaying any man pages. No data was returned from the remote host. man displays the output of the remote man command. Strictly confidential and proprietary man(1) NAME man − Get man pages from remote host SYNOPSIS man [-h host] man_options DESCRIPTION man invokes a man page on a selected remote host.man(1) Property of BladeLogic. Unable to get a license to use the software. NSH 1 .

If you do not specify any files. Inc. You can use this option in conjunction with the -s option to checksum subsets of the file.] DESCRIPTION The md5sum command calculates the MD5 checksum of each file you specify as an argument. If you specify a file on a remote host. This option is useful when dealing with textual files on a Windows system. Strictly confidential and proprietary md5sum(1) NAME md5sum − Calculate MD5 checksum of files SYNOPSIS md5sum [-bltf] [-o offset] [-s size] [file . If the size value ends with a ’k’ md5sum will interpret the value as a KB value. -s size This option tells md5sum the number of bytes to use in the calculation. You can use this option in conjunction with the -o option to checksum subsets of the file. Do not output warning messages.. the remote RSCD agent calculates the MD5 checksum.md5sum(1) Property of BladeLogic. OPTIONS -b -l -t This option tells the md5sum command to read the file in binary mode (as opposed to textual mode). md5sum takes its input from stdin. so as not to have to pull the whole file across the network. If the size value ends with an ’m’ md5sum will interpret the value as a MB value.. -f -o offset This option tells md5sum what offset in bytes to start calculating from. where you do not want to have the different end of line characters (which differ between UNIX and Windows) affect the calculation. If the offset value ends with a ’k’ md5sum will interpret the value as a KB value. This is the default behavior. This option tells the md5sum command to read the file in textual mode (as opposed to binary mode). AUTHOR md5sum was written by Thomas Kraus SEE ALSO ls (-M option) NSH 1 . Only read (up to) the first 512 bytes (same as -s 512). If the offset value ends with an ’m’ md5sum will interpret the value as a MB value. Light mode.

mkdir(1) Property of BladeLogic. mkdir was unable to create one of the named directories. mkdir creates the missing directory. (This may be altered by the value of current umask. where mode is an octal value. If the mode contains non octal digits. Second. By default. Set the initial user ownership to user. If either directory does not exist. This message is followed by a system error message indicating the possible problem. mkdir will create parent directories as required. mkdir creates the directory /u2/newdir/src. Each of the created directories will have their permissions set to mode. -? Output a brief summary of available options and then exit with a zero status without creating any directories. OPTIONS -m mode Set the file permissions of all created directories to mode. Strictly confidential and proprietary mkdir(1) NAME mkdir − Create directories SYNOPSIS mkdir [-m mode] [-p] [-?] dirname . $ mkdir newdir $ mkdir -p -m 0755 //andorra/u2/newdir/src //madrid/u2/newdir/src DIAGNOSTICS mkdir: Error creating directories dirname An error was encountered while creating the directory dirname. mkdir creates directories with the mode 0777. EXAMPLE The first example creates the directory newdir in the local directory.. then this error message will appear.) Parent directories for the new directory must already exist unless you use the -p option (see below). Otherwise a warning message appears. dirname The name of the directory you want to create.. Unable to get a license to use the software. On Windows this must be numeric and you must have appropriate permissions on the file. NSH 1 . Otherwise a warning message appears. -u user -g group Set the initial group ownership to group. On Windows this must be numeric and you must have appropriate permissions on the file. EXIT CODES 0 1 2 255 No errors detected. mkdir: Invalid mode (mode) The mode the directory should be set to must be in octal (digits 0-7). With this option. Inc. The second example first makes sure the directories /u2 and /u2/newdir exist. DESCRIPTION mkdir creates new directories. By default the mode of the newly created directories is calculated to be: 0777 minus <current umask of local host> -p By default the parent of the directory must already exist. An unknown option was given.

Inc.mkdir(1) Property of BladeLogic. Strictly confidential and proprietary mkdir(1) ORIGIN mkdir was written by Thomas Kraus NSH 2 .

.. EXAMPLE The first example creates the named pipe mypipe in the local directory. mkfifo was unable to create the special file. You specified an unknown option or an option was missing. Strictly confidential and proprietary mkfifo(1) NAME mkfifo − Create named pipe (FIFO) SYNOPSIS mkfifo name . EXIT CODES 0 1 2 255 No errors detected. NSH 1 . ORIGIN mkfifo was written by Thomas Kraus SEE ALSO mknod(1). this error message will appear along with an appropriate system message. Inc. The mode of the newly created named pipe is calculated as follows: 0666 minus <current umask of local host> OPTIONS name The name of the named pipe you want to create. DESCRIPTION mkfifo creates a named pipe (FIFO) for each of the named arguments. The second example creates the named pipes /tmp/pipe1 and /tmp/pipe2 on host montecarlo $ mkfifo mypipe $ mkfifo //montecarlo/u2/pipe1 //montecarlo/u2/pipe2 DIAGNOSTICS mkfifo: Error creating named pipe filename If an error occurred while creating the named pipe. CAVEATS You must be a super user to create character and block special files. You cannot create a special file if a file of that name already exists.mkfifo(1) Property of BladeLogic. Unable to get a license to use the software.

mknod was unable to create the special file. As the second argument. The second example creates the character special file /tmp/null on host tirana # mknod mypipe -p # mknod //tirana/tmp/null c 3 2 DIAGNOSTICS mknod: Error creating special file filename If an error occurred while creating the special file. or a block special file (b). the name of the special file you want to create. The minor number of the character/block special file. Strictly confidential and proprietary mknod(1) NAME mknod − Create a special file SYNOPSIS mknod name [p] [b | c major minor] DESCRIPTION mknod creates a special file. You cannot create a special file if a file of that name already exists. NSH 1 . tells mknod to create a named pipe (FIFO). a character special file (c). As the second argument. you must also specify the major and minor number of the device. As the second argument. The second argument specifies the type of special file. Inc. If you create a character or block special file. EXIT CODES 0 1 2 255 No errors detected. You specified an unknown option or an option was missing. EXAMPLE The first example creates the named pipe mypipe in the local directory. Unable to get a license to use the software.mknod(1) Property of BladeLogic. The major number of the character/block special file. which can be either a named pipe (FIFO) (p). The first argument is the name of the special file. ORIGIN mknod was written by Thomas Kraus. The mode of the newly created special file is calculated as follows: 0666 minus <current umask of local host> OPTIONS name p c b major minor As the first argument. this error message will appear along with an appropriate system message. tells mknod to create a block special file. tells mknod to create a character special file. CAVEATS You must be a super user to create character and block special files.

The target file is not a directory. mv: Unable to access parent directory dirname The parent directory of the target file/directory could not be found. Inc. then mv will ask for confirmation to overwrite the target file. if a target file already exists.c files from the directory /u1/src from host bucharest to the local directory new_src.mv(1) Property of BladeLogic. Unable to get a license to use the software.c new_src EXIT CODES 0 1 2 255 No errors detected. Output a brief summary of available options and then exit with a zero status without moving any files. then the target file must be a directory. The named directory (last argument) does not seem to exist. OPTIONS -i With this option. you can use it to rename files. With the -f option. Strictly confidential and proprietary mv(1) NAME mv − Move or rename files SYNOPSIS mv [-fi?] file1 file2 mv [-fi?] file . It simply overwrites the file. Destination file or directory. If there are two or more files to be moved to the target. An error occurred while trying to move a file. mv: Unable to access file filename The file to be moved (filename) was not accessible. If the file exists and does not have appropriate permissions.. and makes sure that the file has appropriate write permissions allowing it to be overwritten. then mv overwrites the file.. then the target must be a directory. If the user confirms with an entry beginning with the letter y. $ mv foo.bar foobar $ mv //bucharest/u1/src/*. First. This option tells mv not to check for potential overwrite problems in the target file’s mode. dir DESCRIPTION mv works in two forms.bar to foobar. mv: Target file (filename) must be a directory When moving more than one file. An unknown option was given. mv checks to see if the target file already exists. DIAGNOSTICS mv: Target directory (dirname) not found When moving more than one file. See UNIVERSE BEHAVIOR for details on how this option interacts with the -f option. Second. then the target file must be a directory. mv does not display this prompt. The second examples moves all . NSH 1 . The last argument given to mv is the destination file/directory (target). By default. you can use it to move files/directories from one directory into another. -f -? file1 file2 EXAMPLE The first example renames the file foo. Source file. mv prompts you to see if it should overwrite the file anyway.

Strictly confidential and proprietary mv: Unable to create link to new file filename An error occurred while moving the file filename. the source file is removed. the -f option will override the -i option. mv: Unable to create file filename If a cross partition/host move is to be made. There was an error copying the source file to the target file. mv: Error writing to file filename If a cross partition/host move is to be made. See cp for more details on copying directories. the files are actually copied. The target file could not be created. mv: Unable to move directory dirname across partitions or hosts You can move directories only within a disk partition. then with the P_BSD variable set (Berkeley behavior). Inc. the source must be deleted. The target file could not be created. NSH 2 . There was an error deleting the source file. the -i option will override the -f option. There was an error removing the source file. the files are actually copied. mv: Could not unlink file filename If a cross partition/host move is to be made. The source file to be copied could not be accessed. With the P_ATT variable set. the files are actually copied. UNIVERSE BEHAVIOR If you use both the -i and -f options. mv: Unable to open file filename If a cross partition/host move is to be made. After having copied the source file to the target file.mv(1) Property of BladeLogic. the files are actually copied. You cannot move directories over partition or host borders. mv(1) mv: Unable to unlink file filename After the source file has been linked to the target file. ORIGIN mv was written by Thomas Kraus SEE ALSO cp(1).

. because the overhead of each fork and subsequent copy of a single file may outweigh the rewards of doing things in parallel. For full details of how the cp/dsync commands work. a separate process should be created to perform the copy. you must include a dash (-) to delimit the start of your target destination(s). -f file -d dir -p n -v EXAMPLE The following example copies a file to multiple destinations rome $ ncp /etc/hosts .. If you use this option with the -h option (above) then the flat file should contain a list of hosts. sourceN -[hv] [-d dir] [-p n] dest1 . This indicates that the destinations are actually hostnames or I. This option can be used in conjunction with the -h option to indicate the (absolute) directory on the destination host into which you want to copy the <sources>. destN ndsync [-bifnprtuvBCLPRST?] [-s suf] source1 .P. Inc. This option indicates that for each source/destination pair. These commands are most useful when you want to update multiple remote hosts with the same data. unless you are using the -d option.. the flat file should contain a list of files/directories to which you want to copy the <sources>. The available options are: -h If you are not using any other options. This option is more useful when copying directories than individual files. This option lets you define a list of destinations inside a flat file. <ncp options> These options affect the way in which the source files/directories are copied to the destinations. these options are the same options supported by the respective parent command. If you use this option. The sections are: ncp <cp options> <sources> <ncp options> <destinations> <cp options> Since ncp/ndsync are supersets of cp/dsync. allowing users to copy/synchronize multiple files and/or directories to multiple destinations. This option tell the program to output verbose messages that include percentages of how far a particular file has been copied.. destN DESCRIPTION ncp and ndsync are supersets of their respective cp and dsync parents.. Copy in parallel.//athens/etc/host //paris/etc/hosts NSH 1 . sourceN -[hv] [-d dir] [-p n] dest1 .. <sources> These are the files and/or directories that you want to copy to the given destinations.. Strictly confidential and proprietary ncp(1) NAME ncp. because the <sources> are copied to the same location on the destination hosts. These commands provide an alternate interface.ncp(1) Property of BladeLogic. see their respective documentation. A maximum of n processes in parallel are started at any time. ndsync − Copy/synchronize multiple sources to multiple destinations SYNOPSIS ncp [-bifnprtuvBCLPRST?] [-s suf] source1 .. then the <sources> must be absolute path names. addresses to which you want to copy the <sources>. OPTIONS The command line arguments are split into multiple sections. Otherwise. The descriptions below apply to both the ncp and ndsync commands.

dsync.. cp(1). Strictly confidential and proprietary You could have done the same thing as follows: rome $ ncp /etc/hosts -h athens paris Or as follows: rome $ cd /etc rome $ ncp hosts -h -d /etc athens paris Here is an example of using the -f option rome $ cat hosts athens moscow lisbon rome $ ncp -v /etc/hosts -h -f hosts -d /tmp Copy /etc/hosts -> //athens/tmp/hosts .ncp(1) Property of BladeLogic. EXIT CODES See EXIT CODES section in cp documentation. Done Copy /etc/hosts -> //moscow/tmp/hosts .. Inc. NSH 2 . SEE ALSO dsync(1). ORIGIN The cp command family (cp. ndsync) was written by Thomas Kraus... Done Copy /etc/hosts -> //lisbon/tmp/hosts ... Done The following example copies a directory to several remote hosts and does so in parallel: rome $ ncp -rvp /foo/bar -p 3 -h athens paris london -d /foo ncp(1) DIAGNOSTICS See DIAGNOSTICS section in cp documentation. uncp(1). ncp.

Sort on the specified column. With this option the data display is truncated by screen size and repeated periodically. You can specify multiple space separated hostnames without re-specifying the -h option.] [-r] [-s field] [-t] DESCRIPTION ncpu displays CPU information in a standardized format independent of the server’s operating system. This option overrides the -t option. -r -s field Sort in reverse order. The values must be resolvable hostnames or valid I. this data may not be available for all servers. Refresh screen. ncpu displays the value as a number. Inc. addresses.. Increase wait time between refreshes by 1 second. Load the list of servers whose CPU information you want to display. The following keyboard commands are available while in top mode. Strictly confidential and proprietary ncpu(1) ncpu(1) NAME ncpu − View CPU information from one or more hosts SYNOPSIS ncpu [-c] [-e expr] [-f file] [-H] [-h host . some systems (for example.. Output system overview information as a set of comma separated values.or 5. addresses. ncpu displays data in the following columns: HOSTNAME The name of the host the entry applies to. Show only entries that match the given expression. In addition. SLOT Indicates which slot this CPU occupies.] [-r] [-s field] [-t] ncpu2 [-c] [-e expr] [-f file] [-H] [-h host . The field must be one of the column headers listed above.3. OPTIONS -c -e expr -f file -H -h hosts Specify a list of hosts whose CPU information you want to display. ncpu2 can display the value as a number or a string.. The file should be a flat file containing either resolvable hostnames or valid I. <SPACE> Ctrl-L Ctrl-C q r + # Refresh the data. See the -s option below.Property of BladeLogic. Quit application. TYPE The manufacturer and model type of the CPU.2. Therefore. STATUS Indicates whether the CPU is online or offline. Quit application. Reverse sort order.P. SPEED The estimated CPU speed in MHz. -t NSH 1 . Decrease wait time between refreshes by 1 second.4. See the EXPRESSIONS section below for more details. AIX) require root access to determine CPU speed. Display data similar to the way the top command displays data. Replace the # character with 1. See the -f option below. By default ncpu sorts in reverse order (largest to smallest) on the CPU speed. Do not show a header on output.P. With the -s option you can specify an alternate field to sort on.. This data is not available on all systems.

See the EXPRESSIONS section below for more details. Strictly confidential and proprietary ncpu(1) ncpu(1) e d m n o p s u -w Define an expression to filter the output data. and OR. CAVEATS The -t option mimics the top command’s behavior.8 This example shows how to view non-numeric slot information using ncpu2. Switch to process summary view. When an expression is used to match a string. Truncate each line of output to the actual screen width. nnet(1). For full details on expressions. nps(1). ndf(1). Switch to network info view. see the man page for blexpr. but does not mimic it exactly. Switch to memory info view. Expressions can contain multiple operators and operands. EXAMPLE This example shows how to view CPU information for multiple hosts (and operating systems). The expression should be a single argument surrounded by single quotes. Switch to statistics view.Property of BladeLogic. host% ncpu2 engaix43agt2 engaix53lp1 HOSTNAME SLOT SPEED STATUS engaix53lp1 00-00 1648 Online engaix43agt2 00-00 0 Online TYPE PowerPC_POWER5 PowerPC_604e EXPRESSIONS You can use the -e option to define an expression that filters the output data. nstats(1) NSH 2 . wildcards are supported. AND. Switch to system info view.8 GenuineIntel Intel(R) Pentium(R) 4 CPU 2. Switch to disk info view. nmem(1). including NOT. ORIGIN ncpu was written by Thomas Kraus SEE ALSO blexpr(1). Switch to process info view. Inc. host% ncpu -h engsuse8agt1 engsol9agt2 HOSTNAME SLOT SPEED STATUS engsol9agt2 0 548 Online engsuse8agt1 0 2800 Online engsuse8agt1 1 2800 Online TYPE sparcv9 GenuineIntel Intel(R) Pentium(R) 4 CPU 2.

<SPACE> Ctrl-L Ctrl-C q r + Refresh the data Refresh screen Quit application Quit application Reverse sort order Increase wait time between refreshes by 1 second -t NSH 1 . Do not show a header on output. Inc. Please see the EXPRESSIONS section below for more details. The field should be one of the column headers as described above.P. -h hosts Specify the list of hosts from which to get the disk usage information. Load the list of servers from which to get disk usage information. The values must be resolvable hostnames or valid I. addresses. MOUNTED ON The directory (or drive) associated with the disk partition OPTIONS The following options are available to modify the behaviour of ndf.P. Property of BladeLogic. With the -i option you can specify an alternate field to sort on. Comparisons are made case neutral. See the -s option below. By default ndf sorts in reverse order (largest to smallest) on the disk usage capacity. Inc. Behave top like. Only show entries which match the given expression.. The following keyboard commands are available while in top mode. FILESYSTEM The name of the system device associated with the disk partition KBYTES The total amount of available disk space in KB USED FREE The total amount of used disk space in KB The total amount of available disk space in KB CAPACITY Amount of disk space used in terms of percentage of total available.. addresses.] [-r] [-s field] [-t] DESCRIPTION Ndf displays disk usage statistics of one or more servers in a standardized format independent of the server’s operating system. -c -e expr -f file -H Output disk usage information as a set of comma separated values. You can specify multiple space separated hostnames without needing to re-specify the -h option.ndf(1) Property of BladeLogic. -r -s field Sort in reverse order. The file should be a flat file containing either resolvable hostnames or valid I. See the -f option below. This option overrides the -t option. With this option the data is displayed such that it is truncated by screen size and repeated periodically. Strictly confidential and proprietary ndf(1) NAME ndf − View disk usage statistics from one or more hosts SYNOPSIS ndf [-c] [-e expr] [-f file] [-H] [-h host . The data it displays is displayed in columns as follows: HOSTNAME The name of the host the entry applies to.

When an expression is used to match a string. or 0 (10). Switch to system info view. enclose the expression in single quotes). EXAMPLE The following illustrates a simple example of getting disk usage information from multiple hosts sorted (smallest to largest) by the available disk space: host% ndf -h solarishost linuxhost winhost -s Free EXPRESSIONS With the -e option. see the man page for blexpr. Strictly confidential and proprietary # e d m n o p s u -w Decrease wait time between refreshes by 1 second Sort on column # which is a value of 1. For full details on expressions.6.3. The expression should be a single argument (i. Expressions can contain multiple operators and operands. AND. CAVEATS The top like behaviour is not meant to exactly mimic the top command. nps(1).2. Switch to statistics view. nstats(1) NSH 2 . ORIGIN ndf was written by Thomas Kraus SEE ALSO blexpr(1). Please see the EXPRESSIONS section below for more details. Switch to process summary view.ndf(1) Property of BladeLogic. ndf(1) Define an expression used to filter the output data.4. wildcards are supported. and OR. Truncate each line of output to the actual screen width. Switch to network info view.e. nover(1).5. nmem(1). nnet(1). including NOT. Inc..8.7. Switch to disk info view. Switch to process info view. Property of BladeLogic. Inc.9. Switch to memory info view. you can define an expression used to filter the output data.

Traverse directories recursively. Will only appear if you specified the -t option. You can change the output device width by using the -w option. Use the directories listed in file as arguments for the command. each entry for an existing file will include the username/groupname of the file in parentheses. If ndircmp detects different file sizes. Output file ownerships numerically (UID/GID) instead of by username/groupname. By default. it indicates this size difference by including the letter S in the compare code. OPTIONS -a -e -f file -M Equivalent to specifying the -s. file ownerships.. -o. When you specify the -o option. In its base use. the width is set to 80 characters. it indicates this ownership difference by including the letter O in the compare code. Inc. When you specify the -p option. then depending on which options you specified. If you specify this option without specifying any additional comparisons (besides existence) then ndircmp will not output a report. Will only appear if you specified the -o option. S T O P The file exists but is of a different size. ndircmp outputs a report of the aggregate files in all given directories. The file exists but has a different time of last modification. When you specify the -s option. and -p options. each entry for an existing file will include the octal file permissions of the file in parentheses. Also compare file sizes. If ndircmp detects a different file ownership. -t. The file exists but has different file ownerships. Also compare file ownerships. If ndircmp detects different file permissions. Strictly confidential and proprietary ndircmp(1) NAME ndircmp − Compare contents of multiple directories SYNOPSIS ndircmp [-aeMmnOoprst] dir1 dir2 . it indicates this permissions difference by including the letter P in the compare code.ndircmp(1) Property of BladeLogic. The file is equal (the same) based on all of the comparison parameters you specified. Also compare file permissions. If the file exists. and date of latest modification. with the first given directory taken as a base line for the remaining directories. Also compare the files’ respective MD5 checksums in the comparison. Not only does it compare the contents (file names) of the directories (which files exist or do not exist) but it can also optionally compare file size.. This option tells ndircmp to calculate the optimal spacing for the generated output based on the width of the output device. Each entry is preceded with a code field indicating what differences exist. DESCRIPTION The ndircmp utility lets you compare the contents of multiple directories. Do not output files if they are equal. file permissions. Will only appear if you specified the -p option. each entry for an -m -n -O -o -p -r -s NSH 1 . the following codes may also appear. The file exists but has different access permissions. The possible codes are: < = The file is missing from this directory. Do not output files if they are equal or missing. Will only appear if you specified the -s option. The calculation of MD5 checksums will significantly increase the amount of time it takes to perform the file/directory comparisons.

If ndircmp detects different dates of last modification. By default. The default assumption is 80 characters. assume the output device width to be width characters. where N is the number of directories being checked. Inc. it indicates this last modification difference by including the letter T in the compare code.ndircmp(1) Property of BladeLogic. ndircmp outputs a table that has N columns. When you specify the -t option. dsync(1). These options (-1. -w width -[1-9] Specify the maximum number of columns to output. When calculating the optimal output. SEE ALSO cp(1). ORIGIN ndircmp was written by Thomas Kraus. ndircmp(1) -t Also compare dates of last modification.. NSH 2 . Strictly confidential and proprietary existing file will include the file size in parentheses. -2 . each entry for an existing file will include the date of last modification of the file in parentheses.. -9) let you specify how many columns to output with directory results (sets of columns) separated by a form feed (Ctrl-L) character.

nexec(1) Property of BladeLogic. . The first argument is either the name of the host on which the specified command should be executed or the command option -e. Note that if the cmd executed is the effective remote user’s default shell then nexec will execute the command directly instead of spawning their shell twice. LOGNAME. not all platforms fully support the utmp entry.. Solaris /bin/vi or AIX smit). On UNIX agents. Tells the agent to run in a pure interactive mode. Note that this option only applies when the remote server is a UNIX-like machine. If you specify this option.profile) should be run. In addition. Invoking a command that is linked to nexec automatically translates the command from <command> to nexec <host> <command>. see the NETWORK SHELL UTILITIES section below. It sets the HOME. Nexec captures all stdin and sends it to the remote command (see -n option). bash. etc. Once the remote program has been started. the nexec command acts as an I/O interface to the remotely running command. any messages to standard error messages are indistinguishable from standard output messages. and it displays all stdout/stderr it gets sent by the remote command. For more information. where the host is determined by the program’s present working directory.g. a pseudo tty is created in which the program is run while on Windows agents a simple pipe-based I/O mechanism is used to communictae with the command. Finally.) for indicating that the shell is a login shell and that the shell’s startup scripts (e. as determined by the current working directory. which some interactive programs need (e. Without this option. ksh. The remaining arguments are the name and arguments of the remote program to be executed. it uses the syntax nexec ARG1 ARG2. It sets your initial working directory to the home directory of the effective remote user. The other way to call the nexec program is by calling a command that is implicitly linked to the nexec program. Strictly confidential and proprietary nexec(1) NAME nexec − Engine to interface remote commands. an entry in the Network Shell remote_cmds configuration file must exist indicating that this command should be treated as a remote command. SYNOPSIS nexec [-?] [-t term] [-o] [-i] [-l] [-nohup hostname "cmd &"] -e | hostname cmd [args] DESCRIPTION The nexec program works in one of two ways. -l Simulates a login session.g. The following examples show what exactly gets executed (assuming a default shell of /bin/ksh). Client sends ’nexec -l -e ls -la’ Agent executes ’/bin/ksh -ksh -c "ls -la" Client sends ’nexec -l -e ksh’ Agent executes ’/bin/ksh -ksh’ NSH 1 . It then invokes the cmd args using the effective remote user’s default shell and also sets argv[0] of the executing program (the effective remote user’s default shell) to "-". If the program is called explicitly.. This option attempts to start the remote program in a way that simulates an actual login session. This is a traditional method understood by shells (sh. COMMAND OPTIONS -e -i Executes the command on the current remote host. the remote stdout/stderr outputs are written to the respective local stdout/stderr. and USER environment variables to their respective values based on the remote permissions. this option creates an appropriate entry in the utmp database for use by utilities such as who. You should only use this option when the remote interactive program does not behave as expected on screen. For the command to be executed directly from /bin/nsh. which indicates that the command should be executed on the current remote host. Inc.

nexec will read all data it gets from stdin and sent it to the remote command as standard input (stdin). By default.0. When using the nexec command to execute a command on a Windows host.3 or later. It must be a batch (output only) command. Use this option to tell nexec not to use the synchronization fixes. random binary data may not be converted properly and invalid and/or unrecognized sequences will be converted to question marks (’?’). by default.0 introduced some synchronization fixes to the nexec protocol. See examples below. Tells nexec to ignore the value of the TERM variable and use term instead as the terminal type. -o -r -u Use the legacy version of the nexec protocol. In the same way. Output generated by the command is captured by the agent and converted to UTF-8 before being sent back to the nexec client where it is converted to the local code page before it is output to the terminal/screen. meaning no auto transcoding. before it is passed to the application. With this option stdin is not read and as such should only be used with commands that do not require any input. If this type of behaviour is not wanted. is converted to the local code page. DEFAULT PROGRAMS The Network Shell provides the following pre-configured links: arp finger ifconfig Address resolution display and control Display information about users Configure and show network interface parameters NSH 2 . Now imagine that from the Windows server one kicks off a command (via nexec) on the Solaris server that generates Japanese output. -nohup hostname "cmd &" Executes a command in the background on the specified server. To deal with this nexec will now.nexec(1) Property of BladeLogic. Strictly confidential and proprietary -n nexec(1) Leave stdin alone (do not read any data from stdin). Release 7. This assumes that the generated output consists of proper code page sequences. that unrecognized characters are replaced with question marks (’?’). automatically transcode data. Imagine for example. -t term See the EXAMPLES section below for more information. INTERNATIONALIZATION ISSUES One of the issues a user could run into when dealing with multiple computers is how these computers meaningfully interact in a mixed code page environment. then one should use the -r (raw) option to have no transcoding done. This allows you to securely tunnel X11 traffic using the same security features as other NSH utilities. Do not transcode input/output. See INTERNATIONALIZATION ISSUES below for more details. As such the output will be not very useful. The output which would now be displayed on the Windows server will be incorrect as the Windows is looking to output CP932 code sequences and the Solaris server is providing EUC-JP code sequences. This option is available on agents running 7. a Windows server localized for Japanese with a code page of CP932 and a Solaris server also localized for Japanese but with a code page of EUC-JP. As this automatic transcoding may not always be desired there is the -r option to have all data dealt with in raw mode. input (stdin) captured by the nexec client is converted to UTF-8 before it is sent to the agent where. the command to be executed cannot be an interactive command. With this option nexec will convert all output (stdout/stderr) generated by the command from the local code page of the target server to UTF8. As such. Inc. It should be noted that if there are any transcoding issues. X11 FORWARDING The nexec utility automatically configures the agent to capture X11 traffic by resetting the DISPLAY variable and tunneling traffic to the server that initiated the nexec call.

/share echo "foobar <path_to_foobar>" >> remote_cmds Now from the Network Shell environment you can: $ /bin/nsh $ cd //rome/home/foo $ foobar -now In the above example. the first line of the stdin is read via the read host command and the remaining entries are gobbled up by nexec and as such only one line of output is generated. In the first instance. This field is only required if the executable is not found in the PATH of the remote RSCD Agent (daemon) when the Agent is started. host% cat hosts NSH 3 .nexec(1) Property of BladeLogic. EXAMPLES The following example shows typical uses of nexec: unix% $ nexec winhost net start unix% $ cd //winhost winhost% $ nexec -e net start winhost% $ nexec linux rpm -qai Notice in the next example the effect of the -n option. First. take the following steps. the second field (<path_to_foobar>) is an optional path to the remote executable. In the second example all entries in the file are handled as nexec is not reading stdin input. nexec(1) NETWORK SHELL UTILITIES To have the Network Shell seamlessly execute remote programs. Inc. make a link to the Network Shell utility nexec and then make a corresponding entry in the remote_cmds file to indicate the program is a remote command. see the nsh man page. The following example shows how a remote utility called foobar can be configured for remote execution. # # # # # cd ‘cat /usr/lib/rsc/HOME‘ cd bin ln -s nexec foobar cd .. Strictly confidential and proprietary ipconfig (NT) mem (NT) mount nbtstat (NT) net (NT) netstat nfsstat ps size swap umount uptime who xterm Configure and show network interface parameters Display memory usage Mount or show mounted file system Show nbt statistics Interface to net command Show network statistics Display NFS status/statistics Display process status/statistics Report size of an object file Display swap space status/statistics on System V type systems Unmount files system Determine how long a system has been up Display who is logged in on a system Start a remote xterm displaying on your local screen. For more information.

com In the following example. this capability is currently limited on Windows machines to simple input/output programs. Its options vary drastically between BSD and ATT systems. and programs needing full Console support may hang or not function as expected. Inc. An option may not be universal to all platforms. ORIGIN nexec was written by Thomas Kraus.com Hostname for lisbon is: lisbon. NSH 4 . nexec runs a command named bgCmd in the background on a server named RemoteHost : nexec -nohup RemoteHost "bgCmd &" CAVEATS Programs/utilities vary between hosts and operating systems.bletch.com Hostname for rome is: rome. While the nexec command does support the ability to interface remote interactive commands.bletch.bletch. The best example of this is the ps command. Similarly.bletch.nexec(1) Property of BladeLogic.com nexec(1) host% cat hosts | while read host do echo -n "Hostname for $host is: " nexec -n $host hostname done Hostname for madrid is: madrid. not all commands are available on all hosts. Strictly confidential and proprietary madrid lisbon rome host% cat hosts | while read host do echo -n "Hostname for $host is: " nexec $host hostname done Hostname for madrid is: madrid. SEE ALSO rsh(1).

the remote user’s login shell will be started in the remote user’s HOME directory. If the remote server successfully authenticates the username and password. Strictly confidential and proprietary nlogin(1) NAME nlogin − Secure remote login (through RSCD Agent) SYNOPSIS nlogin [-?] [-l user] host DESCRIPTION nlogin is a special instance of the nexec utility. The name of the remote host you want to log into. nlogin will prompt you to enter the appropriate remote password. It performs a remote login to host. Utilities such as telnet have a special escape key sequence that lets you exit the protocol and take local action. telnet(1). This capability may be a suitable replacement for utilities such as telnet. and/or ssh. OPTIONS -? -l user host Displays a general usage message.nlogin(1) Property of BladeLogic. If you do not specify a username with which to log in to the remote host (by using the -l user option). The user name with which you want to log into the remote host. rlogin. Inc. NSH 1 . The login session uses the same encrypted protocol as all other NSH utilities and therefore provides a secure remote login capability. nlogin does not have such an escape key sequence. nlogin will attempt to log into the remote host using your current login name. ORIGIN nlogin was written by Thomas Kraus. SEE ALSO nexec(1). host% nlogin santiago Password for tmk@santiago: ******* $ EXAMPLES CAVEATS You can only nlogin to UNIX style machines.

addresses. MEMFREE The amount of free memory available in KB %MEM Amount of memory used in terms of percentage of total available.P. -h hosts Specify the list of hosts from which to get the memory information. -c -e expr -f file -H Output memory information as a set of comma separated values. MEMUSED The amount of memory used in KB.] [-r] [-s field] [-t] DESCRIPTION Nmem displays memory and swap statistics of one or more servers in a standardized format independent of the server’s operating system. -r -s field Sort in reverse order. The file should be a flat file containing either resolvable hostnames or valid I. Strictly confidential and proprietary nmem(1) NAME nmem − View memory and swap statistics from one or more hosts SYNOPSIS nmem [-c] [-e expr] [-f file] [-H] [-h host . Only show entries which match the given expression. The values must be resolvable hostnames or valid I. The data it displays is displayed in columns as follows: HOSTNAME The name of the host the entry applies to. Please see the EXPRESSIONS section below for more details. Do not show a header on output. Behave top like. <SPACE> Ctrl-L Ctrl-C Refresh the data Refresh screen Quit application -t NSH 1 . SWAPUSED The amount of swap space used in KB SWAPFREE The amount of free swap space available in KB %SWAP Amount of swap space used in terms of percentage of total available.. You can specify multiple space separated hostnames without needing to re-specify the -h option. By default nmem sorts in reverse order (largest to smallest) on the swap usage percentage. Comparisons are made case neutral.. With this option the data is displayed such that it is truncated by screen size and repeated periodically. MEMTOTAL The total amount of physical memory in KB.nmem(1) Property of BladeLogic. Inc. The following keyboard commands are available while in top mode. The field should be one of the column headers as described above.P. With the -i option you can specify an alternate field to sort on. addresses. OPTIONS The following options are available to modify the behaviour of nmem. This option overrides the -t option. Property of BladeLogic. SWAPTOTAL The total amount of swap space in KB. See the -s option below. See the -f option below. Load the list of servers from which to get memory information. Inc.

When an expression is used to match a string. you can define an expression used to filter output data. Please see the EXPRESSIONS section below for more details. Switch to process summary view.2. CAVEATS The top like behaviour is not meant to exactly mimic the top command. -w Truncate each line of output to the actual screen width.7. The expression should be a single argument (i.5. For full details on expressions. or 0 (10). Inc. nover(1). EXAMPLE The following illustrates a simple example of getting memory and swap information from multiple hosts sorted (largest to smallest) by total used memory host% nmem -h solarishost linuxhost winhost -r -s MEMUSED EXPRESSIONS With the -e option. nnet(1). Switch to disk info view. see the man page for blexpr.. nmem(1) Define an expression used to filter the output data. including NOT. Strictly confidential and proprietary q r + # e d m n o p s u Quit application Reverse sort order Increase wait time between refreshes by 1 second Decrease wait time between refreshes by 1 second Sort on column # which is a value of 1. Switch to statistics view.3. Switch to process info view. ORIGIN nmem was written by Thomas Kraus SEE ALSO blexpr(1). Expressions can contain multiple operators and operands. AND. ndf(1). Property of BladeLogic.9.8.6. nps(1).4.nmem(1) Property of BladeLogic. and OR. wildcards are supported. enclose the expression in single quotes). Inc. Switch to network info view. Switch to memory info view.e. Switch to system info view. nstats(1) NSH 2 .

Quit application. -H -h hosts Specify a list of hosts whose network adapter configuration information you want to display.2 and beyond. address of the adapter. You can specify multiple space separated hostnames without re-specifying the -h option. the MAC address appears as all zeros. See the -f option below. Increase wait time between refreshes by 1 second. <SPACE> Ctrl-L Ctrl-C q r + Refresh the data. -r -s field -t Sort in reverse order. addresses. MAC Adapter MAC address. The values must be resolvable hostnames or valid I. Load the list of servers whose network adapter configuration information you want to display. With the -s option you can specify an alternate field to sort on. See the EXPRESSIONS section below for more details. nnet sorts in reverse alphabetical order by host name. NAME Adapter name. SPEED NIC speed in Mbit. Quit application. Show only entries that match the given expression.P. NIC speed is obtainable only if the user has appropriate permissions. NSH 1 .. In addition. If there is no MAC address. Not all adapters have a MAC address.. the data display is truncated by screen size and repeated periodically. The file should be a flat file containing either resolvable hostnames or valid I. BROADCAST Broadcast address for the adapter. or if you do not have the required permissions. Inc. I. addresses. you might not have the permissions to gather MAC address data. The field must be one of the column headers listed above.nnet(1) Property of BladeLogic. NIC speed for HP-UX is supported from version 10.P. Display data similar to the way the top command displays data.P. By default. With this option. IP SUBNET OPTIONS -c -e expr -f file Output network adapter configuration information as a set of comma separated values. Reverse sort order. The following keyboard commands are available while in top mode.] [-r] [-s field] [-t] DESCRIPTION nnet displays network adapter configuration data for one or more servers in a standardized format independent of the server’s operating system. Do not show a header on output. This option overrides the -t option. Subnet mask for the adapter. Strictly confidential and proprietary nnet(1) NAME nnet − View network adapter configuration data SYNOPSIS nnet [-c] [-e expr] [-f file] [-H] [-h host . See the -s option below. Refresh screen. nnet displays data in the following columns: HOSTNAME The name of the host the entry applies to.

5. nps(1). see the man page for blexpr.4.nnet(1) Property of BladeLogic. but does not mimic it exactly.6. Inc. nnet(1) Sort on the specified column. CAVEATS The -t option mimics the top command’s behavior.3. EXAMPLE This example shows how to get network adapter configuration information from multiple hosts: host% nnet -h solarishost linuxhost winhost EXPRESSIONS You can use the -e option to define an expression that filters the output data. Replace the # character with 1.2. nstats(1). nmem(1). The expression should be a single argument surrounded by single quotes. or 7. ndf(1) NSH 2 . ORIGIN nnet was written by Thomas Kraus SEE ALSO blexpr(1). Truncate each line of output to the actual screen width. For full details on expressions. nover(1). Strictly confidential and proprietary # -w Decrease wait time between refreshes by 1 second.

BSD June 6. Otherwise. it is directed to the same place as the standard output. the exit status of nohup shall be that of utility.] DESCRIPTION The nohup utility invokes command with its arguments and at this time sets the signal SIGHUP to be ignored.2”) compatible. Strictly confidential and proprietary NOHUP (1) NAME nohup − invoke a command immune to hangups SYNOPSIS nohup utility [arg . If the standard output is a terminal. ENVIRONMENT HOME If the output file nohup. 1993 1 .out cannot be created in the current directory. If standard error is a terminal. The utility could not be found or an error occurred in nohup. SEE ALSO signal(3) STANDARDS The nohup command is expected to be IEEE Std 1003.out in the current directory. The nohup utility shall exit with one of the following values: 126 127 The utility was found but could not be invoked.2 (“POSIX. Inc. . the nohup utility uses the directory named by HOME to create the file. . the standard output is appended to the file nohup.NOHUP (1) PropertyGeneral Commands Manual System of BladeLogic.

P. CPUS The number of system CPUs (online and off). The data it displays is displayed in columns as follows: HOSTNAME The name of the host the entry applies to. Windows systems. This data is not available on all systems while some systems (e. the kernel release for Linux. With this option the data is displayed such that it is truncated by screen size and repeated periodically. Only show entries which match the given expression.g. MEMORY The amount of memory in MB SWAP DISK The amount of swap space in MB The total amount of local disk space in GB.P. The file should be a flat file containing either resolvable hostnames or valid I. -c -e expr -f file -H Output system overview information as a set of comma separated values. ARCH The system hardware architecture. The values must be resolvable hostnames or valid I. Property of BladeLogic. Load the list of servers from which to get system overview information. <SPACE> Ctrl-L Ctrl-C q Refresh the data Refresh screen Quit application Quit application -t NSH 1 . addresses. The following keyboard commands are available while in top mode. See the -f option below. addresses. The field should be one of the column headers as described above.nover(1) Property of BladeLogic. You can specify multiple space separated hostnames without needing to re-specify the -h option. By default nover sorts in reverse order (largest to smallest) on the CPU speed.] [-r] [-s field] [-t] DESCRIPTION Nover displays a system overview in a standardized format independent of the server’s operating system. the release level for AIX. Do not show a header on output.. Behave top like. Inc. See the -s option below. With the -i option you can specify an alternate field to sort on. This field has different meanings for different operating systems and includes the service pack for Windows. OPTIONS The following options are available to modify the behaviour of nover.. SPEED The estimated CPU speed in MHz. OS The system’s operating system MAINT The current maintenance release of the OS. Strictly confidential and proprietary nover(1) NAME nover − View system overview from one or more hosts SYNOPSIS nover [-c] [-e expr] [-f file] [-H] [-h host . AIX) require root access to determine CPU speed and as such this data may not be available for all servers. Please see the EXPRESSIONS section below for more details. -r -s field Sort in reverse order. Comparisons are made case neutral. Inc. -h hosts Specify the list of hosts from which to get the system overview information. This option overrides the -t option. and as not set for Solaris.

nstats(1) NSH 2 . ORIGIN nover was written by Thomas Kraus SEE ALSO blexpr(1).EL solaris8 SunOS 5. enclose the expression in single quotes).3.8. Please see the EXPRESSIONS section below for more details. Switch to process summary view.. nps(1).4.8 CPUS 1 1 SPEED 797 MHz 440 MHz ARCH i686 sun4u MEMORY 121 MB 256 MB SWAP 251 MB 513 MB DIS 18 G 17 G EXPRESSIONS With the -e option. EXAMPLE The following illustrates a simple example of viewing an overview of multiple hosts (and operating systems). see the man page for blexpr.2. or 0 (10). nnet(1).4. wildcards are supported. Switch to memory info view.9. host% nover -h solaris8 linux HOSTNAME OS MAINT linux RedHat ES3 2. nmem(1).6. Switch to network info view. nover(1) Define an expression used to filter the output data. Property of BladeLogic. Switch to system info view. including NOT. and OR. Switch to process info view. Expressions can contain multiple operators and operands. ndf(1).5. AND. For full details on expressions.nover(1) Property of BladeLogic. Switch to statistics view.21-4. Inc. Truncate each line of output to the actual screen width. CAVEATS The top like behaviour is not meant to exactly mimic the top command. The expression should be a single argument (i.e. Strictly confidential and proprietary r + # e d m n o p s u -w Reverse sort order Increase wait time between refreshes by 1 second Decrease wait time between refreshes by 1 second Sort on column # which is a value of 1. Inc. When an expression is used to match a string. you can define an expression used to filter output data.7. Switch to disk info view.

Inc. addresses. You can specify multiple space separated hostnames without re-specifying the -h option. See the -f option below. Show only entries that match the given expression.Property of BladeLogic. Reverse sort order. addresses.P. The total amount of real memory that the processes are using altogether. TIME CPU The cumulative amount of CPU that the processes have used altogether. Do not show a header on output. The values must be resolvable hostnames or valid I. Output process summary information as a set of comma separated values. See the -s option below. -r -s field Sort in reverse order. USER NPROCS Total number of processes. MEMORY The percentage of total memory that the processes are using altogether.. Strictly confidential and proprietary nprocsum(1) nprocsum(1) NAME nprocsum − View process summary from one or more hosts SYNOPSIS nprocsum [-c] [-e expr] [-f file] [-H] [-h host . VSIZE RSS The total amount of virtual memory that the processes are using altogether. By default nprocsum sorts in reverse order (largest to smallest) on the total number of processes. With the -s option you can specify an alternate field to sort on. Quit application. The following keyboard commands are available while in top mode. This option overrides the -t option. Load the list of servers whose process summary information you want to display. See the EXPRESSIONS section below for more details. Refresh screen.] [-r] [-s field] [-t] DESCRIPTION nprocsum displays process summary for one or more servers in a standardized format independent of the server’s operating system. The field must be one of the column headers listed above. <SPACE> Ctrl-L Ctrl-C q r + Refresh the data. Display data similar to the way the top command displays data.P. Increase wait time between refreshes by 1 second. -t NSH 1 . nprocsum displays data in the following columns: HOSTNAME The name of the host the entry applies to. Quit application. The percentage of CPU that the processes have used altogether. With this option the data is truncated by screen size and repeated periodically. The file should be a flat file containing either resolvable hostnames or valid I.Various systems may have different algorithms to determine this value.. OPTIONS -c -e expr -f file -H -h hosts Specify a list of hosts whose process summary information you want to display. The username of the owner of the processes on the remote host.

AND. see the man page for blexpr. Switch to memory info view. CAVEATS The -t option mimics the top command’s behavior.4. Expressions can contain multiple operators and operands. and OR.3. Switch to process info view. Switch to disk info view. nmem(1). When an expression is used to match a string.2. Switch to statistics view. Switch to process summary view. nnet(1). nstats(1) NSH 2 . Replace the # character with 1. nover(1). nps(1). For full details on expressions. but does not mimic it exactly. Switch to network info view. Switch to system info view. The expression should be a single argument surrounded by single quotes. including NOT. Define an expression to filter the output data. Strictly confidential and proprietary nprocsum(1) nprocsum(1) # e d m n o p s u -w Decrease wait time between refreshes by 1 second. ORIGIN nprocsum was written by Thomas Kraus SEE ALSO blexpr(1). wildcards are supported. Sort on the specified column. See the EXPRESSIONS section below for more details. Inc.5.Property of BladeLogic. 7 or 8. Truncate each line of output to the actual screen width. EXAMPLE This example shows how to get process summary information from multiple hosts sorted (smallest to largest) by the available number of processes: host% nprocsum -h solarishost linuxhost winhost -s NPROCS EXPRESSIONS You can use the -e option to define an expression that filters the output data.6.

This option overrides the -t option.nps(1) Property of BladeLogic. The file should be a flat file containing either resolvable hostnames or valid IP addresses. The parent process ID. Display data similar to the way the top command displays data. Refresh screen. The process’ priority. With this option. The percentage of total memory that the process is using. COMMAND The command name and arguments of the given process. Load the list of servers whose process information you want to display. Strictly confidential and proprietary nps(1) NAME nps − Displays process information for one or more hosts SYNOPSIS nps [-c] [-e expr] [-f file] [-H] [-h host . Inc. The field must be one of the column headers listed above. The total amount of virtual memory that the process is using. USER PPID PID CPU MEM VSIZE RSS PRI TIME The username of the owner of the process on the remote host.] [-r] [-s field] [-t] DESCRIPTION nps displays process statistics for the processes running on one or more servers in a standardized format independent of the server’s operating system. -r -s field Sort in reverse order. See the -s option below. OPTIONS -c -e expr -f file -H Output process information as a set of comma separated values. By default nps sorts in reverse order (largest to smallest) on the percentage of CPU in use. START The start time of the process. Various systems may have different algorithms to determine this value.. -t NSH 1 . the data display is truncated by screen size and repeated periodically. (This column only appears in the -c output. Show only entries that match the given expression. <SPACE> Ctrl-L Refresh the data. See the EXPRESSIONS section below for more details. The following keyboard commands are available while in top mode. With the -s option you can specify an alternate field to sort on. This field has no relevant value for Windows systems. The percentage of CPU that the process is using. All Windows processes are currently owned by root. The values must be resolvable hostnames or valid IP addresses. The cumulative amount of CPU that the process has used.. Do not show a header on output.) The process ID. nps displays data in the following columns: HOSTNAME The name of the host the entry applies to. The total amount of real memory that the process is using. -h hosts Specify a list of hosts whose process information you want to display. The meaning of the value may differ from system type to system type. You can specify multiple space separated hostnames without re-specifying the -h option.

nnet(1). Strictly confidential and proprietary Quit application.9. but does not mimic it exactly. nmem(1). SEE ALSO blexpr(1). AND.2. sorted (largest to smallest) by the amount of real memory the process is using. Reverse sort order. Inc.7. ndf(1).nps(1) q r + # e d m n o p s u -w Property of BladeLogic. Increase wait time between refreshes by 1 second. Inc. Truncate each line of output to the actual screen width. Define an expression to filter the output data. Switch to network info view. When an expression is used to match a string. Switch to process info view. CAVEATS The -t option mimics the top command’s behavior. Switch to process summary view.8. Inc. wildcards are supported.6. host% nps -h solarishost -e ’user != "root" & CPU > 5% & mem > 3%’ EXPRESSIONS You can use the -e option to define an expression that filters the output data. 0 indicates column 10. host% nps -h solarishost linuxhost winhost -r -s RSS This second example shows all non root processes. see the man page for blexpr. For full details on expressions. For example. Switch to system info view. nps(1) Sort on the specified column. Switch to statistics view. See the EXPRESSIONS section below for more details. Property of BladeLogic. nstats(1) NSH 2 . ORIGIN nps was developed by BladeLogic. or 0. Switch to memory info view.5. The expression should be a single argument surrounded by single quotes. and OR.4. Decrease wait time between refreshes by 1 second.3. including NOT. nover(1). EXAMPLE This example shows how to get process information from multiple hosts. you could create an expression like the following: host% nps -e ’COMMAND = "*sbin*"’ Expressions can contain multiple operators and operands. Switch to disk info view. host% nps -h solarishost linuxhost winhost -e ’user != "root"’ This example searches for non root processes that may be running out of control. Replace the # character with 1.

Inc. explicitly mention the drive letter as shown in the following examples: $ /bin/nsh unix $ cat //windows/c/autoexec. To access other drives on the computer. When you cd to a new host. you should also specify a directory. then the Network Shell environment defaults to the <SYSTEMDRIVE> drive. ACCESSING REMOTE FILES AND HOSTS WITH THE CD COMMAND The following example shows how to use the cd command to access remote hosts: beaver $ cd //otter/etc otter $ pwd //otter/etc otter $ uname -a Linux otter 2. the shell connects you to the // (root) directory.Property of BladeLogic. The code generating the prompt replaces the sequence \h with the name of the host you are currently accessing rather than the name of the local host. then a drive is irrelevant because the root directory itself is the highest point you can access on the directory tree.0. such as C:. You can access remote files from the command line: beaver $ vi //otter/etc/termcap You can also use the command line to specify files on multiple hosts: beaver $ diff //otter/etc/termcap //duckbill/etc/termcap REMOTE WINDOWS DRIVES When accessing a remote Windows (NT4/2000) machine.34 #1 Fri May 8 16:05:57 EDT 1998 i586 i386 otter $ vi termcap When you access a remote host. the \h sequence takes on a new value. as the following example illustrates.assuming the default shell prompt (PS1) has not been previously set.EXE In Network Shell. If you have set a root directory. It does not provide a detailed description of Network Shell behavior. If you have not set a root directory and you do not provide a drive letter. nor can you access any other drives. you should treat the drive letter as a directory even though that differs from how Windows treats drives.bat unix $ cd //nt/d nt $ ls /e/*. See the man pages for zsh to obtain detailed information on how the Network Shell works. Strictly confidential and proprietary nsh(1) nsh(1) NAME nsh − Network Shell SYNOPSIS This manual page outlines the differences between the Network Shell and a regular shell. The Network Shell is a link to a distributed version of zsh. If you do not. You can never access the root of a drive. you do not have to include the drive letter in the name. SHELL PROMPT The first thing you may notice when you start Network Shell is that the default shell prompt incorporates the name of the host you are currently on -. NSH 1 .

Property of BladeLogic. to execute the native command. The // directory allows you to change directories to another host using relative path names. The later is supported for backwards compatibility. you can make entries in the // directory with the mkdir command and remove them with the rmdir command. or unique Network Shell commands that do not have native equivalents. When executing a command that has an entry in the remote_cmds file. the command returns the hostid of host2. you can be in one of two states: on the local host or on a remote host. This last category is referred to as Network Shell utilities. When executing a command. Network Shell equivalents of native commands are executed by default in either state. For example. Inc. For example: host1 $ cd // host1 $ ls host1 host2 host1 $ cd host2 host2 $ pwd //host2/ In another example: host1 $ pwd //host1/etc host1 $ cd ../host2/etc host2 $ pwd //host2/etc If you have root privileges. The action is equivalent to running "nexec -e hostid" while being rooted on host2 in Network Shell. execution of a native command which is not a Network Shell command will result in an "nexec" execution of the native command on the remote server. Strictly confidential and proprietary nsh(1) nsh(1) THE // DIRECTORY The Network Shell supports the // directory. EXECUTING COMMANDS FROM A REMOTE HOST Network Shell supports two methods for executing commands from a remote host: the default implied "nexec" method and the remote_cmds file method.. Note that you do not need an entry for a remote host in the // directory to access data on that remote host. and the command has a native equivalent on the remote host with a different path. Native commands. which is a virtual directory that contains only hostname entries./. Implied nexec Execution of Commands on a Remote Host When your current directory is on a remote host. enter the command with a fully qualified path. You cannot create regular files and other special files in this directory. the version of the command that is executed is the one pointed to by the path specified in the remote_cmds file. Host$ /bin/tar -cvf /tmp/etc. For a command for which there is a native version and a Network Shell equivalent. host3 host4 EXECUTING A COMMAND There are three categories of commands you can execute through Network Shell. nsh# cd //host2 host2 nsh# hostid NSH 2 . Each entry correspond to another host’s root (/) directory. In the following example. Network Shell equivalents of native commands.tar /etc The following section describes the two methods for executing commands on a remote host.

To continue with the above example. Inc. the RSCD Agent on Windows NT4/2000 machines supports the built-in commands df. you would create a soft link as follows: # cd ‘cat /usr/lib/rsc/HOME‘ # cd bin # ln -s nexec myapp Next. Strictly confidential and proprietary nsh(1) nsh(1) Specifying Remote Commands Using the remote_cmds File The remote_cmds file contains a list of remote commands that the Network Shell supports. REDIRECTION Redirection in the Network Shell is implemented with pipes rather than the usual dup() or dup2 () system calls. First. for example. There are a few limitations when using redirection. you must perform two steps. the Network Shell maps its known utilities to utilities in the Network Shell bin directory. PATH VARIABLE When the Network Shell is started. The remote_cmds file resides in the share directory of the Network Shell install directory. These remote utilities CANNOT require any terminal input because their standard input is redirected from /dev/null. create a soft link to the program nexec.The command_name field must be the basename of the remote command you want to execute. the shell assumes an error has occured and the command is aborted. In addition to regular DOS commands. To add a supported remote command using this method. The default value is 300 seconds (5 minutes). Each entry consists of up to three white space-delimited fields. If the remote command does not finish after the maximum allocated time. First. By entering a value of -. you must run them in conjunction with the nexec command. the shell searches for the command in the PATH of the RSCD Agent (daemon). This can be unset. (White space can be a TAB or SPACE. and reboot. If this field is not set. For example: command_name .Property of BladeLogic. It should be a non-interactive program. only the file descriptors 1 (standard output) and 2 (standard error) are NSH 3 . Adjust this value if you anticipate that the remote command might take longer than 300 seconds to execute. the shell attempts to execute the named program on the remote host. as described earlier. Note that by default the Network Shell is not configured to run the halt and reboot commands. The max_time field represents the maximum time in seconds that the remote command should need to execute. the PATH variable is automatically initialized to include the Network Shell bin directory as the first element in the PATH. Some typical commands in the remote_cmds file are who and ps. If you want to use Network Shell to run these commands. The soft link should have the same name as the remote command. This ensures that all Network Shell utilities are available. but. they can be set to use default values. in the bin directory of the Network Shell installation directory. capturing both its standard output and standard error. the second step for the myapp program could look something like this: # cd ‘cat /usr/lib/rsc/HOME‘ # cd share # echo "myapp /home/me/bin/myapp -" >> remote_cmds When the Network Shell (actually the nexec program) executes a remote command. Any arguments to these utilities must conform with the remote commands arguments and must be in the PATH of the rscd program. If. The command_path should be the absolute path name to the program on the remote host.) command_name command_path max_time The command_path and max_time fields are optional. create an entry in the remote_cmds file in the share directory relative to the Network Shell installation directory. This is necessary to properly implement redirection to files on remote hosts. you wanted to run the remote command myapp. halt.

If the Network Shell again needs access to a remote host. you must escape the -? option as shown below: agentinfo -\? NSH 4 . these connections remain open until the user exits the shell or executes the disconnect command. especially if you are accessing large numbers of remote hosts. is treated the same as the < redirection type. For example: $ agentinfo -? Usage: agentinfo [-?] [-c] [-H] [-f file] [hostname .nshprofile $ZDOTDIR/. calling the disconnect command is not required.nshlogin $ZDOTDIR/. The NSH differs from ZSH in that all startup/shutdown files are prepended with nsh instead of z or zsh. If no arguments are given. Strictly confidential and proprietary nsh(1) nsh(1) supported for redirection. it is a good idea to call the disconnect command occasionally. which causes the output file to be opened for both read and write. REMOTE SHELL SCRIPTS It is possible to execute remote shell scripts. the shell closes all connections.. Other values may produce unexpected results. THE DISCONNECT COMMAND The Network Shell dynamically creates network connections to the remote hosts that it accesses.. The following is a list of valid startup/shutdown files for NSH. For example. the redirection type <>. When accessing relatively few remote hosts. then a new dynamic network connection is created. instead of using /etc/zshenv you would use /etc/nshenv instead. The Network Shell utilities manage their own network connections and do not affect the shell. For efficiency reasons. All of the Network Shell utilities ignore this variable and always use /bin/nsh when a shell process is required. $ZDOTDIR/. To ensure that you do not exhaust system resources.nshlogout ${TMPPREFIX}* (default is /tmp/nsh*) /etc/nshenv /etc/nshprofile /etc/nshrc /etc/nshlogin /etc/nshlogout (installation−specific − /etc is the default) USING THE -? OPTION WITHIN THE NSH SHELL A number of NSH commands let you display brief usage information by specifying the -? option.] -? Output this message -c Output data in CSV format -f file Load list of host from flat file -H Do not output a header line if -c used If you want to use the -? option when you are WITHIN the NSH shell. This command closes the network connections of the hosts given to it as arguments. THE SHELL VARIABLE The SHELL variable is often used to tell programs the default shell to use when a program needs to run a shell process. STARTUP/SHUTDOWN FILES See the zsh(1) man page for more information on startup/shutdown files.nshenv $ZDOTDIR/. Inc.Property of BladeLogic. They can be included in your PATH or expressed as an absolute pathname. The remaining types of redirections work (with the restrictions described above). The network connection to the host on which the current directory exists is not closed even if specifically asked to do so. Next.nshrc $ZDOTDIR/.

Property of BladeLogic. Strictly confidential and proprietary nsh(1) nsh(1) SEE ALSO zsh(1) NSH 5 . Inc.

NSH::close($fd). then you current host is changed to be that host and all subsequent access to any files which are not in full UNC (do not include a hosrtname) will be assumed to be on the given host. If dirname is a full UNC path (includes a hostname). The following examples will help clarify their use. Network Shell Perl Module 1 ."). $buf. NSH::close($fd).. (W_OK) Test for write permission. use NSH. 0777). The NSH calls emulate their C function counter parts. 0) || die "Cant open file: $!\n". int mode) Change the mode (protection attributes) of the file path to mode. and commands. NSH::chdir (char *dirname) Change you current directory to dirname. NSH::chdir (". int mode) NSH::access() checks the file pointed to by path for accessibility according to the bit pattern contained in mode The values for mode can be the ORing of the following values: 0 1 2 4 (F_OK) Check existence of file (X_OK) Test for execute or search permission. NSH::rmdir ("bar"). 0. NSH::chmod (char *path. then the file on the current host is used. 0. Inc. DESCRIPTION The NSH Perl Module gives Perl programmers the ability to access remote files and commands. 0) || die "Cant open file: $!\n".. The NSH module currently supports 45 calls which interface the corresponding Network Shell distributed API. NSH:: FUNCTIONS NSH::access (char *path. All arguments which are file or directory names support UNC syntax which allows the use of a hostname as part of the filename. Perl Module Strictly confidential and proprietary NSH::(1) NAME NSH:: . $fd = NSH::open ("bar". The NSH module acts as glue between Perl and the Network Shell core technology. 100). NSH::chdir ("//hostname/foo/bar") !! die "Can’t cd: $!\n"). NSH::. $fd = NSH::open ("//hostname/foo/bar". processes. 0777). 0777). 100). If no hostname is included in the argument. NSH::unlink("file"). If mode is ommitted it checks for file readability (R_OK). $count = NSH::read ($fd. $buf. NSH::chdir ("//hostname/foo".Network Shell Perl module to access and manipulate remote files. SYNOPSIS use NSH.NSH::(1) Property of BladeLogic. NSH::chdir ("//hostname/foo/") || die "Can’t cd: $!\n". NSH::chmod ("bar". (R_OK) Test for read permission. $count = NSH::read ($fd.. NSH::chmod ("//hostname/foo/bar".

100. while (($filename. Perl Module Strictly confidential and proprietary NSH::(1) NSH::chown (char *path. int fd2) Duplicate the open file descriptor fd1 to filedescriptor fd2 NSH::fchown (int fd. Inc. 200). and group gid. } NSH::closedir ($fd). and group gid. 200). NSH::fchdir (int fd) Change directory to the pth pointed to by the file descriptor fd. Network Shell Perl Module 2 . $fd = NSH::open ("/foo/bar") || die "Open failed: $!\n". NSH::chown ("foo". NSH::dup (int fd) Duplicate the open file descriptor fd NSH::dup2(int fd1. int fd) Read the next line of input from the file descriptor $fd up to a maximum of size bytes. $fd = NSH::creat ($filename. 0777) || die "Cant create: $!\n". NSH::close (int fd) Close the file descriptor fd. int mode) Create the file filename with an initial mode (protection attribute) of mode. int gid) Change the file ownership of the file path to be of owner uid. int uid.") || die "Can’t open current directory: $!\n". $fd = NSH::open("//hostname/foo"). NSH::write ($fd. NSH::fchown ($fd. 100. NSH::fgets (char *buffer. pwd = NSH::getcwd (). $fd = NSH::open("foo") || die "Cant open file: $!\n".NSH::(1) Property of BladeLogic. $inode) = NSH::readdir($fd)) { print "FILENAME = $filename\n". NSH::creat (char *filename. int uid. NSH::fchdir($fd). NSH::close ($fd). int gid) Change the file ownership of the file pointed to by the file descriptor fd to be of owner uid. 12). NSH::close ($fd). "Hello world\n". NSH::close ($fd). print "PWD = $pwd". NSH::closedir (int fd) Close the file descriptor fd which was returned from a successfull call to NSH::opendir $fd = NSH::opendir(". int size.

The argument op determines what operation is to be performed. NSH::getpriority (int which. long pos) Truncate the size of the file pointed to by the file descriptor fd to pos bytes. NSH::fstat (int fd) Return information on the file pointed to by the file descriptor fd. or just a regular path name if the current NSH:: directory is on the local host. Network Shell Perl Module 3 . $pwd = NSH::getcwd (). int op) Apply or remove an advisory lock on an open file pointed to by the filedescriptor fd. The format of the returned value will be a UNC type name (//hostname/directory) if the current NSH:: directory is on a remote host. 1 2 4 8 Apply shared lock (LOCK_SH). $prio = NSH::getpriority (0. Apply exclusive lock (LOCK_SH). Perl Module Strictly confidential and proprietary NSH::(1) $fd = NSH::open ($filename) || die "Cant open $filename: $!\n". int who) Get the scheduling priority for a process. NSH::kill (int pid. In other words. Please see the STAT section below for further information on the stat family of calls. Inc. Remove lock. process group or user. know what you are doing with the call. Pid is the Process ID of the process to receive the signal while sig is the numberic signal to be sent. 100). then it is assumed that the priority for the given process (PRIO_PROCESS) is desired. $fd) { print "Next line is: $buffer". Which is one of 0 1 2 who is a process identifier (PRIO_PROCESS) who is a process group identifier (PRIO_PGRP) who is a user ID (PRIO_USER) If NSH::getpriority is called with only one argumnet.NSH::(1) Property of BladeLogic. int sig) Send a signal to a process. $prio = NSH::getpriority (100). while (NSH::fgets ($buffer. and can have any of the following values ORed together. The following examples both get the priority of the process with PID 100. 512. } NSH::close ($fd). NSH::ftruncate (int fd. NSH::flock (int fd. NSH::kill (100. Make operation non-blocking (LOCK_NB). If sig is ommitted. NSH::getcwd () Return the current NSH:: working directory. 9). then a SIGTERM is sent. Specific signals may have different values on different OSes.

mode is assumed to be 0755. NSH::lseek (int fd. NSH::mkfifo (char *filename. 0). in which case information about the link is returned rather than the information about the file the link references. int whence) Move the read write pointer of the file descriptor fd as follows: • • • If whence is 0 (SEEK_SET). The following example move the read pointer to the end of the file. mode is assumed to be 0755. NSH::chdir ("//hostname"). the pointer is set to offset bytes.NSH::(1) Property of BladeLogic. Both newname can only be created on the same host and disk partition as that of the existing file. long offset. 0777). you can determine it’s file permissions with the third argument. int mode = 0666) Open a file for reading and/or writing. $fd = NSH::open ("bar"). NSH::mkdir (char *dirname. NSH::mkdir ("//hostname/foo/bar"). NSH::mkdir ("foo. if the second (and third) argument are not given. NSH::mkdir ("//hostname/foo/bar"). If mode is ommitted. the pointer is set to size of the file plus offset bytes. NSH::chdir("//hostname/foo"). If whence is 2 (SEEK_END). then the file is opened for reading. NSH::lseek ($fd. char *newname) Create a hard link called newname to the existing file called existing. int maj. If mode is ommitted. When creating a file. The second argument controls how the file is opened. the mode 0666 is used (read/write for all). As previously mentioned. For other read options or to write to a file the remaining arguments must be set. NSH::lstat() works like NSH::stat() with the exception of when the file is a symbolic link. NSH::lstat (char *filename) Return information on the file filename. If whence is 1 (SEEK_CUR). Please see the STAT section below for further information on the stat family of calls. NSH::chdir ("//hostname"). the pointer is set to its current location plus offset bytes. Perl Module Strictly confidential and proprietary NSH::(1) NSH::link (char *existing. NSH::mkdir ("foo. If none is given. int mode) Create the new directory dirname with initial permissions set to mode. file2") || warn ("Link failed: $!\n". NSH::mknod (char *filename. 2. Inc. then the file is opened for reading in binary mode. int mode. int mode) Create the new FIFO special device called filename with initial permissions set to mode. If only a single argument is given. int min) NSH::open (char *filename. The value of the mode argument can be a ORed value of the following flags. Network Shell Perl Module 4 . NSH::link ("file1". 0777). int flags = O_RDONLY.

returning a file descriptor which can be used in subsequent calls to NSH::readdir() to determine the contents of the given directory. Perl Module Strictly confidential and proprietary 0 1 2 4 8 16 64 96 256 512 1024 2048 32768 262144 524288 Open for reading Open for writing only Open for reading and writing Non-blocking I/O Append. Open file in text mode (Not usefull for UNIX files) Open file in binary mode (default) NSH::(1) NSH::opendir (char *dirname) Open the directory dirname for reading. int nbytes) Read the next nbytes bytes from the file descriptor fd storing the result in buf which will always be ’null’ terminated. 100)) { print $buf. $fd = NSH::opendir ("foo") || die "Can’t access foo: $!\n". NSH::readdir (int fd) Read the next directory entry of the directory pointed to by the descriptor fd returned by a successfull call to NSH::opendir(). Inc. $buf. it is assumed to be ’r’. If mode is ommited. This function pushes the filename and the filename’s inode number on the stack. ls") while (NSH::read ($fd. char *mode) Execute the Network Shell command cmd and returns a file descriptor which allows you to either read or write to the command depending on the value of mode. NSH::pclose (int fd) Close a file descriptor returned by a successfull call to NSH::popen(). Network Shell Perl Module 5 . subsequent NSH::write() will write data to the standard input of the command. Writes guaranteed at the end of file Synchronized file update option Synchronized data update option Non-blocking I/O (POSIX) Open with file create (uses third argument if given) Open with truncation Exclusive open Don’t allocate controlling tty (POSIX) Synchronized file update option.NSH::(1) Property of BladeLogic. NSH::popen (char *cmd. char *buffer. If the string mode begins with a ’r’ then subsequent NSH::read() will read the standard output of the command while if mode begins with a ’w’. $fd = NSH::popen ("cd //hostname/foo. NSH::closedir($fd). } NSH::read (int fd. $fd = NSH::opendir("//hostname/foo") || die "Can’t read directory: $!\n (filename) = NSH::readdir($fd).

$fd = NSH::opendir ("foo") || die "Can’t read directory: $!\n". Perl Module Strictly confidential and proprietary while (($filename. process group or user. NSH::rename ("foo". $pos). Please see the STAT section below for further information on the stat family of calls. prio is the new priority to be set. int pos) Move the read pointer of the directory descriptor fd to pos which must be a value returned by a previous call to NSH::telldir(). then they are assumed to be a process ID and it’s new priority. NSH::setpriority (int which. char *newname) Rename the file oldname to newname. NSH::rmdir (char *dirname) Remove the empty directory dirname. NSH::rmdir ("//hostname/foo/bar") || warn "Cant remove directory: $!\n" NSH::seekdir (int fd. NSH::rewinddir (int fd) Move the read pointer to the start of the directory. "bar") || die "Can’t rename: $!\n". ($filename) = NSH::readdir ($fd). Which is one of 0 1 2 who is a process identifier (PRIO_PROCESS) who is a process group identifier (PRIO_PGRP) who is a user ID (PRIO_USER) Finally. $inode) = NSH::readdir($fd)) { print "FILENAME = $FILENAME INODE = $inode\n". int who. NSH::rewinddir ($fd).NSH::(1) Property of BladeLogic. ($filename) = NSH::readdir ($fd). } NSH::closedir($fd). int prio) Set the scheduling priority for a process. $linkname = NSH::readlink("foobar"). NSH::seekdir ($fd. NSH::stat (char *filename) Return information about the file filename. NSH::rename (char *oldname. Network Shell Perl Module 6 . NSH::(1) NSH::readlink (char *filename) Return the value of a symbolic link. $fd = NSH::opendir ("foo") || die "Can’t read directory: $!\n". If NSH::setprio() is only called with two arguments. ($filename) = NSH::readdir ($fd). Inc. $pos = NSH::telldir ($fd).

will not work outside the Network Shell environment. "//host3") { nsh::chdir($host). "//host2". NSH::truncate (char *filename. Inc. %d\n". These types of symbolic links however. NSH::write (int fd. stat. @PROPS = NSH::stat ("//hostname/etc/passwd"). symbolic links may traverse hosts (name -> //hostname/foo/bar). The returned value is only of use to the NSH::seekdir() function and should not be interpreted to be mean anything specific. 200). %d\n". In essence. printf printf printf printf printf ("Device ID of parent dir ("File inode number ("File mode/permissions ("Number of links to file ("File UID = = = = = %d\n". NSH::truncate ("foobar". [4]). int nbytes) Write nbytes of data in buffer to the file pointed to by the file descriptor fd. $nodename. All three (lstat. the following command is generated and executed. Network Shell Perl Module 7 .NSH::(1) Property of BladeLogic. $machine) = NSH:uname ( } NSH::unlink (char *filename) Unlink (remove) the file filename. ($sysname. $release. NSH::uname () This command pushes on the stack information about the host on which the current working NSH directory is. STAT This section gives a more detailed outline the return value of the stat family of calls. exec /bin/nsh -D <pwd> -c <cmd> NSH::telldir (int fd) Return the current location of the directory descriptor fd. NSH::utime (char *filename. [3]). [1]). char *newname) Create the symbolic link newname to the file name. In the Network Shell environment. char *buffer. then the current date of the local host is used. [2]). $version. long atime) Adjust the date of last modification and last access of the file filename to mtime and atime respectively. If either mtime or atime are not given. long pos) Truncate the file filename to be of size pos bytes. foreach $host ("//host1". Perl Module Strictly confidential and proprietary NSH::(1) NSH::symlink (char *name. %d\n". @PROPS @PROPS @PROPS @PROPS @PROPS [0]). NSH::system (char *cmd) Run the Network Shell command cmd and output it’s standard output and error. NSH::utime ("//hostanme/foo/bar"). fstat) of these functions return an array of values representing the various properties of the file in question. %d\n". long mtime. The best way to document this is through an example: use NSH.

NSH::(1) Property of BladeLogic. %d\n". %d\n". [10]). [12]). Perl Module Strictly confidential and proprietary printf printf printf printf printf printf printf printf ("File ("Rdev ("File ("Time ("Time ("Time ("Size ("Size GID (for special files) size of last access of last modification of last status change of a block of file in blocks = = = = = = = = %d\n". [6]). %d\n". [7]). %d\n". @PROPS @PROPS @PROPS @PROPS @PROPS @PROPS @PROPS @PROPS [5]). %d\n". Inc. %d\n". [9]). %d\n". [11]). NSH::(1) Network Shell Perl Module 8 . [8]).

.. OPTIONS -i size -k size Instead of starting with a write buffer size of 512 and using an increment of 512 bytes. Instead of transferring a 2 MB (2048 KB) test file as a sample. .. -b When writing data to the remote host. # secadmin -W hpux to to to to to to hpux hpux hpux hpux hpux hpux .012 seconds for 2048 KB = 39 (3. but sometimes this value may not be optimal. (52... nshopt starts with a write buffer size of 512 bytes and continues to perform the test in 512 byte increments up to a maximum buffer size of 16384 bytes (16KB).020 seconds for 2048 KB = 678 (51. ORIGIN nshopt was written by Thomas Kraus. . DESCRIPTION Depending on the network. The default write buffer size is 4480 bytes. . This lets you determine the optimal network write buffer size to use when communicating with the given host. Inc. If you anticipate that you will be receiving large amounts of data. . Strictly confidential and proprietary nshopt(1) NSHOPT nshopt − Test different network write buffer sizes SYNOPSIS nshopt [-i size] [-k size] [-s bytes] [-b] host1 .) Once nshopt has determined an optimal buffer size.173 seconds for 2048 KB = 40 (51. A regular write does perform those checks and therefore will take a little longer. start with a write buffer size and use an increment size of size. done. The cp command performs bulk writes when copying a file to a remote host. done.. . It does not test how fast it can receive data. then you should be running this test from the agent server to the client server (where you will need to install an agent to test it properly).. use the secadmin command to configure the new buffer size. use a file size KB large.. . This example then uses the command secadmin to update the configuration file with the desired buffer size. done. done. NSH 1 . nshopt prints the results of each test to the standard output for review. EXAMPLE The following example tests the host hpux.nshopt(1) Property of BladeLogic. perform a bulk write rather than a regular write. To determine the optimal write buffer size. (See EXAMPLE..147 seconds for 2048 KB = 40 KB/sec) KB/sec) KB/sec) KB/sec) KB/sec) 1024 CAVEATS The nshopt command tests how best to send data to a remote host. # nshopt hpux Trying 512 bytes Trying 1024 bytes Trying 1536 bytes Trying 2048 bytes Trying 2560 bytes Trying 3072 bytes .... -s bytes Start off with a buffer size of bytes. The difference between the two is that with a bulk write there is no checking or return code to verify that the write actually worked. nshopt writes a 2MB file to a remote host multiple times. done. By default nshopt starts with a buffer size equivalent to the increment size (512 bytes). each time using different network write buffer sizes and determining the time it takes to send the file... using specific write buffer sizes when communicating with remote hosts can improve the net throughput of data. From the data you can see that a buffer size of 1024 bytes is optimal for transferring data from the local host to the host hpux.145 seconds for 2048 KB = 40 (51.

secure(1). Inc. NSH 2 . Strictly confidential and proprietary nshopt(1) SEE ALSO secadmin(1).nshopt(1) Property of BladeLogic. cp(1).

NSH 1 . Inc. Inc. Strictly confidential and proprietary nshpath(1) NAME nshpath − show the path where an nsh executable resides on a local and/or remote machine SYNOPSIS nshpath [hostname . a user working on machine ’host1’ would do the following: host1% nshpath host2 /usr/nsh/bin/nsh This tells the user that nsh has been installed and that the nsh executable resides at /usr/nsh/bin on the ’host2’ machine.] DESCRIPTION The nshpath command displays the path where an nsh executable resides on a local or remote machine. OPTIONS None EXAMPLE To determine the path of nsh installed on a remote machine called ’host2’... ORIGIN nshpath was developed by BladeLogic.nshpath(1) Property of BladeLogic.

The percentage of total swap space currently being used.] [-r] [-s field] [-t] DESCRIPTION nstats displays some system statistics in a standardized format independent of the server’s operating system. SWAP TIME UPTIME The amount of time the system has been running..nstats(1) Property of BladeLogic. LOAD The system’s current load average. Inc.2. See the -s option below. addresses. The current time on the system.4. Increase wait time between refreshes by 1 second.P.. See the EXPRESSIONS section below for more details. The following keyboard commands are available while in top mode. it shows a CPU usage percentage. For Windows. Quit application. -h hosts Specify the list of hosts from which to get the system statistics. <SPACE> Ctrl-L Ctrl-C q r + # Refresh the data. With this option. see uptime (1). You can specify multiple space separated hostnames without re-specifying the -h option. nstats displays data in the following columns: HOSTNAME The name of the host the entry applies to. Do not show a header on output. -t NSH 1 . For UNIX. By default. The field must be one of the column headers listed above. Sort on the specified column. The values must be resolvable hostnames or valid I.3. the data display is truncated by screen size and repeated periodically. addresses. -r -s field Sort in reverse order. Display data similar to the way the top command displays data. nstats sorts in reverse order (largest to smallest) on the current load average. PROCS The total number of processes currently running. Decrease wait time between refreshes by 1 second. Strictly confidential and proprietary nstats(1) NAME nstats − View system statistics from one or more hosts SYNOPSIS nstats [-c] [-e expr] [-f file] [-H] [-h host . OPTIONS -c -e expr -f file -H Output system statistics as a set of comma separated values. Replace the # character with 1. MEMORY The percentage of total memory currently being used. The file should be a flat file containing either resolvable hostnames or valid I. Show only entries that match the given expression. This option overrides the -t option.P. or 7.6. With the -s option you can specify an alternate field to sort on. Load the list of servers from which to get system statistics. Reverse sort order. See the -f option below. Refresh screen. Quit application.5.

nmem(1). nover(1) NSH 2 . ndf(1). See the EXPRESSIONS section below for more details. For full details on expressions. CAVEATS The -t option mimics the top command’s behavior. Switch to disk info view. Switch to process info view. host% nstats -h solaris8 linux windows HOSTNAME LOAD MEMORY SWAP PROCS TIME windows 0. wildcards are supported. nnet(1). blexpr(1). Switch to process summary view. ORIGIN nstats was written by Thomas Kraus SEE ALSO uptime(1). The expression should be a single argument surrounded by single quotes. EXAMPLE These examples show how to get an overview of key system statistics. Strictly confidential and proprietary e d m n o p s u -w nstats(1) Define an expression used to filter the output data.00 87% 20% 63 16:14 UPTIME 6 days 05:12:48 56 days 04:43:39 88 days 15:04:57 host% nstats -h solaris8 linux windows -e ’LOAD > 0’ windows 0. see the man page for blexpr. Expressions can contain multiple operators and operands. Truncate each line of output to the actual screen width.03 68% 1% 43 16:13 6 days 05:13:52 EXPRESSIONS You can use the -e option to define an expression that filters the output data. When an expression is used to match a string. Switch to statistics view. and OR.03 68% 1% 43 16:13 linuxdev 0. nps(1). Switch to system info view. AND. including NOT.nstats(1) Property of BladeLogic. Inc.00 98% 0% 39 16:12 solaris8dev 0. Switch to memory info view. but does not mimic it exactly. Switch to network info view.

ndf(1) NSH 1 .] [-r] [-s field] [-t] nover [-c] [-e expr] [-f file] [-H] [-h host . SEE ALSO blexpr(1).] [-r] [-s field] [-t] nmem [-c] [-e expr] [-f file] [-H] [-h host . nps.. nstats(1). nover.] [-r] [-s field] [-t] nstats [-c] [-e expr] [-f file] [-H] [-h host ... nmem. For more information..] [-r] [-s field] [-t] DESCRIPTION Ntop is a family of commands that can be used to view information and statistics about one or more servers.... nps(1). nover(1). blquery(1)..] [-r] [-s field] [-t] nps [-c] [-e expr] [-f file] [-H] [-h host ... nstats − A collection of commands used to view information and statistics for one or more servers SYNOPSIS ndf [-c] [-e expr] [-f file] [-H] [-h host . Inc. nmem(1).ntop(1) Property of BladeLogic. Strictly confidential and proprietary ntop(1) NAME ndf. please read the individual man page for each command.

nukecert(1) Property of BladeLogic. server1 [<server2> <server2>] A space-delimited list of the names or IP addresses of the servers from which certificates should be removed. Inc. Strictly confidential and proprietary nukecert(1) NAME nukecert − remove certificates from servers SYNOPSIS nukecert user_name server1 [<server2> <server2>] DESCRIPTION The nukecert command removes user certificates from servers that you specify. Inc. EXAMPLE nukecert johnk linuxBuild solarisQA ORIGIN nukecert was developed by BladeLogic. OPTIONS user_name The user for whom certificates should be removed. SEE ALSO putcert(NSH) NSH 1 .

TGZ.gz is uncompressed.GZ. .gz nunzip foo. This option is the default when decompressing. --help file Display a help screen and quit. Strictly confidential and proprietary nunzip1(NSH) NAME nunzip. --quiet --verbose Same as -v. Display the name and percentage reduction for each file compressed or decompressed. or . do not restore the original file name if one is present (remove only the gzip suffix from the compressed file name) and do not restore the original time stamp if one is present.tgz.gz nunzip --verbose foo.tar. the name of the resulting uncompressed file is config. when config. Inc. OPTIONS -c -v Uncompress to stdout.gz. The resulting file is an uncompressed (or compressed) file without the original extension.nunzip1(NSH) Property of BladeLogic. gzcat. gzip -c file1 > foo. Inc. EXAMPLES ORIGIN nunzip was developed by BladeLogic. For example. copy the time stamp from the compressed file. gunzip.gz gzip -c file2 >> foo. 1 .gz Suppress all warnings.tar. File or files to be compressed or decompressed. provided that the file has the correct header. Instead. --no-name When decompressing. Verbose output. . gzip − decompress or compress files SYNOPSIS nunzip [-cv] [--no-name] [--quiet] [--verbose] file DESCRIPTION The nunzip command takes a list of files and decompresses or compresses each file whose name ends with .

the resulting list is printed in the format <tag> <character string> -2 If specified. The resulting list contains only unique entries. Within each tag group. the strings are sorted in a user-specified order. the tag field is optional. Sorting is alphabetical.txt.txt (city) bangalore (country) australia (city) new york asia (country) united states (city) adelaide (city) new york NSH 1 . Sort the list in descending order.order(1) Property of BladeLogic. the resulting list contains strings grouped by the tag fields. If you do not provide a sorting option. the resulting list is printed in the format (<tag>) <character string> If no order style option is specified. the string order is not changed. The tag groups themselves are always sorted in ascending alphabetical order. The strings are only grouped by tag. the resulting list is printed in the format <tag>: <character string> -3 If specified. In the syntax shown above. Remove duplicate entries. $cat list. Strictly confidential and proprietary order(1) NAME order − sort a list of strings (or lines) in a specified order SYNOPSIS order s|r [-u] [order-style] DESCRIPTION The order command is used to sort a list of strings (or lines) in an order specified by the user. input lines are contained in a file called list. the resulting list is printed in the format (<tag>) <character string> EXAMPLES In this example. Inc. it must be enclosed within round brackets ’()’. OPTIONS -s -r -u Sort the list in ascending order. Note: if both the -s and -r options are specified. only the -s option is considered. Each entry in the list of strings that are input must have the following syntax: (<tag>) <character string or line>. ORDER STYLE -1 If specified. If tag fields are provided in the input list. If you provide a tag field.

txt europe order(1) NSH 2 . Inc.order(1) Property of BladeLogic.txt asia america europe (city) bangalore (city) new york (city) adelaide (city) new york (city) new york (city) Rome (country) australia (country) united states (country) india (country) australia (country) england (country) australia (country) germany If ascending order is specified: $order -s < list. Strictly confidential and proprietary america (country) india (country) australia (country) england europe (city) new york (city) Rome (country) australia (country) germany If no sorting option is provided: $order < list.txt america asia europe (city) Rome (city) adelaide (city) bangalore (city) new york (city) new york (city) new york (country) australia (country) australia (country) australia (country) england (country) germany (country) india (country) united states If descending order is specified with the -u (unique) option and the order style specified as -2: $order -r -u -2 < list.

Strictly confidential and proprietary asia america city:new york city:bangalore city:adelaide city:Rome country:united states country:india country:germany country:england country:australia order(1) ORIGIN order was developed by BladeLogic. Inc. NSH 3 . Inc.order(1) Property of BladeLogic.

Please see the intro section for complete acknowledgements... The options are as follows: -d list Use one or more of the provided characters to replace the newline characters instead of the default tab. for each instance of ‘-’. circularly. when list is exhausted the first character from list is reused.merge corresponding or subsequent lines of files SYNOPSIS paste [-s] [-d list] file . standard input is read one line at a time. Strictly confidential and proprietary paste ( 1 ) NAME paste . and >0 if an error occurs. This continues until a line from the last input file (in default operation) or the last line in each file (using the -s option) is displayed. The newline character of every line except the last line in each input file is replaced with the tab character. ORIGIN Paste includes software developed by the University of California. If end-offile is reached on an input file while other input files still contain data. Concatenate all of the lines of each separate input file in command line order. and writes the resulting lines to standard output. replacing all but the last file’s newline characters with a single tab character. at which time paste begins selecting characters from the beginning of list again. DESCRIPTION The Paste utility concatenates the corresponding lines of the given input files.User Commands Property of BladeLogic. The paste utility exits 0 on success. Inc. the standard input is used. Berkeley and its contributors.8 Last change: NSH 1 . The following special characters can also be used in list: Any other character preceded by a backslash is equivalent to the character itself.e. SEE ALSO cut(1) SunOS 5. i. If ‘-’ is specified for one or more of the input files. unless otherwise specified by the -d option. The characters in list are used circularly.. the file is treated as if it were an endless source of empty lines. \n \t \ \0 -s newline character tab character backslash character Empty string (not a null character).

The table of contents will contain the members of the archive file whose pathnames match the specified patterns. The table of contents contains one filename per line and is written using single line buffering.. pax copies the file operands to the destination directory.. The effect of the copy is as if the copied files were written to an archive file and then subsequently extracted. When a file operand is also a directory.. [-G group] .. [-T [from_date] [. and list the members of an archive file.. The presence of the -r and the -w options specifies which of the following functional modes pax will operate under: list. pax will read an archive file from standard input. [file . [-s replstr] . -w -r -w NSH 1 .... When an extracted file is a directory. [-U user] . pax reads a list of files to copy with one per line from the standard input. [-U user] ... Strictly confidential and proprietary pax(1) NAME pax. pax reads a list of files to copy with one per line from standard input.... If you do not specify any file operands. [-o options] ... and write a table of contents to standard output. -r Read. [-G group] . Write. [-G group] .. The setting of ownership..read and write file archives and copy directory hierarchies SYNOPSIS tar -[bcefmprutvwxBLPX[0-9]] [option arguments] [files ...] pax -r [-cdiknuvDYZ] [-f archive] [-o options] . <none> List...pax(1) Property of BladeLogic. see the section below.] directory DESCRIPTION pax will read. and supports a wide variety of different archive formats.. [-T [from_date] [.] pax [-cdnv] [-f archive] [-s replstr] . [-U user] .. and file mode of the extracted files are discussed in more detail under the -p option. read.. write.to_date]] .. [-G group] .. pax writes an archive containing the file operands to standard output using the specified archive format.to_date] [/[c][m]]] .] pax -r -w [-diklntuvDHLPXYZ] [-p string] . The result of a copy under these conditions is unpredictable. pax will read an archive file from standard input.. [-s replstr] .. For a list of supported archive formats... While processing a damaged archive during a read or list operation. the entire file hierarchy rooted at that directory will be included. Warning: The destination directory must not be one of the file operands or a member of a file hierarchy rooted at one of the file operands. If you do not specify any file operands.tar .to_date]] . [pattern .. Copy.. The archive format and blocking is automatically determined on input.. [pattern ... pax will attempt to recover from media defects and will search through the archive to locate and process the largest number of archive members possible (see the -E option for more details on error handling). [-T [from_date] [.. see the -x option. and extract the archive file members whose pathnames match the specified patterns.to_date] [/[c][m]]] .. Inc. pax also supports a tar interface if the basename of argv[0] is tar. When a file operand is also a directory the entire file hierarchy rooted at that directory will be included. except that there may be hard links between the original and the copied files (see the -l option below). pax extracts the entire file hierarchy rooted at that directory. All extracted files are created relative to the current file hierarchy.. For a description of tar options.... [-B bytes] [-T [from_date] [... [-p string] ... [-E limit] [-U user] .. and copy. pax operation is independent of the specific archive format....] pax -w [-dituvHLPX] [-b blocksize] [[-a] [-f archive]] [-x format] [-s replstr] .. [file . access and modification times. write. and will copy directory hierarchies.

Strictly confidential and proprietary pax(1) OPERANDS There are three types of operands: directory operands. If you try to append to an archive. Warning: Many storage devices are not able to support the operations necessary to perform an append operation. If any intermediate directories are needed in order to extract an archive member. -b blocksize Tells pax the size of the output block (bytes per write) it should use when writing an archive. If you do not supply a pattern operand. pax selects the entire file hierarchy rooted at that directory. blocksize must be a positive decimal integer that is a multiple of 512 bytes. Tape drives in particular are more likely to not support an append operation. pax will exit with a non-zero exit status. A specific archive device may impose additional restrictions on the size of blocking it will support. overriding the default standard input (for list and read) or standard output (for write).pax(1) Property of BladeLogic. pax selects archive members using the pattern matching notation described by fnmatch(3). or if it is not of type directory. Cause files of type directory being copied or archived. pax exits immediately with a non-zero exit status. S_IRWXG. or if it is not writable by the user. pax will prompt for the pathname of the file or -w -a -f archive NSH 2 . If you do not specify any file operands. A single archive may span multiple files and different archive devices. and will continue to use that blocking size for the remainder of the archive volume. Inc. to match only the directory file or archive member and not the file hierarchy rooted at the directory. OPTIONS -r Read an archive file from standard input and extract the specified files. or archive members of type directory being extracted. When a file operand does not select at least one archive member. When a pattern operand does not select at least one archive member. When a pattern matches a directory. You can separate a pair of blocksizes by x to indicate a product. pax will observe the blocking size being used in the archive volume where the writing starts. Its maximum is 32256 bytes. Append files to the end of a previously written archive. and file operands. respectively. If you do not specify an archive format -x option. using a format different from the archive’s existing format. An archive stored in a regular file system file or on a disk device will usually support an append operation. pax selects all members of the archive. pax uses the archive’s existing format. If the directory operand does not exist. pax reads standard input for a list of pathnames with one per line without any leading or trailing <blanks>. A blocksize can end with k or b to specify multiplication by 1024 (1K) or 512. Write files to the standard output in the specified archive format. The pattern operand is used to select one or more pathnames of archive members. The directory operand specifies a destination directory pathname. and S_IRWXO as the mode argument. these directories will be created as if mkdir(2) was called with the bitwise inclusive OR of S_IRWXU. Any attempt to append to an archive stored on such a device may damage the archive or have other unpredictable results. pattern operands. The file operand specifies the pathname of a file to be copied or archived. -c -d Match all file or archive members except those specified by the pattern and file operands. When required. pax will write these pattern operands in a diagnostic message to standard error and then exit with a nonzero exit status. If you do not specify a block size. pax will write these file operand pathnames in a diagnostic message to standard error and then exit with a non-zero exit status. When the selected archive format supports the specification of linked files and these files cannot be linked while the archive is being extracted. pax will write a diagnostic message to standard error and exit with a non-zero exit status at the completion of operation. the default block size depends on the specific archive format being used (see the -x option). Specify archive as the pathname of the input or output archive.

Inc. Preserve everything -. Otherwise. If this line consists of a single period.the user ID. These options are specific to the archive format specified by -x.pax(1) Property of BladeLogic. Select the first archive member that matches each pattern operand. Do not preserve file modification times. or the user ID and group ID are not preserved for any reason. someone with all the appropriate privileges. The file times are preserved by default. NSH 3 . -i pax(1) Interactively rename files or archive members. subject to the permissions of the invoking process. -k -l -n -o options Information to modify the algorithm for extracting or writing archive files. If neither the e nor the o specification character is specified. group ID. pax will prompt to /dev/tty giving the name of the file. If the preservation of any of these items fails for any reason. m. and p (described below). the one(s) given last will take precedence. if -p eme is specified. The meanings of the specification characters are: a e Do not preserve file access times. pax processes the file or archive member with no modification to its name. This intended to be used by a user with regular privileges who wants to preserve all aspects of the file other than the ownership. and you can specify multiple -p options. The string consists of the specification characters a. By default. o. When pax matches members of type directory. The string option-argument is a string specifying file characteristics to be retained or discarded on extraction. This is intended to be used by root. in order to preserve all aspects of the files as they are recorded in the archive. file modification times are still preserved. file mode bits. The e flag is the sum of the o and p flags. pax makes hard links between the source and destination file hierarchies whenever possible. Link files. pax will not set the S_ISUID (setuid) and S_ISGID (setgid) bits of the file mode. In general. Preserve the file mode bits. Failure to preserve these items will affect the final exit status. You can concatenate multiple characteristics within the same string. options take the form: name=value -p string Specify one or more file characteristic options (privileges). its modification time. By default. If the file characteristic letters in any of the string option-arguments are duplicated or conflict with each other. file access time. and file modification time. Do not overwrite existing files. pax skips the file or archive member. For each archive member matching a pattern operand or each file matching a file operand. Otherwise the attribute of the extracted file is determined as part of the normal file creation action. ‘preserve’ indicates that an attribute stored in the archive is given to the extracted file. In the copy mode ( -r -w). Strictly confidential and proprietary device of the next volume in the archive. (This option is the letter ell). Match no more than one archive member for each pattern. pax preserves file modification times whenever possible. pax replaces its name with the contents of the line. Preserve the user ID and group ID. For example. If this line is blank. pax will then read a line from /dev/tty. m o p In the preceding list. pax will write a diagnostic message to standard error. e. but will not cause the extracted file to be deleted. pax preserves file access times whenever possible. it also matches the file hierarchy rooted at that directory (unless -d is also specified). pax will immediately exit with a non-zero exit status if <EOF> is encountered when reading a response or if /dev/tty cannot be opened for reading and writing. but two other flags are offered to disable this and use the time of extraction instead. its file mode and.

2 (‘‘POSIX’’) standard. a file system member with the same name as an archive member will be written to the archive if it is newer than the archive member. produce a verbose table of contents using the format of the ls(1) utility with the -l option. Inc.pax(1) -s replstr Property of BladeLogic. For pathnames representing a hard link to a previous member of the archive. Any non-null character can be used as a delimiter (/ is shown here). The default blocksize for this format is 5120 bytes. During write. Ignore files that are older (having a less recent file modification time) than a pre-existing file or archive member with the same name. pax currently supports the following formats: cpio The extended cpio interchange format specified in the IEEE Std1003. pax applies the expressions in the order you specify them on the command line. During a list operation. The optional trailing p will cause the final result of a successful substitution to be written to standard error in the following format: <original pathname> >> <new pathname> File or archive member names that substitute to the empty string are not selected and will be skipped. and is written only after the file has been read or written. The format of these regular expressions is: /old/new/[gp] As in ed(1). \n (where n is a digit) back-references. the output has the format: <ls -l listing> => <link name> Where <ls -l listing> is the output format specified by the ls(1) utility when used with the -l option. The old string may also contain <newline> characters. The default blocksize for this format is 5120 bytes. This format is not very portable. -x format Specify the output archive format. terminating with the first successful substitution. do not use this format if other formats are -v bcpio NSH 4 . the file in the destination hierarchy is replaced by the file in the source hierarchy or by a link to the file in the source hierarchy if the file in the source hierarchy is newer. and copy). old is a basic regular expression and new can contain an ampersand (&). Otherwise. or subexpression matching. the output has the format: <ls -l listing> == <link name> For pathnames representing a symbolic link. You can specify multiple -s expressions. for all the other operational modes ( read. with the default format being ustar. Strictly confidential and proprietary pax(1) Modify the file or archive member names specified by the pattern or file operands according to the substitution expression replstr. During copy. write. If this format truncates inode and device information about a file (used for detecting file hard links). The trailing <newline>. During read. read or accessed them. The old binary cpio format. The optional trailing g continues to apply the substitution expression to the pathname substring which starts with the first character following the end of the last successful substitution. an archive member with the same name as a file in the file system will be extracted if the archive member is newer than the file. The first unsuccessful substitution stops the operation of the g option. pax writes pathnames and flushes them to standard error without a trailing <newline> as soon as processing begins on that file or archive member. pax detects the truncation and repairs it. Therefore. using the syntax of the ed(1) utility regular expressions. is not buffered. -t -u Reset the access times of any file or directory that pax read or accessed to be the same as they were before pax.

-D This option is the same as the -u option. Warning: Use this option only when writing an archive to a device that supports an end of file read condition based on last (or largest) write offset (such as a regular file or a tape drive). This is the default mode. A pair of bytes limits can be separated by x to indicate a product.pax(1) Property of BladeLogic. A limit of NONE will cause pax to attempt to recover from read errors forever. pax detects the truncation and repairs it. Follow all symbolic links to perform a logical file system traversal. The old BSD tar format as found in BSD4. You can supply multiple -G options. and directories will be archived (other file system types are not supported). If this format truncates inode and device information about a file (used for detecting file hard links). k. Strictly confidential and proprietary pax(1) available. Typical archive format restrictions include (but are not limited to): file pathname length. file size. Inc. a numeric gid. The default blocksize for this format is 5120 bytes. 1024 (1K) or 512. pax detects the truncation and repairs it. gid. -E limit Limit the number of consecutive read faults while trying to read a flawed archive to the number specified here. because pax may get stuck in an infinite loop on a very badly flawed archive. etc.) is newer than a copy of the file in the destination directory. a -o option can be used when writing an archive to omit the storage of directories. With a positive limit. sv4crc tar ustar pax will detect and report any file that it is unable to store or extract as the result of any specific archive format restrictions. Do not follow symbolic links. A limit of 0 will cause pax to stop operation after it detects the first read error on an archive volume.3. -B bytes Limit the number of bytes written to a single archive volume to the value you specify here. Checking stops with the first match. Pathnames stored by this format must be 100 characters or less in length. -G group Select a file based on its group name. The default blocksize for this format is 5120 bytes. NSH 5 . Pathnames stored by this format must be 250 characters or less in length. The file inode change time can be used to select files whose inode information (for example. soft links. sv4cpio The System V release 4 cpio. If this format truncates inode and device information about a file (used for detecting file hard links). uid. For backwards compatibility with even older tar formats. pax will attempt to recover from an archive read error and will continue processing starting with the next file stored in the archive. -H -L -P Follow only command line symbolic links while performing a physical file system traversal. The System V release 4 cpio with file crc checksums. or b to specify multiplication by 1048576 (1M). If this format truncates inode and device information about a file (used for detecting file hard links). hard links. You can use a ’´ to escape the #.2 (‘‘POSIX’’) standard. We do not recommend using this option with a floppy or hard disk. link pathname length and the type of the file. The bytes limit can end with m. perform a physical file system traversal. Only regular files. or when starting with a #. Warning: Use NONE with extreme caution. respectively. This option takes the form: -o write_opt=nodir The extended tar interchange format specified in the IEEE Std1003. except that pax checks the file inode change time instead of the file modification time. The default limit is a small positive number of retries. The default blocksize for this format is 10240 bytes. pax detects the truncation and repairs it. Instead. The default blocksize for this format is 10240 bytes. The individual archive formats may impose additional restrictions on use.

Then the -Y and -Z options will be applied based on the final pathname.ss] Where yy is the last two digits of the year. -G. the names of these selected files. The minute field mm is required. pax selects all files with a modification or inode change time equal to or older than the to-date. You can supply multiple -U options. archive members are selected based only on the user specified pathnames as modified by the -n. Checking stops with the first match. When archiving files during a write operation. dd is the day of the month (from 01 to 31). pax selects all files with a modification or inode change time equal to or younger than the fromdate. hh is the hour of the day (from 00 to 23). The inode change time comparison is useful in selecting files whose attributes were recently changed. the names of these selected files. When extracting files during a read operation. the second mm is the minute (from 00 to 59). and ss is the seconds (from 00 to 59). or when starting with a #. except that pax checks the modification time using the pathname created after all the file name modifications have completed. -T. Strictly confidential and proprietary pax(1) -T [from_date][. A ’´ can be used to escape the #. Finally the -v option will write the names resulting from these modifications. and -Z) interact as follows. file modification or both) pax should use in the comparison. Inc. A time range is made up of six different fields. or selecting files that were recently created and had their modification time reset to an older time (as happens when a file is extracted from an archive and the modification time is preserved). pax defaults to using the file modification time only. Time comparisons using both file times are useful when you are using pax to create a time based incremental archive (only files that were changed during a specified time range will be archived). The ss field may be added independently of the other fields. you can use the optional trailing field [c][m] to specify which file time (inode change. the last time there was a change of owner. so -T 1234/cm would select all files with a modification or inode change time of 12:34 PM today or later. while the other fields are optional and must be added in the following order: hh. This option is the same as the -u option. -u. -n. pax selects only files with a modification or inode change time of exactly that time. You can supply multiple -T time ranges. -i. -n. or copying files during a copy operation. for example. -U. Checking stops with the first match. Time ranges are relative to the current time. mode. If you specify neither. The m tells pax to compare the file modification time (the time when the file was last written). -u. When the from_date is equal to the to_date. archive members are selected based only on the user specified pattern operands as modified by the -c. -G. -Y -Z The options that operate on the names of files or archive members ( -c. etc). group. Each field must contain two digits. -T. When traversing the file hierarchy specified by a pathname. -G. mm. See the st_dev field as described in stat(2) for more information about device IDs. -s. and -U options (the -D option applies only during a copy operation). -U options. -D. -D. If you supply only a from_date. -u. Then during a copy operation the -Y and the -Z options will be applied based on the final pathname. If you specify both c and m.pax(1) Property of BladeLogic. The c tells pax to compare the inode change time (the time when the file inode was last changed. dd.to_date][/[c][m]] Allow files to be selected based on a file modification or inode change time falling within a specified time range of from_date to to_date (the dates are inclusive). This option is the same as the -D option. -D. Then any -s and -i options will modify in that order. The format is: [yy[mm[dd[hh]]]]mm[. -T. If you supply only a to_date. a numeric uid. When pax is in the write or copy mode. Finally the -v option will write the names NSH 6 . -Y. except that pax checks the inode change time using the pathname created after all the file name modifications have completed. -v. then pax compares both the modification time and the inode change time. do not descend into directories that have a different device ID. the first mm is the month (from 01 to 12). Then any -s and -i options will modify in that order. yy. -U user -X Select a file based on its user name.

pax(1) If you specify one or both of the -u or -D options. Do not preserve modification time. Follow symlinks.. NSH 7 . copies the contents of the current directory to the device /dev/rst0. Stop after first error. group ID. Append to the archive. Strictly confidential and proprietary resulting from these modifications. The following commands: mkdir newdir cd olddir pax -rw .’ -f a. Extract data from archive. newdir will copy the entire olddir directory hierarchy to newdir. Do not pass over mount points in the file system. access/modification times. Create an archive. TAR OPTIONS The pax utility supports a tar interface if the basename of argv[0] is tar.pax(1) Property of BladeLogic. pax does not select a file unless it is newer than the file to which it is compared.ˆ//*usr//*. file mode. Verbose operation mode. b c e f m p r u t v w x H L P X The respective argument is the desired blocksize to use. In this case the following options are supported. along with the -n option. Interactive file rename. with all files rooted in ‘‘/usr’’ into the archive extracted relative to the current directory. The command: pax -r -s ’. The command: pax -r -v -f filename gives the verbose table of contents for an archive stored in filename. Append to the archive. List contents of the tape.pax reads the archive a. Do not follow symlinks. Inc. Preserve user ID. The respective argument is the name of the archive to create/view/update. Follow command line symlinks only.pax. [14578] Use tape device /dev/rmt/ N EXAMPLES The command: pax -w -f /dev/rst0 .

The command: pax -r -pe -U root -G bin -f a. -E. or file mode when the -p option is specified. Whenever pax cannot create a file or a link when reading an archive or cannot find a file when writing an archive. In the case where pax cannot create a link to a file. -T. or cannot preserve the user ID. the archive formats bcpio.pax(1) The command: pax -rw -i . it exits with a non-zero exit status. STANDARDS The pax utility is a superset of the IEEE Std1003. pax may have only partially extracted a file the user wanted. and the flawed archive handling during list and read operations are extensions to the POSIX standard. ORIGIN pax includes software developed by the University of California.pax will extract all files from the archive a. but continues processing.pax that are owned by root with group bin and will preserve all file permissions. -Z. ERRORS pax will exit with one of the following values: 0 All files were processed successfully. -U. -H. and the modification and access times may be wrong. sv4crc. Inc. Berkeley and its contributors. If the creation of an archive is prematurely terminated by a signal or error. sv4cpio. pax writes a diagnostic message to standard error and when pax completes. The command: pax -r -w -v -Y -Z home /backup will update (and list) only those files in the destination directory /backup that are older (less recent inode change or file modification times) than files with the same name found in the source file tree home. -L. NSH 8 . If the extraction of a file from an archive is prematurely terminated by a signal or error. Strictly confidential and proprietary pax(1) can be used to interactively select the files to copy from the current directory to dest_dir. -P. -D. The options -B. -Y. 1 An error occurred. pax writes a diagnostic message to standard error and returns a non-zero exit status. Additionally. pax will not create a second copy of the file. group ID. pax detects a file is about to overwrite itself. while doing a copy. pax may have only partially created the archive which may violate the specific archive format specification. pax does not copy the file. If. dest_dir Property of BladeLogic. the file modes of extracted files and directories may have incorrect file bits. -G.2 (‘‘POSIX’’) standard. tar.

such as /bin/sh. address arguments. When you use the -d option to install a directory of packages in file system format (not a single file datastream). copying the necessary files to those target hosts. admin. and then will selectively copy those packages (directories) to each target host. The pkgadd wrapper utility works by automatically determining which files (package.06-sol8-sparc-local Install a package on a remote host where the package file exists on the local host.P. address of the host on which you want to install the package.P. and/or response) need to be copied to each target host. Because the pkgadd utility acts as a wrapper utility that eventually executes the pkgadd command on the target Solaris server. You can specify multiple hostname/I. pkgadd will selectively copy just the package needed for the installation. /bin/ksh. For example. Strictly confidential and proprietary pkgadd(1) NAME pkgadd − Network Shell wrapper to pkgadd command SYNOPSIS pkgadd [-h host1 [hostn]] [-T tmpdir] <pkgadd arguments> DESCRIPTION The Network Shell version of pkgadd is a distributed utility wrapped around the Solaris pkgadd utility. pkgadd installs the package the host from which you executed the package command. it needs a staging area to hold all files required for the installation. the pkgadd command will emulate the standard pkgadd command. If you do not use this option. OPTIONS The pkgadd wrapper understands all the standard pkgadd command options as well as the options below. solaris # pkgadd -d SUNWppm Install a package on the local system where the package file exists on the remote host athens. This utility lets you install Solaris packages onto any number of remote (or local) hosts.pkgadd(1) Property of BladeLogic. pkgadd supports both individual files as well as directories. Install a package on the local system where the package file also exists on the local system. Defines an alternative directory for the default staging directory /tmp. The packages you install. etc. It will first determine which packages you want to install. -h host The resolvable hostname or I. can reside on any server. including remote servers. solaris # pkgadd -d //athens/tmp/bc-1. and executing the Solaris pkgadd command with the selected arguments on the target hosts. solaris # pkgadd -h rome -d SUNppm The previous example could have also been done from the Network Shell as follows: solaris # cd //rome/tmp rome # pkgadd -d //@/cdrom/cdrom0/s0/Solaris_8/Product/SUNWppm NSH 1 . rather than copying a complete CDROM to a remote host in order to install a single package. Inc. as well as any optional response or admin files. The following examples are meant to work from within the Network Shell environment and may not necessarily work on any Solaris standard shell. <pkgadd arguments> See the man section for the pkgadd (1M) command to see what options the pkgadd command supports. -T tmpdir EXAMPLES The pkgadd wrapper is designed for use from within the Network Shell (nsh).

pkgadd(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary

pkgadd(1)

Install a package on a remote host where the package file exists on that same remote host. solaris # cd //budapest/tmp budapest # pkgadd -d apache-1.3.12-sol8-sparc-local.gz Install a package on two remote hosts where the package file exists on the local host. solaris # pkgadd -h rome paris -d SUNWppm Install a package on a remote host where the package file (directory) exists on a different remote server. solaris # pkgadd -h london -d //athens/cdrom/cdrom0/s0/Solaris_8/Product

DIAGNOSTICS
pkgadd has several of its own self-explanatory diagnostic messages. It also outputs all messages from the execution of the remote pkgadd command.

EXIT CODES
pkgadd exits with a zero value if all package adds work successfully. If a remote pkgadd commands fails, it returns an exit code of 6. General errors return an exit code of 1.

CAVEATS
When installing a remote package to a series of hosts where the remote package is being copied from a (slower) WAN to hosts on a (faster) LAN, there is no option to tell the pkgadd command to copy the remote package into the LAN environment first and then copy the package to each of the remote hosts. Instead, pkgadd copies the package from the WAN to the LAN for each host. You can install packages only on Solaris hosts, as reported by the uname system call (looking for "SunOS").

ORIGIN
The pkgadd wrapper utility was written by Thomas Kraus.

SEE ALSO
pkgadd(1M), nsh(NSH).

NSH

2

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

pr ( 1 )

NAME

pr - print files
SYNOPSIS

pr [+page] [-column] [-adFmrt] [[-e] [char] [gap]] [-h header] [[-i] [char] [gap]] [-l lines] [-o offset] [[-s] [char]] [[-n] [char] [width]] [-w width] [-] [file ...]
DESCRIPTION

The pr utility is a printing and pagination filter for text files. When multiple input files are specified, each is read, formatted, and written to standard output. By default, the input is separated into 66-line pages, each with A 5-line header with the page number, date, time, and the pathname of the file. A 5-line trailer consisting of blank lines. If standard output is associated with a terminal, diagnostic messages are suppressed until the pr utility has completed processing. When multiple column output is specified, text columns are of equal width. By default text columns are separated by at least one <blank>. Input lines that do not fit into a text column are truncated. Lines are not truncated under single column output.
OPTIONS

In the following option descriptions, column, lines, offset, page, and width are positive decimal integers and gap is a nonnegative decimal integer. +page Begin output at page number page of the formatted input. -column Produce output that is columns wide (default is 1) that is written vertically down each column in the order in which the text is received from the input file. The options -e and -i are assumed. This option should not be used with -m. When used with -t , the minimum number of lines is used to display the output. -a Modify the effect of the -column option so that the columns are filled across the page in a roundrobin order (e.g., when column is 2, the first input line heads column 1, the second heads column 2, the third is the second line in column 1, etc.). This option requires the use of the -column option. Produce output that is double spaced. An extra <newline> character is output following every <newline> found in the input.

-d

-e [char][gap] Expand each input <tab> to the next greater column position specified by the formula n∗gap+1, where n is an integer > 0. If gap is zero or is omitted the default is 8. All <tab> characters in the input are expanded into the appropriate number of <space>s. If any nondigit character, char, is specified, it is used as the input tab character. -F -h header header Use the string header to replace the file name in the header line. -i [char][gap] In output, replace multiple <space>s with <tab>s whenever two or more adjacent <space>s reach column positions gap+1, 2∗gap+1, etc. If gap is zero or omitted, default <tab> settings at every eighth column position is used. If any nondigit character, char, is specified, it is used as the output <tab> character. -l lines Override the 66 line default and reset the page length to lines. If lines is not greater than the sum of both the header and trailer depths (in lines), the pr utility suppresses output of both the header and trailer, as if the -t option were in effect. Use a <form-feed> character for new pages, instead of the default behavior that uses a sequence of <newline> characters.

SunOS 5.8

Last change: NSH

1

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

pr ( 1 )

-m

Merge the contents of multiple files. One line from each file specified by a file operand is written side by side into text columns of equal fixed widths, in terms of the number of column positions. The number of text columns depends on the number of file operands successfully opened. The maximum number of files merged depends on page width and the per process open file limit. The options -e and -i are assumed.

-n [char][width] Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies the first width column positions of each text column or each line of -m output. If char (any nondigit character) is given, it is appended to the line number to separate it from whatever follows. The default for char is a <tab>. Line numbers longer than width columns are truncated. -o offset Each line of output is preceded by offset <spaces>s. If the option is not specified, the default is zero. The space taken is in addition to the output line width. -r -s char -t Write no diagnostic reports on failure to open a file. Separate text columns by the single character char instead of by the appropriate number of <space>s (default for char is the <tab> character). Print neither the five-line identifying header nor the five-line trailer usually supplied for each page. Quit printing after the last line of each file without spacing to the end of the page.

-w width Set the width of the line to width column positions for multiple text-column output only. If the -w option is not specified and the -s option is not specified, the default width is 72. If the -w option is not specified and the -s option is specified, the default width is 512. file A pathname of a file to be printed. If no file operands are specified, or if a file operand is ‘-’, the standard input is used. The standard input is used only if no file operands are specified, or if a file operand is ‘-’.

The -s option does not allow the option letter to be separated from its argument, and the options -e, -i , and -n require that both arguments, if present, not be separated from the option letter.
ERRORS

If pr receives an interrupt while printing to a terminal, it flushes all accumulated error messages to the screen before terminating.
EXIT CODES

The pr utility exits 0 on success, and 1 if an error occurs. Error messages are written to standard error during the printing process (if output is redirected) or after all successful file printing is complete (when printing to a terminal).
SEE ALSO

cat(1), more(1)
ORIGIN

Pr includes software developed by the University of California, Berkeley and its contributors. Please see the intro section for complete acknowledgements.

SunOS 5.8

Last change: NSH

2

prune(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary

prune(1)

NAME
prune − prune log files to specified size

SYNOPSIS
prune

DESCRIPTION
prune is a utility that prunes log files to a specific size. prune clips off the tops of the log files to shorten them. prune reads the file share/prune/prune_list (from the Network Shell install directory) to find the names of the files to prune. Each line of prune_list should consist of two white space separated fields. The first field is the name of the file you want to prune and the second field is the size in KB that the file should be pruned to. Lines beginning with a ’#’ are treated as comment lines and are ignored. prune was designed to run from cron. When running from cron with root privileges be sure to allow root access on remote hosts in order for prune to work (See exports(1)).

AUTHORS
prune was originally written by Ray Davis, with modifications made by Thomas Kraus.

NSH

1

putcert(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary

putcert(1)

NAME
putcert − push a certificate generated by bl_gen_ssl to one or more servers

SYNOPSIS
putcert user_name id.pem server1 [<server2> <server2>]

DESCRIPTION
The putcert command pushes a certificate that was generated by the bl_gen_ssl command to one or more servers. When the putcert command is issued, BladeLogic places the public key in a file called <user_name>. The file resides in the /nsh/certs directory on UNIX-style servers and in /Program Files/BladeLogic/RSC/certs on Windows servers.

OPTIONS
user_name The name of the user who created the certificate by running bl_gen_ssl. id.pem The path to the id.pem file generated by the bl_gen_ssl command. server1 [<server2> <server2>] A space-delimited list of the names or IP addresses of the servers to which the certificate should be pushed.

EXAMPLE
putcert gopal id.pem linuxBuild solarisQA

ORIGIN
putcert was developed by BladeLogic, Inc.

SEE ALSO
bl_gen_ssl(NSH), nukecert(NSH)

NSH

1

putlic(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary

putlic(1)

NAME
putlic − License remote agents

SYNOPSIS
putlic

DESCRIPTION
The putlic command is meant to be used in conjunction with the getlic command. The basic idea is to let you remotely license multiple servers. The getlic command gathers necessary license information from each remote host, and places this information in a file called license.raw. BladeLogic’s licensing web page takes this file and creates a file called license.dat. putlic uses license.dat to license the remote agents. The license.dat file can contain multiple entries, one per line. Each entry consists of a hostname, a product code, a license key, and an optional expiration key. putlic sends this data to each remote host (listed in the first field of each entry) and creates an appropriate license based on the data.

USAGE
The putlic command takes an optional argument that specifies the name of the file containing the license data. If you do not specify a file name, putlic defaults to using the license.dat file. host $ putlic Host bombay successfully licensed Host madras successfully licensed

CAVEATS
To install new licenses on remote UNIX-style machines, you usually need root privileges.

ORIGIN
putlic was written by Thomas Kraus

SEE ALSO
getlic(NSH), agentinfo(NSH).

NSH

1

redi(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary

redi(1)

NAME
redi − redirect input to a file

SYNOPSIS
redi [-?] [-a] filename

DESCRIPTION
redi reads the standard input and writes it to filename. If the file does not exist, redi creates it. The primary purpose of this utility is to let you perform distributed redirection. In other words, you can use redi as a replacement for the output redirection sh(1) commands (> and >>) in a distributed environment by piping the data to the redi command.

OPTIONS
-a -? Append to the file instead of overwriting the file. If the file does not exist, create it. Equivalent to the >> command. Output a brief summary of available options and then exit with a zero status without redirecting any input. $ wc *.c | redi files.wc This would be equivalent to: $ wc *.c > files.wc The following example appends the data found by the fgrep utility into the file /etc/users.bad on host vaduz. $ fgrep evil /etc/passwd | redi -a //vaduz/etc/users.bad

EXAMPLE

DIAGNOSTICS
redi: Unable to redirect output to file filename redi was unable to create or append to the file filename. redi: Error redirecting output to file filename An error occurred while trying to write data to the named output file. This message will be followed by system error message offering a possible reason for the error.

EXIT CODES
0 1 2 255 No errors detected. You specified an unknown option. An error occurred in redirecting the data to the named output file. Unable to get a license to use the software.

ORIGIN
redi was written by Thomas Kraus

SEE ALSO
sh(1).

NSH

1

RENICE ( 8 )

Property of BladeLogic, Inc. BSD System Manager’s Manual Strictly confidential and proprietary

RENICE ( 8 )

NAME renice – alter priority of running processes SYNOPSIS renice priority [ [ –p] pid ...] [ [ –g] pgrp ...] [ [ –u] user ...] DESCRIPTION Renice alters the scheduling priority of one or more running processes. The following who parameters are interpreted as process ID’s, process group ID’s, or user names. Renice’ing a process group causes all processes in the process group to have their scheduling priority altered. Renice’ing a user causes all processes owned by the user to have their scheduling priority altered. By default, the processes to be affected are specified by their process ID’s. Options supported by renice: –g –u –p Force who parameters to be interpreted as process group ID’s. Force the who parameters to be interpreted as user names. Resets the who interpretation to be (the default) process ID’s.

For example, renice +1 987 -u daemon root -p 32 would change the priority of process ID’s 987 and 32, and all processes owned by users daemon and root. Users other than the super-user may only alter the priority of processes they own, and can only monotonically increase their ‘‘nice value’’ within the range 0 to PRIO_MAX (20). (This prevents overriding administrative fiats.) The super-user may alter the priority of any process and set the priority to any value in the range PRIO_MIN (–20) to PRIO_MAX. Useful priorities are: 20 (the affected processes will run only when nothing else in the system wants to), 0 (the ‘‘base’’ scheduling priority), anything negative (to make things go very fast). FILES /etc/passwd to map user names to user ID’s SEE ALSO getpriority(2), setpriority(2) BUGS Non super-users can not increase scheduling priorities of their own processes, even if they were the ones that decreased the priorities in the first place. The Linux kernel (at least version 2.0.0) and linux libc (at least version 5.2.18) does not agree entierly on what the specifics of the systemcall interface to set nice values is. Thus causes renice to report bogus previous nice values. HISTORY The renice command appeared in 4.0BSD.

4th Berkeley Distribution

June 9, 1993

1

rm(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary

rm(1)

NAME
rm − Remove a file

SYNOPSIS
rm [-] [-firRv?] file ...

DESCRIPTION
rm removes the named files. rm removes a file by unlinking it from its parent directory. If this link was the last link the file had, then rm also destroys the file. rm does not remove directories unless you use the -r option. In this case, rm deletes ALL files and subdirectories in the named directory.

OPTIONS
-f -i This option causes rm not to output any error messages that occur. This option causes rm to first prompt the user to see if rm should remove the file/directory. If the user confirms with an entry beginning with the letter y, then rm removes the file/directory. See UNIVERSE BEHAVIOR for details on how this option interacts with the -f option. If any of the named arguments is a directory, then rm will recursively descend the directory and try to remove all files and sub-directories below it. Same as -r Output a message for each file or directory to be removed. Useful for monitoring recursive file removal. This option causes rm to treat the remaining arguments as file names. This can be useful when trying to remove a file starting with the character ’-’. Output a brief summary of available options and then exit with a zero status without removing any files. File to be removed

-r -R -v -? file

EXAMPLE
The first example removes all .old files in the directory /tmp The second example removes all .old files in the directory /u1/data on host helsinki. $ rm /tmp/*.old $ rm -frv //helsinki/u1/data/*.old

DIAGNOSTICS
rm: filename non existent You asked rm to remove a file that does not exist. rm: dirname is a directory You asked rm to remove a directory without using the -r option. rm: Unable to access directory dirname When removing a directory recursively, rm was unable to access a directory within the directory hierarchy. rm: Unable to remove file filename There was a problem in removing the file filename. rm: Unable to remove directory dirname There was a problem in removing the directory dirname.

EXIT CODES
0 1 No errors detected. You specified an unknown option.

NSH

1

rm(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary 2 255 One of the files to be removed was not removable. Unable to get a license to use the software.

rm(1)

CAVEATS
rm will not allow you to delete the directories . and ..

UNIVERSE BEHAVIOR
If both the -i and -f options are used, then with the P_BSD variable set (Berkeley behavior), the -i option will override the -f option. With the P_ATT variable set, the -f option will override the -i option.

ORIGIN
rm was written by Thomas Kraus

SEE ALSO
rmdir(1).

NSH

2

rmdir(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary

rmdir(1)

NAME
rmdir − Remove an empty directory

SYNOPSIS
rmdir [-] [-ifps?] directory ...

DESCRIPTION
rmdir tries to remove the named directories. For a directory to be removed, it must be empty, meaning that it must not contain any files or sub-directories.

OPTIONS
-f -i This option causes rmdir not to output any error messages that occur. This option causes rmdir to first prompt the user to see if the directory should be removed. If the user confirms with an entry beginning with the letter y, then rmdir will remove the directory. See UNIVERSE BEHAVIOR for details on how this option interacts with the -f option. This option causes rmdir to try to also delete any of the named parent directories. If the parent directory is not explicitly named as a component of the directory, then rmdir will not delete it. This option is used in conjunction with the -p option, where if there are any errors in removing a directory, then no error messages are output. This option causes rmdir to treat the remaining arguments as directory names. This can be useful when trying to remove a directory starting with the character ’-’. Output a brief summary of available options and then exit with a zero status without removing any directories. Directory to be removed

-p -s -? directory

EXAMPLE
The first example will first ask for confirmation that the directory mydir should be deleted. The second example deletes the directory mydir/foo and then tries to remove the (parent) directory mydir on host valetta. $ rmdir -i mydir $ rmdir -p //valleta/mydir/foo

DIAGNOSTICS
rmdir: Cannot remove directories . or .. rmdir does not allow you to remove the directories ’.’ and ’..’. If you try to do this, and you are not suppressing error messages, then rmdir displays this message. rmdir: Unable to delete directory dirname If there is an error in deleting the directory dirname, rmdir displays this message, along with a possible explanation of why the operation failed.

EXIT CODES
0 1 2 255 No errors detected. You specified an unknown option. One of the files to be deleted was not accessible. Unable to get a license to use the software.

CAVEATS
By default the command ls does not show hidden files in a directory (files beginning with the character ’.’). Consequently, running ls in a directory may seem to indicate that the directory is empty, but when you try to remove the directory using rmdir, rmdir may complain that the directory is not empty. Use the -a option in ls to find hidden files.

NSH

1

Inc. then with the P_BSD variable set (Berkeley behavior). the -i option will override the -f option. With the P_ATT variable set. NSH 2 . ORIGIN rmdir was written by Thomas Kraus SEE ALSO mkdir(1). the -f option will override the -i option. Strictly confidential and proprietary rmdir(1) UNIVERSE BEHAVIOR If both the -i and -f options are used.rmdir(1) Property of BladeLogic.

3 . it opens a connection on that port and listens for Network Shell client connections. the agent defaults to port 4750. The first way is to start the RSCD agent directly. 2 .If it does not find an entry in either the secure file or in the Internet services database.If it does not find an entry there. it basically attempts to make a connection to the RSCD daemon running on that remote host. With this mechanism. See the -i option for the RSCD agent below. then verifies that it is a valid handshake. It goes through the following steps: 1 . NSH 1 . But first. If it finds an entry. it uses the configured port number. If you started the agent with the -i option (start from inetd) then the fork does not occur. 3 .Based on the client host. Before the client exits. the encryption type and encryption key or keys. If not.It looks for an rscd entry in the secure file. Strictly confidential and proprietary rscd(1) NAME rscd . either from a command line or from a script. Next. it initially accepts the connection and then checks to see if the connection is allowed. If it finds an entry in the database.The agent must now handle the initial handshake between the client and daemon (server). At this time full acceptance of the client has not yet occurred. STARTING THE RSCD AGENT There are two ways to start the RSCD agent. determine how the communication between the two should occur. it looks for an rscd entry in the Internet service database (often /etc/services ). the RSCD agent first turns itself into a daemon. When an RSCD agent receives a connection. 2 . the agent forks off a child process to handle all future requests from that one client (connection). the agent consults the exports file to determine if the client is even allowed to make the connection. If the handshake is valid.Determine the client machine from which the connection is coming. the agent determines and sets appropriate permissions (see below). the Internet services daemon ( inetd ) acts as the master process and just forks off rscd sub-processes as needed. the agent decrypts the data that the client sent. because some of the criteria for acceptance can only be determined after the initial handshake. When it hears a connection. the agent closes the connection. the connection to the agent is closed and the agent terminates. so that it can run in background mode. Once the agent has determined its TCP/IP port. Inc. 1 . the agent closes the connection. the initial handshake will include valuable information about the connecting client.Remote System Call Daemon SYNOPSIS rscd [-D] [-d] [-f] [-i] [-r] [-x] DESCRIPTION The RSCD agent (or daemon) is the piece of software that needs to be installed and running on each remote host. it uses the configured port number. the agent needs to determine the TCP/IP port on which it should be listening. among other things. In this case.Before going any further. If the handshake is invalid (which usually occurs when the encryption type and/or encryption keys do not match). The agent determines its TCP/IP port in the following way. The agent will use this information in further security related checks. If necessary. This master process will eventually fork off sub-processes for client connections as these connections are made and validated. 4 . The second way to start the RSCD agent is through the inetd mechanism. so that the Network Shell utilities can access the host. RSCD AND SECURITY When a Network Shell utility (client) attempts to access a remote host. For now it will proceed and fork off a sub-process to continue handling the acceptance. This information is found in the secure file and includes.rscd(1) Property of BladeLogic.

then the daemon sets the final permissions. and the daemon will just keep trying and trying and trying.Once the daemon has all the relevant information. This option tells the daemon to retry listening on the port every 10 seconds until it succeeds.conf file might look something like this: rscd stream tcp nowait root /opt/nsh/bin/rscd rscd -i When you use this option. ORIGIN rscd was written by Thomas Kraus SEE ALSO exports (1). OPTIONS The RSCD agent accepts the following options: -i Use this option when you are starting the daemon from inetd. and what permissions the client should have. If the client is not allowed to have access.Once it has the initial handshake data. 6 . Output some debug messages. the daemon now consults the users file see if there should be any specific (override) permissions for the connecting user. which includes performing a seteuid and setegid (UNIX type systems only). Sometimes after the master RSCD daemon exits. the daemon sets them. users (1).rscd(1) Property of BladeLogic. Inc. The following options are not recommended for use and exist only for debugging purposes. it decides whether or not the client should have access. After the first client exits the daemon exits as well. the daemon closes the connection without processing any requests. the port it was listening on may continue to be busy for a short time longer. If the client is allowed to have access. the default TCP/IP communications port is not determined by the secure file. A sample entry for the /etc/inetd. Output brief usage description. If there should be overrides. -D -f -d -x Do not go into daemon mode. Note that if the daemon was initiated by inetd then the port will never be free (not being listened on). NSH 2 . but rather by the rscd Internet service entry found in the /etc/services file or other respective configuration file. These are also known as the user overrides. -r This option tells the RSCD daemon to retry listening on the configured TCP/IP port if the port is currently already being listened on. Do not fork. Implied if -i option is used and basically makes the daemon single use. secure (1). Strictly confidential and proprietary rscd(1) 5 .

You obtain the specified user’s permissions by providing the password for the user on the remote host.] DESCRIPTION You can use the rsu command to run a command with a different set of permissions on a remote machine. The specified user’s permissions will override the standard permissions. Inc. If the remote user is not set up this way. Those permissions govern your access to that host. you will be prompted for the user’s password for that host. The user and entered password are then authenticated on the remote server.. EXAMPLE The following example shows a sample session where you can determine your effective UID on the various hosts you are working with. if you rsu root a vi session and enter into a sub-shell. host1 $ NSH 1 .... Normally. just as if you had entered an incorrect password. you can select an alternate user whose permissions will be granted to the selected NSH command you are using to access the remote host. Except when you are using the -p option (see below). you will not get access to the host. When the command accesses a remote host for the first time. $ /bin/nsh host1 $ id uid=503(tmk) gid=600(nsh) host1 $ nexec host2 id uid=503(tmk) gid=600(nsh) host1 $ rsu root nexec host2 id Password for root@host2: uid=0(root) gid=1(other) host1 $ In this example you can look at a restricted file on two hosts $ /bin/nsh host1 $ cat //host2/etc/shadow //host3/etc/shadow cat: Cannot open file //host2/etc/shadow: Permission denied cat: Cannot open file //host3/etc/shadow: Permission denied host1 $ rsu root cat //host2/etc/shadow //host3/etc/shadow Password for root@host2: . you will not gain access to the remote server. With the rsu command. OPTIONS You can configure the RSCD agent to let you rsu to the remote server without having to enter a password. this change in permissions applies only to the selected command. Otherwise the command will continue on with the new permissions. Password for root@host3: . the remote user must be configured on the remote server as a user who does not need a password. when you run an NSH command to access a remote host.. the RSCD agent (NSH server) of that host assigns you a specific set of permissions. If you are accessing multiple hosts. It does not apply to any sub-commands (processes). the sub-shell and subsequent commands you run from the shell will NOT have the new permissions. use the -p option.rsu(1) Property of BladeLogic.. If the user/password combination does not properly authenticate on the remote host. To do this. In other words. you will need to enter the respective password for the user for each host. Strictly confidential and proprietary rsu(1) NAME rsu − Run NSH command with alternate privileges SYNOPSIS rsu [-p] user command [args . For this option to work.

) in the users. and/or exports file must exist. See the users and/or exports man pages for more details. Strictly confidential and proprietary rsu(1) CAVEATS The -p option will work only if the target server has been specifically configured to allow the rsu command to access the server without providing a password.. users.. exports (1). rscd(1) NSH 2 . ORIGIN rsu was written by Thomas Kraus SEE ALSO users(1). Inc.local.rsu(1) Property of BladeLogic. Appropriate entries (rsu=. EXIT CODES rsu exits with the same exit code as that of the finished command.

. Depending on what action you are currently performing.. OPTIONS -c Execute a Network Shell command on each host. hostn] [-e command1 .. your header line would read eng1 belongs to Engineering. The format of this file is one entry per line. commandn] runscript [-v -n -p n] [-H header] [-NH] [-s | -c] [-d directory] [-f file] [-h host1 . This option indicates the host(s) on which you want to run the command. NSH 1 . As with each entry in the file specified with the -f file option. where each entry can be either a hostname or a UNC name. This is implicit if the program name is runcmd -d dirname When you specify the hosts on which you want to run the command. the environment variable NSH_RUNCMD_HOST is set for each sub-command that is run.. Furthermore the environment variable NSH_RUNCMD_DIR is set indicating the current Network Shell path. while runscript runs the given Network Shell script on each machine. you have the option of also specifying a start directory on each host. This option specifies the command to execute.runcmd(1) Property of BladeLogic. All arguments after the -e are assumed to be part of the commands to be executed on each host. If you do not specify a start directory with the host.. you may want to know which host you are dealing with. runcmd and runscript output a brief header before the command is executed. This option must be the last option. -H header By default. which consists of a hostname and directory. hostn] [-e command1 . commandn] DESCRIPTION The programs runcmd and runscript let you run the same command on multiple machines.. To this end. -n This option tells runcmd and runscript not to output a CR (carriage return) after the header. you can specify it using the -d option’s dirname. The -H header option lets you specify a custom header. which consists of a hostname and directory. For example. Inc... Strictly confidential and proprietary runcmd(1) NAME runcmd − Run a Network Shell command on one or more hosts SYNOPSIS runcmd [-v -n -p n] [-H header] [-NH] [-s | -c] [-d directory] [-f file] [-h host1 . if you specified -H "%h belongs to Engineering" for the host eng1. until runcmd and runscript encounter another option (an argument starting with ´-´)... You can specify multiple hosts by putting spaces between host names. The difference between the two is that runcmd executes a shell command. each -h argument can be either a hostname or a UNC name. -f file This option indicates that file file contains the names of the hosts on which the command is to be executed. runcmd and runscript consider all subsequent arguments to be host names. After encountering the -h option.. -e cmd .. This lets you easily differentiate the output that each host produces. -h host . The default header is "==> %h <==" where the macro "%h" is substituted by the name of the host where the program is about to be executed.

This can significantly speed things up. This includes the default header or any header you defined using the -H option. but be advised that since things are running in parallel. ORIGIN runcmd and runscript were written by Thomas Kraus NSH 2 . Strictly confidential and proprietary runcmd(1) -NH -p n This option tells runcmd and runscript not to display a header. In other words. if you are going to make assumptions about the output produced by each instance. This is implicit if the program name is runscript. then these programs will exit with a non-zero status. then these programs will exit with a status of 0. Inc. host% runcmd -h rome athens -d /etc -e ls -l \| wc -c host% runscript -h //rome/bin //athens/bin -e scriptname -script_option host% runcmd -h rome athens paris london -p 2 -e ifconfig ppp down host% runcmd -h rome athens -d /tmp -e sh -c ’echo $NSH_RUNCMD_HOST $NSH_RUNCM ==> rome <== rome //rome/tmp ==> athens <== athens //athens/tmp EXIT STATUS If a command or script is successfully executed on all named hosts.runcmd(1) Property of BladeLogic. the output generated by each instance may overall not be output in a linear way. Tag each line with the name of the host the output is coming from. Run up to n commands/scripts in parallel. you may not want to do things in parallel. Execute a Network Shell script on each host. If an error occurs or if a command or script exits with a non zero status. The host name is preceded by a ( and followed by a ) as in (hostname). Output a brief explanation of the available options. -v -V -s -? EXAMPLE Some simple examples. Output the effective command executed for each host.

If the script refers to an existing file then that file will be the one copied and executed. If it does not refer to an existing file. . Can specify multiple hosts and can also be used in conjunction with the -f file option. EXAMPLE Show all scripts host% scriptutil -l .e. the output (stdout) of the script is sent to stdout on the local machine.. If a name is given.AIX . -d dir -f file The default staging directory for the script is /tmp.[AIX] Audit that UUCP is disabled NSH 1 . scriptutil proceeds as follows for a given script to run on a particular server: 1) 2) 3) 4) 5) 6) Determine remote OS type Look for script name with OS name extension in library directory If not found look for script in library directory as is (no OS name extension) Copy script to remote server Execute script on remote server capturing (and passing through) stdout and stderr Remove script from remote server OPTIONS The following options are supported. The script library is found in <install_directory>/share/sensors. As such.scriptutil(1) Property of BladeLogic. then the script library will be searched with the OS type extension filter applied. -s script Specify the name of the script one want to run on the given remote servers. Scripts in the library with an OS name extension (output of uname command) are treated as overrides for the particular platform (i. As a particular task may have different implementations on various UNIX type servers. With this option one can specify a file to which the output is sent.. when looking to run a script. With this option one can override the staging directory. file contains a list of servers one wants to run the scripts on (one entry per line). Inc.[ALL] Audit non-unique GIDs in /etc/group .] Add host to the list of hosts one wants to run the script on. grp_uniq_gid grp_uniq_grpname net_disabled_uucp..] [-l] [-o file] -s scan [-x arg] DESCRIPTION The idea behind scriptutil is to execute a given script on a remote server without the need to have the script on the given server before the script is executed (if the script already exists on the remote server one can execute the script directly by using nexec). Strictly confidential and proprietary scriptutil(1) NAME scriptutil − Copy and execute scripts on remote servers SYNOPSIS scriptutil [-d dir] [-f file] -h host1 [host2 . Scriptutil also supports the concept of a script library that in turn supports the concept of OS abstraction. See also -h -h host [host .[ALL] Audit non-unique group names in /etc/group . one still wants to have a single point of access for all platforms for that task. then it will show all scripts (for all OSes) of that name. no OS name extension).. -l [name] Show the list of scripts in the library and exit. -o file By default.

HP-UX . NSH 2 .[HP-UX] Audit that UUCP is disabled Example of using a script in the script library host% scriptutil -h rome -s net_disabled_uucp Example of using an existing script host% cd //athens/tmp athens% cat rr pwd athens% scriptutil -h rome -s rr -d /tmp/nsh /tmp/nsh ORIGIN scriptutil was written by Thomas Kraus SEE ALSO runscript (NSH). . Strictly confidential and proprietary net_disabled_uucp. scriptutil(1) . nexec (NSH).scriptutil(1) Property of BladeLogic. Inc.

Quit sdiff. 2008 1 . Skip identical lines.SDIFF (1) System General Commands Manual SDIFF (1) NAME sdiff − side-by-side diff SYNOPSIS sdiff [ −abdilstW] [ −I regexp] [ −o outfile] [ −w width] file1 file2 DESCRIPTION sdiff displays two files side by side. In this mode. −w width Print a maximum of width characters on each line. −i Do a case-insensitive comparison. The default is 130 characters. s v e e l e r e b q −s Silent mode – identical lines are not printed. Ignore trailing blank spaces. Minimize diff size. is invoked. and changed lines are marked with ‘|’. Start editing file with right set of diffs. sdiff can also be used to interactively merge two files. −o outfile Interactively merge file1 and file2 into outfile. See EDITOR and VISUAL. below. deleted lines are marked with ‘<’. for details of which editor. Start editing file with left set of diffs. with any differences between the two highlighted as follows: new lines are marked with ‘>’. −I regexp Ignore line changes matching regexp. The commands are as follows: l | 1 Choose left set of diffs. The options are: −l Only print the left column for identical lines. All lines in the change must match regexp for the change to be ignored. Start editing file with both sets of diffs. Verbose mode – identical lines are printed. BSD March 28. prompting at each set of differences. which will be merged into outfile upon exiting the editor. Start editing an empty file. r | 2 Choose right set of diffs. if any. the user is prompted for each set of differences. See the −o option for an explanation. Options passed to diff(1) are: −a −b −d Treat file1 and file2 as text files.

diff3(1). If neither EDITOR nor VISUAL are set.SDIFF (1) System General Commands Manual SDIFF (1) −t −W Expand tabs to spaces. vi(1). ENVIRONMENT EDITOR. BSD March 28. CAVEATS Although undocumented. If both EDITOR and VISUAL are set. The default is /tmp. VISUAL Specifies an editor to use with the −o option. Tabs are treated as anywhere from one to eight characters wide. though some require GNU diff. TMPDIR Specifies a directory for temporary files to be created. sdiff supports most long options supported by GNU sdiff. depending on the current column. diff(1). SEE ALSO cmp(1). Ignore all spaces (the −w flag is passed to diff(1)). 2008 2 .net〉. VISUAL takes precedence. Terminals that treat tabs as eight characters wide will look best. the default is vi(1). BUGS sdiff may not work with binary data. re_format(7) AUTHORS sdiff was written from scratch for the public domain by Ray Lai 〈ray@cyth.

certificate-based communication between an Application Server and agents and repeaters. BladeLogic clients and servers use a communication protoccol called protocol 5 that is based on a TLS transportation mechanism (a. If the agent does not find a match.. including encryption and authentication parameters. or hostname. By default. or a subnet designation that defines a range of addresses (see SUBNET DESIGNATIONS below). SSL). When entering a value for hostname. you can specify communication parameters by creating three types of entries: rscd. use the special hostname default. for BladeLogic clients and RSCD servers running on the local host. When configuring communication parameters for a specific host (client or server). you can create entries for an Application Server and entries for repeaters. which stores encrypted password information needed to access the private key for X. For an Application Server. When configuring default communication parameters for servers. Inc. Thus. If the client does not find a match. you can provide a host’s IP address. Protocol 5 auto-negotiates the most secure connection between a client and server.. Secadmin also lets you edit the securecert file. If you are creating entries for individual hostnames as well as an rscd or default entry. create an entry that stores the password for the owner of the process that NSH 1 . default. if you are using the same communication parameters for all your RSCD Agents. then the software looks for a default entry. the agent searches its secure file from top to bottom until it finds the first entry that resolves to an IP address matching the IP address of the client attempting to make a connection. when the agent detects that a host is attempting to make a connection. through an indirect deployment). create a hostname entry in the secure file. By storing passwords in the securecert file. it uses the rscd entry. place the rscd or default entry at the end of the list. BladeLogic can access those passwords without any user interaction. the client searches from top to bottom through entries in its secure file until it finds the first entry that resolves to an IP address matching the IP address of the server. Accessing passwords non-interactively is essential for setting up secure. NOTE: Hostnames are matched to secure file entries by matching the IP addresses (including ranges) of their respective resolved names and not by comparing the hostnames entered in secure file entries. CREATING ENTRIES IN THE SECURE FILE When using secadmin to create a secure file.509 certificates. CREATING ENTRIES IN THE SECURECERT FILE When using secadmin to edit a securecert file. When configuring default communication parameters for BladeLogic clients. On the agent side. See CREATING ENTRIES IN THE SECURECERT FILE.a.secadmin(1) Property of BladeLogic. If an entry does not exist for a particular remote host.k. The order of entries in the secure file matters. When a client attempts to establish a connection with a server. secadmin -c <config_file> -i secadmin -d [hostname] secadmin -P [-C] secadmin -W hostname size secadmin -a|m [hostname] [-w size] [-r [port [hostname]]] [-p 5] [-e tls] secadmin [-appserver_host [hostname]] [-appserver_port [port]] [-appserver_protocol [ clear | srp ]] secadmin [-cu [username]] [-cp [password]] DESCRIPTION Secadmin is a utility that can be used to define communications parameters. It is also necessary when using secure communication to deploy assets via repeaters (that is. you do not have to create an entry for each remote host needing access to those agents. use the special hostname rscd. Strictly confidential and proprietary secadmin(1) NAME secadmin − Utility to define encryption and authentication security SYNOPSIS secadmin -up | -down | -top | -bottom hostname secadmin -c <config_file> . a resolvable host name. it uses the default entry.

As mentioned above. you can delete or modify an existing entry in the secure file as well as add new entries to the file. NSH 2 . Strictly confidential and proprietary secadmin(1) communicates securely with repeaters and servers. The encrypted file must be installed on a system using the -i option. See below for details. If hostname is not provided. On UNIX-style systems. passwords (keys) are encrypted using a key that is unique to the host for which the key is generated. On Windows. in a regular secure file. While this is an important security measure. When issuing a secadmin command. At times it may be necessary to re-arrange the order of the entries in the secure file. that user is BladeLogicRSCD. enter one of the following commands: # secadmin -m default -cu bladmin -cp password # secadmin -m default -cu SYSTEM -cp password For a repeater. Use the following options to change the order of an entry: -up hostname Move the entry up one. -d hostname Delete the entry for entry hostname. If hostname is not provided. -m hostname Modify the entry for host hostname. enter one of the following commands: # secadmin -m default -cu root -cp password # secadmin -m default -cu BladeLogicRSCD -cp password OPTIONS With the secadmin utility. the passwords are not revealed. that user is bladmin. then the file secure. it impedes the ability to pre-configure the secure file for use in automated or non-interactive installations on multiple systems. -a hostname Create a new entry for host hostname. To accomplish this. If this option is followed by the -C option then the output will be in a CSV format. -down hostname Move the entry down one. This primarily happens when you are working with subnet definitions (see below) and you have individual host overrides in that subnet. The primary use for this option is to create and install pre-configured secure files. On Windows.secadmin(1) Property of BladeLogic. you are prompted to enter the hostname. Inc. that user is typically root. If hostname is not provided. that user is SYSTEM. If no value is entered for file. With the -c option you can create and install (-c and -i) a portable secure file. create an entry that stores the password for the administrative user that communicates with servers. you must append one of the following options immediately after the command: -c file Use file as an alternate secure file.cfg is used. On UNIX-style systems. you are prompted to enter the hostname. you are prompted to enter the hostname. To accomplish this. Since this alternate secure file is encrypted. -P Print the output of the current configuration in a formatted table. (NOTE: The alternate secure file is encrypted).

These failures are limited to encryption misconfigurations and host authorization errors. This option is used in conjunction with the -l option. If -u is a negative number. -bottom hostname Move the entry to the bottom of the list.secadmin(1) Property of BladeLogic. This option must be used with the -c option. This option requires a certificate. the secadmin utility prompts you for all information required to create or modify an entry. See the nshopt command for details about the network write buffer size.2. To compress data. Each of the following options may require additional arguments. encryption_and_auth Use TLS for encryption and authorization. -i Install an encrypted secure file created with the -c option. The software searches for certificates in $HOME/BladeLogic/id. -l n When set to a non-zero positive value. The default value for -u is 1 minute. Please see the EXAMPLES section below for an example. Strictly confidential and proprietary secadmin(1) -top hostname Move the entry to the top of the list. you can specify how many minutes the IP address should be locked before allowing connection attempts to resume. Set the network write buffer size to be size bytes with the default size being 4480 bytes. with a higher number indicating better compression. you can enter the following options to define the communication parameters for a given hostname. No authorizations or certificates are required. -w size -z value Set compression level. If you are adding or modifying an entry. -p protocolnum Specify which protocol to use. a cipher) and then use that cipher to communicate.pem. this option determines the maximum number of times a bad connection is allowed from a source address before the address is locked. By default data is not compressed. -u n -T mode Specify one of the following TLS features: encryption_only Use the TLS protocol to auto-negotiate an encryption type (that is. With the -u option. set value to a number between 1 and 9. Note that better compression is more CPU intensive. -W hostname size Only update the network write buffer size for host hostname to be size bytes. the IP address is locked until the RSCD Agent is restarted. The address is locked for a period of time as defined by the -u field (see below). Inc. If you omit these additional arguments from the command line. NSH 3 . which allows you to lock out IP addresses that repeatedly fail to connect to an agent. The default protocol is protocol 5. A bad connection can happen if encryption is not set up properly or a particular host is not granted access. supported since release 5.

then data is sent to the alternate port number on the hostname specified by the -m or -a options. -appserver_host Specify the Application Server. If no hostname is given. -appserver_protocol Specify the authentication protocol used when communicating with a Network Shell Proxy Server.509 certificate.is the same as giving no redirection host. that functions as an intermediary when Network Shell is communicating with RSCD agents. if you want to use an alternate port number for a server. Set the protocol to one of the following: clear srp Do not use authentication when communicating with the Network Shell Proxy Server. SUBNET DESIGNATIONS When defining a hostname or address for a specific permission. Setting hostname to . It should be followed by an IP address or hostnames within the subnet followed by a / and then the number of bits in the subnet mask. The secadmin utility also provides the following options. Currently the rscd daemon cannot listen to multiple ports for connections. This value is useful because otherwise the secadmin utility will prompt you for a redirection host.0/24 Here are some sample subnet mask definitions: NSH 4 . When accessing the host specified in either the -m or -a option. This value is related to the -appserver_host setting. configured as a Network Shell Proxy Server. data should be sent to the specified port number on the host hostname. The password to the private key for a user’s X. -appserver_port Specify the port used to connect to a Network Shell Proxy Server. Strictly confidential and proprietary secadmin(1) -r [port [hostname]] Specify port redirection parameters. you can choose to specify a subnet address that defines a range of addresses for that entry. This field is related to the -appserver_host setting. A subnet with a subnet mask of 255.255. Inc.secadmin(1) Property of BladeLogic.168. Consequently. which let you add entries to the securecert file: -cu -cp The user for whom you are storing a password to the private key for an X.10. A subnet designation has the following format: @<IP Address or Hostname>/mask The @ symbol indicates that a subnet is being defined.0 might look something like: @192. BladeLogic now only supports the tls encryption type. Use SRP authentication when communicating with the Network Shell Proxy Server. all clients must be configured to use that alternate port number when accessing a server.509 certificate. -e tls Specify the encryption method to be used to encrypt data between BladeLogic clients and the RSCD Agent (daemon).255.

enter # secadmin -a foo -p 5 -e tls To specify use of port 999 rather than the default port of 4750.100.255.225/27 @192.255.193/26 @192.100. enter the following command on the server host: # secadmin -a rscd -p 5 -r 999 -e tls On each client host that is communicating with the server host.248 Property of BladeLogic.129/25 @192.255.255.168.255.255. Strictly confidential and proprietary @192.000 255. enter # secadmin -d foo To create a standard entry for host foo so it communicates using protocol 5 (the default communication protocol). # secadmin -a <server_host> -r 999 -e tls SEE ALSO nshopt (1).255.100.secadmin(1) 255. To delete the entry for host foo.168. Inc.240 255.168.100.168.168.100.128 255.0/24 @192.192 255.224 255.168.249/29 secadmin(1) EXAMPLES The following examples illustrate actions you can take to modify the secure file.255.255.255.100. NSH 5 . enter the following command.255.255.241/28 @192.

or the standard input if no files are specified. copies the pattern space to the standard output. . sed starts looking again for the first address. applies all of the commands with addresses that select that pattern space. by default. −e command Append the editing commands specified by the command argument to the list of commands. −n By default. or a context address (which consists of a regular expression preceded and followed by a delimiter). modifying the input as specified by a list of commands.) Starting at the first line following the selected range. All commands are applied to the input in the order they are specified regardless of their origin. only that line is selected. (If the second address is a number less than or equal to the line number first selected. appending a newline. A single command may be specified as the first argument to sed. −f command_file Append the editing commands found in the file command_file to the list of commands. . Multiple commands may be specified by using the −e or −f options. (unless there is something left after a ‘D’ function). . Inc. The input is then written to the standard output. The options are as follows: −a The files listed as parameters for the ‘w’ functions are created (or truncated) before any processing begins. Some of the functions use a hold space to save all or part of the pattern space for subsequent retrieval. but if specified must be a number (that counts input lines cumulatively across input files). . into a pattern space. The −n option suppresses this behavior. [address[. and deletes the pattern space. A command line with one address selects all of the pattern spaces that match the address.SED (1) PropertyGeneral Commands Manual System of BladeLogic. The form of a sed command is as follows: BSD December 30. The −a option causes sed to delay opening each file until a command containing the related ‘w’ function is applied to a line of input. The editing commands should each be listed on a separate line. a dollar character ( ‘$’ ) that addresses the last line of input. each line of input is echoed to the standard output after all of the commands have been applied to it. 1993 1 . A command line with two addresses selects the inclusive range from the first pattern space that matches the first address through the next pattern space that matches the second. not including its terminating newline character.] DESCRIPTION The sed utility reads the specified files.] sed [ −an] [ −e command] [ −f command_file] [file . sed cyclically copies a line of input. Normally. SED ADDRESSES An address is not required.address]]function[arguments] Whitespace may be inserted before the first address and the function portions of the command. Strictly confidential and proprietary SED (1) NAME sed − stream editor SYNOPSIS sed [ −an] command [file . A command line with no addresses selects every pattern space.

[2addr] function-list Execute function-list only when the pattern space is selected. however. The last regular expression is defined as the last regular expression used as part of an address or substitute command. function } The ‘{’ can be preceded or followed by whitespace.. The function can be preceded by whitespace as well. Other backslashes in text are deleted and the following character taken literally. This is a list of sed functions separated by newlines. and ‘:’ functions all accept additional arguments. BSD December 30. representing zero. in the context address \xabc\xdefx. the last regular expression encountered is used instead. The following synopses indicate which arguments have to be separated from the function letters by whitespace characters. one. 1993 2 ..SED (1) PropertyGeneral Commands Manual System of BladeLogic. ‘t’. precede it with a backslash. The ‘r’ and ‘w’ functions take an optional file parameter. whether by executing the ‘N’ function or by beginning a new cycle. not compile-time. In addition. One special feature of sed regular expressions is that they can default to the last regular expression used. and at run-time. You can’t. If the label is not specified. [1addr]a\ text Write text to standard output immediately before each attempt to read a line of input. If a regular expression is empty. The terminating ‘}’ must be preceded by a newline or optional whitespace. the command “/abc/s//XXX/” will substitute “XXX” for the pattern “abc”. For example. Each file given as an argument to sed is created (or its contents truncated) before any input processing begins. just the delimiter characters are specified. putting a backslash character before the delimiting character causes the character to be treated literally.. sed has the following two additions to BREs: 1. use a literal newline character in an address or in the substitute command. so that the regular expression is “abcxdef”.e. Inc. SED FUNCTIONS In the following list of commands. as follows: { function function . branch to the end of the script. ‘!’. ‘s’. Two of the functions take a function-list. which should be separated from the function letter by whitespace. SED REGULAR EXPRESSIONS The sed regular expressions are basic regular expressions ( BREs ) . i. [1addr]. See re_format(7) for more information on regular expressions. The argument text consists of one or more lines. For example. ‘w’. any character other than a backslash ( ‘\’ ) or newline character may be used to delimit the regular expression. The ‘b’. [2addr]b[label] Branch to the ‘:’ function with the specified label. In a context address. the maximum number of permissible addresses for each command is indicated by [0addr]. To embed a newline in the text. or [2addr]. ‘y’. the RE delimiter is an ‘x’ and the second ‘x’ stands for itself. ‘r’. 2. Also. The escape sequence \n matches a newline character embedded in the pattern space. Strictly confidential and proprietary SED (1) Editing commands can be applied to non-selected pattern spaces by use of the exclamation character ( ‘!’ ) function. or two addresses.

Inc. and replace the pattern space with the next line of input. Write the pattern space to standard output.SED (1) PropertyGeneral Commands Manual System of BladeLogic. Replace the contents of the pattern space with the contents of the hold space. [2addr]n [2addr]N Write the pattern space to the standard output if the default output has not been suppressed. Replace the contents of the hold space with the contents of the pattern space. Delete the initial segment of the pattern space through the first newline character and start the next cycle. Write the pattern space. Append the next line of input to the pattern space. Branch to the end of the script and quit without starting a new cycle. This form is as follows: backslash alert form-feed newline carriage-return tab vertical tab \\ \a \f \n \r \t \v Delete the pattern space and start the next cycle. with the point of folding indicated by displaying a backslash followed by a newline. [2addr]l (The letter ell. [2addr]d [2addr]D [2addr]g [2addr]G [2addr]h [2addr]H [1addr]i\ text Write text to the standard output.) Write the pattern space to the standard output in a visually unambiguous form. 1993 3 . up to the first newline character to the standard output. Note that the current line number changes. Append a newline character followed by the contents of the hold space to the pattern space. With 0 or 1 address or at the end of a 2-address range. The end of each line is marked with a ‘$’. using an embedded newline character to separate the appended material from the original contents. [2addr]s/re/replacement/flags Substitute the replacement string for the first instance of the regular expression in the pattern space. Any character other than backslash or newline can be used instead of a slash to delimit [2addr]p [2addr]P [1addr]q [1addr]r file BSD December 30. text is written to the standard output. it is silently ignored and no error condition is set. Strictly confidential and proprietary SED (1) [2addr]c\ text Delete the pattern space. Long lines are folded. If file cannot be read for any reason. Append a newline character followed by the contents of the pattern space to the hold space. Non-printable characters are written as three-digit octal numbers (with a preceding backslash) for each byte in the character (most significant byte first). Copy the contents of file to the standard output immediately before the next attempt to read a line of input.

SED (1)

PropertyGeneral Commands Manual System of BladeLogic, Inc. Strictly confidential and proprietary

SED (1)

the RE and the replacement. Within the RE and the replacement, the RE delimiter itself can be used as a literal character if it is preceded by a backslash. An ampersand ( ‘&’ ) appearing in the replacement is replaced by the string matching the RE. The special meaning of ‘&’ in this context can be suppressed by preceding it by a backslash. The string ‘\#’, where ‘#’ is a digit, is replaced by the text matched by the corresponding backreference expression (see re_format(7)). A line can be split by substituting a newline character into it. To specify a newline character in the replacement string, precede it with a backslash. The value of flags in the substitute function is zero or more of the following: 0 ... 9 g p Make the substitution only for the N’th occurrence of the regular expression in the pattern space. Make the substitution for all non-overlapping matches of the regular expression, not just the first one. Write the pattern space to standard output if a replacement was made. If the replacement string is identical to that which it replaces, it is still considered to have been a replacement. Append the pattern space to file if a replacement was made. If the replacement string is identical to that which it replaces, it is still considered to have been a replacement.

w file

[2addr]t[label] Branch to the ‘:’ function bearing the label if any substitutions have been made since the most recent reading of an input line or execution of a ‘t’ function. If no label is specified, branch to the end of the script. [2addr]w file Append the pattern space to the file. [2addr]x Swap the contents of the pattern and hold spaces. [2addr]y/string1/string2/ Replace all occurrences of characters in string1 in the pattern space with the corresponding characters from string2. Any character other than a backslash or newline can be used instead of a slash to delimit the strings. Within string1 and string2, a backslash followed by any character other than a newline is that literal character, and a backslash followed by an ‘n’ is replaced by a newline character. [2addr]!function, [2addr]!function-list Apply the function or function-list only to the lines that are not selected by the address(es). [0addr]:label This function does nothing; it bears a label to which the ‘b’ and ‘t’ commands may branch. [1addr]= [0addr] [0addr]# Write the line number to the standard output followed by a newline character. Empty lines are ignored. The ‘#’ and the remainder of the line are ignored (treated as a comment), with the single exception that if the first two characters in the file are ‘#n’, the default output is suppressed. This is the same as specifying the −n option on the command line.

The sed utility exits 0 on success or >0 if an error occurred.

BSD

December 30, 1993

4

SED (1)

PropertyGeneral Commands Manual System of BladeLogic, Inc. Strictly confidential and proprietary

SED (1)

SEE ALSO awk(1), ed(1), grep(1), regex(3), re_format(7) "SED — A Non-interactive Text Editor", /usr/share/doc/usd/15.sed/. STANDARDS The sed function is expected to be a superset of the IEEE Std 1003.2 (“POSIX.2”) specification. HISTORY A sed command appeared in Version 7 AT&T UNIX.

BSD

December 30, 1993

5

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

sort ( 1 )

NAME

sort - sort or merge text files
SYNOPSIS

sort [-cmubdfinr] [-t char] [-T char] [-k field1[,field2]] ... [-o output] [file] ...
DESCRIPTION

The sort utility sorts text files by lines. Comparisons are based on one or more sort keys extracted from each line of input, and are performed lexicographically. By default, if keys are not given, sort regards each input line as a single field. The following options are available: -c -m Check that the single input file is sorted. If the file is not sorted, sort produces the appropriate error messages and exits with code 1; otherwise, sort returns 0. Sort -c produces no output. Merge only; the input files are assumed to be pre-sorted.

-o output The argument given is the name of an output file to be used instead of the standard output. This file can be the same as one of the input files. -u Unique: suppress all but one in each set of lines having equal keys. If used with the -c option, check that there are no lines with duplicate keys.

The following options override the default ordering rules. When ordering options appear independent of key field specifications, the requested field ordering rules are applied globally to all sort keys. When attached to a specific key (see -k), the ordering options override all global ordering options for that key. -d -f -i -n Only blank space and alphanumeric characters are used in making comparisons. Considers all lowercase characters that have uppercase equivalents to be the same for purposes of comparison. Ignore all non-printable characters. An initial numeric string, consisting of optional blank space, optional minus sign, and zero or more digits (including decimal point) is sorted by arithmetic value. (The -n option no longer implies the -b option.) Reverse the sense of comparisons. Ignores leading blank space when determining the start and end of a restricted sort key. A -b option specified before the first -k option applies globally to all -k options. Otherwise, the -b option can be attached independently to each field argument of the -k option (see below). Note that the -b option has no effect unless key fields are specified. Char is used as the field separator character. The initial char is not considered to be part of a field when determining key offsets (see below). Each occurrence of char is significant (for example, ‘‘charchar’’ delimits an empty field). If -t is not specified, blank space characters are used as default field separators. Char is used as the record separator character. This should be used with discretion; -T <alphanumeric> usually produces undesirable results. The default line separator is newline.

-r -b

The treatment of field separators can be altered using the options:

-t char

-T char

-k field1[,field2] Designates the starting position, field1, and optional ending position, field2, of a key field. The -k option replaces the obsolescent options +pos1 and -pos2. The following operands are available: file The pathname of a file to be sorted, merged, or checked. If no file operands are specified, or if a file operand is -, the standard input is used. A field is defined as a minimal sequence of characters followed by a field separator or a newline character. By default, the first blank space of a sequence of blank spaces acts as the field separator. All blank spaces

SunOS 5.8

Last change: NSH

1

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

sort ( 1 )

in a sequence of blank spaces are considered as part of the next field; for example, all blank spaces at the beginning of a line are considered to be part of the first field. Fields are specified by the -k field1[,field2] argument. A missing field2 argument defaults to the end of a line. The arguments field1 and field2 have the form m.n followed by one or more of the options -b, -d, -f, -i, -n, -r. A field1 position specified by m.n (m,n > 0) is interpreted as the nth character in the mth field. A missing .n in field1 means indicating the first character of the ‘’, field; If the -b option is in effect, n is counted from the first non-blank character in the mth field; m.1b refers to the first non-blank character in the mth field. A field2 position specified by m.n is interpreted as the nth character (including separators) of the mth field. A missing .n indicates the last character of the mth field; m = 0 designates the end of a line. Thus the option -k v.x,w.y is synonymous with the obsolescent option +v-1.x-1 -w-1.y; when y is omitted, -k v.x,w is synonymous with +v-1.x-1 -w+1.0. The obsolescent +pos1 -pos2 option is still supported, except for -w.0b, which has no -k equivalent.
FILES

/tmp/sort.∗ Default temporary directories. output#PID if output already exists.
SEE ALSO

Temporary name for output

sort(1), comm(1), uniq(1), join(1)
RETURN VALUES

Sort exits with one of the following values: 0: with the -c option 2: an error occurred.
BUGS

normal behavior. 1:

on disorder (or non-uniqueness)

Lines longer than 65522 characters are discarded and processing continues. To sort files larger than 60Mb, use sort -H; files larger than 704Mb must be sorted in smaller pieces, then merged. To protect data sort -o calls link and unlink, and thus fails in protected directories.
ORIGIN

Sort includes software developed by the University of California, Berkeley and its contributors. Please see the intro section for complete acknowledgements.
NOTES

The current sort command uses lexicographic radix sorting, which requires that sort keys be kept in memory (as opposed to previous versions which used quick and merge sorts and did not.) Thus performance depends highly on efficient choice of sort keys, and the -b option and the field2 argument of the -k option should be used whenever possible. Similarly, sort -k1f is equivalent to sort -f and may take twice as long.

SunOS 5.8

Last change: NSH

2

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

split ( 1 )

NAME

split - split a file into pieces
SYNOPSIS

split [-b byte_count[km]] [-l line_count] [file [name]]
DESCRIPTION

The split utility reads the given file (or standard input if no file is specified) and breaks it up into files of 1000 lines each.
OPTIONS

The options are as follows: -b Create smaller files byte_count bytes in length. If ‘‘k’’ is appended to the number, the file is split into byte_count kilobyte pieces. If ‘‘m’’ is appended to the number, the file is split into byte_count megabyte pieces. Create smaller files n lines in length.

-l

If additional arguments are specified, the first is used as the name of the input file which is to be split. If a second additional argument is specified, it is used as a prefix for the names of the files into which the file is split. In this case, each file into which the file is split is named by the prefix followed by a lexically ordered suffix in the range of ‘‘aa-zz’’. If the name argument is not specified, the file is split into lexically ordered files named in the range of ‘‘xaa-zzz’’.
BUGS

For historical reasons, if you specify name, split can only create 676 separate files. The default naming convention allows 2028 separate files.
ORIGIN

Split includes software developed by the University of California, Berkeley and its contributors. Please see the intro section for complete acknowledgements.

SunOS 5.8

Last change: NSH

1

strings(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary

strings(1)

NAME
strings - find printable strings in a file

SYNOPSIS
strings [-afo] [-n number] [file ...]

DESCRIPTION
Strings displays the sequences of printable characters in each of the specified files, or in the standard input, by default. By default, a sequence must be at least four characters in length before being displayed. The options are as follows: -a -f -n -o By default, strings only searches the text and data segments of object files. The -a option causes strings to search the entire object file. Each string is preceded by the name of the file in which it was found. Specifies the minimum number of characters in a sequence to be number, instead of four. Each string is preceded by its decimal offset in the file.

Strings is useful for identifying random binaries, among other things.

SEE ALSO
hexdump(1)

BUGS
The algorithm for identifying strings is extremely primitive. In particular, machine code instructions on certain architectures can resemble sequences of ASCII bytes, which will fool the algorithm.

NOTES
Since strings works in a multi platform environment, it can not recognize all types of executable files. Consequently the -a option is always assumed to be turned on. This may be fixed in the future. Strings includes software developed by the University of California, Berkeley and its contributors. Please see the intro section for complete acknowledgements.

NSH

1

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

su ( 1 )

NAME

su – substitute user identity
SYNOPSIS

su [-flm] [login [args ... ]]
DESCRIPTION

Su requests the password for login (or for root, if no login is provided), and switches to that user and group ID and then executes the Network Shell nsh. If su is executed by root, no password is requested and the Network Shell with the appropriate user ID is executed By default, the environment is unmodified with the exception of USER, HOME, and SHELL. HOME and SHELL are set to the target login’s default values. USER is set to the target login, unless the target login has a user ID of 0, in which case it is unmodified. The invoked shell is the target login’s. This is the traditional behavior of su. The options are as follows: -f -l or This flag is used in confunction with the csh which of course we are not running. This option is accepted for compatability reasons and is ignored. Simulate a full login. The environment is discarded except for HOME, SHELL, PATH, TERM, and USER. HOME and SHELL are modified as above. USER is set to the target login. PATH is set to /usr/sbin/usr/bin on Solaris hosts, /usr/sbin:/usr/bin on HPUX hosts, /usr/ucb:/bin:/usr/bin on Sun OS hosts, and TERM is imported from your current environment. The invoked shell is the Network Shell nsh, and su will change directory to the target login’s home directory. Leave the environment unmodified. The Network Shell is started and no directory or environment variable changes are made.

-m

The -l and -m options are mutually exclusive; the last one specified overrides any previous ones. By default (unless the prompt is reset by a startup file) the super-user prompt is set to ‘‘#’’ to remind one of its awesome power.
SEE ALSO

nsh(1), login(1)
ENVIRONMENT

Environment variables used by su: HOME PATH TERM USER Default home directory of real user ID unless modified as specified above. Default search path of real user ID unless modified as specified above. Provides terminal type which may be retained for the substituted user ID. The user ID is always the effective ID (the target user ID) after an su unless the user ID is 0 (root).

SunOS 5.8

Last change: NSH

1

TAIL (1)

PropertyGeneral Commands Manual System of BladeLogic, Inc. Strictly confidential and proprietary

TAIL (1)

NAME tail − display the last part of a file SYNOPSIS tail [ −f | −r] [ −b number | −c number | −n number | −number] [file . . .] DESCRIPTION The tail utility displays the contents of file or, by default, its standard input, to the standard output. The display begins at a byte, line, or 512-byte block location in the input. Numbers having a leading plus ( ‘+’ ) sign are relative to the beginning of the input, for example, -c +2 starts the display at the second byte of the input. Numbers having a leading minus ( ‘-’ ) sign or no explicit sign are relative to the end of the input, for example, -n 2 displays the last two lines of the input. The default starting location is -n 10, or the last 10 lines of the input. The options are as follows: −b number The location is number 512-byte blocks. −c number The location is number bytes. −n number | −number The location is number lines. −f Do not stop when end-of-file is reached, but rather to wait for additional data to be appended to the input. If the file is replaced (i.e., the inode number changes), tail will reopen the file and continue. If the file is truncated, tail will reset its position to the beginning. This makes tail more useful for watching log files that may get rotated. The −f option is ignored if the standard input is a pipe, but not if it is a FIFO. The −r option causes the input to be displayed in reverse order, by line. Additionally, this option changes the meaning of the −b, −c, and −n options. When the −r option is specified, these options specify the number of bytes, lines or 512-byte blocks to display, instead of the bytes, lines, or blocks from the beginning or end of the input from which to begin the display. The default for the −r option is to display all of the input.

−r

If more than a single file is specified, each file is preceded by a header consisting of the string “==> XXX <==” where “XXX” is the name of the file. The tail utility exits 0 on success or >0 if an error occurred. EXAMPLES To display the last 500 lines of the file foo: $ tail -500 foo Keep /var/log/messages open, displaying to the standard output anything appended to the file: $ tail -f /var/log/messages SEE ALSO cat(1), head(1), sed(1)

BSD

June 6, 1993

1

TAIL (1)

PropertyGeneral Commands Manual System of BladeLogic, Inc. Strictly confidential and proprietary

TAIL (1)

STANDARDS The tail utility is expected to be a superset of the IEEE Std 1003.2-1992 (“POSIX.2”) specification. In particular, the −b and −r options are extensions to that standard. The historic command line syntax of tail is supported by this implementation. The only difference between this implementation and historic versions of tail, once the command line syntax translation has been done, is that the −b, −c and −n options modify the −r option, i.e., -r -c 4 displays the last 4 characters of the last line of the input, while the historic tail (using the historic syntax -4cr) would ignore the −c option and display the last 4 lines of the input. HISTORY A tail command appeared in Version 7 AT&T UNIX.

BSD

June 6, 1993

2

tee(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary

tee(1)

NAME
tee − Pipe fitting

SYNOPSIS
tee [-ai?] [file ...]

DESCRIPTION
The tee utility copies the standard input to standard output, making copies of the input to the optionally named files.

OPTIONS
The following options may modify the behavior of tee. -a -i Append the output to the files rather than overwriting them. This option causes tee to ignore the SIGINT signal.

EXAMPLE
The first example takes the output from the program someprog and appends it to the file messages creating the file if it does not already exist. The second example copies the file /etc/motd to the hosts ottawa and washington. $ someprog | tee -a messages $ cat /etc/motd | tee //ottawa/etc/motd //washington/etc/motd

DIAGNOSTICS
tee: Unable to access file filename Error creating or trying to append to one of the name files. tee: Write error to file filename An error occurred updating (writing) to one of the files.

EXIT CODES
0 1 2 255 No errors detected An unknown option was given Was not able to create or able to write to one the files. Unable to get a license to use the software.

ORIGIN
Tee includes software developed by the University of California, Berkeley and its contributors. Please see the intro section for complete acknowledgments.

SEE ALSO
tee(1)

NSH

1

test(1)

Property of BladeLogic, Inc. Strictly confidential and proprietary

test(1)

NAME
test − Test value of expression

SYNOPSIS
test expression

DESCRIPTION
The test command tests the value of the given expression and exits with an appropriate exit code to indicate if the expression was TRUE or FALSE. In the sh(1) family of command interpreters, an exit code of 0 indicates a value of TRUE, while a non zero exit code indicates a value of FALSE.

OPTIONS
You can build an expression from any combination of the following primitives. -b file -c file -d file -f file. -f file -g file -h file -k file -l string -n string -p file -r file -s file -t fd -u file -w file -x file -z string s1 = s2 s1 != s2 n1 -eq n2 n1 -ne n2 n1 -gt n2 n1 -ge n2 n1 -lt n2 n1 -le n2 ! -a -o (expr) TRUE if file is a block special device. TRUE if file is a character special device. TRUE if file is a directory. TRUE if file is not a directory (P_BSD). TRUE if file is a regular file (P_ATT). TRUE if file has its set-GID bit set. TRUE if file is a symbolic link. TRUE if file has its sticky bit set. The length of string. TRUE if length of strings is not zero. TRUE if file is a named pipe (FIFO). TRUE if file is readable. TRUE if file is greater than 0 bytes large. TRUE if file descriptor is associated with a tty. TRUE if file has its set-UID bit set. TRUE if file is writable. TRUE if file is executable. TRUE if length of strings is zero. TRUE if strings s1 and s2 are equal. TRUE if strings s1 and s2 are not equal. TRUE if integers n1 and n2 are equal. TRUE if integers n1 and n2 are not equal. TRUE if integer n1 is greater than integer n2. TRUE if integer n1 is greater than or equal to integer n2. TRUE if integer n1 is less than integer n2. TRUE if integer n1 is less than or equal to integer n2. Unary negation operator. Binary ’and’ operator. Binary ’or’ operator. Parentheses for grouping.

NSH

1

ORIGIN test was written by Thomas Kraus NSH 2 . and the directory /etc/security exists. test is an executable program. You can use parentheses to group operators so that they are evaluated in the order you want. The sh(1) counterpart test(1) is a built in function to the shell and a separate executable program for it does not exist.test(1) Property of BladeLogic. EXIT CODES 0 1 2 255 Value of the expression is TRUE. The difference is that a special file such as a character special file is neither a directory nor a regular file. also have special meaning to the sh(1). Inc. CAVEATS Parentheses. Consequently the primitive -f <character_special_file> will produce different values in the two universes. UNIVERSE BEHAVIOR With the P_BSD variable set (Berkeley behavior). The -a (binary AND) operator has a higher precedence than the -o (binary OR) operator. the -f primitive checks if the file is not a directory. Value of the expression is FALSE. $ test -f //bonn/etc/passwd -a -f //bonn/etc/group $ test -f \( /etc/passwd -o -f /etc/group \) -a -d /etc/security DIAGNOSTICS test: argument expected This message is output if a primitive of the expression is missing an operand. Unable to get a license to use the software. so as not to have them interpreted by sh(1). EXAMPLE The first example would return TRUE if both the files /etc/passwd and /etc/group exist on host bonn. which in turn has a higher precedence than the ! (negation) operator. With the P_ATT variable set. An operand of a primitive was missing. Consequently you must escape or quote them. which can be used for grouping primitives. the -f primitive check that the file is a regular file. The second example would return TRUE if either one of the files /etc/passwd or /etc/group exists. Strictly confidential and proprietary -? test(1) Output a brief summary of available options and then exit with a zero status without doing any testing.

and the first argument is a string of digits either eight or ten characters in length. there are at least two arguments. If the file doesn’t exist. The touch utility does not treat this as an error. from 0 to 23. No error messages are displayed and the exit value is not affected.TOUCH (1) PropertyGeneral Commands Manual System of BladeLogic. where a time format is specified as the first argument. from 0 to 59. The access time of the file is not changed unless the −a flag is also specified. The day of the month.] DESCRIPTION The touch utility sets the modification and access times of files to the current time of day. from 0 to 61. Otherwise. If “YY” is specified. Do not create the file if it does not exist. it is created with default permissions. SEE ALSO utimes(2) STANDARDS The obsolescent form of touch. If the “YY” letter pair is in the range 69 to 99. . The options are as follows: −a −c −f −m −r −t Change the access time of the file. The second two digits of the year. the value defaults to 0. from 1 to 31. the year is set in the 21st century. BSD April 28. The “MM”. Use the access and modification times from the specified file instead of the current time of day. The minute of the hour. but “CC” is not. Strictly confidential and proprietary TOUCH (1) NAME touch − change file access and modification times SYNOPSIS touch [ −acfm] [ −r file] [ −t [[CC]YY]MMDDhhmm[. otherwise. Inc. the first argument is interpreted as a time specification of the form “MMDDhhmm[YY]”. the values default to the current year. The touch utility exits 0 on success or >0 if an error occurred. Change the modification time of the file. The argument should be in the form “[[CC]YY]MMDDhhmm[. “DD”. .SS]] file [ . from 1 to 12. The modification time of the file is not changed unless the −m flag is also specified. If the “CC” and “YY” letter pairs are not specified.SS]” where each pair of letters represents the following: CC YY MM DD hh mm SS The first two digits of the year (the century). The second of the minute. the year is set from 1969 to 1999. When no −r or −t option is specified. “hh” and “mm” letter pairs are treated as their counterparts specified to the −t option. a value for “YY” between 69 and 99 results in a “CC” value of 19. even if the file permissions do not currently permit it. Attempt to force the update. is supported. If the “SS” letter pair is not specified. The month of the year. a “CC” value of 20 is used. 1995 1 . Change the access and modification times to the specified time. The hour of the day.

BSD April 28. Inc. 1995 2 .TOUCH (1) PropertyGeneral Commands Manual System of BladeLogic.2”) specification.2 (“POSIX. HISTORY A touch utility appeared in Version 7 AT&T UNIX. Strictly confidential and proprietary TOUCH (1) The touch utility is expected to be a superset of the IEEE Std 1003.

the characters in string1 are compressed as described for the –s option. Shpink October 27. The –s option squeezes multiple occurrences of the characters listed in the last operand (either string1 or string2) in the input into a single instance of the character. 1991 1 . In the second synopsis form. A backslash followed by certain special characters maps to special values. \a \b \f \n \r \t \v <alert character> <backspace> <form-feed> <newline> <carriage return> <tab> <vertical tab> \character A backslash followed by any other character maps to that character. and the characters in string2 are compressed as described for the –s option. In the third synopsis form. SYNOPSIS tr [ –cs] string1 string2 tr [ –c] –d string1 tr [ –c] –s string1 tr [ –c] –ds string1 string2 DESCRIPTION The tr utility copies the standard input to the standard output with substitution or deletion of selected characters. the characters in string1 are deleted from the input. the characters in string1 are translated into the characters in string2 where the first character in string1 is translated into the first character in string2 and so on. The following options are available: –c –d –s Complements the set of characters in string1. that is ‘‘-c ab’’ includes every character except for ‘‘a’’ and ‘‘b’’. Strictly confidential and proprietary TR ( 1 ) NAME tr – Translate Characters. In the first synopsis form. If string1 is longer than string2. A backslash followed by 1. the characters in string1 are deleted from the input. Inc. This occurs after all deletion and translation is completed. the last character found in string2 is duplicated until string1 is exhausted.TR ( 1 ) Property of Reference Manual BSD BladeLogic. 2 or 3 octal digits represents a character with that encoded value. To follow an octal sequence with a digit as a character. The –d option causes characters to be deleted from the input. left zero-pad the octal sequence to the full 3 octal digits. In the fourth synopsis form. The following conventions can be used in string1 and string2 to specify sets of characters: character \octal Any character not described by one of the following conventions represents itself.

English has no equivalence classes. [#∗n] The tr utility exits 0 on success. For specific information as to which ASCII characters are included in these classes. If n is omitted or is zero. This expression is only valid when it occurs in string2. the characters are ordered in ascending sequence. where a word is taken to be a maximal string of letters. otherwise. EXAMPLES The following examples are shown as given to the shell: Create a list of the words in file1. [=equiv=] Represents all characters or collating (sorting) elements belonging to the same equivalence class as equiv. In the ‘‘upper’’ and ‘‘lower’’ classes.TR ( 1 ) Property of Reference Manual BSD BladeLogic. see ctype(3) and related manual pages. and >0 if an error occurs. If n has a leading zero. characters in the classes are in unspecified order. Represents all characters belonging to the defined character class. tr -cs [:alpha:]" "\n" < file1" Translate the contents of file1 to upper-case. Inc. one per line. they are ordered after their encoded values. it is be interpreted as large enough to extend string2 sequence to the length of string1. tr -cd [:print:]" < file1" COMPATIBILITY System V has historically implemented character ranges using the syntax ‘‘[c-c]’’ instead of the ‘‘c-c’’ used by historic BSD implementations and standardized by POSIX. i. System V shell scripts should work under this implementation as long as the range is intended to map in another range. Class names are: alnum alpha cntrl digit graph lower print punct space upper xdigit <alphanumeric characters> <alphabetic characters> <control characters> <numeric characters> <graphic characters> <lower-case alphabetic characters> <printable characters> <punctuation characters> <space characters> <upper-case characters> <hexadecimal characters> With the exception of the ‘‘upper’’ and ‘‘lower’’ classes. the command ‘‘tr [a-z] [A- Shpink October 27. tr [:lower:]" "[:upper:]" < file1" Strip out non-printable characters from file1. Represents n repeated occurrences of the character represented by #. inclusively.e. If there is a secondary ordering within the equivalence class. Strictly confidential and proprietary TR ( 1 ) c-c [:class:] Represents the range of characters between the range endpoints. characters are entered in ascending order. An example of an equivalence class might be ‘‘c’’ and ‘‘ch’’ in Spanish. 1991 2 . Otherwise. it’s interpreted as a decimal value. it is interpreted as an octal value.

Shpink October 27. This implementation has removed this behavior as a bug. Inc. STANDARDS The tr utility is expected to be IEEE Std1003. any scripts that depended on the sequence ‘‘a-z’’ to represent the three characters ‘‘a’’. It should be noted that the feature wherein the last character of string2 is duplicated if string2 has less characters than string1 is permitted by POSIX but is not required. ‘‘-’’ and ‘‘z’’ will have to be rewritten as ‘‘a\-z’’.2 (‘‘POSIX’’) compatible. the characters ‘‘[’’ and ‘‘]’’ will be included in the deletion or compression list which would not have happened under an historic System V implementation. 1991 3 .TR ( 1 ) Property of Reference Manual BSD BladeLogic. Shell scripts attempting to be portable to other POSIX systems should use the ‘‘[#∗]’’ convention instead of relying on this behavior. the –c and –s options were ignored unless two strings were specified. The tr utility has historically not permitted the manipulation of NUL bytes in its input and. The tr utility has historically been extremely forgiving of syntax errors. additionally. Additionally. if the shell script is deleting or squeezing characters as in the command ‘‘tr -d [a-z]’’. for example. However. Strictly confidential and proprietary TR ( 1 ) Z]’’ will work as it will map the ‘‘[’’ character in string1 to the ‘‘[’’ character in string2. stripped NUL’s from its input stream. This implementation will not permit illegal syntax.

UNAME (1) PropertyGeneral Commands Manual System of BladeLogic. The options are as follows: −a −m −n −p −r −s −l −v Behave as though all of the options −mnrsv were specified. 1994 1 . If no options are specified. Print the operating system version. Print the processor type in more detail. SEE ALSO hostname(1).2-1992 (“POSIX. HISTORY The uname command appeared in 4. Print the operating system release. Inc. machine(1). Strictly confidential and proprietary UNAME (1) NAME uname − print operating system name SYNOPSIS uname [ −amnprsv] DESCRIPTION The uname utility writes symbols representing one or more system characteristics to the standard output. uname prints the operating system name as if the −s option had been specified. uname(3) STANDARDS The uname utility conforms to IEEE Std 1003. Print the machine hardware name.2”). BSD January 26. Print the nodename (the nodename may be a name that the system is known by to a communications network). Print the operating system name.4 BSD. Print the patch level.

uncp(1) Property of BladeLogic. The default suffix is ˜ (foo -> foo˜). When uncp finds files with the specified suffix. This is a useful option when you want to remove any files that the dsync or cp commands previously backed up. DESCRIPTION The cp and dsync commands have an option (-b or -B) that lets you back up the target file (if it exists) before the new source file is copied into its place. SEE ALSO cp(1). OPTIONS -d -n Instead of restoring the files to their previous names. Strictly confidential and proprietary uncp(1) NAME uncp − Uncopy files backed up during a cp or dsync SYNOPSIS uncp [-dnv] [-s suf] file1 . Inc. uncp looks for the suffix ˜. Output a message for each file being renamed. -v -s suf ORIGIN uncp was written by Thomas Kraus.. Do not actually make any changes. This option automatically turns on the verbose flag -v and just lists the renames it would perform if you had not turned on the -n option. it renames them (removes the suffix). It does not rename any files.. The uncp command is a mechanism to restore the saved files to their previous state by renaming them back to their original name (foo˜ -> foo). dsync(1). The backup is done by renaming the target file with a suffix. just delete the files. uncp does not rename directories as it will automatically recursively travel through the directories passed to it as arguments. Set the suffix to suf. By default. NSH 1 . This option tells it to look for a different suffix.

the second is used as the name of an output file. Inc. BSD December 8. A field is a string of non-blank characters separated from adjacent fields by blanks. The uniq utility exits 0 on success or >0 if an error occurred. The uniq utility is expected to be IEEE Std 1003. The options are as follows: −c −d Precede each output line with the count of the number of times the line occurred in the input. A file name of ‘-’ denotes the standard input or the standard output ( depending on its position on the command line ) . Repeated lines in the input will not be detected if they are not adjacent. so it may be necessary to sort the files first. −f fields Ignore the first fields in each input line when doing comparisons. Character numbers are one based.UNIQ (1) PropertyGeneral Commands Manual System of BladeLogic. the first chars characters after the first fields fields will be ignored. −s chars Ignore the first chars characters in each input line when doing comparisons. followed by a single space. the first character is character one. If additional arguments are specified on the command line. i. SEE ALSO sort(1) STANDARDS The historic +number and −number options have been deprecated but are still supported in this implementation. Only output lines which have duplicates. −u Only output lines which are unique. The second and succeeding copies of identical adjacent input lines are not written.2 (“POSIX.. Field numbers are one based.2”) compatible. the first field is field one.e.e. If specified in conjunction with the −f option.. i. Strictly confidential and proprietary UNIQ (1) NAME uniq − report or filter out repeated lines in a file SYNOPSIS uniq [ −c | −d | −u] [ −f fields] [ −s chars] [input_file [output_file]] DESCRIPTION The uniq utility reads the standard input comparing adjacent lines and writes a copy of each unique input line to the standard output. 2002 1 . the first such argument is used as the name of an input file.

there are no diagnostic messages to be output except for network and licensing messages. NOTES By default. because improper use may adversely affect the consistency of the file systems.bar $ unlink //amsterdam/u1/data/*. except that it does exactly what it is told to do.. File to be unlinked EXAMPLE The first example unlinks the file foo.unlink(1) Property of BladeLogic.old DIAGNOSTICS Since unlink errors are ignored. change the ownership of the unlink file to root and the mode to 500. $ unlink foo. any user can run the unlink command. without doing any type of error checking. CAVEATS Since unlink does not perform any error checking. We strongly suggest that you use the commands rm and rmdir instead of the unlink command. To restrict its use to the super user. Unable to get a license to use the software.bar The second example removes all . Strictly confidential and proprietary unlink(1) NAME unlink − Unlink a file and/or directory SYNOPSIS unlink [-?] file . Inc. it unlinks the named files (which is the mechanism to remove files) regardless of the state of the files. Normally. NSH 1 . ORIGIN unlink was written by Thomas Kraus SEE ALSO rm(1).old files in the directory /u1/data on host amsterdam. you should use it only in exceptional cases. In other words. DESCRIPTION The unlink command is similar to the rm command.. unlink always exits with 0. EXIT CODES 0 255 Besides license problems. OPTIONS -? file Output a brief summary of available options and then exit with a zero status without unlinking any files. you should use the rm command.

) If no matches are found. Strictly confidential and proprietary UNZIP ( 1L ) NAME unzip – list. [–x xfile(s)] An optional list of archive members to be excluded from processing. but none in any subdirectories. . Without the –x option. the specification is assumed to be a literal filename. If an exclamation point or a caret (‘!’ or ‘∧ follows the left bracket. a hyphen. The default behavior (with no options) is to extract into the current directory (and subdirectories below it) all files from the specified ZIP archive. [ c h ] .zip] Path of the ZIP archive(s). (Be sure to quote any character that might otherwise be interpreted or modified by the operating system. For example. it is also accepted before the zipfile specification (with the normal options).) Regular expressions (wildcards) may be used to match multiple members. commonly found on MS-DOS systems. but in many cases the program options or default behaviors differ.] [–x xfile(s) . ranges are specified by a beginning character. Note that selfextracting ZIP files are supported. . but note that this may cause normal shell behavior to be suppressed. zip(1L). Again. and an ending character. all C source files in all directories within the zipfile would be extracted. then the range of characters within the brackets is comple’) mented (that is. test. as with any other ZIP archive. See –v in OPTIONS below.zip] [file(s) . the –d option allows extraction in an arbitrary directory (always assuming one has permission to write to the directory). In particular. or extract files from a ZIP archive. z i p is appended. This option need not appear at the end of the command line. . just specify the . [file(s)] An optional list of archive members to be processed. Reference Manual Pages Property of BladeLogic. Only the filename can be a wildcard. . anything except the characters inside the brackets is considered a match). test and extract compressed files in a ZIP archive SYNOPSIS unzip [–Z] [–cflptuvz[abjnoqsCLMVX$/]] file[. ARGUMENTS file[.] [–d exdir] DESCRIPTION unzip will list. or between the file(s) and the –x option. A companion program. Since wildcard characters match directory separators (‘/’). separated by spaces. the suffix . creates ZIP archives. see above. Inc. The option and directory may be concatenated without any white space between them. By default.Misc. ‘‘u n z i p f o o ∗. this option may be used to exclude any files that are in subdirectories. but ‘‘–d˜ ’’ is treated as a literal subdirectory ‘‘˜’’ of the current directory. be sure to quote expressions that would otherwise be expanded or modified by the operating system. and if that also fails.x ∗/ ∗’’ would extract all C source files in the main directory. [–d exdir] An optional directory to which to extract files. ‘‘–d ˜ ’’ (tilde) is expanded by Unix C shells into the name of the user’s home directory. particularly under Unix and VMS. all files and subdirectories are recreated in the current directory. Info-ZIP Last change: 14 January 2001 (v5.42) 1 . .] matches a sequence of 0 or more characters matches exactly 1 character matches any single character found inside the brackets. immediately after the zipfile specification. (VMS versions compiled with VMSCLI defined must delimit files with commas instead. Wildcard expressions are similar to Unix egrep(1) (regular) expressions and may contain: ∗ ? [. both programs are compatible with archives created by PKWARE’s PKZIP and PKUNZIP for MS-DOS. If the file specification is a wildcard. e x e suffix (if any) explicitly. each matching file is processed in an order determined by the operating system (or file system). the path itself cannot. .

uncompressed file sizes and modification dates and times of the specified files are printed. extract only those files that already exist on disk and that are newer than the disk copies.zip’’) and is much faster. compression ratio and 32-bit CRC. an enhanced checksum) of the expanded file with the original file’s stored CRC value. unzip’s usage screen is limited to 22 or 23 lines and should therefore be considered only a reminder of the basic unzip syntax rather than an exhaustive list of all possible flags. but the –o option may be used to suppress the queries. See –f above for information on setting the timezone properly. a diagnostic screen is printed. [most OSes] set the timestamp on the archive(s) to that of the newest file in each one. This option performs the same function as the –f option. Unix DLL] print extended help for the DLL’s programming interface (API). the TZ (timezone) environment variable must be set correctly in order for –f and –u to work properly (under Unix the variable is usually set automatically). update existing files and create new ones if needed. the –a option is allowed. Reference Manual Pages Property of BladeLogic.. By default unzip queries before overwriting. –v lists archive files verbosely.42) 2 . list archive files (short format). This option has evolved and now behaves as both an option and a modifier. If UnZip was compiled with OS2_EAS defined. See the appropriate manual page for a description of these options. This option is similar to the –p option except that the name of each file is printed as it is extracted. and the compilation date. just as they are stored (no conversions). As an option it has two purposes: when a zipfile is specified with no other options. freshen existing files. This option extracts each specified file in memory and compares the CRC (cyclic redundancy check. and any options stored in environment variables that might do the same (see ENVIRONMENT OPTIONS below). When no zipfile is specified (that is. the filename is converted to lowercase and is prefixed with a caret (∧ ). The reasons for this are somewhat subtle but have to do with the differences between DOS-format file times (always local time) and Unix-format times (always in GMT/UTC) and the necessity to compare the two. the old MS-DOS FAT file system) and the –L option was given. along with totals for all files specified. If a file was archived from a single-case file system (for example. Nothing but the file data is sent to stdout. the target operating system for which it was compiled. The exhaustive list follows: –Z –A –c zipinfo(1L) mode. As a modifier it works in conjunction with other –f –l –p –t –T –u –v Info-ZIP Last change: 14 January 2001 (v5. compressed size. In addition. This corresponds to zip’s –go option except that it can be used on wildcard zipfiles (e. extract files to pipe (stdout). adding to the basic –l info the compression method. in order to support obsolescent hardware. If the first option on the command line is –Z. test archive files. the compiler and version used. ‘‘unzip –T \∗. unzip lists the home Info-ZIP ftp site and where to find a list of other ftp and non-ftp sites. i. extracting (with query) files that are newer than those with the same name on disk.g. The names. Note that under many operating systems.. the complete command is simply ‘‘unzip –v’’). the remaining options are taken to be zipinfo(1L) options. as well as (possibly) the hardware on which it was compiled. In addition to the normal header with release date and version. Strictly confidential and proprietary UNZIP ( 1L ) OPTIONS Note that. extract files to stdout/screen (‘‘CRT’’). and in addition it extracts those files that do not already exist on disk. and ASCII-EBCDIC conversion is automatically performed if appropriate.Misc. the –l option also lists columns for the sizes of stored OS/2 extended attributes (EAs) and OS/2 access control lists (ACLs). the zipfile comment and individual file comments (if any) are displayed. A typical TZ value is ‘‘PST8PDT’’ (US Pacific time with automatic adjustment for Daylight Savings Time or ‘‘summer time’’). Inc. and the files are always extracted in binary format. any special compilation options that might affect the program’s operation (see also DECRYPTION below).e. [OS/2. This option is not listed in the unzip usage screen. be verbose or print diagnostic version info.

[general] treat all files as binary (no text conversions). all three files would then match ‘‘makefile’’ (or ‘‘make∗’’. That is. This is a shortcut for – – –a. Since this does not correspond to the behavior of many other operating/file systems (for example. The –a option causes files identified by zip as text files (those with the ‘t’ label in zipinfo listings. convert text files. Inc. OS/2 HPFS. –t) to produce more verbose or debugging output. just the file’s data. [Unix only. [MacOS only] ignore MacOS extra fields. Unix files use line feeds (LFs) for end-of-line (EOL) and have no end-of-file (EOF) marker. In the example above. All Macintosh specific info is skipped. or similar). Ordinarily all files are extracted exactly as they are stored (as ‘‘binary’’ files). see the relevant options below). the old copy of ‘‘foo’’ is renamed to ‘‘foo~’’). [BeOS only] junk file attributes. unzip’s default behavior is to match both wildcard and literal filenames case-sensitively..g.) Note that zip’s identification of text files is by no means perfect. In addition. all files are deposited in the extraction directory (by default. Macintoshes use carriage returns (CRs) for EOLs. Doubling the option (–bb) forces all files to be extracted in this format. –a is enabled by default. Instead. This is similar to the default behavior of emacs(1) in many locations. –z MODIFIERS display only the archive comment. [Acorn only] suppress removal of NFS filetype extension from stored filenames. it is replaced by the info from the extra field.) [MacOS only] ignore filenames stored in MacOS extra fields. not ‘‘Makefile’’ or ‘‘MAKEFILE’’ (and similarly for wildcard specifications). unzip’s philosophy is ‘‘you get what you ask for’’ (this is also responsible for the –L/–U change. Data-fork and resource-fork are restored as separate files. [Unix only. the –C option may be used to force all filename matches to be case-insensitive. IBM mainframes and the Michigan Terminal System use EBCDIC rather than the more common ASCII character set. Strictly confidential and proprietary UNZIP ( 1L ) options (e. 512-byte record format. The –C option affects files in both the normal file list and the excluded-file list (xlist). and only if compiled with ACORN_FTYPE_NFS defined] translate filetype information from ACORN RISC OS extra field blocks into a NFS filetype extension and append it to the names of the extracted files. The –aa option forces all files to be extracted as text. The file’s BeOS file attributes are not restored. Because some file systems are fully case-sensitive (notably those under the Unix operating system) and because both ZIP archives and unzip itself are portable across platforms. specifying ‘‘makefile’’ on the command line will only match ‘‘makefile’’ in the archive. regardless of the supposed file type. and most PC operating systems use CR+LF for EOLs and control-Z for EOF. The archive’s directory structure is not recreated. Reference Manual Pages Property of BladeLogic. end-of-file characters and the character set itself as necessary. which preserves mixed case but is not sensitive to it). and NT supports Unicode.. (For example. unzip therefore prints ‘‘[text]’’ or ‘‘[binary]’’ as a visual check for each file it extracts when using the –a option. match filenames case-insensitively. this is not yet fully implemented but will be in future releases. –a –b –b –b –B –C –E –F –F –i –j –J –J Info-ZIP Last change: 14 January 2001 (v5. (On Tandem. the current one). junk paths. [VMS] auto-convert binary files (see –a above) to fixed-length. some ‘‘text’’ files may actually be binary and vice versa. the most compatible filename stored in the generic part of the entry’s header is used.42) 3 .Misc. (When the stored filename appears to already have an appended NFS filetype extension. converting line endings. and only if compiled with UNIXBACKUP defined] save a backup copy of each overwritten file with a tilde appended (e. rather than ‘b’) to be automatically extracted as such. see above).g. [Tandem] force the creation files with filecode type 180 (’C’) when extracting Zip entries marked as "text". [MacOS only] display contents of MacOS extra field during restore operation.

Storing the plaintext password as part of a command line in an automated script is even worse. in the format file. so use it with care. unzip doesn’t notice if long lines wrap at the edge of the screen. or with the –N option of the Amiga port of zip(1L).42) 4 . never overwrite existing files. use the non-echoing. old MS-DOS FAT. skip extraction of the current file. (It is often used with –f. MS-DOS] convert spaces in filenames to underscores. on some systems. See –L above. By default unzip lists and extracts such filenames exactly as they’re stored (excepting truncation. and possibly a summary when finished with each archive. ‘‘EA DATA. the version numbers may be truncated or stripped regardless of this option. and is the only way to overwrite directory EAs under OS/2. (And where security is truly important. VMS. use strong encryption such as Pretty Good Privacy instead of the relatively weak encryption provided by standard zipfile utilities. Unlike Unix more(1). but this option allows them to be retained.) Depending on the archiver.) –M –n –N –o –P password use password to decrypt encrypted zipfile entries (if any). or rename the current file. (obsolete.##’’ version numbers are stripped. interactive prompt to enter passwords.11. File comments are created with the –c option of zip(1L). THIS IS INSECURE! Many multiuser operating systems provide ways for any user to see the current command line of any other user. unzip can be terminated by pressing the ‘‘q’’ key and. NT. to be removed in a future release) leave filenames uppercase if created under MS-DOS. the user may choose to overwrite only the current file. etc. overwrite all files. files archived under single-case file systems (VMS. in which case unzip assumes the height is 24 lines. Inc. Strictly confidential and proprietary UNZIP ( 1L ) –L convert to lowercase any filename originating on an uppercase-only operating system or file system. the new default behavior is identical to the old behavior with the –U option. The –q[q] options suppress the printing of some or all of these messages. (This was unzip’s default behavior in releases prior to 5. this can be ugly or inconvenient when extracting to a case-preserving file system such as OS/2 HPFS or a case-sensitive one such as under Unix. any file or zipfile comments that may be stored in the archive. VMS files can be stored with a version number. overwrite existing files without prompting. On some systems the number of available lines on the screen is not detected. skip extraction of all existing files. skip the extraction of that file without prompting. which stores filenotes as comments. etc. this option causes the names of all files from certain systems to be converted to lowercase. [Amiga] extract file comments as Amiga filenotes.##. The –LL option forces conversion of every filename to lowercase. This is a dangerous option.ext. which is now obsolete and will be removed in a future release. Conversion of spaces to underscores can eliminate the awkwardness in some cases. etc.g. regardless of the originating file system.) –s –U –V Info-ZIP Last change: 14 January 2001 (v5.) may be stored as all-uppercase names. If a file already exists. Ordinarily unzip prints the names of the files it’s extracting or testing. By default unzip queries before extracting any file that already exists. retain (VMS) file version numbers. the next screenful may be viewed by pressing the Enter (Return) key or the space bar. This can be awkward. Whenever possible. SF’’).). the extraction methods. [OS/2. there is no forwardsearching or editing capability.. conversion of unsupported characters. unzip pauses with a ‘‘– –More– –’’ prompt. Since all PC operating systems allow spaces in filenames. (On file systems that limit filenames to particularly short lengths. By default the ‘‘.Misc. Reference Manual Pages Property of BladeLogic. even on stand-alone systems there is always the threat of over-the-shoulder peeking. pipe all output through an internal pager similar to the Unixmore(1) command. unzip by default extracts filenames with spaces intact (e. the Enter/Return key.) –q perform operations quietly (–qq = even quieter). however. At the end of a screenful of output. however. Also. effectively resulting in the printing of two or more lines and the likelihood that some text will scroll off the top of the screen before being viewed. since MS-DOS in particular does not gracefully support spaces in filenames.

–L. Doubling the option (–$$) allows fixed media (hard disks) to be labelled as well. It is not clear under what conditions this would ever be useful anyway. OS/2. Inc.0 to 5. in effect. UNZIP takes precedence. By default. or –n modifiers: make unzip auto-convert text files by default.0). If both UNZIP and UNZIPOPT are defined. To override an environment option. or make it always overwrite or never overwrite files as it extracts them. two (or more) minuses may be used: unzip –t––q zipfile unzip –––qt zipfile (the two are equivalent). It is also consistent with the behavior of Unix nice(1). filename extensions that match one of the items in this extension list are swapped in front of the base name of the extracted file. for example. make it convert filenames from uppercase systems to lowercase. Strictly confidential and proprietary UNZIP ( 1L ) –X [VMS. During extraction. but under Unix. –q. –C. only reporting errors. use the command unzip ––q[other options] zipfile The first hyphen is the normal switch character. acting on the q option. Reference Manual Pages Property of BladeLogic. volume labels are ignored. Info-ZIP Last change: 14 January 2001 (v5. NT] restore the volume label if the extraction medium is removable (e. UNZIPOPT is also accepted (don’t ask). considered to be just like any other command-line options. or security ACLs under Windows NT. For compatibility with zip(1L). To cancel both quiet flags. the default variable names are UNZIP_OPTS for VMS (where the symbol used to install unzip as a foreign command would otherwise be confused with the environment variable). extra ownership info available on some operating systems.Misc. In most cases this will require special system privileges. Warp Connect with IBM Peer 1. and UNZIP for all other operating systems. or user and group info (UID/GID) under Unix. however. make it match names case-insensitively. to make unzip act as quietly as possible. so no attempt is made at cross-platform portability of access privileges. and doubling the option (–XX) under NT instructs unzip to use privileges for extraction. one may use the ‘‘minus operator’’ to remove it. to override one of the quiet-flags in the example above. This can be done with any option. Thus the effect here is to cancel one quantum of quietness. as long as the user IDs match his or her own.] [MS-DOS. –$ –/ extensions [Acorn only] overrides the extension list supplied by Unzip$Ext environment variable. For example.42) 5 . and the second is a minus sign. but it is reasonably intuitive: just ignore the first hyphen and go from there.g. Note that ordinary file attributes are always restored--this option applies only to optional. [NT’s access control lists do not appear to be especially compatible with OS/2’s.. NT] restore owner/protection info (UICs) under VMS.0. ENVIRONMENT OPTIONS unzip’s default behavior may be modified via options placed in an environment variable. make it quieter. a diskette). a user who belongs to several groups can restore files owned by any of those groups. Unix. As suggested by the examples above. unzip’s diagnostic option (–v with no zipfile name) can be used to check the values of all four possible unzip and zipinfo environment variables. one would use one of the following commands: UNZIP=–qq. This may seem awkward or confusing. OS/2. except that they are effectively the first options on the command line. or access control lists (ACLs) under certain network-enabled versions of OS/2 (Warp Server with IBM LAN Server/Requester 3. export UNZIP setenv UNZIP –qq set UNZIP=–qq define UNZIP_OPTS "–qq" Unix Bourne shell Unix C shell OS/2 or MS-DOS VMS (quotes for lowercase) Environment options are. –o. but it is probably most useful with the –a. For instance.

UnZip 5. older versions of zip(1L) and zipcloak(1L) allowed null passwords. To check a version for crypt support.g. including Latin-1 (ISO 8859-1) and OEM code page 850. unzip will prompt for another password. US export restrictions have been liberated. Reference Manual Pages Property of BladeLogic. Info-ZIP uses the OEM code page on DOS. if both of these fail. assuming the timezone is correctly set in the Control Panel. either attempt to test or extract an encrypted archive.) ISO character encodings other than Latin-1 are not supported. and so on until all files are extracted. DECRYPTION Encrypted archives are fully supported by Info-ZIP software. In case you need binary distributions with crypt support enabled. if a zipfile member is encrypted. just a carriage return or ‘‘Enter’’) is taken as a signal to skip all further prompting.zip. The preferred decryption method is simply to extract normally. (This is a security feature of the PKWARE zipfile format. Inc. passwords with accented European characters) may not be portable across systems and/or other archivers.3 attempts to use the default character set first (e. de-/encryption support might be disabled in your compiled binary. followed by the alternate one (e.x ports but Latin-1 everywhere else. On EBCDIC systems. However. Strictly confidential and proprietary UNZIP ( 1L ) The timezone variable (TZ) should be set according to the local timezone in order for the –f and –u to operate correctly. As noted above. This problem stems from the use of multiple encoding methods for such characters.50 uses Latin-1 (and is therefore incompatible with DOS PKZIP). it helps prevent brute-force attacks that might otherwise gain a large speed advantage by testing only the header. that’s not quite true. The correct password will always check out against the header. but there is a 1-in-256 chance that an incorrect password will as well. but at a cost in security. see the file ‘‘WHERE’’ in any Info-ZIP source or binary distribution for locations both inside and outside the US. by testing a 12-byte header on each file. unzip continues to use the same password as long as it appears to be valid. creating any subdirectories as necessary: unzip letters To extract all members of letters. Windows PKZIP 2. See the description of –f above for details. If the first password fails the header check on some file. either an incorrect CRC will be generated for the extracted data or else unzip will fail during the extraction because the ‘‘decrypted’’ bytes do not constitute a valid compressed data stream. Latin-1). unzip will prompt for the password without echoing what is typed.Misc. and Nico Mak’s WinZip 6.g.. and our source archives do now include full crypt code. so unzip checks each encrypted file to see if the null password works. EBCDIC encoding will be tested as a last resort. OEM code page) to test passwords.zip into the current directory and subdirectories below it. printing only a summary message indicating whether the archive is OK or not: unzip -tq letters Info-ZIP Last change: 14 January 2001 (v5. If a password is not known.04g uses the OEM code page.x does not allow 8-bit passwords at all. but due to United States export restrictions. This may result in ‘‘false positives’’ and extraction errors. as noted above. EXAMPLES To use unzip to extract all members of the archive letters.) Archives encrypted with 8-bit passwords (for example.42) 6 . This variable may also be necessary in order for timestamps on extracted files to be set correctly. the –P option may be used to supply a password on the command line. Some compiled versions of unzip may not support decryption. since spring 2000. OS/2 and Win3. EBCDIC is not tested on non-EBCDIC systems.. DOS PKZIP 2. entering a null password (that is.) In the case that an incorrect password is given but it passes the header test anyway. or else check unzip’s diagnostic screen (see the –v option above) for ‘‘[decryption]’’ as one of the special compilation options. Under Windows 95/NT unzip should know the correct timezone even if TZ is unset. Only unencrypted files in the archive(s) will thereafter be extracted. (Since there are no known archivers that encrypt using EBCDIC encoding.zip into the current directory only: unzip -j letters To test letters. (In fact.

With luck unzip will report ‘‘No errors Info-ZIP Last change: 14 January 2001 (v5.tex.zip "∗.zip or unzip –l–q file.: unzip –v In the last five examples. To do a singly quiet listing: unzip –l file. Inc. auto-converting to the local end-of-line convention and piping the output into more(1): unzip –ca letters \∗.) To extract to standard output all members of letters.f. Reference Manual Pages Property of BladeLogic. be older): unzip –fo sources To extract newer versions of the files already in the current directory and to create any files not already there (same caveat as previous example): unzip –uo sources To display a diagnostic screen showing which unzip and zipinfo options are stored in environment variables.1 or later contain no timezone information. both ∗. something that is worth making a habit of doing. etc. Makefile. regardless of case (e. being a lazy sort. One may then simply type ‘‘tt zipfile’’ to test an archive.zip whose names end in . To extract all FORTRAN and C source files. double quotes could have been used instead. as in the source examples below.dvi to standard output and pipe it to a printing program: unzip –p articles paper1.zip TIPS (extra minuses don’t hurt) The current maintainer.[fch]" makefile -d /tmp To extract only newer versions of the files already in the current directory. Strictly confidential and proprietary UNZIP ( 1L ) To test all zipfiles in the current directory. whether decryption support was compiled in.zip or unzip –l––q file.) To do a standard listing: unzip ––ql file. without querying (NOTE: be careful of unzipping in one timezone a zipfile created in another--ZIP archives other than those created by Zip 2.zip (The backslash before the asterisk is only required if the shell expands wildcards.dvi | dvips To extract all FORTRAN and C source files--∗. ∗.Misc. the compiler with which unzip was compiled.tex | more To extract the binary file paper1. MAKEFILE or similar): unzip –C source.C.42) 7 . and a ‘‘newer’’ file from an eastern timezone may.zip’’ is generally not necessary. and any makefile.g. as in Unix.zip "∗.c.[fch]" makefile -d /tmp To extract any such files but convert any uppercase MS-DOS or VMS names to lowercase and convert the line-endings of all of the files to the local standard (without respect to any files that might be marked ‘‘binary’’): unzip –aaCL source. ∗.zip (Note that the ‘‘. assume that UNZIP or UNZIP_OPTS is set to -q. in fact.c and ∗.zip "∗..zip To do a doubly quiet listing: unzip –ql file.[fch]" Makefile -d /tmp (the double quotes are necessary only in Unix and only if globbing is turned on). finds it very useful to define a pair of aliases: tt for ‘‘unzip –tq’’ and ii for ‘‘unzip –Z’’ (or ‘‘zipinfo’’). and Makefile--into the /tmp directory: unzip source.h. printing only the summaries: unzip -tq \∗.

no errors or warnings detected. the end of the ZIP archive was encountered prematurely. unzip was unable to allocate memory during in-memory decompression. except with funzip (and then only the first member of the archive can be extracted). but processing completed successfully anyway.Misc. the exit status is 1. the disk is (or was) full during extraction. Strictly confidential and proprietary UNZIP ( 1L ) detected in compressed data of zipfile. 0x7fff0001 for warning errors. no matching files were found. DIAGNOSTICS The exit status (or error level) approximates the exit codes defined by PKWARE and takes on the following values. except in conjunction with zip. invalid options were specified on the command line. The maintainer also finds it useful to set the UNZIP environment variable to ‘‘–aL’’ and is tempted to add ‘‘–C’’ as well. no files were found due to bad decryption password(s). unzip was unable to allocate memory during decompression to disk. The current mapping is as follows: 1 (success) for normal exit. Reference Manual Pages Property of BladeLogic. In addition. there is a compilation option to expand upon this behavior: defining RETURN_CODES results in a human-readable explanation of what the error status means. some broken zipfiles created by other archivers have simple workarounds. and (0x7fff000? + 16∗normal_unzip_exit_status) for all other errors. unzip was unable to allocate memory or unable to obtain a tty to read the decryption password(s). 9-11 and 80-82. scarier-looking things. where the ‘?’ is 2 (error) for unzip values 2. (All parts must be concatenated together in order. one or more warning errors were encountered. a generic error in the zipfile format was detected.) This will definitely be corrected in the next major release. 50. however.42) 8 . so unzip instead maps them into VMS-style status codes.) 2 3 4 5 6 7 8 9 10 11 50 51 80 81 82 VMS interprets standard Unix (or PC) return values as other. His ZIPINFO variable is set to ‘‘–z’’. BUGS Multi-part archives are not yet supported. Inc. Archives read from standard input are not yet supported. Processing probably failed immediately. 51). and 4 (fatal error) for the remaining ones (3-8. a severe error in the zipfile format was detected. [currently not used] the specified zipfiles were not found.zip. the user aborted unzip prematurely with control-C (or similar) testing or extraction of one or more files failed due to unsupported compression methods or unsupported decryption. Processing may have completed successfully anyway.’’ after which one may breathe a sigh of relief. except under VMS: 0 1 normal. Info-ZIP Last change: 14 January 2001 (v5. unzip was unable to allocate memory for one or more buffers during program initialization. This includes zipfiles where one or more files was skipped due to unsupported compression method or encryption with an unknown password. and then ‘‘zip –F’’ must be performed on the concatenated archive in order to ‘‘fix’’ it. (If even one file is successfully processed.

Onno van der Linden (Zip).Misc.org/pub/infozip/ or ftp://ftp. Kai Uwe Rommel (OS/2). Hunter Goatley (VMS). Dates. unzip would sometimes fail on long zipfiles (bad CRC. zipinfo(1L). MS-DOS. Mike White (Windows GUI. Johnny Lee (MS-DOS. passwords with accented European characters) may not be portable across systems and/or other archivers. Carl Mascott did the first Unix port. Windows 95). The full list of contributors to UnZip has grown quite large. then overwrite just the directory entries (e. not always reproducible).42) 9 . zipgrep(1L). John Bush (Solaris. directories and symbolic (soft) links. as noted above.g. Retry. there should additionally be a choice for creating a new version of the file.. Sergio Monesi (Acorn RISC OS). SEE ALSO funzip(1L). In addition. the ‘‘overwrite’’ choice does create a new version. VMS. older versions of unzip may hang the system. Steve Salisbury (Windows 95. The author of the original unzip code upon which Info-ZIP’s was based is Samuel H. Chris Herborth (BeOS. and Dave Smith (Tandem NSK). Since Ultrix has been abandoned in favor of Digital Unix (OSF/1). NT). Mark Adler (decompression. Windows DLLs). This is a limitation of the operating system. zipcloak(1L). AUTHORS The primary Info-ZIP authors (current semi-active members of the Zip-Bugs workgroup) are: Greg ‘‘Cave Newt’’ Roelofs (UnZip). but control-C (or control-Break) can still be used to terminate unzip. NT). Info-ZIP Last change: 14 January 2001 (v5. This was apparently due either to a hardware bug (cache memory) or an operating system bug (improper handling of page faults?). [Unix] Unix special files such as FIFO buffers (named pipes). unzip should detect and treat each occurrence of line-wrap as one additional line printed. Amiga). Windows 95. Smith. unzip should detect the true screen geometry on all systems. Reference Manual Pages Property of BladeLogic. requiring a reboot. unzip’s query only allows skipping. This requires knowledge of the screen’s width as well as its height. Jean-loup Gailly (compression).info-zip. the old version is not overwritten or deleted. fUnZip). Fail?’’ message. it fails to detect the wrapping of long lines and may thereby cause lines at the top of the screen to be scrolled off before being read. ‘‘unzip -o foo ∗/’’). please refer to the CONTRIBS file in the UnZip source distribution for a relatively complete version. block devices and character devices are not restored even if they are somehow represented in the zipfile. This problem appears to be fixed. this may not be an issue anymore. Windows 95. [MS-DOS] When extracting or testing files from an archive on a defective floppy diskette. In practice this may mean a two-pass approach is required: first unpack the archive normally (with or without freshening/updating existing files).org/pub/infozip/ . Jonathan Hudson (SMS/QDOS). unzip’s –M (‘‘more’’) option is overly simplistic in its handling of screen output. overwriting or renaming. In fact. See the discussion in DECRYPTION above. times and permissions of stored directories are not restored except under Unix. if the ‘‘Fail’’ option is chosen from DOS’s ‘‘Abort. zipsplit(1L) URL The Info-ZIP home page is currently at http://www. Harald Denker (Atari. Paul Kienitz (Amiga. Strictly confidential and proprietary UNZIP ( 1L ) Archives encrypted with 8-bit passwords (e.. and David P. [VMS] When extracting to another directory. nor are hard-linked files relinked. the simple Unix foo syntax is silently ignored (as is the less common VMS foo. Atari). Under DEC Ultrix. [VMS] When the file being extracted already exists. MVS). shared code. general Zip and UnZip integration and optimization). zipnote(1L). [OS/2] Extended attributes for existing directories are only updated if the –o (‘‘overwrite all’’) option is given. QNX. Steve Miller (Windows CE GUI). Basically the only file types restored by unzip are regular files. Christian Spieler (UnZip maintance coordination.info-zip. zip(1L). NT.dir syntax). unzip has no way to determine whether the stored attributes are newer or older than those on disk. Inc. because directories only have a creation time associated with them.foo] syntax is accepted for the –d option. Kirschbaum organized and led Info-ZIP in its early days with Keith Petersen hosting the original mailing list at WSMR-SimTel20.g. only the [.

1 v5. GRR) Info-ZIP (Zip-Bugs subgroup. Inc. GRR) Info-ZIP (Zip-Bugs subgroup. GRR) Info-ZIP (Zip-Bugs subgroup.42 15 Mar 89 9 Sep 89 fall 1989 1 May 90 15 Aug 90 1 Dec 90 12 May 91 20 Mar 92 21 Aug 92 15 Jan 93 7 Feb 94 2 Aug 94 28 Aug 94 30 Apr 96 22 Apr 97 31 May 97 3 Nov 97 28 Nov 98 16 Apr 00 14 Jan 01 Samuel H.1 v4.0 v4. maintainer) Info-ZIP Info-ZIP (Zip-Bugs subgroup.1 v4. SPC) Info-ZIP Last change: 14 January 2001 (v5. consolidator) Info-ZIP (GRR.11 v5. Smith Samuel H.41 v5. GRR) Info-ZIP (Zip-Bugs subgroup.0 v5. GRR) Info-ZIP (Zip-Bugs subgroup. consolidator) Info-ZIP (DPK.0 v2. GRR) Info-ZIP (Zip-Bugs subgroup.2 v5. GRR) Info-ZIP (Zip-Bugs subgroup. Reference Manual Pages Property of BladeLogic.32 v5. Strictly confidential and proprietary UNZIP ( 1L ) VERSIONS v1. GRR) Info-ZIP (Zip-Bugs subgroup.2 v2.01 v5.Misc. GRR) Info-ZIP (Zip-Bugs subgroup.42) 10 .3 v5.2 v5.12 v5. SPC) Info-ZIP (Zip-Bugs subgroup. Smith many Usenet contributors Info-ZIP (DPK.x v3.4 v5. GRR) Info-ZIP (Zip-Bugs subgroup.0 v3.31 v5. SPC) Info-ZIP (Zip-Bugs subgroup.

ranges are specified by a beginning character. Note that self-extracting archives made with unzipsfx are no more (or less) portable across different operating systems than is the unzip executable itself. [ c h ] . a number of the less-vital capabilities in regular unzip have been removed. the following option is also enabled: [–d exdir] An optional directory to which to extract files.] matches a sequence of 0 or more characters matches exactly 1 character matches any single character found inside the brackets. the listing and diagnostic functions (–l and –v). Because the executable stub adds bulk to the archive (the whole purpose of which is to be as small as possible). although it will generate a harmless warning about extra bytes at the beginning of the zipfile. the ability to decompress older compression formats (the ‘‘reduce.x ∗/ ∗’’ would extract all C source files in the main directory. Since wildcard characters match directory separators (‘/’). . Despite this. . all files and subdirectories are recreated in the current directory. The option and directory may be concatenated without any white space between them. ‘‘f o o s f x ∗. If an exclamation point or a caret (‘!’ or ‘∧ follows the left bracket. If unzipsfx is compiled with SFX_EXDIR defined. For example. all C source files in all directories within the zipfile would be extracted. [–x xfile(s) .Misc. but none in any subdirectories. . then the range of characters within the brackets is comple’) mented (that is. the –d option allows extraction in an arbitrary directory (always assuming one has permission to write to the directory).42) 1 . (Be sure to quote any character that might otherwise be interpreted or modified by the operating system. ARGUMENTS [file(s)] An optional list of archive members to be processed. These wildcards may contain: ∗ ? [. ‘‘–d ˜ ’’ (tilde) is expanded by Unix C shells into the name of the user’s home directory. the internal directory structure is not updated to reflect the extra bytes prepended to the original zipfile. In particular. Reference Manual Pages Property of BladeLogic. By default. .) [–x xfile(s)] An optional list of archive members to be excluded from processing. particularly under Unix and VMS. Instead of taking its first non-flag argument to be the zipfile(s) to be extracted. This limitation is due to the simplistic manner in which the archive is created. a hyphen. Among these are the usage (or help) screen. but note that this may cause normal shell behavior to be suppressed. for example. Inc. and PKUNZIP may be unable to test or extract it. anything except the characters inside the brackets is considered a match). Strictly confidential and proprietary UNZIPSFX ( 1L ) NAME unzipsfx – self-extracting stub for prepending to ZIP archives SYNOPSIS <name of unzipsfx+archive combo> [–cfptuz[ajnoqsCLV$]] [file(s) . unzipsfx seeks itself under the name by which it was invoked and tests or extracts the contents of the appended archive. Without the –x option. Regular expressions (wildcards) similar to those in Unix egrep(1) may be used to match multiple members. this option may be used to exclude any files that are in subdirectories. and the ability to extract to a directory other than the current one. will only self-extract under the same flavor of Unix. however. Regular unzip may still be used to extract the embedded archive as with any normal zipfile. . and an ending character. but ‘‘–d˜ ’’ is treated as a literal subdirectory ‘‘˜’’ of the current directory.]] DESCRIPTION unzipsfx is a modified version of unzip(1L) designed to be prepended to existing ZIP archives in order to form self-extracting archives. Info-ZIP Last change: 14 January 2001 (v5.’’ ‘‘shrink’’ and ‘‘implode’’ methods). . Decryption is supported as a compile-time option but should be avoided unless the attached archive contains encrypted files. the self-extracting archive is technically not a valid ZIP archive. In general a self-extracting archive made on a particular Unix system.

exe zip -A letters. ‘‘zip -A’’ doesn’t work on Amiga self-extracting archives. although this is likely to be an issue only for the person creating and testing the self-extracting archive. –o (overwrite without prompting).Misc.42) 2 . OS/2 or NT (note the use of the /b [binary] option to the copy command): copy /b unzipsfx. See unzip(1L) for details. Once again.zip and change the new archive’s permissions to be world-executable under Unix: cat unzipsfx letters. OS/2.exe Under VMS: copy unzipsfx. but the testing option (–t) may be used as a ‘‘poor man’s’’ listing. Strictly confidential and proprietary UNZIPSFX ( 1L ) OPTIONS unzipsfx supports the following unzip(1L) options: –c and –p (extract to standard output/screen).exe letters == "$currentdisk:[currentdir]letters.zip letters. (Support for regular ASCII text-conversion may be removed in future versions.) To test (or list) the newly created self-extracting archive: Info-ZIP Last change: 14 January 2001 (v5. All normal listing options (–l.zip letters. See unzip(1L) for details. interactively with a non-echoing prompt for the password(s).exe+letters. Inc. –v and –Z) have been removed.exe.exe (The VMS append command may also be used. EBCDIC conversion will of course continue to be supported since the zipfile format implies ASCII storage of text files. those creating self-extracting archives may wish to include a short listing in the zipfile comment. Reference Manual Pages Property of BladeLogic. The third line assumes that Zip is already installed as a foreign command. –L (convert uppercase-OS names to lowercase). ENVIRONMENT OPTIONS unzipsfx uses the same environment variables as unzip(1L) does. –q (operate quietly). that only adds to the size of the archive. DECRYPTION Decryption is supported exactly as in unzip(1L).zip > letters chmod 755 letters zip -A letters To create the same archive under MS-DOS. EXAMPLES To create a self-extracting archive letters from a regular zipfile letters. NT]) and –$ (restore volume label [DOS. The second command installs the new program as a ‘‘foreign command’’ capable of taking arguments. See unzip(1L) for a more complete description of these options. MODIFIERS unzipsfx currently supports all unzip(1L) modifiers: –a (convert text files). –j (junk paths) and –V (retain version numbers). NT. –t (test archive) and –z (print archive comment). –C (match names case-insenstively). OS/2.exe" zip -A letters. that is. note that if the archive has no encrypted files there is no reason to use a version of unzipsfx with decryption support. –s (convert spaces in filenames to underscores [DOS.zip UnZipSFX (MakeSFX is included with the UnZip source distribution and with Amiga binary distributions.) Under AmigaDOS: MakeSFX letters letters. –n (never overwrite). plus the following operating-system specific options: –X (restore VMS owner/protection info).) See unzip(1L) for a more complete description of these modifiers. Amiga]).letters. Alternatively. –f and –u (freshen and update existing files upon extraction). since it is simple enough for the archive’s creator to ensure that text files have the appropriate format for the local OS.

so the archive may be invoked from anywhere in the user’s path. and therefore neither are the resulting archives.Misc. but other compilers may not). the attached archive is defined as a ‘‘debug hunk. so in general an archive must either be in the current directory when it is invoked. Atari TOS. between some flavors of Intel-based Unix).txt To extract everything except the ∗. The situation is not known for AmigaDOS. printing only a summary message indicating whether the archive is OK or not: letters –tqq To extract the complete contents into the current directory. or else a full or relative path must be given. VMS users must know how to set up self-extracting archives as foreign commands in order to use any of unzipsfx’s options.txt files: letters -x ∗. ‘‘can’t find myself. in order to create working selfextracting archives. MakeSFX. however (e.txt To extract only the README file to standard output (the screen): letters -c README To print only the zipfile comment: letters –z LIMITATIONS The principle and fundamental limitation of unzipsfx is that it is not portable across architectures or operating systems. But PKWARE’s archiver suite may not be able to deal with the modified archive unless its offsets have been adjusted. are also known to prepend junk. ‘‘run letters’’ (to continue the examples given above). DIAGNOSTICS unzipsfx’s exit status (error level) is identical to that of unzip(1L). (For technically oriented users. Also. notably MacBinary. As noted above. unzipsfx has no knowledge of the user’s PATH. This is not necessary for simple extraction. unzipsfx on the Amiga requires the use of a special program. e. The latter limitation is mainly relevant to those who create SFX archives. Under OS/2 and NT there are operating-system calls available that provide the full path name.. Reference Manual Pages Property of BladeLogic.’’ This is always true under Unix and may be true in some cases under MS-DOS.. however.42) 3 . etc.txt files (in Unix quote the ‘∗’): letters ∗. see the corresponding man page. listing functions and extraction to other directories.g. depending on the compiler used (Microsoft C fully qualifies the program name. Another problem with the current implementation is that any archive with ‘‘junk’’ prepended to the beginning technically is no longer a zipfile (unless zip(1) is used to adjust the zipfile offsets appropriately. Inc.g. MacOS. recreating all files and subdirectories as necessary: letters To extract all ∗. unzip(1) takes note of the prepended bytes and ignores them since some file-transfer protocols. as noted above). a number of the normal unzip(1L) functions have been removed in order to make unzipsfx smaller: usage and diagnostic info. unzipsfx will print a warning to the effect. All current bugs in unzip(1L) exist in unzipsfx as well. Strictly confidential and proprietary UNZIPSFX ( 1L ) letters –t To test letters quietly. If a user attempts to extract the archive from a directory in the PATH other than the current one. only stored and deflated files are supported. Info-ZIP Last change: 14 January 2001 (v5.’’) There may be compatibility problems between the ROM levels of older Amigas and newer ones. simple concatenation does not work. For some architectures there is limited portability. but the command to do so then becomes.

Inc. zipinfo(1L).Misc.org/pub/infozip/ or ftp://ftp. zip(1L). zipgrep(1L).org/pub/infozip/ . Reference Manual Pages Property of BladeLogic. unzip(1L). zipcloak(1L). See unzip(1L) for the current list of Zip-Bugs authors.info-zip.info-zip. Info-ZIP Last change: 14 January 2001 (v5. AUTHORS Greg Roelofs was responsible for the basic modifications to UnZip necessary to create UnZipSFX. or the file CONTRIBS in the UnZip source distribution for the full list of Info-ZIP contributors. zipnote(1L). Strictly confidential and proprietary UNZIPSFX ( 1L ) SEE ALSO funzip(1L).42) 4 . zipsplit(1L) URL The Info-ZIP home page is currently at http://www.

the number of bytes the rest of the line represents. Berkeley and its contributors. and represents an integer. EXAMPLES The following example packages up a source tree. uudecode . Lines preceding a header must not.tar. 6 bits per character. The header line is distinguished by having the first 6 characters ‘‘begin ’’ (note the trailing space). followed by a newline. the standard input) into the original form. Uudecode transforms uuencoded files (or by default.encode/decode a binary file SYNOPSIS uuencode [file] name uudecode [file . All are offset by a space to make the characters printing. The encoding uses only printing ASCII characters and includes the mode of the file and the operand name for use by uudecode.. ORIGIN Uuencode and uudecode include software developed by the University of California. compresses it. When uudecode is run on the target system. The uudecode(1) command will ignore any lines preceding the header or following the trailer. and a string which names the remote file. each at most 62 characters long (including the trailing newline). Extra garbage will be included to make the character count a multiple of 4.src_tree | compress | uuencode src_tree.uuencode(1) Property of BladeLogic. OPTIONS There are no options for any of these commands. Uuencode reads file (or by default the standard input) and writes an encoded version to the standard output. tar cf . this fact can be determined by the value of the count on the last line. Groups of 3 bytes are stored in 4 characters.] DESCRIPTION Uuencode and uudecode are used to transmit binary files over transmission mediums that do not support other than simple ASCII data. NSH 1 . Such integers are always in the range from 0 to 63 and can be determined by subtracting the character space (octal 40) from the character. These consist of a character count. If the size is not a multiple of 3. Please see the intro section for complete acknowledgements. uuencodes it and mails it to a user. A space separates the three items in the header line. The last line may be shorter than the normal 45 bytes. Inc. followed by a number of body lines. The body is terminated by a line with a count of zero.tar.Z | mail jsmith FILE FORMAT Files output by uuencode(1) consist of a header line. The character count is a single printing character.. This line consists of one ASCII space. and a trailer line. The resulting file is named name and will have the mode of the original file except that setuid and execute bits are not retained. Strictly confidential and proprietary uuencode(1) NAME uuencode. followed by encoded characters. CAVEATS The encoded form of the file is expanded by 35% (3 bytes become 4 plus control information).Z’’ will be created which may then be uncompressed and extracted into the original tree. Uudecode ignores any leading and trailing lines. the file ‘‘src_tree. of course. look like a header. The word begin is followed by a mode (in octal). The body consists of a number of lines. The trailer line consists of ‘‘end’’ on a line by itself.

Inc. compress(1) NSH 2 . Strictly confidential and proprietary uuencode(1) SEE ALSO uuencode(1).uuencode(1) Property of BladeLogic. uudecode (1).

Strictly confidential and proprietary version(1) NAME version − Output version information about BladeLogic software SYNOPSIS version DESCRIPTION The version command outputs release information about the BladeLogic software that it detects as being installed on the local server.2002 BladeLogic Inc.494 [Oct 20 2002 16:41:59] Copyright (C) 1996 . SEE ALSO agentinfo(1). NSH 1 .494 [Oct 20 2002 16:41:59] Copyright (C) 1996 .5.0. Inc. ORIGIN version was written by Thomas Kraus.5.2002 BladeLogic Inc.0. BladeLogic Network Shell 4. Sample output is: BladeLogic RSCD Agent 4.version(1) Property of BladeLogic.

informative messages and other user oriented messages are turned off. . or. Strictly confidential and proprietary VI (1) NAME ex. if standard input is not a terminal. −e −F −R −r −S −s −t tag −v −w size Set the initial window size to the specified number of lines. or the readonly option was set. . Particularly useful for initial positioning in the file. vi.] DESCRIPTION ex is a line-oriented text editor. exactly as if the −s option had been specified. disallowing all access to external programs. If no recoverable files by the specified name exist. Don’t copy the entire file when first starting to edit. See the SEE ALSO section below for a list of additional materials. and no startup files or environment variables are read. In the ex interface. and you absolutely have to get work done immediately. as if the command name were ex. entitled FAST STARTUP. view − text editor SYNOPSIS ex [ −FRrSsv] [ −c cmd] [ −t tag] [ −w size] [file . If you’re in an unfamiliar environment. applicable only to ex edit sessions. . Start editing at the specified tag (see ctags(1)). Command input for ex/vi is read from the standard input. Inc. nex/nvi is used only when it’s necessary to distinguish it from the historic implementations of ex/vi.) Start editing in read-only mode. This manual page is intended for users already familiar with ex/vi. nex/nvi supports both the old and new syntax. the file is edited as if the −r option had not been specified. (The default is to make a copy in case someone else modifies the file during your edit session. ex will read commands from it regardless. list the files that could be recovered. Batch mode is useful when running ex scripts.VI (1) PropertyGeneral Commands Manual System of BladeLogic. nex/nvi supports both the old and new syntax. Prompts. For the rest of this manual page. This is the POSIX 1003. as if the command name was vi.] vi [ −eFRrS] [ −c cmd] [ −t tag] [ −w size] [file . It’s probably enough to get you going. vi is a screen-oriented text editor. . 1996 1 . nex/nvi are intended as bug-for-bug compatible replacements for the original Fourth Berkeley Software Distribution ( 4BSD ) ex and vi programs. Start editing in ex mode. although cmd is not limited to positioning commands. ex and vi are different interfaces to the same program. Anyone else should almost certainly read a good tutorial on the editor before this manual page.2 interface for the historic “+cmd” syntax. In the vi interface. however.2 interface for the historic “-” argument. The following options are available: −c cmd Execute cmd on the first file loaded. it is an error if standard input is not a terminal. Recover the specified files. This manual page is the one provided with the nex/nvi versions of the ex/vi text editors.] view [ −eFrS] [ −c cmd] [ −t tag] [ −w size] [file . if no files are specified. as if the command name was view. . view is the equivalent of using the −R ( read-only ) option of vi. read the section after the options description. . BSD October 10. Start editing in vi mode. This is the POSIX 1003. Enter batch mode. Run with the secure edit option set. and it is possible to switch back and forth during an edit session. the session will be a batch mode session.

vi is a screen editor. enter the following command: $ vi file The command you should enter as soon as you start editing is: :set verbose showmode This will make the editor give you verbose error messages and display the current mode at the bottom of the screen. too. There is only one key that takes you out of input mode. FAST STARTUP This section will tell you the minimum amount that you need to do simple editing tasks using vi. The other fact that you need to understand is that vi is a modeful editor. Key names are written using less-than and greater-than signs. 〈cursor-arrows〉 The cursor arrow keys should work. In that case you should find someone that already knows vi and have them walk you through this section. before the cursor.e. vi will beep at you if you try and do something that’s not allowed. Move the cursor down one line. If you’ve never used any screen editor before. Inc. you are either entering text or you are executing commands. Once you’ve entered input mode using one of the a. except for the last line of the screen. O or o commands.VI (1) PropertyGeneral Commands Manual System of BladeLogic. /text a i O o 〈escape〉 Search for the string “text” in the file. you’re likely to have problems even with this simple introduction. Generally. or greater than 0 if an error occurs. and move the cursor to its first character. keep entering the 〈escape〉 key until vi beeps at you. after the cursor. The last line of the screen is used for you to give commands to vi. and start entering text. Open a new line above the line the cursor is on. To start editing a file. i. and you have to be in the right mode to do one or the other. use 〈escape〉 to quit entering text and return to command mode. Move the cursor up one line. You will be in command mode when you first start editing a file. This means that it takes up almost the entire screen. Insert new text. 〈escape〉 means the “escape” key. e. If you’re ever confused as to which mode you’re in. and for vi to give information to you. Move the cursor right one character. The commands to enter new text are: The commands to copy text are: BSD October 10. usually labeled “Esc” on your terminal’s keyboard. Append new text. There are commands that switch you into input mode. 1996 2 . and start entering text. and that is the 〈escape〉 key. It will also display error messages. Strictly confidential and proprietary VI (1) ex/vi exits 0 on success. The commands to move around the file are: h j k l Move the cursor left one character. Open a new line below the line the cursor is on.g. displaying part of the file on each screen line. i.

vi will refuse to quit). Delete the line the cursor is on. 〈control-A〉 Search forward for the current word. The commands to delete text are: The commands to write the file are: :w file_name Write the file back to the file with the name file_name. i. leaving the current line and column as is. One final caution: Unusual characters can take up more than one column on the screen. If count is not given. Delete the character the cursor is on. they affect the entire line no matter how many screen lines it takes up and the entire character no matter how many screen columns it takes up. [count] 〈control-E〉 Scroll forward count lines. and long lines can take up more than a single screen line. The above commands work on “physical” characters and lines. Quit. Write the file back to the file with the name that you originally used as an argument on the vi command line. Inc. The commands to quit editing and exit the editor are: :q :q! Quit editing and leave vi (if you’ve modified the file. [count] 〈control-J〉 BSD October 10. [count] 〈control-F〉 Page forward count screens. Strictly confidential and proprietary VI (1) p yy dd x :w Append the copied line after the line the cursor is on. 1996 3 . VI COMMANDS The following section describes the commands available in the command mode of the vi editor. 〈control-G〉 Display the file information.e. but not saved your changes. scroll forward half the number of lines in the current screen. [count] 〈control-H〉 [count] h Move the cursor back count characters in the current line. discarding any modifications that you may have made. [count] 〈control-D〉 Scroll forward count lines. Copy the line the cursor is on. the tag line is a usage synopsis for the command character.VI (1) PropertyGeneral Commands Manual System of BladeLogic. if possible. [count] 〈control-B〉 Page backwards count screens. In each entry below.

If the trailing character is a ‘-’. % Move to the matching character. 〈control-ˆ〉 Switch to the most recently edited file. [count] 〈control-M〉 [count] + Move the cursor down count lines to the first non-blank character of that line. [count] $ Move the cursor to the end of a line. 〈control-T〉 Return to the most recent tag context. leaving the current line and column as is. scroll forward half the number of lines in the current screen. the number is incremented. [count] 〈control-P〉 [count] k Move the cursor up count lines. Strictly confidential and proprietary VI (1) [count] 〈control-N〉 [count] j Move the cursor down count lines without changing the current column. [count] 〈space〉 [count] l Move the cursor forward count characters without changing the current line.VI (1) PropertyGeneral Commands Manual System of BladeLogic. If count is not given. [count] 〈control-U〉 Scroll backwards count lines. the number is decremented. [count] ! motion shell-argument(s) 〈carriage-return〉 Replace text with results from a shell command. Inc. [count] 〈control-Y〉 Scroll backwards count lines. If the trailing character is a ‘#’ or ‘+’. BSD October 10. 〈control-W〉 Switch to the next lower screen in the window. if possible. 〈control-]〉 Push a tag reference onto the tag stack. without changing the current column. 〈control-L〉 〈control-R〉 Repaint the screen. 1996 4 . or to the first screen if there are no lower screens in the window. 〈control-Z〉 Suspend the current editor session. 〈escape〉 Execute ex commands or cancel partial commands. [count] # #|+|Increment or decrement the number under the cursor.

’〈character〉 ‘〈character〉 Return to a context marked by the character character. the characters input are repeated count − 1 number of times. “yank” the deleted text into buffer. If a count argument is given. Repeat the last character find count times. 1996 5 . n and N repeat the last search in the same or opposite directions. [count] A Enter input mode. [count] . the cursor is placed offset lines before or after the matched regular expression. [count] . The second form returns to the first character of the context marked by character. [buffer] [count] C Change text from the current position to the end-of-line. 0 : Move to the first character in the current line.VI (1) PropertyGeneral Commands Manual System of BladeLogic. Execute an ex command. If offset is specified. [count] <motion [count] >motion Shift lines left or right. [count] ( Back up count sentences. [count] Move to the first non-blank of the previous line. The first form returns to the beginning of the line marked by character. Reverse find character count times. Inc. [count] ) Move forward count sentences. BSD October 10. [count] B Move backwards count bigwords. [count] . count times. appending the text after the end of the line. Strictly confidential and proprietary VI (1) & Repeat the previous substitution command on the current line. respectively. If buffer is specified. /RE 〈carriage-return〉 /RE/ [offset] 〈carriage-return〉 ?RE 〈carriage-return〉 ?RE? [offset] 〈carriage-return〉 N n Search forward ( ‘/’ ) or backward ( ‘?’ ) for a regular expression. Repeat the last vi command that modified text. @ buffer Execute a named buffer.

“yank” the deleted text into buffer. [count] E Move forward count end-of-bigwords. BSD October 10. If buffer is specified. replacing the characters in the current line. [count] J Join lines. “yank” the deleted text into buffer. 1996 6 .VI (1) PropertyGeneral Commands Manual System of BladeLogic. [count] T 〈character〉 Search backwards. [buffer] [count] S Substitute count lines. or the last line of the file if count is not specified. If buffer is specified. [buffer] [count] X Delete count characters before the cursor. M Move to the screen line in the middle of the screen. If a count argument is given. [count] W Move forward count bigwords. Inc. If a count argument is given. the characters input are repeated count − 1 number of times. [count] G Move to line count. the characters input are repeated count − 1 number of times. Q Exit vi ( or visual ) mode and switch to ex mode. count times. [count] R Enter input mode. Strictly confidential and proprietary VI (1) [buffer] D Delete text from the current position to the end-of-line. or the default buffer if none is specified. “yank” the deleted text into buffer. [count] O Enter input mode. [count] I Enter input mode. [count] F 〈character〉 Search count times backward through the current line for character. appending text in a new line above the current line. [buffer] [count] Y Copy (or “yank”) count lines into the specified buffer. If a count argument is given. U Restore the current line to its state before the cursor last moved to it. through the current line for the character after the specified character. [buffer] P Insert text from a buffer. If buffer is specified. inserting the text at the beginning of the line. [count] H Move to the screen line count − 1 lines below the top of the screen. [count] L Move to the screen line count − 1 lines above the bottom of the screen. the characters input are repeated count − 1 number of times.

[count] w Move forward count words. If a count argument is given. [count] t 〈character〉 Search forward. [count] a Enter input mode. appending the text after the cursor. [count] [[ Back up count section boundaries. count times. If a count argument is given. m 〈character〉 Save the current context ( line and column ) as 〈character〉. [buffer] [count] d motion Delete a region of text. the characters input are repeated count − 1 number of times. Strictly confidential and proprietary VI (1) ZZ Write the file and exit vi. the characters input are repeated count −1 number of times. count times. [count] _ Move down count − 1 lines. [count] o Enter input mode. [count] ]] Move forward count section boundaries. u Undo the last change made to the file. Inc. [count] r 〈character〉 Replace count characters. [buffer] [count] c motion Change a region of text. BSD October 10.VI (1) PropertyGeneral Commands Manual System of BladeLogic. [count] b Move backwards count words. [count] i Enter input mode. 1996 7 . inserting the text before the cursor. through the rest of the current line for 〈character〉. [buffer] p Append text from a buffer. If a count argument is given. through the current line for the character immediately before 〈character〉. [count] e Move forward count end-of-words. the characters input are repeated count −1 number of times. [count] f 〈character〉 Search forward. appending text in a new line under the current line. ˆ Move to the first non-blank character on the current line. [buffer] [count] s Substitute count characters in the current line starting with the current character. to the first non-blank character.

[column] | Move to a specific column position on the current line. 〈control-D〉 Erase to the previous shiftwidth column boundary. 2 screens before ) . 1996 8 . [count] ˜ motion Reverse the case of the characters in a text region specified by the count and motion. optionally repositioning and resizing the screen. Only in effect if the tildeop option is set. display the screen before the current screen. Place the line count1 at the bottom of the screen. Strictly confidential and proprietary VI (1) [buffer] [count] x Delete count characters. VI TEXT INPUT COMMANDS The following section describes the commands available in the text input mode of the vi editor. 〈nul〉 Replay the previous input. [count] } Move forward count paragraphs. 〈control-T〉 Insert sufficient 〈tab〉 and 〈space〉 characters to move forward to the next shiftwidth column boundary. If count2 is specified. Otherwise. BSD October 10. [count1] z [count2] type Redraw. display the screen before the screen before count1 ( i. . and reset the autoindent level. [count] { Move backward count paragraphs. The 〈interrupt〉 character is usually 〈control-C〉. ˆ〈control-D〉 Erase all of the autoindent characters. [buffer] [count] y motion Copy (or “yank”) a text region specified by count and motion into a buffer. If column is omitted.VI (1) PropertyGeneral Commands Manual System of BladeLogic. move to the start of the current line. ˆ Place the line count1 in the center of the screen. Otherwise. limit the screen size to count2 lines. 0〈control-D〉 Erase all of the autoindent characters. [count] ˜ Reverse the case of the next count character(s). display the screen after the current screen. If count1 is given. 〈carriage-return〉 Place the line count1 at the top of the screen. 〈interrupt〉 Interrupt the current operation.e. The following type characters may be used: + If count1 is specified. place the line count1 at the top of the screen. Inc.

display the line number of the last line in the file. 〈end-of-file〉 Scroll the screen. ! argument(s) [range] ! argument(s) Execute a shell command. returning to command mode. 〈escape〉 Resolve all text input into the file. The 〈interrupt〉 character is usually 〈control-C〉. 〈literal next〉 Escape the next character from any special meaning. and return to command mode. . or filter lines through a shell command. The 〈literal next〉 character is usually 〈control-V〉. Inc. [range] >[> . EX COMMANDS The following section describes the commands available in the ex editor. In each entry below. 〈control-W〉 〈word erase〉 Erase the last word. . . Strictly confidential and proprietary VI (1) 〈erase〉 〈control-H〉 Erase the last character.VI (1) PropertyGeneral Commands Manual System of BladeLogic. [range] nu[mber] [count] [flags] [range] # [count] [flags] Display the selected lines.] [count] [flags] Shift lines left.] [count] [flags] Shift lines right. @ buffer ∗ buffer Execute a buffer. " A comment. the tag line is a usage synopsis for the command. BSD October 10. each preceded with its line number. 〈line erase〉 Erase the current line. [range] <[< . 〈control-X〉[0-9A-Fa-f]+ Insert a character with the specified hexadecimal value into the text. [line] = [flags] Display the line number of line. The definition of word is dependent on the altwerase and ttywerase options. If line is not specified. . 〈interrupt〉 Interrupt text input mode. 1996 9 .

vi only. ar[gs] bg Display the argument list. [range] j[oin][!] [count] [flags] Join lines of text together. Foreground the specified screen. [line] a[ppend][!] The input text is appended after the specified line. f[ile] [file] Display and optionally change the file name.VI (1) PropertyGeneral Commands Manual System of BladeLogic. [range] d[elete] [buffer] [count] [flags] Delete the lines from the file. [line] i[nsert][!] The input text is inserted before the specified line. exu[sage] [command] Display usage for an ex command. [Ee][dit][!] [+cmd] [file] [Ee]x[!] [+cmd] [file] Edit a different file. cs[cope] add | find | help | kill | reset Execute a Cscope command. Strictly confidential and proprietary VI (1) ab[breviate] lhs rhs vi only. 1996 10 . [range] co[py] line [flags] [range] t line [flags] Copy the specified lines after the destination line. Background the current screen. Inc. he[lp] Display a help message. BSD October 10. screens or tags. chd[ir][!] [directory] cd[!] [directory] Change the current working directory. [range] g[lobal] /pattern/ [commands] [range] v /pattern/ [commands] Apply commands to lines matching ( ‘global’ ) or not matching ( ‘v’ ) a pattern. [range] c[hange][!] [count] The input text replaces the specified range. Cscope connections. Add lhs as an abbreviation for rhs to the abbreviation list. di[splay] b[uffers] | c[onnections] | s[creens] | t[ags] Display buffers. [range] l[ist] [count] [flags] Display the lines unambiguously. [Ff]g [name] vi mode only.

so[urce] file Read and execute ex commands from a file. [Pp]rev[ious][!] Edit the previous file from the argument list.] [option? . rew[ind][!] Rewind the argument list. [line] pu[t] [buffer] Append buffer contents to the current line.. . . se[t] [option[=[value]] . [range] s[ubstitute] [/pattern/replace/] [options] [count] [flags] [range] & [options] [count] [flags] [range] ˜ [options] [count] [flags] Make substitutions. . res[ize] [+|-]size vi mode only. editor options and maps to the specified file. q[uit][!] End the editing session. [range] p[rint] [count] [flags] Display the specified lines. . mk[exrc][!] file Write the abbreviations. Strictly confidential and proprietary VI (1) map[!] [lhs rhs] Define or display maps (for vi only).VI (1) PropertyGeneral Commands Manual System of BladeLogic. 1996 11 .] Edit the next file from the argument list. . rec[over] file Recover file if it was previously saved. [line] ma[rk] 〈character〉 [line] k 〈character〉 Mark the line with the mark 〈character〉.] [all] Display or set editor options. Inc. [Nn][ext][!] [file . su[spend][!] BSD October 10. [range] m[ove] line Move the specified lines after the target line. Grow or shrink the current screen. .] [nooption . sh[ell] Run a shell program.. [line] r[ead][!] [file] Read a file. pre[serve] Save the file in a form that can later be recovered using the ex −r option.

[Tt]agn[ext][!] Edit the file containing the next context for the current tag. tagp[op][!] [file | number] Pop to the specified tag in the tags stack.VI (1) PropertyGeneral Commands Manual System of BladeLogic. unm[ap][!] lhs Unmap a mapped string. una[bbreviate] lhs vi only. [range] x[it][!] [file] Exit the editor. [Tt]a[g][!] tagstring Edit the file containing the specified tag. tagt[op][!] Pop to the least recent tag on the tags stack. viu[sage] [command] Display usage for a vi command. Edit a new file. clearing the stack. writing the file if it has been modified. Enter vi. Strictly confidential and proprietary VI (1) st[op][!] 〈suspend〉 Suspend the edit session. ve[rsion] Display the version of the ex/vi editor. [Tt]agp[rev][!] Edit the file containing the previous context for the current tag. Inc. [Vi]i[sual][!] [+cmd] [file] vi mode only. [range] w[rite][!] [>> ] [file] [range] w[rite] [!] [file] [range] wn[!] [>> ] [file] [range] wq[!] [>> ] [file] Write the file. SET OPTIONS There are a large number of options that may be set ( or unset ) to change the editor’s behavior. BSD October 10. [line] z [type] [count] [flags] Adjust the window. The 〈suspend〉 character is usually 〈control-Z〉. [line] vi[sual] [type] [count] [flags] ex mode only. their abbreviations and their default values. This section describes the options. u[ndo] Undo the last change made to the file. [range] ya[nk] [buffer] [count] Copy the specified lines to a buffer. 1996 12 . Delete an abbreviation.

See re_format(7) for more information on regular expressions. unless otherwise specified. directory. Select an alternate word erase algorithm. altwerase [off ] vi only. C and C++ language files. Display the current line automatically. ex [off ] Read the startup files in the local directory. eb [off ] ex only. cedit [no default ] Set the character to edit the colon command-line history. beautify. or current directory] The directory paths used as path prefixes for the cd command. extended [off ] Use extended regular expressions ( EREs ) rather than basic regular expressions ( BREs ) . or /tmp] The directory where temporary files are created. 1996 13 . and do not have an associated value. followed by any equivalent abbreviations. ed [off ] Remember the values of the ‘c’ and ‘g’ suffixes to the substitute commands. filec [no default ] Set the character to perform file path completion on the colon command line. edcompatible. instead of initializing them as unset for each new command. ap [on] ex only. Announce error messages with a bell. autowrite. ai [off ] Automatically indent new lines. aw [off ] Write modified files automatically when changing files. backup [""] Back up files before they are overwritten. Skip leading comments in shell. exrc.e. autoindent.VI (1) PropertyGeneral Commands Manual System of BladeLogic. columns. Most of the options are boolean. dir [environment variable TMPDIR. Options apply to both ex and vi modes. Inc. i. cdpath [environment variable CDPATH. co [80] Set the number of columns in the screen. autoprint. the first part of the tag line is the full name of the option. escapetime [1] The 10th’s of a second ex/vi waits for a subsequent key to complete an 〈escape〉 key mapping. Strictly confidential and proprietary VI (1) In each entry below. BSD October 10. errorbells. bf [off ] Discard control characters. The part in square brackets is the default value of the option. comment [off ] vi only. they are either on or off.

Modify various search commands and options to work with Lisp. keytime [6] The 10th’s of a second ex/vi waits for a subsequent key to complete a key mapping. BSD October 10. number. This option currently has no effect. li [24] vi only. mesgcat [/usr/share/vi/catalog/ ] Selects a message catalog to be used to display error and informational messages in a specified language. read or written. magic [on] Treat certain characters specially in regular expressions. Inc. Strictly confidential and proprietary VI (1) flash [on] Flash the screen instead of beeping the keyboard on error. lines. matchtime [7] vi only. The 10th’s of a second ex/vi pauses on the matching character when the showmatch option is set. lock [on] Attempt to get an exclusive lock on any file being edited. ignorecase. ht [0] Set the spacing between hardware tab settings. instead of the default hexadecimal. mesg [on] Permit messages from other users. as long as an upper-case letter does not appear in the search string.VI (1) PropertyGeneral Commands Manual System of BladeLogic. lisp [off ] vi only. Do left-right scrolling. This option will never be implemented. leftright [off ] vi only. noprint [""] Characters that are never handled as printable characters. iclower [off ] Makes all regular expressions case-insensitive. list [off ] Display lines in an unambiguous fashion. octal [off ] Display unknown characters as octal numbers. This option is not yet implemented. 1996 14 . Set the number of lines in the screen. modelines. ic [off ] Ignore case differences in regular expressions. nu [off ] Precede each line displayed with its current line number. modeline [off ] Read the first and last few lines of each file for ex commands. hardtabs.

scr [($LINES − 1) / 2] Set the number of lines scrolled. path [""] Define additional directories to search for files being edited. scroll. opt [on] vi only. prompt [on] ex only. ro [off ] Mark the file and session as read-only.recover] The directory where recovery files are stored. redraw.VI (1) PropertyGeneral Commands Manual System of BladeLogic. sh [environment variable SHELL. Strictly confidential and proprietary VI (1) open [on] ex only. para [IPLPPPQPP LIpplpipbp] vi only. sw [8] Set the autoindent and shift command indentation width. remap [on] Remap keys until resolved. sect [NHSHH HUnhsh] vi only. This option is not yet implemented paragraphs. ruler [off ] vi only. BSD October 10. Optimize text throughput to dumb terminals. shellmeta [˜{[∗?$‘’"\ ] Set the meta characters checked to determine if file name expansion is necessary. This option is not yet implemented. the open and visual commands are disallowed. Simulate an intelligent terminal on a dumb one. Inc. sm [off ] vi only. shell. report [5] Set the number of lines about which the editor reports changes or yanks. print [""] Characters that are always handled as printable characters. recdir [/var/tmp/vi. Define additional section boundaries for the [[ and ]] commands. readonly. or /bin/sh] Select the shell used by the editor. shiftwidth. showmatch. Define additional paragraph boundaries for the { and } commands. Note matching ‘{’ and (‘’ for ‘}’ and ‘)’ characters. secure [off ] Turns off all access to external programs. re [off ] vi only. Display a command prompt. sections. If this option is not set. searchincr [off ] Makes the / and ? commands incremental. optimize. 1996 15 . Display a row/column ruler on the colon command line.

tl [0] Set the number of significant characters in tag names. taglength. terse [off ] This option has historically made editor messages less verbose. slow [off ] Delay display updating during text input. timeout. to [on] Time out on keys which may be mapped. term. Set the amount a left-right scroll will shift. verbose [off ] vi only. sourceany [off ] Read startup files not owned by the current user. tag [tags ] Set the list of tags files. warn [on] ex only. ttywerase [off ] vi only. tags. Select an alternate erase algorithm. w300 [no default ] vi only. BSD October 10. tty [environment variable TERM] Set the terminal type. ts [8] This option sets tab widths for the editor display. This option is not yet implemented. sidescroll [16] vi only. windowname [off ] Change the icon/window name to the current file name even if it can’t be restored on editor exit. w1200 [no default ] vi only. wi [environment variable LINES − 1] Set the window size for the screen.VI (1) PropertyGeneral Commands Manual System of BladeLogic. Display the current editor mode and a “modified” flag. ttytype. This option will never be implemented. tabstop. Set the window size if the baud rate is greater than 1200 baud. window. before a ! command. Inc. Set the window size if the baud rate is less than 1200 baud. Strictly confidential and proprietary VI (1) showmode. w9600 [no default ] vi only. This option causes a warning message to be printed on the terminal if the file has been modified since it was last written. Set the window size if the baud rate is equal to 1200 baud. Display an error message for every error. tildeop [off ] Modify the ˜ command to take an associated motion. smd [off ] vi only. slowopen. It has no effect in this implementation. w. 1996 16 .

See the vi/ex reference manual section Sizing the Screen for more information. wa [off ] Turn off file-overwriting checks. ex/vi enters the value into the environment. the current operation is halted and the editor returns to the command level. See the vi/ex reference manual section Recovery for more information. The location used to stored temporary files (see also the directory edit option). Break lines automatically. If the LINES environment variable is not set when ex/vi runs. or the columns option is explicitly reset by the user.VI (1) PropertyGeneral Commands Manual System of BladeLogic. If both the wraplen and wrapmargin edit options are set. read if the variable NEXINIT is not set. wrapscan. The user’s terminal type. used as the initial directory path for the startup $HOME/. ENVIRONMENT COLUMNS The number of columns on the screen. the specified number of columns from the left-hand margin. Strictly confidential and proprietary VI (1) wraplen. Inc. the specified number of columns from the right-hand margin. wl [0] vi only. wm [0] vi only.exrc files. The user’s shell of choice (see also the shell option). SIGINT SIGWINCH The screen is resized. the wrapmargin value is used. This value is also used as the default directory for the vi cd command. writeany. When an interrupt occurs. This value overrides any system or terminal specific values. SIGHUP SIGTERM If the current buffer has changed since it was last written in its entirety. or the lines option is explicitly reset by the user. If interrupted during text input. If the TERM environment variable is not set when ex/vi runs. SHELL TERM TMPDIR ASYNCHRONOUS EVENTS SIGALRM vi/ex uses this signal for periodic backups of file modifications and to display “busy” messages when operations are likely to take a long time. ex/vi enters the value into the environment. The number of rows on the screen. ws [on] Set searches to wrap around the end or beginning of the file. the wrapmargin value is used. 1996 17 .nexrc and $HOME/. EXINIT HOME LINES A list of ex startup commands. If the COLUMNS environment variable is not set when ex/vi runs. The default is the type “unknown”. This value overrides any system or terminal specific values. or the term option is explicitly reset by the user. the editor attempts to save the modified file so it can be later recovered. wrapmargin. FILES BSD October 10. NEXINIT A list of ex startup commands. the text already input is resolved into the file as if the text input had been normally terminated. If both the wraplen and wrapmargin edit options are set. Break lines automatically. ex/vi enters the value into the environment. The user’s home directory.

vi/. "Ex Reference Manual". /usr/share/doc/usd/12. This document is the closest thing available to an introduction to the vi screen editor.summary. "Vi/Ex Reference Manual". Roff source for all of these documents is distributed with nex/nvi in the vi/docs/USD. Inc.VI (1) PropertyGeneral Commands Manual System of BladeLogic.viref/. /usr/share/doc/usd/11.exrc SEE ALSO ctags(1). BSD October 10. /usr/share/doc/usd/13. First choice for local directory startup file. First choice for user’s home directory startup file. The default recovery file directory.exrc . Second choice for local directory startup file.doc directory of the nex/nvi source code.nexrc .2 (“POSIX.4 BSD.2”). The "Vi Quick Reference" card.nexrc $HOME/. That document differs from historical ex/vi practice in several places. This document is the closest thing available to an introduction to the ex editor. Second choice for user’s home directory startup file.ex/. "Ex: A Tutorial". STANDARDS nex/nvi is close to IEEE Std 1003. System-wide vi startup file.edit/. Temporary file directory.vi/vi. This document is the final reference for the nex/nvi text editors. quoting. and structures found in the vi/docs/internals directory of the nex/nvi source code. This document is the final reference for the ex editor. re_format(7) The default user shell. 1996 18 . /usr/share/doc/usd/12. input.exrc /tmp /var/tmp/vi. The files autowrite. /usr/share/doc/usd/13. HISTORY The nex/nvi replacements for the ex/vi editor first appeared in 4. Strictly confidential and proprietary VI (1) /bin/sh /etc/vi. there are changes to be made on both sides.recover $HOME/. "An Introduction to Display Editing with Vi".

vsh log level This defines what you want to log. may not properly understand the result.conf VSH. You can use NSH format to name the log files. the vsh log file viewer.]>[. vsh will use /bin/sh by default. it passes any arguments you give it to the backend shell specified in vsh. which is a shell of /bin/sh.<field=val[:val]>. Example: Example: logout shell=/bin/ksh shell=<nsh> Set an optional auto logout time in minutes. The available values are: stdin stdout stderr all Log all user keyboard input. Strictly confidential and proprietary vsh(1) NAME vsh − Virtual shell (keyboard capture tool) SYNOPSIS vsh DESCRIPTION vsh is a keyboard (actually input and output) capture tool. If you specify <nsh>.conf file comes pre-configured with a default entry.vsh(1) Property of BladeLogic. If there is no input or output activity for the specified number of minutes. vsh dynamically creates directories for the log files as needed. If you do not specify a shell. All of the above. This file is located in share/vsh. vsh will automatically terminate the session. Example: log=/var/log/vshlog-%u. Example: level=stdin:stdout DEFAULT ENTRY If the username of the given entry has the special name of default. it will start a shell (or other tty application) session and capture input and output.conf file controls the behavior of vsh. You can use macros (defined below) in your log file names to dynamically create unique names for each log file.. an autologout of NSH 1 .conf file to specify which shell vsh should start... Log all terminal output. You should create one log file per session. The vsh. If you have more than one session logged into a particular log file. meaning that you can specify a log file on a remote server with the //hostname/path format. You can capture any combination of I/O streams by defining multiple levels as colon (’:’) separated values..CONF The vsh. Log all terminal error output (same as stdout). You can specify multiple log files. vshview. then this entry will be used for all users that do not have a specific entry in the vsh.conf in the NSH installation directory. Inc.conf file. You can configure the vsh.] The accepted fields are: shell The application (shell) to start when you invoke vsh. Instead. Example: logout=30 Name of log file where you want to store the vsh session I/O. then vsh will try to launch NSH instead. The format of this file is: username <field=val[:val. It is called vsh (Virtual Shell) because once you start it. vsh itself does not take any arguments.

NSH 2 . %m The month as a decimal number (range 01 to 12). %h Current host name. %y The year as a decimal number without a century (range 00 to 99). %M The minute as a decimal number (range 00 to 59). %Y The year as a decimal number including the century. %S The second as a decimal number (range 00 to 61). you must dynamically create log file names by using macros. %a The abbreviated weekday name. %H The hour as a decimal number using a 24-hour clock (range 00 to 23). %C The century number (year/100) as a 2-digit integer. Strictly confidential and proprietary 60 minutes. and a log file in the format: /var/log/vsh/<hostname>/<username>/<start timestamp>. which are expanded at run time. log file names should be unique for each vsh session. ORIGIN vsh was written by Thomas Kraus SEE ALSO vshview (1). Inc. %d The day of the month as a decimal number (range 01 to 31). %j The day of the year as a decimal number (range 001 to 366). %B The full month name. Sunday being 0. %w The day of the week as a decimal. The following macros are supported. %% A literal ‘%’ character. %u Current user name. %b The abbreviated month name.vsh(1) Property of BladeLogic. %I The hour as a decimal number using a 12-hour clock (range 01 to 12). %A The full weekday name. To do this.vsh vsh(1) MACROS As previously mentioned. range 0 to 6.

Output only those entries that happened on host. Precede each line of output with the name of the host it relates to. Use the following format: expr = ( expr ) | operand operator operand | operand operand = number | string | field name number = value | value% | octal value | hex value NSH 1 . Precede each line of output with the name of the user it relates to. Define a search expression (see below). Can be used with -1 and -2. logouttime. The first mode is to show selected input and output (default mode). In either case. vshview will automatically recursively scan all files in the given directory. Therefore. Output only those entries that happened on or after this date. Precede each line of output with the most recent available timestamp. There are two basic modes to vshview. Show error (stderr) output (same as -1). Can be used with -0 and -2. OPTIONS -0 -1 -2 -b -v -e -l -H -U -T -h host -u user -i date Show keyboard (stdin) input.) -s sort -o date EXPRESSIONS You can use the -e option to define an expression that filters the output data. (Note that when using this option. you do not have to escape the forward slash date separator.) You can specify the following options to sort your display: user. The date has the format ’month/day/year’ with the year being optional. vshview scans the given log files and produces the appropriate output. Show the name of the log file being displayed as it is reached. shell. Instead. shows a summary of login and logout activity. Show terminal (stdout) output. only one minute granularity is available. The date has the format ’month/day/year’ with the year being optional.vshview(1) Property of BladeLogic. you need to use the vshview utility. The second mode (turned on with the -l option). To view the these log files. vsh creates a time stamp every 60 seconds.. The expression should be a single argument surrounded by single quotes. This is the default output if you do not select any other output type. logintime. just output a summary of vsh sessions. logout. Output only those entries that happened before this date. If a given file is a directory. (Note that when using this option. login. Strictly confidential and proprietary vshview(1) NAME vshview − vsh log file viewer SYNOPSIS vshview − [-012lbvHTU] [-e expr] [-h host] [-i date] [-s sort] [-o date] [-u user] file1 [file2 . Do not show any blank lines. host. Inc.] DESCRIPTION The keyboard (I/O) capture tool vsh does not create plain text log files.. or pid. Do not output any keyboard input or screen output. you do not have to escape the forward slash date separator. Output only those entries that relate to user.

Inc. Operators of the same precedence are grouped together by { }: operator = + | . These are are displayed as (for example) ’ˆD’. These are are displayed as (for example) ’207’. The second type are 8 bit characters.| / | * | % | & | \| | > | >= | < | <= | = | != \ { * / % } { + . NSH 2 . Strictly confidential and proprietary value = <integer value> | <floating point value> | <long long value> string = "<value>" field name = <user> | <host> | logindate | logoutdate | \ logintime | logouttime | <shell> | <pid> logindate = month/day/year logoutdate = month/day/year logintime = HH:MM logouttime = HH:MM vshview(1) Here is the operator precedence.} { > >= < <= = != } & | Some sample expressions: user = "tmk" user = "tmk" & host = "linuxdev" user != "tmk" | logindate > Feb\/12 (logintime > 10:00 ) | (user = "tmk" & logintime > 8:00) EXAMPLES $ vshview -T -b /var/log/vsh Feb 22/03 12:59:48: ls -la Feb 22/03 13:14:53: ls Feb 22/03 13:14:53: ls -la Feb 22/03 13:19:08: echo $0 Feb 22/03 13:19:08: ˆ[k Feb 22/03 13:19:08: ls Feb 22/03 13:19:08: stty -a Feb 22/03 13:19:08: exit $ vshview -u tmk -l /var/log/vsh HOSTNAME USER LOGIN TIME LOGOUT TIME PID SHELL linuxdev tmk Feb 22/03 12:59:48 Feb 22/03 12:59:54 26958 /bin/nsh linuxdev tmk Feb 22/03 13:14:50 Feb 22/03 13:14:56 27070 /bin/nsh linuxdev tmk Feb 22/03 13:19:07 Feb 22/03 13:19:52 27204 /bin/bash NOTE vshview deals with two types of non-printable characters. The first type are the control characters (ASCII 0-31). ORIGIN vshview was written by Thomas Kraus SEE ALSO vsh (1).vshview(1) Property of BladeLogic.

svn ------+-> text-base +-> prop-base NSH 1 . Adding two more Vs displays the options that are set when you run this command.vtree(1) Property of BladeLogic. and the output line reflects the accumulated totals for all files in the directory. EXAMPLE In this example. /space/home/parag/maserati_nsh/om/src/commands/less /space/home/parag/maserati_nsh/om/src/commands/less mands/less +-> lessQef ---+-> . Inc. Show the current version. Strictly confidential and proprietary vtree(1) NAME vtree − show the directory structure of a file system SYNOPSIS vtree [ -d ] [ -h # ] [ -i ] [ -s ] [ -q ] [ -v ] [ -V ] <target-dir> DESCRIPTION The vtree command shows the directory structure of a file system or part of a file system. For example: johnk% vtree -VVV VTREE 1.0 4/26/88 Tree height: 9999 <target-dir> The directory whose structure you want to display. OPTIONS -d -h # -i -s -t -q -v -V Count duplicate nodes. It also shows the amount of space taken up by files in each subdirectory. vtree lists the file system of the ’less’ directory. Count nodes.svn ------+-> text-base | +-> prop-base | +-> props | +-> wcprops | −> tmp -------+-> text-base | +-> prop-base | +-> props | −> wcprops −> lesskey ---+-> . Place totals at the end. Provide a quick display with no counts. Include subdirectories that were excluded due to the -h option. vtree recursively descends into it.svn ------+-> text-base | +-> prop-base | +-> props | +-> wcprops | −> tmp -------+-> text-base | +-> prop-base | +-> props | −> wcprops +-> . Height of tree to examine. If any of the given file names is a directory (the usual case). Provide a visual display.

Strictly confidential and proprietary vtree(1) +-> props +-> wcprops −> tmp -------+-> text-base +-> prop-base +-> props −> wcprops Total space used: 0 Total inodes: 0 ORIGIN vtree vtree is based upon "agef." written by David S. NSH 2 . Hayes at the Army Artificial Intelligence Center at the Pentagon. Inc.vtree(1) Property of BladeLogic.

Output a brief summary of available options and then exit with a zero status without counting any files. wc uses the standard input. -c -l -w -? Count the number of characters in the file. words. You specified an unknown option. words and/or characters in a file SYNOPSIS wc [-clw?] [file . you can use the following options to tell wc which things you want it to count. Both behaviors output a column in at least seven spaces. Count the number of words in the file. however when the P_BSD variable is set (Berkeley behavior). the number of words. EXIT CODES 0 1 2 255 No errors detected. $ wc -l //lisbon/etc/passwd 14 //lisbon/etc/passwd $ wc src/*.c 347 945 6227 file1. wc counts lines. OPTIONS By default. wc outputs four columns containing the number of lines. and characters. The second example counts lines. the number of characters. words. wc will also output a total for all files. ORIGIN wc was written by Thomas Kraus NSH 1 .c 339 917 6051 file3.] DESCRIPTION wc counts the number of lines. Strictly confidential and proprietary wc(1) NAME wc − Count the number of lines.c 449 1334 8491 file2. Count the number of lines in the file. If you do not specify any files. words. and characters in a file and then outputs its findings.. If you do not want counts for all of these things. UNIVERSE BEHAVIOR There is a small difference in the way wc formats the output depending on the current universe.c 1135 3196 20769 total DIAGNOSTICS wc: Cannot open file filename This message is output if wc is unable to access the file filename. an extra SPACE is output between columns to ensure that they never touch. EXAMPLE The first example counts the number of lines in the file /etc/passwd on the host lisbon.wc(1) Property of BladeLogic. If you specify more than one file. Inc.. Unable to get a license to use the software. it is possible that columns will touch for very large numbers. With the P_ATT variable set. and (if available) the name of the file it is counting. and characters of several source files. One of the files to be counted was not accessible.

For example.zip.Misc. Strictly confidential and proprietary ZIP ( 1L ) NAME zip.r .04g or unzip 5.04. Atari and Macintosh.3) 1 . zip version 2. Minix. allowing the output to be piped to another program. to archive all the C source files in the current directory and its subdirectories: f i n d . For example: z i p . If the file list is specified as –@. zipcloak. MSDOS. path.zip exists and contains foo/file1 and foo/file2.0p1 (or later versions) to extract them.  z i p ba c kup - Info-ZIP Last change: 14 August 1999 (v2. zip automatically chooses the better of the two for each file to be compressed. For a brief help on zip and unzip. Inc. zip will replace identically named entries in the zip archive or add entries for new names. [ c h ] " . allowing zip to take input from another program.zip contains foo/file1. Compression ratios of 2:1 to 3:1 are common for text files. The zip program puts one or more compressed files into a single zip archive. It is analogous to a combination of the UNIX commands tar(1) and compress(1) and is compatible with PKZIP (Phil Katz’s ZIP for MSDOS systems). zip also accepts a single dash ("-") as the name of a file to be compressed.10 cannot extract files produced by PKZIP 2.3. The zip and unzip(1L) programs can work with archives produced by PKZIP. then: z i p . The program is useful for packaging a set of files for distribution.p r i n t  z i p s o u r c e . OS/2. with foo/file2 unchanged from before. and check information to verify file integrity). After this. unpacks zip archives. and PKZIP and PKUNZIP can work with archives produced by zip. Windows NT. . . for archiving files.]] [–xi list] zipcloak [–dhL] [–b path] zipfile zipnote [–hwL] [–b path] zipfile zipsplit [–hiLpst] [–n size] [–b path] zipfile DESCRIPTION [–b path] [–n suffixes] [–t mmddyyyy] zip is a compression and file packaging utility for Unix... protection. [Not on MacOS] zip takes the list of input files from standard input. along with information about the files (name.3 is compatible with PKZIP 2. For example: t a r c f .  d d o f =/ d e v / n r s t 0 o b s =1 6 k would write the zip output directly to a tape with the specified block size for the purpose of backing up the current directory. Under UNIX. and foo/file3. foo/file2. You must use PKUNZIP 2.zip and add foo/file3 to foo. if foo. Note that PKUNZIP 1. this option can be used to powerful effect in conjunction with the find(1) command. zipnote. Reference Manual Pages Property of BladeLogic. and for saving disk space by temporarily compressing unused files or directories. Amiga and Acorn RISC OS. When given the name of an existing zip archive.n a me " ∗. date. run each without specifying any parameters on the command line. in which case it will read the file from standard input. zipsplit – package and compress (archive) files SYNOPSIS zip [–aABcdDeEfFghjklLmoqrRSTuvVwXyz!@$] [–tt mmddyyyy] [ zipfile [ file1 file2 .r f oo f oo will replace foo/file1 in foo. zip will also accept a single dash ("-") as the zip file name. For example. zip has one compression method (deflation) and can also store files without compression. . foo. and the directory foo contains the files foo/file1 and foo/file3.04 or zip 2. in which case it will write the zip file to standard output. An entire directory structure can be packed into a zip archive with a single command.@ (note that the pattern must be quoted to keep the shell from expanding it). VMS. A companion program (unzip(1L)). time of last modification.

For example: zip -d foo foo/tom/junk foo/harry/\∗ \∗. The backup can be restored using the command unzip -p backup | tar xf When no zip file name is given and stdout is not a terminal. and only replace the old one when the process of creating the new version has been completed without error. | zip | dd of=/dev/nrst0 obs=16k is equivalent to tar cf .zip is added. zip acts as a filter.zip the existing extension is kept unchanged. copying over stuff. Strictly confidential and proprietary ZIP ( 1L ) would compress the output of the tar command for the purpose of backing up the current directory. because zip can take advantage of redundancy between files. If the name of the zip archive does not contain an extension.. the extension . and the user is then prompted for a one-line comment for each file. For example. –c Add one-line comments for each file. and the file system containing this old archive does not have enough space to hold both old and new archives at the same time.o (in any path).3) 2 . Note: self-extracting archives for the Amiga are a special case.| dd of=/dev/nrst0 obs=16k zip archives created in this manner can be extracted with the program funzip which is provided in the unzip package. [TANDEM] set Edit/Enscribe formatting options with n defined as bit 0: Don’t add delimiter (Edit/Enscribe) bit 1: Use LF rather than CR/LF as delimiter (Edit/Enscribe) bit 2: Space fill record to maximum record length (Enscribe) bit 3: Trim trailing space (Enscribe) bit 8: Force 30K (Expand) large read for unstructured files zip -b /tmp stuff ∗ will put the temporary zip archive in the directory /tmp. OPTIONS –a –A [Systems using EBCDIC] Translate file to ASCII format. tar cf . The –A option tells zip to adjust the entry offsets stored in the archive to take into account this "preamble" data. Enter the comment followed by return. Reference Manual Pages Property of BladeLogic.Misc. all of the files that start with foo/harry/. Remove (delete) entries from a zip archive.o will remove the entry foo/tom/junk. For example: dd if=/dev/nrst0 ibs=16k  funzip  tar xvf When changing an existing zip archive.. Adjust self-extracting executable archive. compressing standard input to standard output. or just return for no comment. updating) are done first. For example: –d Info-ZIP Last change: 14 August 1999 (v2. -J can be used to remove the SFX stub if other updates need to be made. Inc. | zip . –B –Bn [VM/CMS and MVS] force file to be read binary (default is text). Note that shell pathname expansion has been inhibited with backslashes. At present. If the name already contains an extension other than . This option is only useful when updating an existing archive.. only the Amiga port of Zip is capable of adjusting or updating these without corrupting them. zip will write a temporary file with the new contents. or by gunzip which is provided in the gzip package. A self-extracting executable archive is created by prepending the SFX stub to an existing archive. This generally produces better compression than the previous example using the -r option. so that zip can see the asterisks. enabling zip to match on the contents of the zip archive instead of –b path Use the specified path for the temporary zip archive. File operations (adding.zip to the current directory when done. and all of the files that end with .

–E –f –h –i files Include only the specified files. Directory entries are created by default so that their attributes can be saved in the zip archive. for example if it has only been truncated. unlike the update option (–u) this will not add files that are not already in the zip archive.c in the current directory and its subdirectories.3) 3 .Misc. the –t option of unzip may show that some files have a bad CRC.) The option –D is a shorthand for –x "∗/" but the latter cannot be set as default in the ZIPOPT environment variable. so you MUST make a backup of the original archive first.LONGNAME Extended Attribute (if found) as filename. This requires that file names be entered in upper case if they were zipped by PKZIP on an MSDOS system. After the repair. (Note Info-ZIP Last change: 14 August 1999 (v2. The reasons behind this are somewhat subtle but have to do with the differences between the Unix-format file times (always in GMT) and most of the other operating systems (always local time) and the necessity to compare the two. -u and -o options to work correctly. [OS/2] Use the . Strictly confidential and proprietary ZIP ( 1L ) the contents of the current directory. For example under Unix with sh: ZIPOPT="-D". When doubled as in –FF the compressed sizes given inside the damaged archive are not trusted and zip scans for special signatures to identify the limits between the archive members. since paths stored in zip archives are always relative. If this operation fails. A typical TZ value is ‘‘MET-1MEST’’ (Middle European time with automatic adjustment for ‘‘summertime’’ or Daylight Savings Time). Replace (freshen) an existing entry in the zip archive only if it has been modified more recently than the version already in the zip archive. The environment variable ZIPOPT can be used to change the default options. Good for exporting files to foreign operating-systems. if standard error is not a tty. Do not create entries in the zip archive for directories. This option can be used if some portions of the archive are missing. –d is case sensitive when it matches names in the zip archive. Such files cannot be recovered. For example: zip -f foo This command should be run from the same directory from which the original zip command was run. It is not guaranteed to work. zip attempts to restore the archive to its original state. Display the zip help information (this also appears if zip is run with no arguments). –e Encrypt the contents of the zip archive using a password which is entered on the terminal in response to a prompt (this will not be echoed. If the restoration fails. Reference Manual Pages Property of BladeLogic. Neither option will recover archives that have been incorrectly transferred in ascii mode instead of binary. Resource-forks will be ignored at all. Note that the timezone environment variable TZ should be set according to the local timezone in order for the -f . –df –D [MacOS] Include only data-fork of files zipped into the archive. the archive might become corrupted. This option is ignored when there’s no existing archive or when at least one archive member must be updated or deleted. as in: zip -r foo . The password prompt is repeated to save the user from typing errors.c which will include only the files that end in . instead of creating a new one. –F Fix the zip archive. export ZIPOPT (The variable ZIPOPT can be used for any option except –i and –x and can include several options. The single –F is more reliable if the archive is not too much damaged. -i \∗. you can remove them from the archive using the –d option of zip. zip will exit with an error). Inc. so try this option first. –g Grow (append to) the specified zip archive. Under MSDOS.

Z:. –I [Acorn RISC OS] Don’t scan through Image files. By default.c PKZIP does not allow recursion in directories other than the current one. Such files are simply stored (0% compression) in the output zip file. Translate the Unix end-of-line character LF into the MSDOS convention CR LF. –l –ll –L –m –n suffixes Do not attempt to compress files named with the given suffixes. The complete path including volume will be stored.gif. If a directory becomes empty after removal of the files. When used. a SFX stub) from the archive.zip. or . This is useful for conserving disk space. This option should not be used on binary files. By default.gif:. this option adds an extra CR. –j –jj –J –k Store just the name of a saved file (junk the path). zip will store the full path (relative to the current path).) The backslash avoids the shell filename substitution.g. to undo the effect of zip -l.snd without trying to compress them (image and sound files often have their own specialized compression methods).snd foo foo will copy everything from foo into foo. Translate the MSDOS end-of-line CR LF into Unix LF. . the directory is also removed.tiff. Attempt to convert the names and paths to conform to MSDOS.zip.Z. Strictly confidential and proprietary ZIP ( 1L ) for PKZIP users: the equivalent command is pkzip -rP foo ∗.Misc. This option should not be used on binary files. zipping a Spark archive will result in a zipfile containing a directory (and its content) while using the ’I’ option will result in a zipfile containing a Spark archive. Display the zip license.lst which will only include the files in the current directory and its subdirectories that match the patterns in the file include. but will store any files that end in . Move the specified files into the zip archive. Strip any prepended data (e. Also possible: zip -r foo . [MacOS] record Fullpath (+ Volname). For example: zip -rn . actually. No deletions are done until zip has created the archive without error. DOS partitions or Spark archives when SparkFS is loaded) as directories but will store them as single files. but is potentially dangerous so it is recommended to use it in combination with –T to test the archive before removing all input files. Obviously this second case will also be obtained (without the ’I’ option) if SparkFS isn’t loaded. this deletes the target directories/files after making the specified zip archive. The suffixes are separated by either colons or semicolons. . .tiff:. if you have SparkFS loaded. for compatibility with PKUNZIP under MSDOS which cannot handle certain names such as those with two dots. This ensure that unzip -a on Unix will get back an exact copy of the original file. Reference Manual Pages Property of BladeLogic.zip:. -i@include.lst. If the input files already contain CR LF. so that zip doesn’t waste its time trying to compress them. and mark the entry as made under MSDOS (even though it was not). For example. This option can be used on MSDOS if the zip file is intended for unzip under Unix. store only the MSDOS attribute (just the user write attribute from UNIX). and do not store directory names. Inc. zip will not consider Image files (eg. so that the name matching is performed by zip at all directory levels.3) 4 . zip does not compress files with extensions in the list Info-ZIP Last change: 14 August 1999 (v2. This option can be used on Unix if the zip file is intended for PKUNZIP under MSDOS. By default the relative path will be stored.

You should not use –r with the name ". This can be used without any other operations. [MacOS] Includes finder invisible files. –tt mmddyyyy Do not operate on files modified after or at the specified date.zip.e. CFS files and PackDir files). since the recursion does not use the shell’s file-name substitution mechanism.∗". WIN32 and ATARI] Include system and hidden files. For example: zip -rt 12071991 infamy foo zip -rt 1991-12-07 infamy foo will add all the files in foo and its subdirectories that were last modified on or after 7 December 1991. which are ignored otherwise. If -c is used also. The ISO 8601 date format yyyy-mm-dd is also accepted. Such files are stored directly in the output archive.zip:. –o –t mmddyyyy Do not operate on files modified prior to the specified date.zoo:.zip. all the files matching ∗. for example: zip -R foo ’∗. dd is the day of the month (1-31). If you wish to include only a specific subset of the files in directory foo and its subdirectories. Reference Manual Pages Property of BladeLogic. MacOS] Save Amiga or MacOS filenotes as zipfile comments. Note for PKZIP users: the equivalent command is pkzip -rP foo ∗. zip does not compress files with filetypes in the list DDC:D96:68E (i. Strictly confidential and proprietary ZIP ( 1L ) . and yyyy is the year.c’ In this case. since that matches ". The environment variable ZIPOPT can be used to change the default options. where mm is the month (0-12). and yyyy is the year. Set the "last modified" time of the zip archive to the latest (oldest) "last modified" time found among the entries in the zip archive. dd is the day of the month (1-31).3) 5 . In this case.lzh:. to the zip archive infamy. For example: zip -rtt 11301995 infamy foo Info-ZIP Last change: 14 August 1999 (v2. Inc. They can be restored by using the -N option of unzip. By default." which will attempt to zip up the parent directory (probably not what was intended). use: zip -n : foo The maximum compression option –9 also attempts compression on all files regardless of extension. For example under Unix with csh: setenv ZIPOPT "-n . On Acorn RISC OS systems the suffixes are actually filetypes (3 hex digit format). –R Travel the directory structure recursively starting at the current directory.. all the files and directories in foo are saved in a zip archive named foo. if desired.gif:.arc:.zip" To attempt compression on all files.c –S [MSDOS.Misc. use the –i option to specify the pattern of files to be included.zip.". including files with names starting with ". Archives. you are prompted for comments only for those files that do not have filenotes.arj. –N [Amiga.c in the tree starting at the current directory are stored into a zip archive named foo.zip. The ISO 8601 date format yyyy-mm-dd is also accepted.Z:.zip to the latest time of the entries in foo. where mm is the month (0-12). For example: zip -o foo will change the last modified time of foo. OS/2.

–T –u Test the integrity of the new zip file. so that the name matching is performed by zip at all directory levels. The backslash avoids the shell filename substitution. the old zip file is unchanged and (with the -m option) no input files are removed. Prompt for a multi-line comment for the entire zip archive. The comment can be taken from a file: zip -z foo < foowhat –# Regulate the speed of compression using the specified digit #. –v Verbose mode or print diagnostic version info.3) 6 .o. ignores the suffix list). or an end of file condition (∧ on UNIX.lst which will include the contents of foo in foo. Note that the –u option with no arguments acts like the –f (freshen) option. Strictly confidential and proprietary ZIP ( 1L ) zip -rtt 1995-11-30 infamy foo will add all the files in foo and its subdirectories that were last modified before the 30 November 1995. it shows information about the target environment (compiler type and version. a diagnostic screen is printed.zip while excluding all the files that match the patterns in the file exclude.zip into itself when you do this). Also possible: zip -r foo foo -x@exclude. –V –w [VMS] Save VMS file attributes. Reference Manual Pages Property of BladeLogic. and update any files which have been modified since the zip archive stuff. and release date. ∧ on MSDOS. version. some pointers to the Info-ZIP home and distribution sites are given. Then.zip was last created/modified (note that zip will not try to pack stuff.zip while excluding all the files that end in . –1 indicates the fastest compression method (less compression) and –9 indicates the slowest compression method (optimal compression. In addition to the help screen header with program name. –X –y –z Do not save extra file attributes (Extended Attributes on OS/2. OS/2. and D Z VAX/VMS). to the zip archive infamy.Misc. zip archives created with this option will generally not be usable on other systems. Info-ZIP Last change: 14 August 1999 (v2. Normally. this option enables the display of a progress indicator during compression and requests verbose diagnostic info about zipfile structure oddities. The comment is ended by a line containing just a period. including multiple versions of files. When –v is the only command line argument. as in: zip -r foo foo -x \∗.o which will include the contents of foo in foo. If the check fails. instead of compressing and storing the file referred to by the link (UNIX only). Inc.zip. (default: use only the most recent version of a specified file). Replace (update) an existing entry in the zip archive only if it has been modified more recently than the version already in the zip archive. compilation date and the enabled optional features used to create the zip executable. The default compression level is –6. and stdout is not redirected to a file. uid/gid and file times on Unix). where –0 indicates no compression (store all files). when applied to real operations.lst. For example: zip -u stuff ∗ will add any new files in the current directory. Store symbolic links as such in the zip archive. [VMS] Append the version number of the files to the name. –x files Explicitly exclude the specified files. OS version.

the shell will look for files relative to the current path that match the pattern. in compressed form (the . The UNIX shells (sh(1) and csh(1)) do filename substitution on command arguments." are not included. Only one filename per line. use the drive name as first file name. If you want to include only the volume label or to force a specific drive. Because of the way the shell does filename substitution. Info-ZIP Last change: 14 August 1999 (v2. making room for the next zip command to function. OS/2. you can: zip -rm foo foo/tom zip -rm foo foo/dick zip -rm foo foo/harry where the first command creates foo. and the next two add to it. and replace the argument with a list of the names that matched.Misc. [0–9]). as in: zip -$ foo a: c:bar EXAMPLES The simplest example: zip stuff ∗ creates the archive stuff. To zip up an entire directory. When these characters are encountered (without being escaped with a backslash or quotes). [MSDOS. the last created archive is deleted.zip. Strictly confidential and proprietary ZIP ( 1L ) –! –@ –$ [WIN32] Use priviliges (if granted) to obtain all aspects of WinNT security.zip (assuming it does not exist) and puts all the files in the current directory in it. as in: zip -j foo foo/∗ If you are short on disk space. In this case. The special characters are: ? ∗ [] match any single character match any number of characters (including none) match any character in the range indicated within the brackets (example: [a–f]. the command: zip -r foo foo creates the archive foo. you might not have enough room to hold both the original directory and the corresponding compressed zip archive.zip.∗ ∗ Even this will not include any subdirectories from the current directory. You may want to make a zip archive that contains the files in foo. WIN32] Include the volume label for the the drive holding the first file to be compressed. Take the list of input files from standard input. Inc. without recording the directory name. you can create the archive in steps using the –m option. You can use the –j option to leave off the paths. If foo contains the subdirectories tom. containing all the files and directories in the directory foo that is contained within the current directory. At the completion of each zip command.3) 7 . to include these as well: zip stuff . files starting with ". Reference Manual Pages Property of BladeLogic. PATTERN MATCHING This section applies only to UNIX.zip suffix is added automatically. foo. dick. this allows the explicit specification of other suffixes). Watch this space for details on MSDOS and VMS operation. unless that archive name given contains a dot already. and harry.

o". ENVIRONMENT ZIPOPT contains default options that will be used when running zip ZIP [Not on RISC OS and VMS] see ZIPOPT Zip$Options [RISC OS] see ZIPOPT Zip$Exts [RISC OS] contains extensions separated by a : that will cause native filenames with one of the specified extensions to be added to the zip file with basename and extension swapped. Processing probably failed immediately. by using backslashes or quotes to tell the shell not to do the name expansion. and so patterns like \∗. –f. Inc. or the entire argument must be enclosed in double quotes ("").3) 8 . If it does not find it. some broken zipfiles created by other archivers have simple workarounds. no errors or warnings detected. zip was unable to allocate memory for one or more buffers during program initialization. and sometimes after the –x (exclude) option when used with an appropriate operation (add. if present. in the case of the –x (exclude) or –i (include) options.Misc. tar(1). it looks for the name in the zip archive being modified (if it exists). For each match. use backslash to make zip do the pattern matching with the –f (freshen) and –d (delete) options.e. Strictly confidential and proprietary ZIP ( 1L ) The zip program can do the same matching on names that are in the zip archive being modified or. In general.o match names that end in ". it first looks for the name in the file system. using the pattern matching characters described above. unexpected end of zip file. when zip encounters a name in the list of files to do. except under VMS: 0 2 3 normal. a generic error in the zipfile format was detected. or does not match any name given with the –i option. Reference Manual Pages Property of BladeLogic. unzip(1L). entry too large to be split with zipsplit invalid comment format zip -T failed or out of memory the user aborted zip prematurely with control-C (or similar) zip encountered an error while using a temp file read or seek error zip has nothing to do missing or empty zip file 4 5 6 7 8 9 10 11 12 13 Info-ZIP Last change: 14 August 1999 (v2. it will add that name to the list of files to be processed. ?∗[]). gzip(1L) DIAGNOSTICS The exit status (or error level) approximates the exit codes defined by PKWARE and takes on the following values. on the list of files to be operated on. Processing may have completed successfully anyway. Note that the backslash must precede every special character (i. a severe error in the zipfile format was detected. zip ZIP_OPTS [VMS] see ZIPOPT SEE ALSO compress(1). The pattern matching includes the path. shar(1L). In general. If it finds it. –u. unless this name matches one given with the –x option. or –d). it then adds it to the list of files to do. no matter what the path prefix is.

For bug reports. If you do not use encryption and use regular disk files. please include the version of zip (see zip–h ). Under VMS. Otherwise OS/2 1.wku. and as much additional information as possible. On OS/2. Only stream-LF format zip files are expected to work with zip. the structure layout returned by the 32-bit DosQueryPathInfo() is a bit different. 16. you do not have to care about this problem. When transfering from MSDOS to Vax.1 or PKZIP 1. zip hangs for file specification that uses DECnet syntax foo::∗. the make options used to compile it see zip–v ). it uses extra padding bytes and link pointers (it’s a linked list) to have all fields on 4-byte boundaries for portability to future RISC OS/2 versions.3) 9 . Strictly confidential and proprietary ZIP ( 1L ) 14 15 16 18 error writing to a file zip was unable to create a file to write to bad command line parameters zip could not open a specified file to read VMS interprets standard Unix (or PC) return values as other. Jean-loup Gailly. The old versions can list the contents of the zip file but cannot extract it anyway (because of the new compression algorithm). not all of the odd file formats are treated properly. The current mapping is as follows: 1 (success) for normal exit. 7.Pas program. zip stores the 32-bit format for portability. Other programs such as GNU tar are also affected by this bug. Kai Uwe Rommel.edu. John Bush and Paul Kienitz. and .3. Therefore the value reported by zip (which uses this 32-bit-mode size) differs from that reported by DIR.3 is not compatible with PKUNZIP 1. and for accepting minor changes to the file format. if they contain encrypted members or if they have been produced in a pipe or on a non-seekable device. which inspired this project. 6. scarier-looking things. The old versions of zip or PKZIP would create an archive with an incorrect format. zip cannot match some names. and that this copyright notice is retained.10. Wales. 9. Use zip 1. IN NO EVENT WILL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. the machine and operating system in use.ZIP filename extension. P. and 4 (fatal error) for the remaining ones. 2 (error) for the zip values 3. BUGS zip 2. type "set file type binary" on MSDOS.0 would report different EA sizes when DIRing a file.3 must not be updated by zip 1.Misc.10. to Steve Burg for Info-ZIP Last change: 14 August 1999 (v2. Others can be converted using Rahul Dhesi’s BILF program. AUTHORS Copyright (C) 1990-1997 Mark Adler. even the 16-bit MS-C-compiled version running on OS/2 1. to Phil Katz for placing in the public domain the zip file format. and from which the shrink algorithm was stolen. 18. Permission is granted to any individual or institution to use. Igor Mandrichenko. type "set file type block" on the Vax. so even this one shows the 32-bit-mode size. However. In both cases. LIKE ANYTHING ELSE THAT’S FREE. Onno van der Linden. the amount of Extended Attributes displayed by DIR is (for compatibility) the amount returned by the 16-bit version of DosQueryPathInfo(). Reference Manual Pages Property of BladeLogic. EITHER EXPRESSED OR IMPLIED. copy. zip files produced by zip 2. type "set file type fixed" on the Vax. where the ‘?’ is 0 (warning) for zip value 12. ACKNOWLEDGEMENTS Thanks to R. When using Kermit to transfer zip files from Vax to MSDOS. ZIP AND ITS ASSOCIATED UTILITIES ARE PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND. Byrne for his Shrink.3 and 2. This is a bug in OS/2 itself: the 32-bit DosFindFirst/Next don’t find such names. or redistribute this software so long as all of the original files are included. so zip instead maps them into VMS-style status codes. This version of zip handles some of the conversion internally. Richard B. such as those including an exclamation mark or a hash sign. 13. and (0x7fff000? + 16∗normal_zip_exit_status) for all errors.∗. Under VMS. Please send bug reports and comments by email to: zip–bugs@lists. compression format.10. Under OS/2. Inc.1 to produce zip files which can be extracted by PKUNZIP 1. that it is not sold for profit.

Hunter Goatley and Mark Adler for providing a mailing list and ftp site for the Info-ZIP group to use. The manual page was rewritten for UNIX by R. Rich Wales. Strictly confidential and proprietary ZIP ( 1L ) clarifications on the deflate format. to Keith Petersen. P. Rodgers. Info-ZIP Last change: 14 August 1999 (v2. to the Info-ZIP group itself (listed in the file infozip. Finally we should thank (blame) the first Info-ZIP moderator. C.who) without whose tireless testing and bug-fixing efforts a portable zip would not have been possible. for getting us into this mess in the first place.Misc. Inc.3) 10 . David Kirschbaum. and most importantly. to Haruhiko Okumura and Leonid Broukhis for providing some useful ideas for the compression algorithm. Reference Manual Pages Property of BladeLogic.

zip(1L). Reference Manual Pages Property of BladeLogic. i nf o. funzip(1L).z i p . or g/ pub/ i nf oz i p/ . . zipgrep is a shell script and requires egrep(1) and unzip(1L) to function. zipnote(1L). . . Inc. AUTHORS or zipgrep was written by Jean-loup Gailly. o r g / p u b / i n f o z i p / f t p: / / f t p. zipinfo(1L). zipcloak(1L).zip] [file(s) .] DESCRIPTION zipgrep will search files within a ZIP archive for lines matching the given string or pattern.z i p. zipsplit(1L) URL The Info-ZIP home page is currently at h t t p : / / www. Info-ZIP Last change: 14 January 2001 1 . unzip(1L). Its output is identical to that of egrep(1). SEE ALSO egrep(1). i n f o .] [–x xfile(s) . . ARGUMENTS All options prior to the ZIP archive filename are passed to egrep(1).Misc. Strictly confidential and proprietary ZIPGREP ( 1L ) NAME zipgrep – search files in a ZIP archive for lines matching a pattern SYNOPSIS zipgrep [egrep_options] pattern file[.

] DESCRIPTION zipinfo lists technical information about files in a ZIP archive. Note that selfextracting ZIP files are supported. one per line. each matching file is processed in an order determined by the operating system (or file system). actual size (in bytes) and total number of files is printed. [file(s)] An optional list of archive members to be processed. is also listed.] [–x xfile(s) . Wildcard expressions are similar to Unix egrep(1) (regular) expressions and may contain: ∗ ? [. Note that zipinfo is the same program as unzip (under Unix. encryption status. The default behavior (with no options) is to list single-line entries for each file in the archive.zip] Path of the ZIP archive(s). the suffix . trailers and zipfile comments are never printed. headers. be sure to quote expressions that would otherwise be expanded or modified by the operating system. list header line. Such information includes file access permissions. a link to it). the specification is assumed to be a literal filename. multi-page format. ARGUMENTS file[. If an exclamation point or a caret (‘!’ or ‘∧ follows the left bracket. type of compression. version and operating system or file system of compressing program.] matches a sequence of 0 or more characters matches exactly 1 character matches any single character found inside the brackets. a hyphen. e x e suffix (if any) explicitly. on some systems. Strictly confidential and proprietary ZIPINFO ( 1L ) NAME zipinfo – list detailed information about a ZIP archive SYNOPSIS zipinfo [–12smlvhMtTz] file[. The archive name. . . Only the filename can be a wildcard. z i p is appended. see above. the path itself cannot.Misc. and if that also fails. with header and trailer lines providing summary information for the entire archive.32) 1 . If the file specification is a wildcard. [–x xfile(s)] An optional list of archive members to be excluded from processing. It is intended for use in Unix shell scripts. . As with –m except that the compressed size (in bytes) is printed instead of the compression ratio. but allow headers (–h). list zipfile info in medium Unix ‘‘l s –l ’’ format. expressed as a percentage. and an ending character. Identical to the –s output. ranges are specified by a beginning character. list filenames only. and the like. Regular expressions (wildcards) may be used to match multiple members. The format is a cross between Unix ‘‘l s –l ’’ and ‘‘u n z i p –v’’ output. Again. . zipinfo support may have been omitted when unzip was compiled. most commonly found on MS-DOS systems. then the range of characters within the brackets is comple’) mented (that is. Inc. however. except that the compression factor. .] [–x xfile(s) . particularly under Unix and VMS. This option excludes all others. list zipfile information in verbose. . This option may be useful in cases where the stored filenames are particularly long. just specify the . trailers (–t) and zipfile comments (–z). list zipfile info in short Unix ‘‘l s –l ’’ format.] unzip –Z [–12smlvhMtTz] file[. . as well. Info-ZIP Last change: 14 January 2001 (v2. This is the default behavior. (Be sure to quote any character that might otherwise be interpreted or modified by the operating system. Reference Manual Pages Property of BladeLogic. OPTIONS –1 –2 –s –m –l –v –h list filenames only.zip] [file(s) . see below. .) If no matches are found. list zipfile info in long Unix ‘‘l s –l ’’ format.zip] [file(s) . one per line. anything except the characters inside the brackets is considered a match). . See DETAILED DESCRIPTION below. .

if the reverse.hhmmss).defX 11-Aug-91 13:48 perms.2660 The last three fields are the modification date and time of the file. there is no forwardsearching or editing capability. human-readable version with abbreviated month names (see examples below). ‘l’. These are denoted as follows: -rw-a--r--ahs --w------1. is not encrypted. the values for the entire archive are given. and if both exist.0 hpf 1. the next screenful may be viewed by pressing the Enter (Return) key or the space bar. they provide a standard way to include non-standard information in the archive). (4) is executable (guessed on the basis of the extension--. respectively. and its name. if only the totals line is being printed. Inc. on the other hand. Also. indicating that zip believes the file to be text or binary. If the file was zipped with a stored directory name.R 0. either of which may take on several values. print the file dates and times in a sortable decimal format (yymmdd. If neither exists.9 of zip.com.Misc. zipinfo doesn’t notice if long lines wrap at the edge of the screen. the file permissions at the beginning of the line are printed in Unix format.9 unx 2802 t.. where the seven subfields indicate whether the file: (1) is a directory. which is presumably the case here. list totals for files listed or for all files. . ‘X’. (2) is readable (always true).9 vms 168 Bx shrk 9-Aug-91 19:15 perms.TXT. (5) has its archive Info-ZIP Last change: 14 January 2001 (v2.32) 2 . the Enter/Return key. The fifth field consists of two characters.1 fat 1.0644 Extra fields are used for various purposes (see discussion of the –v option below) including the storage of VMS file attributes. since the latter includes all of the internal zipfile headers in addition to the compressed data. Strictly confidential and proprietary ZIPINFO ( 1L ) –M pipe all output through an internal pager similar to the Unix more(1) command. depending on whether there is an extended local header and/or an ‘‘extra field’’ associated with the file (fully explained in PKWare’s APPNOTE. zipinfo pauses with a ‘‘– –More– –’’ prompt. The second character may also take on four values. Since it comes from Unix. zipinfo notes this fact by capitalizing the character (‘T’ or ‘B’). . Note that the total compressed (data) size will never match the actual zipfile size. The example below. if there is an extended local header but no extra field. thus files that come from MS-DOS PKZIP are always capitalized. Some other possibilities for the host operating system (which is actually a misnomer--host file system is more correct) include OS/2 or NT with High Performance File System (HPFS).cmd and . and their overall compression factor is printed. Reference Manual Pages Property of BladeLogic.macr File attributes in the first two cases are indicated in a Unix-like format. Thus the file in this example is (probably) a text file. (3) is writable. The case of the filename is respected. At the end of a screenful of output. zipinfo can be terminated by pressing the ‘‘q’’ key and. Note that the file attributes are listed in VMS format. Unlike Unix more(1). On some systems the number of available lines on the screen is not detected. include the archive comment (if any) in the listing. and its behavior can be rather difficult to fathom if one isn’t familiar with Unix ls(1) (or even if one is). The second and third fields indicate that the file was zipped under Unix with version 1. but basically analogous to pragmas in ANSI C--i. The default behavior is to list files in the following format: -rw-rws--1.i4:2 14-Jul-91 12:58 EA DATA. that is also displayed as part of the filename. The uncompressed file-size (2802 in this example) is the fourth field. their uncompressed and compressed total sizes.exe.bat.hpfs 4096 b.e. ‘x’. OS/2 or NT with File Allocation Table (FAT) file system. and Macintosh. MS-DOS. on some systems. SF 17357 bx i8:2 4-May-92 04:02 unzip. but if the file is encrypted. The number of files listed. The default date format is a more standard.btm files are assumed to be so).R. in which case zipinfo assumes the height is 24 lines. effectively resulting in the printing of two or more lines and the likelihood that some text will scroll off the top of the screen before being viewed.0 mac 5358 Tl i4:3 4-Dec-91 11:33 longfilename. is an encrypted binary file with an extra field: RWD. . and has neither an extra field nor an extended local header associated with it. –t –T –z DETAILED DESCRIPTION zipinfo has a number of modes. The first character may be either ‘t’ or ‘b’. or. the character will be a hyphen (‘–’).

instead: -rw-rws--1. Acorn/Archimedes SparkFS info. 1. tokenizing (never publicly released). In addition. 13386 bytes uncompressed.. the file has been compressed by more than a factor of five. Finally.rw. there are four levels of reducing (1 through 4). 1.5 unx 2802 t538 defX 910811.stor 21-Aug-91 5 files.. and (7) is a system file. environment options.32) 3 .0 hpf 3710 b. imploding. 1..os2 15:29 os2unzip. yet Unix-like. (6) is hidden. re:2.i4:3 26-Jun-92 . fast.rw. which can override or add to the defaults.0% The header line gives the name of the archive. the header and trailer lines are not listed. four types of imploding (4K or 8K sliding dictionary. In brief.c 15:34 unzip. shrk.2660 Adding the –T option changes the file date and time to decimal format: -rw-rws--1.) Nevertheless.rw.def 17:51 zipinfo. In addition to individual file information. and defS. The medium and long listings are almost identical to the short format except that they add information on the file’s compression. i4:2. its total size. Strictly confidential and proprietary ZIPINFO ( 1L ) bit set. defF. and explicit options given by the user.zip 5453 bytes 5 files .def compressed: 63. defN. tokn.0 hpf 8753 b. In such a case the listing format must also be specified explicitly. manner. and the total number of files.134804 perms. the trailer gives the number of files listed. if any. maximum compression). due to zipinfo’s attempts to handle various defaults in an intuitive. and their total compressed size (not including any of zip’s internal overhead). If. and defX. one or more file(s) are provided.2660 In this example. and deflating. VMS filesystem info. reducing.0 hpf 730 b. their total uncompressed size. OS/2 extended attributes. etc. and the type and number of bytes in any stored extra fields.rw.5 unx 2802 t.Misc. It also lists file comments and the zipfile comment.) ENVIRONMENT OPTIONS Modifying zipinfo’s default behavior via options placed in an environment variable can be a bit complicated to explain. Macintosh resource forks. and so on. i8:3. and 2 or 3 Shannon-Fano trees).. The verbose listing is mostly self-explanatory.81% defX 11-Aug-91 13:48 perms. Currently known types of extra fields include PKWARE’s authentication (‘‘AV’’) info. Inc. Info-ZIP Last change: 14 January 2001 (v2.. normal. there is some underlying logic. 1.rw. See the EXAMPLES section below for a semi-intelligible translation of this nonsense. which can override or add to either of the above. There are six methods known at present: storing (no compression). 4951 bytes 23:40 Contents 23:33 makefile. the compressed data are only 19% of the original size. For Unix files this is expected to change in the next major releases of zip(1L) and unzip.. however. The medium format lists the file’s compression factor as a percentage indicating the amount of space that has been ‘‘removed’’: -rw-rws--1.i8:3 26-Jun-92 .0 hpf 95 b. a default zipfile listing also includes header and trailer lines: Archive: OS2.stor 21-Aug-91 . re:1. and four levels of deflating (superfast.5 unx 2802 t538 defX 11-Aug-91 13:48 perms.i4:3 26-Jun-92 . it may be overridden by specifying the –h and –t options explicitly. 1. the sixth field indicates the compression method and possible sub-method used. shrinking. (Try not to laugh.0 hpf 98 b.2660 Note that because of limitations in the MS-DOS format used to store file times. This behavior is also similar to that of Unix’s ‘‘ls –l’’. Interpretation of Macintosh file attributes is unreliable because some Macintosh archivers don’t store any attributes in the archive. the seconds field is always rounded to the nearest even second. Reference Manual Pages Property of BladeLogic. there are three ‘‘priority levels’’ of options: the default options. both PKWARE and Info-ZIP versions. since –h or –t (or both) in the absence of other options implies that ONLY the header or trailer line (or both) is listed.. whereas zipinfo always reports the 32-bit storage. zipinfo represents these methods and their sub-methods as follows: stor. etc. (Note that in the case of OS/2 extended attributes--perhaps the most common use of zipfile extra fields--the size of the stored EAs as reported by zipinfo may not match the number given by OS/2’s dir command: OS/2 always reports the number of bytes required in 16-bit format. The long format gives the compressed file’s size in bytes.

Reference Manual Pages Property of BladeLogic. Strictly confidential and proprietary ZIPINFO ( 1L ) The default listing format.Misc. an explicit –t option was necessary to produce the full listing. as in Unix when globbing is turned on--double quotes around the asterisk would have worked as well). It is also consistent with the behavior of the Unix command nice(1). Info-ZIP Last change: 14 January 2001 (v2. For compatibility with zip(1L). the contents of all zipfiles are then summarized with a single command. Since the environment variable specified no footers and that has a higher precedence than the default behavior of –s. the user dislikes the trailer line. ZIPINFOOPT is also accepted (don’t ask). This is accomplished by preceding the undesired option with one or more minuses: e. includes headers and footers by default. ZIPINFO takes precedence. in addition. use –l: zipinfo –l storage To list the complete contents of the archive without header and totals lines. the default variable names are ZIPINFO_OPTS for VMS (where the symbol used to install zipinfo as a foreign command would otherwise be confused with the environment variable). override any default listing of member files.zip. A user who prefers the long-listing format (–l) can make use of the zipinfo’s environment variable to change this default: ZIPINFO=–l. corresponds roughly to the "zipinfo –hst" command (except when individual zipfile members are specified).g. but the one before the ‘t’ is a minus sign. Note that both the –h and –t options. Nothing was indicated about the header. when used by themselves or with each other. given that the environment variable is set as in the previous example. however. as noted above. use the environment variable (C shell is assumed here): setenv ZIPINFO ––t zipinfo storage To get the full. and ZIPINFO for all other operating systems. like –m and –l. short-format listing of the first example again. since the –t option by itself implies that ONLY the footer line is to be printed: setenv ZIPINFO ––t zipinfo –t storage zipinfo –st storage [only totals line] [full listing] The –s option. As suggested above. only the header and/or footer are printed. If both ZIPINFO and ZIPINFOOPT are defined. however. in this example. unzip’s diagnostic option (–v with no zipfile name) can be used to check the values of all four possible unzip and zipinfo environment variables. The first hyphen is the regular switch character. zipinfo’s concept of ‘‘negative options’’ may be used to override the default inclusion of the line. but it’s reasonably intuitive nonetheless: simply ignore the first hyphen and go from there. either negate the –h and –t options or else specify the contents explicitly: zipinfo ––h–t storage zipinfo storage \∗ (where the backslash is required only if the shell would otherwise expand the ‘∗’ wildcard. it is necessary to specify the –s option explicitly. ‘‘–l–t’’ or ‘‘––tl’’.. including header and totals lines. Inc. The dual use of hyphens may seem a little awkward. with both header and totals lines. This behavior is useful when zipinfo is used with a wildcard zipfile specification.32) 4 . To turn off the totals line by default. use only the archive name as an argument to zipinfo: zipinfo storage To produce a basic. so the –s option was sufficient. EXAMPLES To get a basic. unless otherwise specified. export ZIPINFO setenv ZIPINFO –l set ZIPINFO=–l define ZIPINFO_OPTS "–l" Unix Bourne shell Unix C shell OS/2 or MS-DOS VMS (quotes for lowercase) If. short-format listing of the complete contents of a ZIP archive storage. long-format listing (not verbose).

org/pub/infozip/ or ftp://ftp. as noted above.c The specification of any member file.[ch]" Mak\∗ To get maximal information about the ZIP archive. create a link or create a command file with the name ii).. copy/rename the executable. zipnote(1L). This requires knowledge of the screen’s width as well as its height. on other systems. if –m or –l is used.Misc. only the single line of information about the requested file will be printed. in such cases –t may be specified explicitly: zipinfo –mt storage "∗. use the verbose option. The tail(1) command filters out all but the last 15 lines of the listing. Strictly confidential and proprietary ZIPINFO ( 1L ) To list information on a single file within the archive. zipinfo should detect the true screen geometry on all systems. unzip(1L). (This is not to say that it will be. Please refer to the CONTRIBS file in the UnZip source distribution for a more complete list.info-zip. This assumes the default short-listing format.info-zip. zip(1L). will override the default header and totals lines. Future releases of zipinfo may incorporate date/time and filename sorting as built-in options. Info-ZIP Last change: 14 January 2001 (v2. TIPS The author finds it convenient to define an alias ii for zipinfo on systems that allow aliases (or. BUGS As with unzip. Reference Manual Pages Property of BladeLogic. specify the filename explicitly: zipinfo –m storage unshrink. Inc.e.32) 5 . to see the most recently modified files in the archive. It is usually wise to pipe the output into a filter such as Unix more(1) if the operating system allows it: zipinfo –v storage | more Finally. zipinfo should detect and treat each occurrence of line-wrap as one additional line printed. This is intuitively what one would expect when requesting information about a single file. For multiple files. and the similarity between the outputs of the two commands was intentional. unzipsfx(1L). and the +6 option tells it to sort on the sixth field after the first one (i. ZipInfo contains pattern-matching code by Mark Adler and fixes/improvements by many others. zipinfo’s –M (‘‘more’’) option is overly simplistic in its handling of screen output. funzip(1L).) SEE ALSO ls(1).org/pub/infozip/ . it is often useful to know the total compressed and uncompressed size. the seventh field). In addition. as in this example. AUTHOR Greg ‘‘Cave Newt’’ Roelofs. in this example): zipinfo –T storage | sort -n +6 | tail -15 The –n option to sort(1) tells it to sort numerically rather than in ASCII order. zipinfo’s listing-format behavior is unnecessarily complex and should be simplified. zipsplit(1L) URL The Info-ZIP home page is currently at http://www. the proper sort(1) option would be +7. zipcloak(1L). it fails to detect the wrapping of long lines and may thereby cause lines at the top of the screen to be scrolled off before being read. in medium format. use the –T option in conjunction with an external sorting utility such as Unix sort(1) (and tail(1) as well. The ii usage parallels the common ll alias for long listings in Unix.

The sites marked with (H) may be mirroring ftp. and a host of other features.User Commands Property of BladeLogic.zsh.elte.cs.org/pub/zsh/ ftp://ftp. Zsh has command line editing.de/pub/unix/shell/zsh/ Hungary ftp://ftp.org/pub/zsh/ Australia ftp://ftp.gov. Zsh is available from the following anonymous FTP sites.org>.elte.elte.dgac.org>.4 Last change: October 26. shell functions (with autoloading). builtin spelling correction.de/pub/unix/shells/zsh/ (H) ftp://ftp.fi/pub/unix/shells/zsh/ France ftp://ftp.ips. a history mechanism.hu/pub/zsh/ http://www. Zsh is now maintained by the members of the zsh–workers mailing list <zsh–workers@sunsite.zsh.gmd. These mirror sites are kept frequently up to date. Strictly confidential and proprietary ZSHALL ( 1 ) NAME zshall – the Z shell meta–man page SYNOPSIS Because zsh contains many features.org>.fr/shells/zsh/ Germany ftp://ftp.hu instead of the primary site.0.org/pub/zsh/ http://www.zsh.org/pub/zsh/ http://www. 2001 1 . The development is currently coordinated by Peter Stephenson <pws@zsh.funet.au/pub/packages/zsh/ (H) Denmark ftp://sunsite. zsh most closely resembles ksh but includes many enhancements.fu–berlin. This manual page includes all the separate manual pages in the following order: zshmisc Anything not fitting into the other sections zshexpn Zsh command and parameter expansion zshparam Zsh parameters zshoptions Zsh options zshbuiltins Zsh built–in functions zshzle Zsh command line editing zshcompwid Zsh completion widgets zshcompsys Zsh completion system zshcompctl Zsh completion control zshmodules Zsh loadable modules zshzftpsys Zsh built–in FTP client DESCRIPTION Zsh is a UNIX command interpreter (shell) usable as an interactive login shell and as a shell script command processor.hu/pub/zsh/ zsh 4. the zsh manual has been split into a number of sections.uni–trier.cs.cena. Inc. programmable command completion.dk/pub/unix/shells/zsh/ Finland ftp://ftp. Of the standard shells.de/packages/zsh/ ftp://ftp. but matters relating to the code should generally go to the mailing list. The coordinator can be contacted at <coordinator@zsh.cs. AVAILABILITY Primary site ftp://ftp.dk>.cenatls.zsh. AUTHOR Zsh was originally written by Paul Falstad <pf@zsh.

Inc.net/pub/mirrors/ftp. All submissions to zsh–users are automatically forwarded to zsh–workers.roedu.4 Last change: October 26.rge.uk/packages/zsh/ USA ftp://uiarchive.edu.hu/pub/packages/zsh/ Israel ftp://ftp.kfki.dk> Announcements about releases.0.technion.math.se/pub/unix/zsh/ UK ftp://ftp.pl/pub/unix/shells/zsh/ Romania ftp://ftp.ac.uit. (moderated) <zsh–users@sunsite.dk> <zsh–workers–subscribe@sunsite.il/pub/zsh/ Italy ftp://ftp.org/zsh/ MAILING LISTS Zsh has 3 mailing lists: <zsh–announce@sunsite. major changes in the shell and the monthly posting of the Zsh FAQ.uiuc. send mail to the associated administrative address for the mailing list.dk> <zsh–users–unsubscribe@sunsite.jp/pub/shell/zsh/ Norway ftp://ftp.dk> <zsh–users–subscribe@sunsite. Strictly confidential and proprietary ZSHALL ( 1 ) ftp://ftp.org/pub/zsh/ http://foad.il/pub/zsh/ http://www.ro/pub/mirrors/ftp.technion.org.com/pub/shells/zsh/ ftp://foad.net/pub/shells/zsh/ (H) ftp://ftp.uk/zsh/ ftp://sunsite. To subscribe or unsubscribe.edu/pub/packages/shells/zsh/ ftp://ftp.icm. zsh 4.dk> <zsh–workers–unsubscribe@sunsite.siol.lysator.ac.unina.net.net/mirrors/zsh/ Sweden ftp://ftp.org/pub/zsh/ Slovenia ftp://ftp.it/pub/Unix/pkgs/shell/zsh/ Japan ftp://ftp.dk> <zsh–announce–unsubscribe@sunsite. bug reports and patches.org/pub/zsh/ ftp://ftp.math.ne.lut.dk> YOU ONLY NEED TO JOIN ONE OF THE MAILING LISTS AS THEY ARE NESTED.nisiq.liu. <zsh–announce–subscribe@sunsite. development.no/pub/unix/shells/zsh/ Poland ftp://sunsite.dk> Hacking.dk> User discussions.User Commands Property of BladeLogic. <zsh–workers@sunsite.kappa.win.zsh.zsh. 2001 2 . All submissions to zsh–announce are automatically forwarded to zsh–users.ac.

org>. Unlike other option syntaxes. the first argument is taken to be the pathname of a script to execute.dk>. rather than reading commands from a script or standard input. It can be viewed in its current state at http://zsh.org/. or downright mystifying (for example. but takes a following string as the option name.org>. the archives can be accessed via the administrative addresses listed above. GNU–style long options cannot be stacked with any other options. THE ZSH WEB PAGE THE ZSH USERGUIDE A userguide is currently in preparation. options can be turned off by replacing the initial ‘–’ with a ‘+’. the remaining arguments are assigned to the positional parameters.org/mla/. –o can be stacked up with preceding single–letter options. INVOCATION OPTIONS The following flags are interpreted by the shell when invoked to determine where the shell will read commands from: –c Take the first argument as a command to execute. ‘– –option–name’. For further options. chapters dealing with startup files and their contents and the new completion system were essentially complete. The mailing lists are maintained by Karsten Thygesen <karthy@kom. send mail to <listmaster@zsh. Zsh has a web page which is located at http://www. Force shell to read commands from the standard input. If the –s flag is not present and an argument is given. Force shell to be interactive.unix. The contact address for FAQ–related matters is <faqmaster@zsh. For example.org>. ‘–’ characters in the option name are permitted: they are translated into ‘_’. maintained by Geoff Wing <gcw@zsh. It is intended to complement the manual. see zshoptions(1).4 Last change: October 26. It is regularly posted to the newsgroup comp. Options may be turned off by name by using +o instead of –o. So. At the time of writing. thus ‘+–sh–word–split’ is equivalent to ‘– –no–sh–word–split’. zsh 4. When this is done. so for example ‘–xo shwordsplit’ or ‘–xoshwordsplit’ is equivalent to ‘–x –o shwordsplit’. THE ZSH FAQ Zsh has a list of Frequently Asked Questions (FAQ). with explanations and hints on issues where the manual can be cabbalistic.zsh. Strictly confidential and proprietary ZSHALL ( 1 ) If you have problems subscribing/unsubscribing to any of the mailing lists. the first one is assigned to $0.zsh.0.auc. The mailing lists are archived. or at http://www.dk/Guide/. Like other option syntaxes.org>. rather than being treated like ‘–x – –shwordsplit’. There is also a hypertext archive. The contact address for web–related matters is <webmaster@zsh.org>. hierographic.org/FAQ/. setting the XTRACE option by the corresponding letter ‘–x’ and the SH_WORD_SPLIT option by name. maintained by Peter Stephenson <pws@zsh. and thus ignored.sunsite. the word ‘hierographic’ does not exist). Options may also be specified by name in GNU long option style.User Commands Property of BladeLogic. This is maintained by Karsten Thygesen <karthy@zsh. for example. zsh –x –o shwordsplit scr runs the script scr.org>. available at http://www. which are common to invocation and the set builtin. –i –s After the first one or two arguments have been appropriated as described above. The latest version can be found at any of the Zsh FTP sites.shell and the zsh–announce mailing list. ‘zsh – –sh–word–split’ invokes zsh with the SH_WORD_SPLIT option turned on. 2001 3 . Inc. If any further arguments are given. rather than being used as a positional parameter. of SunSITE Denmark. –o acts like a single–letter option.zsh. Options may be specified by name using the –o option. so for example ‘–x–shwordsplit’ is an error.

LD_LIBRARY_PATH. where ‘– –shwordsplit’ is permitted and does not end option processing.0. SHELL. Emulation mode is determined after stripping the letter ‘r’ from the invocation name. SH_OPTION_LETTERS. 2001 4 . Also. Inc. if invoked as su (which happens on certain systems when the shell is executed by the su command). HISTCHARS. SH_FILE_EXPANSION. manpath. except that further single–letter options can be stacked after the ‘–b’ and will take effect as normal. If the ENV environment variable is set on invocation. GLOB_SUBST. and arithmetic expansion before being interpreted as a pathname. The following options are set if the shell is invoked as sh or ksh: NO_BAD_PATTERN. The value of ENV is subjected to parameter expansion. Options are not permitted to be stacked after ‘– –’ (so ‘–x–f’ is an error).4 Last change: October 26. ‘–b’ is like ‘– –’. COMPATIBILITY Zsh tries to emulate sh or ksh when it is invoked as sh or ksh respectively.User Commands Property of BladeLogic. ‘– –help’ is also handled. NO_FUNCTION_ARGZERO. NO_EQUALS. Secondly. LOCAL_OPTIONS. PROMPT4. it sends to standard output a list of options that can be used when invoking the shell. argv. watch. allowing following arguments that start with ‘–’ or ‘+’ to be treated as normal arguments. NO_MULTIOS. NO_PROMPT_PERCENT. RM_STAR_SILENT. INTERACTIVE_COMMENTS. NO_BANG_HIST. EGID. NO_NOTIFY. EUID. and if that is ‘s’ or ‘k’ it will emulate sh or ksh. prompt. excluding any initial ‘r’ (assumed to stand for ‘restricted’). The usual zsh startup/shutdown scripts are not executed. fignore. HISTSIZE. it sends to standard output the shell’s version information. the KSH_OPTION_PRINT. MANPATH. $ENV is sourced after the profile scripts. SH_GLOB. NO_BG_NICE. Except when the sh/ksh emulation single–letter options are in effect. POSIX_BUILTINS. a special option ‘– –’ (or ‘+–’). Firstly. status. module_path. then exits successfully. PROMPT2. but note the GNU–style option form discussed above. path. GID. mailpath. the option ‘–b’ (or ‘+b’) ends option processing. Furthermore. PROMPT3. HISTFILE. Option processing may be finished. In sh and ksh compatibility modes the following parameters are not special and not initialized by the shell: ARGC. The following are disabled in restricted mode: • • changing directories with the cd builtin changing or unsetting the PATH. KSH_ARRAYS. command substitution. USERNAME. PROMPT_BANG. which may be specified on its own (which is the standard POSIX usage) or may be stacked with preceding options (so ‘–x–’ is equivalent to ‘–x – –’). more precisely. path. fpath. Login shells source /etc/profile followed by $HOME/. Note that the PRIVILEGED option also affects the execution of startup files. NO_GLOBAL_EXPORT. then exits successfully. cdpath. psvar. a lone ‘–’ (or ‘+’) as an argument by itself ends option processing. PROMPT_SUBST and SINGLE_LINE_ZLE options are set if zsh is invoked as ksh. in two ways. LD_PRELOAD and LD_AOUT_PRELOAD parameters specifying command names containing / specifying command pathnames using hash redirecting output to files using the exec builtin command to replace the shell with another command using jobs –Z to overwrite the shell process’ argument and environment space • • • • • zsh 4. NO_NOMATCH. SH_WORD_SPLIT. it looks at the first letter of the name by which it was invoked. UID. the shell will try to find an alternative name from the SHELL environment variable and perform emulation based on that.profile. PROMPT. MODULE_PATH. NO_HUP. Additionally the BSD_ECHO and IGNORE_BRACES options are set if zsh is invoked as sh. RESTRICTED SHELL When the basename of the command used to invoke zsh starts with the letter ‘r’ or the ‘–r’ command line option is supplied at invocation. Strictly confidential and proprietary ZSHALL ( 1 ) The special GNU–style option ‘– –version’ is handled. LD_AOUT_LIBRARY_PATH. the shell becomes restricted.

the logout files are not read. This immediately enables all the restrictions described above even if the shell still has not processed all startup files. any subsequent startup file(s) of the corresponding type will not be read.4 Last change: October 26. The startup files should set up PATH to point to a directory of commands which can be safely invoked in the restricted environment. These are also affected by the RCS and GLOBAL_RCS options. Strictly confidential and proprietary ZSHALL ( 1 ) • • using the ARGV0 parameter to override argv[0] for external commands turning off restricted mode with set +r or unsetopt RESTRICTED These restrictions are enforced after processing the startup files. it is important that it be kept as small as possible. the compiled file will be used instead. commands are read from /etc/zshrc and then $ZDOTDIR/.. it is a good idea to put code that does not need to be run for every single shell behind a test of the form ‘if [[ –o rcs ]].User Commands Property of BladeLogic.zshrc.zshenv. As /etc/zshenv is run for all instances of zsh.e. However. Both RCS and GLOBAL_RCS are set by default. STARTUP/SHUTDOWN FILES Commands are first read from /etc/zshenv. They may also add further restrictions by disabling selected builtins.’ so that it will not be executed when zsh is invoked with the ‘–f’ option. zsh 4. i. 2001 5 . Any of these files may be pre–compiled with the zcompile builtin command (see zshbuiltins(1)). if the shell terminates due to exec’ing another process.zwc extension) and it is newer than the original file. Restricted mode can also be activated any time by setting the RESTRICTED option.zprofile. Commands are then read from $ZDOTDIR/. Finally. this cannot be overridden. if RCS is unset when the shell exits. commands are read from /etc/zprofile and then $ZDOTDIR/. the former affects all startup files. Note also that the RCS option affects the saving of history files. If one of the options is unset at any point. if the shell is a login shell. If a compiled file exists (named for the original file plus the . HOME is used instead. When a login shell exits.0. Then. if the shell is interactive.zlogout and then /etc/zlogout are read. depending on the installation. This happens with either an explicit exit via the exit or logout commands. Those files listed above as being in /etc may be in another directory. /etc/zlogin and $ZDOTDIR/. the files $ZDOTDIR/. then . while the second only affects those in the /etc directory. In particular.zlogin are read.. no history file will be saved. If ZDOTDIR is unset. If the shell is a login shell. Inc. or an implicit exit by reading end–of–file from the terminal. Subsequent behaviour is modified by the RCS and GLOBAL_RCS options. It is also possible for a file in $ZDOTDIR to re–enable GLOBAL_RCS.

or a newline.. or 128 plus the signal number if terminated by a signal.0. including the complex commands below.}’. Strictly confidential and proprietary ZSHMISC ( 1 ) NAME zshmisc – everything and then some SIMPLE COMMANDS & PIPELINES A simple command is a sequence of optional parameter assignments followed by blank–separated words. Both operators have equal precedence and are left associative. A list is a sequence of zero or more sublists. A pipeline is either a simple command. 2001 1 . the second is executed only if the first fails (returns a nonzero value). where the output (‘foo’ plus a newline) of the first command will be passed to the input of the second. with optional redirections interspersed. and does not wait for it to finish (note the difference from other shells which execute the whole sublist in the background). or a sequence of two or more pipelines separated by ‘&&’ or ‘’. echo foo  sed ’s/foo/bar/’ is a pipeline.’ or newline.. which connects both the standard output and the standard error of the command to the standard input of the next. If a pipeline is preceded by ‘coproc’. it is executed as a coprocess. If it does not. the shell waits for it to finish before executing the next sublist. The shell can read from or write to the coprocess by means of the ‘>&p’ and ‘<&p’ redirection operators or with ‘print –p’ and ‘read –p’. else it is the value returned by the print (almost certainly zero).4 Last change: October 26. dmesg  grep panic && print yes is a sublist consisting of two pipelines. ‘&’ is shorthand for ‘2>&1 ’. More generally. When a sublist is terminated by ‘. a list can be seen as a set of any shell commands whatsoever. or ‘&!’.’. are arguments to the command. the commands in a shell function form a special sort of list. the second pipeline is executed only if the first succeeds (returns a zero value).. the standard output of the first command is connected to the standard input of the next. A pipeline cannot be preceded by both ‘coproc’ and ‘!’. PRECOMMAND MODIFIERS A simple command may be preceded by a precommand modifier. A backgrounded pipeline returns a status of zero. For example. this is implied wherever the word ‘list’ appears in later descriptions. unless the pipeline is preceded by ‘!’ in which case the value is the logical inverse of the value of the last command. if any. These modifiers are shell builtin commands with the exception of nocorrect which is a reserved word. ‘&!’.)’ or ‘{. the second just a simple command which will be executed if and only if the grep command returns a zero value. For example. a two–way pipe is established between it and the parent shell. in which each sublist is terminated by ‘. The value of a pipeline is the value of the last command. the coprocess can be treated in other than input and output as an ordinary background job. If a command name is given. This terminator may optionally be omitted from the last sublist in the list when the list appears as a complex command inside ‘(. which will alter how the command is interpreted. the parameter assignments modify the environment of the command when it is executed. or a sequence of two or more simple commands where each command is separated from the next by ‘’ or ‘&’. ‘&’. If a sublist is terminated by a ‘&’. echo foo is a simple command with arguments. Where commands are separated by ‘’. ‘&’. For example. the shell executes the last pipeline in it in the background. The value of the sublist is the value of the last pipeline executed. and the remaining words. the value of the sublist is that return value. If job control is active. ‘&’. For example.User Commands Property of BladeLogic. zsh 4. Inc. The value of a simple command is its exit status. If two pipelines are separated by ‘&&’. A sublist is either a single pipeline. If two pipelines are separated by ‘’.. The first word is the command to be executed.

each preceded by a number. 2001 2 .. while list do list done Execute the do list as long as the while list returns a zero exit status.. to terminate the words.0. or else standard input. the elif list is executed and if its value is zero. and if it returns a zero exit status.. repeat word do list done word is expanded and treated as an arithmetic expression.. command The command word is taken to be the name of an external command. nocorrect Spelling correction is not done on any of the words. the else list is executed. The contents of the line read from standard input is saved in the parameter REPLY. If the list that is executed is terminated with .. exec The command is executed in the parent shell without forking. executing list each time... Print the set of words. then the parameter name is set to the word corresponding to this number. esac Execute the list associated with the first pattern that matches word.. the then list is executed. Inc. [expr3] )) do list done The arithmetic expression expr1 is evaluated first (see the section ‘Arithmetic Evaluation’).. The form of the patterns is the same as that used for filename generation. the then list is executed. case word in [ [(] pattern [  pattern ] . [ else list ] fi The if list is executed. If the in word is omitted. list is then executed n times.. the value of the parameter name is set to null. before any parsing is done. use the positional parameters. which must evaluate to a number n. the selection list is printed again.& rather than . builtin The command word is taken to be the name of a builtin command. rather than a shell function or external command.&) ] . The PROMPT3 prompt is printed and a line is read from the line editor if the shell is interactive and that is active. use the positional parameters instead of the words. Strictly confidential and proprietary ZSHMISC ( 1 ) – The command is executed with a ‘–’ prepended to its argv[0] string. until list do list done Execute the do list as long as until list returns a nonzero exit status. for name [ in word . and set the parameter name to each of them in turn. as it is interpreted immediately. term ] do list done where term is at least one newline or . This must appear before any other precommand modifier. then it behaves as if it evaluated to 1. Otherwise. select name [ in word ... If this line consists of the number of one of the listed words. See the section ‘Filename Generation’.User Commands Property of BladeLogic. zsh 4. list is executed for each selection until a break or end–of–file is encountered. rather than a shell function or builtin. if any. If any expression is omitted. COMPLEX COMMANDS A complex command in zsh is one of the following: if list then list [ elif list then list ] . list is executed and the arithmetic expression expr3 evaluated. noglob Filename generation (globbing) is not performed on any of the words. or the esac is reached.. It has no effect in non–interactive shells. term ] do list done where term is one or more newline or . for (( [expr1] . If the in word is omitted. Expand the list of words.4 Last change: October 26. Otherwise. ) list (. the following list is also executed. If each elif list returns nonzero.. The arithmetic expression expr2 is repeatedly evaluated until it evaluates to zero and when non–zero.. If this line is empty. This continues until either a list is terminated with . [expr2] ..

ALTERNATE FORMS FOR COMPLEX COMMANDS Many of zsh’s complex commands have alternate forms. and timing statistics are reported on the standard error in the form specified by the TIMEFMT parameter.. () [ term ] command where term is one or more newline or . If pipeline is omitted. Normally. See the section ‘Conditional Expressions’ for a description of exp. for name ( word . in both these cases the test part of the loop must also be suitably delimited. These particular versions of complex commands should be considered deprecated and may be removed in the future.. then whitespace may appear between between the left and right parentheses when there is a single word.. otherwise. such as by ‘[[ .. but if true { # Does not work! print yes } does not. Another short form of for. [ else { list } ] An alternate form of if. since the test is not suitably delimited. The rules mean that if [[ –o ignorebraces ]] { print yes } works.. the parentheses will be treated as forming a globbing pattern in that case. ))’. ) sublist A short form of for. () [ term ] { list } word . [ () ] [ term ] { list } word . The short versions below only work if sublist is of the form ‘{ list }’ or if the SHORT_LOOPS option is set. Traps set by the trap builtin are reset to their default values while executing list. else the end of the test will not be recognized. ]]’ or ‘(( . multiple words are usually only useful for setting traps. only one word is provided.. The body of the function is the list between the { and }.. Define a function which is referenced by any one of word. if list sublist A short form of the alternate ‘if’. print statistics about the shell process and its children. term ] sublist where term is at least one newline or . Execute list. [expr3] )) sublist A short form of the arithmetic for command. time [ pipeline ] The pipeline is executed.. Strictly confidential and proprietary ZSHMISC ( 1 ) ( list ) { list } Execute list in a subshell. The versions in the previous section should be preferred instead. while and until commands. zsh 4.. repeat. [expr2] . case and select commands no such special form for the arguments is necessary... See the section ‘Functions’. for name [ in word . 2001 3 . if list { list } [ elif list { list } ] . function word . for (( [expr1] .. [[ exp ]] Evaluates the conditional expression exp and return a zero exit status if it is true. but the other condition (the special form of sublist or use of the SHORT_LOOPS option) still applies.User Commands Property of BladeLogic...0... For the for. Inc. For the if. The same limitations on the form of list apply as for the previous form..4 Last change: October 26.. If the option SH_GLOB is set for compatibility with other shells.

For example. parameter and command substitution occur.. global aliases may be defined using the –g option to that builtin. it is replaced by the text of the alias if it is in command position (if it could be the first word of a simple command). 2001 4 . ALIASING Every token in the shell input is checked to see if there is an alias defined for it.4 Last change: October 26. But there is nothing to prevent an alias being defined for \foo as well. e. if an alias is defined for the word foo.. A single quote cannot appear within single quotes unless the option RC_QUOTES is set. All characters enclosed between a pair of single quotes (’’) that is not preceded by a ‘$’ are quoted. Strictly confidential and proprietary ZSHMISC ( 1 ) foreach name ( word . Inside double quotes (" " ). and ‘$’.User Commands Property of BladeLogic. \foo. Inc..g. but one single quote if it is set.. ‘‘’. and ‘\’ quotes the characters ‘\’. case word { [ [(] pattern [  pattern ] . If the text ends with a space. A literal ‘’’ character can be included in the string by using the ‘\’’ escape. until list { list } An alternative form of until. ) list end Another form of for. alias expansion may be avoided by quoting part of the word. ‘\’ followed by a newline is ignored. If so. ) list (. zsh 4. while list { list } An alternative form of while.. print ’’’’ outputs nothing apart from a newline if RC_QUOTES is not set.. A short form of select. QUOTING A character may be quoted (that is. Note the limitations on the form of list mentioned above. ‘}’ is recognized in any position if the IGNORE_BRACES option is not set.. and the resulting string is considered to be entirely quoted. a word beginning with the third character of the histchars parameter (‘#’ by default) causes that word and all the following characters up to a newline to be ignored. An alias is defined using the alias builtin. the next word in the shell input is treated as though it were in command position for purposes of alias expansion. RESERVED WORDS The following words are recognized as reserved words when used as the first word of a command unless quoted or disabled using disable –r: do done esac then elif else fi for case if while function repeat time until select coproc nocorrect foreach end ! [[ { } Additionally. COMMENTS In noninteractive shells.&) ] . Note the limitations on the form of list mentioned above.. Alias expansion is done on the shell input before any other expansion except history expansion. ‘" ’. A string enclosed between ‘$’’ and ‘’’ is processed the same way as the string arguments of the print builtin. made to stand for itself) by preceding it with a ‘\’.0.. or in interactive shells with the INTERACTIVE_COMMENTS option set. } An alternative form of case. Therefore. or if the alias is global. in which case a pair of single quotes are turned into a single quote. select name [ in word term ] sublist where term is at least one newline or . repeat word sublist This is a short form of repeat.

The resulting document. and the CLOBBER option is unset. it is truncated to zero length. << < word Perform shell expansion on word and pass the result to standard input. command substitution or filename generation is performed on word.4 Last change: October 26. otherwise.0. Otherwise. the file is created. redirection occurs for each separate filename in turn. If any character of word is quoted with single or double quotes or a ‘\’. Inc. parameter and command substitution occurs. Otherwise. If the result of substitution on word produces more than one filename. > word Open file word for writing as standard output. No parameter expansion. <<[–] word The shell input is read up to a line that is the same as word. except that the file is truncated to zero length if it exists. If the file does not exist then it is created. >> word >>! word Same as >>. ‘&>’ can always be used to avoid this ambiguity. < word Open file word for reading as standard input. The input/output from/to the coprocess is moved to the standard input/output. then the default standard input for the command is the empty file /dev/null. Strictly confidential and proprietary ZSHMISC ( 1 ) REDIRECTION If a command is followed by & and job control is not active. even if CLOBBER is unset. If the file does not exist. and the CLOBBER option is unset. >> word Open file word for writing in append mode as standard output. no interpretation is placed upon the characters of the document. The following may appear anywhere in a simple command or may precede or follow a complex command. except that the file is created if it does not exist. > word >! word Same as >. If the file does not exist then it is created. called a here–document. even if CLOBBER is unset. the environment for the execution of a command contains the file descriptors of the invoking shell as modified by input/output specifications.) Redirects both standard output and standard error (file descriptor 2) in the manner of ‘> word’. zsh 4. >& word &> word (Except where ‘>& word’ matches one of the above syntaxes. ‘‘’ and the first character of word. 2001 5 . otherwise. This is known as a here–string. If the file exists. and ‘\’ must be used to quote the characters ‘\’. If <<– is used. <& number >& number The standard input/output is duplicated from file descriptor number (see dup2(2)). or to an end–of–file. <& – >& – <& p >& p Close the standard input/output. this causes an error. then all leading tabs are stripped from word and from the document. ‘\’ followed by a newline is removed. ‘$’.User Commands Property of BladeLogic. Expansion occurs before word or digit is used except as noted below. becomes the standard input. <> word Open file word for reading and writing as standard input. Note that this does not have the same effect as ‘> word 2>&1’ in the presence of multios (see the section below). this causes an error.

0. provided the MULTIOS option is set. If the MULTIOS option is set.. and also pipes it to cat. >>& word &>> word Redirects both standard output and standard error (file descriptor 2) in the manner of ‘>> word’.ubar} is equivalent to ‘cat foo fubar  sort’. thus zsh 4. If one of the above is preceded by a digit. as it is by default. MULTIOS If the user tries to open a file descriptor for writing more than once. the shell opens the file descriptor as a pipe to a process that copies its input to all the specified outputs. fname). thus date >foo  cat writes the date to the file ‘foo’. >>& word >>&! word &>> word &>>! word Redirects both standard output and standard error (file descriptor 2) in the manner of ‘>> word’. file) association at the time of evaluation. provided the MULTIOS option is set. Note that a pipe is an implicit redirection. file descriptor 2 would be associated with the terminal (assuming file descriptor 1 had been) and then file descriptor 1 would be associated with file fname. Thus sort <foo <fubar or even sort <f{oo. similar to tee.4 Last change: October 26. Thus: date >foo >bar writes the date to two files. The shell evaluates each redirection in terms of the (file descriptor. the shell opens the file descriptor as a pipe to a process that copies all the specified inputs to its output in the order specified.User Commands Property of BladeLogic. It then associates file descriptor 2 with the file associated with file descriptor 1 (that is.) echo exit 0 >> ∗ ∗. the word after a redirection operator is also subjected to filename generation (globbing). it would create an empty file called ‘∗ Similarly. If the order of redirections were reversed. 1>fname 2>&1 first associates file descriptor 1 with file fname.sh If the user tries to open a file descriptor for reading more than once. Thus :>∗ will truncate all files in the current directory. assuming there’s at least one. For example: . Strictly confidential and proprietary ZSHMISC ( 1 ) >& word >&! word &> word &>! word Redirects both standard output and standard error (file descriptor 2) in the manner of ‘> word’.. similar to cat. Note that a pipe is an implicit redirection. The order in which redirections are specified is significant. you can do ∗’. named ‘foo’ and ‘bar’. Inc. (Without the MULTIOS option. 2001 6 . then the file descriptor referred to is that specified by the digit instead of the default 0 or 1.

the shell searches for its definition using the elements of the fpath variable.) Functions execute in the same process as the caller and share all files and present working directory with the caller. zsh can behave in several ways. If execution fails because the file is not in executable format. This is the csh behavior and CSH_NULLCMD is set by default when emulating csh. Strictly confidential and proprietary ZSHMISC ( 1 ) cat bar  sort <foo is equivalent to ‘cat bar foo  sort’ (note the order of the inputs). If there exists a shell function by that name. but no command name. with paging if that is a terminal. the builtin is invoked. the shell attempts to locate it. the function is invoked as described in the section ‘Functions’. it is assumed to be a shell script. Thus < file shows the contents of file on standard output. When the function is first executed. If there exists a shell builtin by that name. if the parameter NULLCMD is set. then the value of the latter will be used instead of that of the former when the redirection is an input. The default for NULLCMD is ‘cat’ and for READNULLCMD is ‘more’. the shell prints an error message and returns a nonzero exit status. 2001 7 . If the search is unsuccessful. /bin/sh is spawned to execute it. the shell searches each element of $path for a directory containing an executable file by that name.User Commands Property of BladeLogic. the remainder of the first line specifies an interpreter for the program. This is the default when emulating sh or ksh. Inc. and write ‘foo’ into baz. If the parameter NULLCMD is not set or the option CSH_NULLCMD is set. If the program is a file beginning with ‘#!’. Thus to define functions for autoloading. its value will be used as a command with the given redirections. A trap on EXIT set inside a function is executed after the function completes in the environment of the caller. all files redirected to are actually opened. a typical sequence is: zsh 4. REDIRECTIONS WITH NO COMMAND When a simple command consists of one or more redirection operators and zero or more parameter assignments. Otherwise. Shell functions are read in and stored internally. each redirection replaces the previous redirection for that file descriptor. AUTOLOADING FUNCTIONS A function can be marked as undefined using the autoload builtin (or ‘functions –u’ or ‘typeset –fu’).4 Last change: October 26. an error is caused. However. Such a function has no body. The return builtin is used to return from function calls. and the file is not a directory. Alias names are resolved when the function is read. Functions are executed like commands with the arguments passed as positional parameters. Functions can be undefined with the unfunction builtin. the builtin ‘:’ is inserted as a command with the given redirections. Otherwise. If the option SH_NULLCMD is set. If both NULLCMD and READNULLCMD are set. (See the section ‘Command Execution’. COMMAND EXECUTION If a command name contains no slashes. so echo foo > bar > baz when MULTIOS is unset will truncate bar. The shell will execute the specified interpreter on operating systems that do not handle this executable format in the kernel. NULLCMD and READNULLCMD may refer to shell functions. If the MULTIOS option is unset.0. FUNCTIONS Shell functions are defined with the function reserved word or the special syntax ‘funcname ()’. Function identifiers can be listed with the functions builtin.

2001 8 . It may include other function definitions as well.0. element/function. and the other message on the second and subsequent calls. but may also perform initialization. the file should contain initialization code (which will be executed then discarded) in addition to a complete function definition (which will be retained for subsequent calls to the function). and may therefore define local parameters.zwc A file created with the zcompile builtin command. or the file contains only a simple definition of the function. which is expected to contain the definitions for all functions in the directory named element. the newest of which is used to load the definition for the function: element. Inc... the function itself is not re–executed. first. If the definition is not found. the function body (with no surrounding ‘funcname() {. the search for a definition proceeds with the other two possibilities described below. there does not need to be any directory named element without the suffix. which is expected to contain the definition for function.zwc extension (i.User Commands Property of BladeLogic.4 Last change: October 26. It is an error if the function is not defined by loading the file. the newer of either a compiled function or an ordinary function definition is used. Thus including an element such as ‘/usr/local/funcs. in fact. which is executed in the context of the function execution. This will normally define the function in question. Without KSH_AUTOLOAD set. element/function A file of zsh command text. This form allows the file to be used directly as an executable shell script. within a directory. } print func is initialized then ‘func. second. This is recommended for the use of functions supplied with the zsh distribution. Otherwise. with the disadvantage that functions included must be explicitly recompiled by hand before the shell notices any changes. If processing of the file results in the function being re–defined. element is searched for the definition of the function without comparing its age to that of other files.. The usual alias expansion during reading will be suppressed if the autoload builtin or its equivalent is given the option –U. the leftmost in the fpath is chosen. suppose the autoload file func contains func() { print This is func. To force the shell to perform initialization and then call the function defined.e. Note that for functions precompiled with the zcompile builtin command the flag –U must be provided when the . a file found in this way is searched only for the definition of function. The file is treated in the same manner as a directory containing files for functions and is searched for the definition of the function. and third. In summary. If element already includes a . the order of searching is.}’) is taken to be the complete contents of the file. zsh 4. For example. but only the message ‘This is func’ on the second and subsequent calls. as the corresponding information is compiled into the latter.zwc A file created with zcompile. at the end. taken to be the definition for function. the shell looks for three possible files. but those are neither loaded nor executed..zwc’ in fpath will speed up the search for functions.zwc file is created. if more than one of these contains a definition for the function that is sought. func’ with KSH_AUTOLOAD set will produce both messages on the first call. Strictly confidential and proprietary ZSHMISC ( 1 ) fpath=(˜/myfuncs $fpath) autoload myfunc1 myfunc2 . it will produce the initialization message on the first call. the file’s contents will be executed. For each element in fpath. the extension was explicitly given by the user). and a call to the shell function. If the KSH_AUTOLOAD option is set. in the parents of directories in fpath for the newer of either a compiled directory or a directory in fpath. including any arguments.

TRAPEXIT Executed when the shell exits. the shell and processes spawned by it will ignore SIGNAL. the function is not executed if the command occurred in a sublist followed by ‘&&’ or ‘’. or when the current function exits if defined inside a function. by using ‘autoload –X’ within a shell function. only the final command in a sublist of this type causes the trap to be executed. precmd Executed before each prompt. this function will be executed whenever the shell catches a signal SIGNAL. have special meaning to the shell: chpwd Executed whenever the current working directory is changed. 2001 9 . In fact. A true autoloaded function can be identified by the presence of the comment ‘# undefined’ in the body. TRAPDEBUG Executed after each command. However. The actual command that will be executed (including expanded aliases) is passed in two different forms: the second argument is a single–line. the following are equivalent: myfunc() { autoload –X } myfunc args. otherwise it is an empty string. the string that the user typed is passed as the first argument. TRAPZERR Executed whenever a command has a non–zero exit status. because all comments are discarded from defined functions. TRAPNAL If defined and non–null. if defined. but which loads its own definition by searching fpath.. The signal number will be passed as the first parameter to the function.0.4 Last change: October 26.. Strictly confidential and proprietary ZSHMISC ( 1 ) It is also possible to create a function that is not marked as autoloaded. To load the definition of an autoloaded function myfunc without executing myfunc. just before a prompt. If a function of this form is defined and null. Inc. If the history mechanism is active (and the line was not discarded from the history buffer). this function is executed every $PERIOD seconds. the third argument contains the full text what what is being executed. where NAL is a signal name as specified for the kill builtin. the functions command outputs ‘builtin autoload –X’ as the body of an autoloaded function. This is done so that eval " $(functions)" produces a reasonable result. size–limited version of the command (with things like function bodies elided).. For example.User Commands Property of BladeLogic. preexec Executed just after a command has been read and is about to be executed. use: autoload +X myfunc SPECIAL FUNCTIONS The following functions.. periodic If the parameter PERIOD is set. and unfunction myfunc # if myfunc was defined autoload myfunc myfunc args. zsh 4.

It keeps a table of current jobs. it waits until just before it prints a prompt before it informs you. zsh restores tty modes that were in effect when it was suspended.User Commands Property of BladeLogic. Inc. then that job is immediately disowned. printed by the jobs command. the shell prints a line which looks like: [1] 1234 indicating that the job which was started asynchronously was job number 1 and had one (top–level) process. The shell learns immediately whenever a process changes state. When a job is started asynchronously with ‘&’. %?string Any job whose command line contains string. 2001 10 .4 Last change: October 26. The shell will then normally indicate that the job has been ‘suspended’. If the NOTIFY option is not set. After startup. If a job is started with ‘&’ or ‘&!’. or run some other commands and then eventually bring the job back into the foreground with the foreground command fg. If you are running a job and wish to do something else you may hit the key ∧ (control–Z) which sends a Z TSTP signal to the current job: this key may be redefined by the susp option of the external stty command. whose process ID was 1234. If you set this tty option. A job being run in the background will suspend if it tries to read from the terminal. %% Current job.0. then background jobs will suspend when they try to produce output like they do when they try to read input. There are several ways to refer to jobs in the shell. It normally informs you whenever a job becomes blocked so that no further progress is possible. %string Any job whose command line begins with string. %– Previous job. %+ Equivalent to ‘%%’. as they are then run in the environment of the calling process. Strictly confidential and proprietary ZSHMISC ( 1 ) The functions beginning ‘TRAP’ may alternatively be defined with the trap builtin: this may be preferable for some uses. You can then manipulate the state of this job. and print another prompt. rather than in their own function environment. the forms TRAPNAL() { # code } and trap ’ # code are equivalent. When a command is suspended and continued later with the fg or wait builtins. A ∧ takes effect immediately and is like an interrupt in that pending output and unread input are Z discarded when it is typed. it does not have a place in the job table. JOBS If the MONITOR option is set. and is not subject to the job control features described here. an interactive shell associates a job with each pipeline. This (intentionally) does not apply if the command is continued via ‘kill –CONT’. A job can be referred to by the process ID of any process of the job or by one of the following: %number The job with the given number. but this can be disabled by giving the command ‘stty tostop’. nor when it is continued with bg. Background jobs are normally allowed to produce output. zsh 4. Apart from the difference in calling procedure and the fact that the function form appears in lists of functions. and assigns them small integer numbers. putting it in the background with the bg command.

For example. for example ‘[#16]’.. and then ‘8#40 16#20’. all the characters until a matching ‘))’ are treated as a quoted expression and arithmetic expansion performed as for an argument of let.))’ is equivalent to ‘let " . For integers. Integers may also be of the form ‘base#n’. each background job that completes triggers any trap set for CHLD. If the # is doubled. either using the builtin let. 2001 11 . signals have the values inherited by the shell from its parent (but see the TRAPNAL special functions in the section ‘Functions’). zsh 4. the shell will not warn you a second time. Floating point arithmetic is always double precision. as well as spaces. y = 32 )) print $x $y outputs first ‘8#40’. in which case base 10 is used. so that the value output is valid syntax for input.User Commands Property of BladeLogic. This is used when outputting arithmetical substitutions or when assigning to scalar parameters. the rightmost value in the given output base. you will be warned that ‘You have suspended (running) jobs’. or via a substitution of the form $((. each is evaluated separately. if the HUP option is set. the last encountered is used. The expression has no precedence and if it occurs more than once in a mathematical expression. for example ‘[##16]’. then no base prefix is output.. When an output base is specified using the ‘[#base]’ syntax.. the suspended jobs will be terminated. ‘16#ff’ is 255 in hexadecimal). When you try to leave the shell while jobs are running or suspended. ARITHMETIC EVALUATION The shell can perform integer and floating point arithmetic. while x (assuming it does not already exist) is implicitly typed by the arithmetic evaluation. an appropriate base prefix will be output if necessary. where base is a decimal number between two and thirty–six representing the arithmetic base and n is a number in that base (for example.. A leading ‘0x’ or ‘0X’ denotes hexadecimal.0. Otherwise. Since many of the arithmetic operators. either use the nohup command (see nohup(1)) or the disown builtin. where it acquires the output base 8. because y has been explicitly declared to have output base 16. but an explicitly defined integer or floating point parameter will not be affected. any base specified in this way will be set as the variable’s output arithmetic base as if the option ‘–i base’ to the typeset builtin had been used. by giving the command ‘print – $(( 12345678901 ))’. Strictly confidential and proprietary ZSHMISC ( 1 ) When the monitor mode is on. Inc. For clarity it is recommended that it appear at the beginning of an expression. The let builtin command takes arithmetic expressions as arguments.4 Last change: October 26. an alternative form is provided: for any command which begins with a ‘((’. For backwards compatibility the form ‘[base]n’ is also accepted.. the precision is at least 8 bytes. if the number appears unchanged. require quoting. and the running jobs will be sent a SIGHUP signal.. If an integer variable is implicitly defined by an arithmetic expression. If you do this or immediately try to exit again. the following statement (( val = 2 + 1 )) is equivalent to let " val = 2 + 1" both assigning the value 3 to the shell variable var and returning a zero status. the shell is usually compiled to use 8–byte precision where this is available. As an example: typeset –i 16 y print $(( [#8] x = 32. More precisely.)). The base# may also be omitted. You may use the jobs command to see what they are. for example. To avoid having the shell terminate the running jobs. This can be tested. It is also possible to specify a base to be used for output in the form ‘[#base]’. ‘((. Integers can be in bases other than 10. otherwise precision is 4 bytes." ’. SIGNALS The INT and QUIT signals for an invoked command are ignored if the command is followed by ‘&’ and the MONITOR option is not active.

‘>>’ and their equivalents with assignment) is given a ’. right & bitwise AND ∧ bitwise XOR bitwise OR  ∗∗ ∗∗ exponentiation ∗ / % multiplication. ASCII value of this character and an expression of the form ‘#foo’ gives the ASCII value of the first character of the value of the parameter foo. ‘’. where the function decides if the args is used as a string or a comma–separated list of arithmetic expressions. ‘${float}’ uses the defined format. Note the precedence of the bitwise AND.de}crement << >> bitwise shift left. ‘#\’ is accepted instead of ‘##’. Arithmetic evaluation is performed on the value of each assignment to a named parameter declared integer in this manner. and only one of the latter two expressions in a ternary operator is evaluated. Assigning a floating point number to an integer results in rounding down to the next integer. An expression of the form ‘##x’ where x is any character sequence such as ‘a’. OR. For example. 2001 12 .4 Last change: October 26. floating point numbers can be declared with the float builtin. Inc. ‘∧ or ‘\M–\C–x’ gives the A’. there are two types.e. Strictly confidential and proprietary ZSHMISC ( 1 ) Floating point constants are recognized by the presence of a decimal point or an exponent. {pre. division. but its use is deprecated. Named parameters and subscripted arrays can be referenced by name within an arithmetic expression without using the parameter expansion syntax. The following operators are supported (listed in decreasing order of precedence): + – ! ˜ ++ – – unary plus/minus. The decimal point may be the first character of the constant. Promotion of integer to floating point values is performed where necessary. ‘&&=’. modulus (remainder) +– addition. ‘<<’. An arithmetic expression uses nearly the same syntax. zsh 4. and ‘=’ are short–circuiting. differing only in their output format. comma operator The operators ‘&&’. precedence. Mathematical functions can be called with the syntax ‘func(args)’. but the exponent character e or E may not.0. ((val2 = val1 ∗ 2)) assigns twice the value of $val1 to the parameter named val2. floating point argument. In addition. and XOR operators. XOR  ∧ ?: ternary operator = += –= ∗ /= %= &= ∧ = <<= >>= &&= = ∧ = ∗ ∗= ∗= = ∧ ∗∗ assignment . if any operator which requires an integer (‘˜’. The output format can be bypassed by using arithmetic substitution instead of the parameter substitution. Likewise. subtraction < > <= >= comparison == != equality and inequality && logical AND ∧ logical OR. i. Note that this is different from the expression ‘$#foo’. as described for the typeset builtin. ‘∧ ‘%’. The shell currently defines no mathematical functions by default. complement. but the module zsh/mathfunc may be loaded with the zmodload builtin to provide standard floating point mathematical functions. An internal integer representation of a named parameter can be specified with the integer builtin. ‘’. and associativity of expressions in C. but ‘$((float))’ uses a generic floating point format.User Commands Property of BladeLogic. logical NOT. as it will be taken for a parameter name. a standard parameter substitution which gives the length of the parameter foo. ‘&’. it will be silently rounded down to the next integer.post}{in.

in which case it is a single letter option name. true if file exists and is executable by current process. zsh 4. true if file exists and is readable by current process.User Commands Property of BladeLogic. do # use $f done if f has not already been declared. true if file exists and is a block special file. then the current process has permission to search in the directory. true if file exists and is a character special file.) –p file –r file –s file –t fd –u file –x file –z string true if length of string is zero. true if file exists and is a FIFO special file (named pipe). This can have unforeseen consequences. option may be a single character. and consequently the operation ‘f += 0.0’. (note: fd is not optional) true if file exists and has its setuid bit set. Inc. It is therefore best to declare numeric variables with explicit types. true if file exists and is a symbolic link. it will be implicitly typed as integer or float and retain that type either until the type is explicitly changed or until the end of the scope. A simple fix would be to turn the initialization into ‘f = 0. (See the section ‘Specifying Options’. in the loop for (( f = 0. true if file exists and is a directory. –n string true if length of string is non–zero. 2001 13 . CONDITIONAL EXPRESSIONS A conditional expression is used with the [[ compound command to test attributes of files and to compare strings. If file exists and is a directory. –o option true if option named option is on. true if file exists. true if file descriptor number fd is open and associated with a terminal device. –O file true if file exists and is owned by the effective user ID of this process. so that the loop will fail.0. there is no memory of the numeric type in this case. f += 0. true if file exists and is a regular file. f < 1. –L file true if file exists and is a symbolic link. Strictly confidential and proprietary ZSHMISC ( 1 ) Scalar variables can hold integer or floating point values at different times. true if file exists and has its setgid bit set.1’ will always cause the result to be truncated to zero.1 )).4 Last change: October 26. the first assignment will cause it to be created as an integer. true if file exists and has size greater than zero. true if file exists and has its sticky bit set. For example. Each expression can be constructed from one or more of the following unary or binary expressions: –a file –b file –c file –d file –e file –f file –g file –h file –k file true if file exists. –G file true if file exists and its group matches the effective group ID of this process. –w file true if file exists and is writable by current process. If a variable is first assigned in a numeric context without previously being declared.

The ‘=’ form is for backward compatibility and should be considered obsolete. exp1 –lt exp2 true if exp1 is numerically less than exp2. string1 < string2 true if string1 comes before string2 based on ASCII value of their characters. string = pattern string == pattern true if string matches pattern. However. Normal shell expansion is performed on the file. file1 –ef file2 true if file1 and file2 exist and refer to the same file. but there is no special behaviour of ‘/’ nor initial dots. zsh 4. true if exp is false.User Commands Property of BladeLogic. but the result of each expansion is constrained to be a single word. even if the underlying system does not support the /dev/fd directory.0. pattern metacharacters are active for the pattern arguments. –N file true if file exists and its access time is not newer than its modification time. exp1 –le exp2 true if exp1 is numerically less than or equal to exp2. ( exp ) ! exp true if exp is true. exp1  exp2 true if either exp1 or exp2 is true. the patterns are the same as those used for filename generation. file1 –ot file2 true if file1 exists and is older than file2. exp1 –ne exp2 true if exp1 is numerically not equal to exp2. 2001 14 . and no glob qualifiers are allowed. similar to the effect of double quotes. then the test applied to the open file whose descriptor number is n. exp1 && exp2 true if exp1 and exp2 are both true. file1 –nt file2 true if file1 exists and is newer than file2. string != pattern true if string does not match pattern.4 Last change: October 26. In each of the above expressions. exp1 –eq exp2 true if exp1 is numerically equal to exp2. The ‘==’ form is the preferred one. where n is an integer. Strictly confidential and proprietary ZSHMISC ( 1 ) –S file true if file exists and is a socket. exp1 –gt exp2 true if exp1 is numerically greater than exp2. see zshexpn(1). string1 > string2 true if string1 comes after string2 based on ASCII value of their characters. string and pattern arguments. if file is of the form ‘/dev/fd/n’. Inc. exp1 –ge exp2 true if exp1 is numerically greater than or equal to exp2.

am/pm format. which should appear between the ‘%’ and the next character of the sequence. in 24–hour format. command substitution and arithmetic expansion. If it starts with $HOME. If an integer follows the ‘%’. For example.User Commands Property of BladeLogic. Strictly confidential and proprietary ZSHMISC ( 1 ) In the forms which do numeric comparison. if the value of the parameter report begins with ‘y’. A ‘)’. trailing components of the hostname are shown.4 Last change: October 26. with seconds. and if so. Current time of day. the message ‘File exists. zsh 4.’ is printed. As %d and %/. ∗ tests if either file foo or file bar exists.0. it specifies a number of trailing components of $PWD to show. The following escape sequences are recognized: %% %) %d %/ A ‘%’. An integer may follow the ‘%’ to specify how many components of the hostname are desired. zero means the whole path. the prompt string is first subjected to parameter expansion. A literal ‘!’ may then be represented as ‘!!’. a ‘!’ in the prompt is replaced by the current history event number. %–1d specifies the first component.)). Inc. See zshexpn(1). that part is replaced by a ‘˜’ followed by the name of the directory. certain escape sequences that start with ‘%’ are expanded.’. if the complete condition is true... If the PROMPT_PERCENT option is set. Certain escape sequences may be recognised in the prompt string. Present working directory ($PWD). The hostname up to the first ‘. If the PROMPT_SUBST option is set. Current time of day in 24–hour format. %B (%b) Start (stop) boldface mode. the expressions exp undergo arithmetic expansion as if they were enclosed in $((. This type of expansion is also available using the –P option to the print builtin. PROMPT EXPANSION Prompt sequences undergo a special form of expansion. the following: [[ ( –f foo  –f bar ) && $report = y∗ ]] && print File exists. The current value of $SHLVL. %t %@ %T %∗ ∗ %n Current time of day. If the PROMPT_BANG option is set. The full machine hostname. in 12–hour. %˜ %h %! %L %M %m %S (%s) Start (stop) standout mode. Current history event number. that part is replaced by a ‘˜’. %U (%u) Start (stop) underline mode. 2001 15 . Some escapes take an optional integer argument. but if $PWD has a named directory as its prefix.e. i. $USERNAME. A negative integer specifies leading components. With a negative integer.

i. This separator may not appear in the true–text. Equivalent to ‘%(!.%%)’. and %K/%L correspond to %k/%l for the hour of the day (24/12 hour clock) in the same way. with prefix replacement.0. %l %y %? %_ The line (tty) the user is logged in on without /dev/ prefix. Three additional codes are available: %f prints the day of the month. like %e but without any preceding space if the day is a single digit. %E %# %v %{. this is equivalent to the parameter $0. The date in yy–mm–dd format. See strftime(3) for more details. in the latter case it will also work non–interactively. 2001 16 .%} Include a string as a literal escape sequence. The value of the first element of the psvar array parameter. Clears to end of line. The left parenthesis may be preceded or followed by a positive integer n. zero means the full path. True if the current absolute path has at least n elements. true–text and false–text may both contain arbitrarily–nested escape sequences.4 Last change: October 26. or. the shell constructs (like ‘if’ and ‘for’) that have been started on the command line. If given an integer number that many strings will be printed.. If name starts with /dev/tty this is stripped. Strictly confidential and proprietary ZSHMISC ( 1 ) %N The name of the script. zsh 4.. which defaults to zero. including further ternary expressions. ∗ The return code of the last command executed just before the prompt. %i %w %W %D %D{string} string is formatted using the strftime function. Negative integers count from the end of the array. a ‘%’ if not.true–text. zero or negative or no integer means print as many as there are. True if the time in minutes is equal to n. A ‘#’ if the shell is running with privileges.User Commands Property of BladeLogic. is that either the effective user ID is zero. The status of the parser. An integer may follow the ‘%’ to specify a number of trailing path components to show. The string within the braces should not change the cursor position. sourced file. or shell function given by %N. ˜ / C t True if the current path. sourced file. The character following the x is arbitrary. the same character is used to separate the text for the ‘true’ result from that for the ‘false’ result.false–text) Specifies a ternary expression. The date in day–dd format. if POSIX. The test character x may be any of the following: c . A negative integer specifies leading components. or shell function that zsh is currently executing. whichever was started most recently. The line number currently being executed in the script. The line (tty) the user is logged in on without /dev/ prefix. Brace pairs can nest. for these purposes. The definition of ‘privileged’. This is most useful in prompts PS2 for continuation lines and PS4 for debugging with the XTRACE option. A ‘)’ may appear in the false–text as ‘%)’.1e capabilities are supported. The date in mm/dd/yy format. that at least one capability is raised in either the Effective or Inheritable capability vectors.e. except as part of a %–escape sequence. %(x. Inc. has at least n elements. This is most useful for debugging as part of $PS4.#. It does not treat /dev/tty∗ specially. Following the ‘%’ with an integer gives that element of the array. A negative integer will be multiplied by –1. If there is none.

In particular. ‘>’ or ‘]’). may be quoted by a preceding ‘\’. The forms with ‘<’ truncate at the left of the string. In this string.g. the terminating character (‘<’.<%˜%<<%# ’ will print a truncated representation of the current directory. tilde contraction is performed first. For example. Without the ‘%<<’. respectively..0. True if the month is equal to n (January = 0). or to the end of the next enclosing group of the ‘%(’ construct. truncations inside a ‘%(’ are separate). 2001 17 . True if the exit status of the last command was n.e. zsh 4. which ever comes first. True if the effective uid of the current process is n. the prompt ‘%8<. True if at least n characters have already been printed on the current line." ’. The string will be displayed in place of the truncated portion of any string. form is equivalent to ‘%xstringx’. %C Trailing component of $PWD. %<string< %>string> %[xstring] Specifies truncation behaviour for the remainder of the prompt string. True if the SHLVL parameter is at least n.<%/’ will expand to ‘.User Commands Property of BladeLogic. if the current directory is ‘/home/pike’.. True if the SECONDS parameter is at least n.. Inc. i. it will appear in full. a truncation with argument zero (e. The numeric argument. These are deprecated as %c and %C are equivalent to %1˜ and %1/. followed by a ‘%’ or ‘#’.4 Last change: October 26. and the forms with ‘>’ truncate at the right of the string. The third. For example. Unless ‘%C’ is used.e/pike’. The part of the prompt string to be truncated runs to the end of the string.e. which in the third form may appear immediately after the ‘[’. in addition to any backslashes removed by a double quoted string: the worst case is therefore ‘print –P " %<\\\\<<. x may be ‘<’ or ‘>’. specifies the maximum permitted length of the various strings that can be displayed in the prompt. ‘%<<’) marks the end of the range of the string to be truncated while turning off truncation from there on.. note when using print –P. note this does not undergo prompt expansion. completely replacing the truncated string. that this must be doubled as the string is also subject to standard print processing. however. Strictly confidential and proprietary ZSHMISC ( 1 ) T d D w ? # g l L S v _ ! True if the time in hours is equal to n. If the string is longer than the specified truncation length. the prompt ’%10<. True if the day of the month is equal to n.. or in fact any character. True if the shell is running with privileges. or to the next truncation encountered at the same grouping level (i. deprecated. True if the effective gid of the current process is n. True if the day of the week is equal to n (Sunday = 0). while explicit positive integers have the same effect as for the latter two sequences. True if the array psvar has at least n elements. An integer may follow the ‘%’ to get more than one component. those two characters would be included in the string to be truncated.. %c %. True if at least n shell constructs were started. followed by a space.

The one most recent command is always retained in any case. However. then ‘!:1’ and ‘!$’ function in the same manner as ‘!!:1’ and ‘!!$’. if neither of these designators is present. For example. no history expansion occurs. preceding the set of five expansions mentioned above. then ‘!:1’ and ‘!$’ refer to the first and last zsh 4. Double quotes will not work for this. Each saved command in the history list is called a history event and is assigned a number. then every history reference with no event specification always refers to the previous command. The history number that you may see in your prompt (see Prompt Expansion in zshmisc(1)) is the number that is to be assigned to the next command. so ‘!!:1’ always refers to the first word of the previous command. In that case filename expansion is performed immediately after alias expansion. This simplifies spelling corrections and the repetition of complicated commands or arguments.User Commands Property of BladeLogic. Process Substitution Parameter Expansion Command Substitution Arithmetic Expansion Brace Expansion These five are performed in one step in left–to–right fashion. By default. but before any other expansions take place and before the command is executed. which is ‘!’ by default. Conversely. the order of expansion is modified for compatibility with sh and ksh. history expansions do not nest. ‘!’ is the event designator for the previous command. After these expansions. Immediately before execution. if it is the only history reference in a command. if the option CSH_JUNKIE_HISTORY is set. and ‘!!$’ always refers to the last word of the previous command. Filename Generation This expansion. it refers to the previous command.4 Last change: October 26. Strictly confidential and proprietary ZSHEXPN ( 1 ) NAME zshexpn – zsh expansion and substitution DESCRIPTION The following types of expansions are performed in the indicated order in five steps: History Expansion This is performed only in interactive shells. Inc. It is this expanded form that is recorded as the history event for later references. Alias Expansion Aliases are expanded immediately before the command line is parsed as explained under Aliasing in zshmisc(1). commonly referred to as globbing. is always done last. Following this history character is an optional event designator (see the section ‘Event Designators’) and then an optional word designator (the section ‘Word Designators’). beginning with 1 (one) when the shell starts up. all unquoted occurrences of the characters ‘\’. 2001 1 . if CSH_JUNKIE_HISTORY is unset. respectively. With CSH_JUNKIE_HISTORY set. Overview A history expansion begins with the first character of the histchars parameter. ‘’’ and ‘" ’ are removed. and may occur anywhere on the command line.0. a history reference with no event designator refers to the same event as any preceding history reference on that command line. Input lines containing history expansions are echoed after being expanded. Filename Expansion If the SH_FILE_EXPANSION option is set. the size of which is controlled by the HISTSIZE parameter. The ‘!’ can be escaped with ‘\’ or can be enclosed between a pair of single quotes (’’) to suppress its special meaning. each command is saved in the history list. HISTORY EXPANSION History expansion allows you to use words from previous command lines in the command line you are typing. The following sections explain the types of expansion in detail.

zsh 4. Refer to command–line n. of the same event referenced by the nearest other history reference preceding them on the current command line. and any subsequent ‘!’ characters have no special significance. !! !n !–n !str !?str[?] Refer to the most recent command containing str. Insulate a history reference from adjacent characters (if necessary). ‘=’ or ‘(’. this forms a history reference with no event designator (see the section ‘Overview’). replacing the string foo with bar. ∗’. Like ‘x∗ but omitting word $. The ‘!" ’ is removed from the input. The character sequence ‘∧ bar’ (where ‘∧ is actually the second character of the histchars parameter) foo∧ ’ repeats the last command. The trailing ‘?’ is necessary if this reference is to be followed by a modifier or followed by any text that is not to be considered part of str. All the arguments. ! Start a history expansion. A ‘:’ usually separates the event specification from the word designator. Abbreviates ‘x–$’. Refer to the current command–line minus n. respectively. ∗’ Note that a ‘%’ word designator works only when used in one of ‘!%’. except when followed by a blank. newline. you can add a sequence of one or more of the following modifiers. The first argument.User Commands Property of BladeLogic. ‘!:%’ or ‘!?str?:%’. the sequence ‘∧ bar∧ is foo∧ ’ synonymous with ‘!!:s∧ bar∧ hence other modifiers (see the section ‘Modifiers’) may follow the final foo∧ ’.. The nth argument.. Refer to the most recent command starting with str. The last argument. The word matched by (the most recent) ?str search. Event Designators An event designator is a reference to a command–line entry in the history list. this expansion repeats the previous command. Inc. If followed immediately by a word designator (see the section ‘Word Designators’).} Refer to the current command line typed in so far. More precisely. 1. Strictly confidential and proprietary ZSHEXPN ( 1 ) words. ‘∗ ‘–’ or ‘%’. Refer to the previous command. 2001 2 . A range of words.4 Last change: October 26. 0 n ∧ $ % x–y ∗ x∗ ∗ x– The first input word (command). although the error may not be the most obvious one. the history mechanism is temporarily disabled until the current list (see zshmisc(1)) is fully parsed. A less convenient but more comprehensible form of command history support is provided by the fc builtin. Word Designators A word designator indicates which word or words of a given command line are to be included in a history reference. remember that the initial ‘!’ in each item may be changed to another character by setting the histchars parameter. or to the previous command if there is no preceding reference. ‘∧ ’. It may be omitted only if the word designator begins with a ‘∧ ‘$’. By itself. or a null value if there are none. except where noted. Anything else results in an error.0. Modifiers After the optional word designator. The line is treated as if it were complete up to and including the word before the one with the ‘!#’ reference. x defaults to 0. !# !{. These modifiers also work on the result of filename generation and parameter expansion. and only when used after a !? expansion (possibly in an earlier command). If the shell encounters the character sequence ‘!" ’ in the input. Word designators include: ’. In the list below. each preceded by a ‘:’. That is.

Any character can be used instead of the ‘:’. w Makes the immediately following modifier work on each word in the string. but repeats only n times if the expression expr evaluates to n. in the right–hand–side r. Remove all leading pathname components. If the system supports the /dev/fd mechanism. escaping further substitutions. F:expr: Like f. the closing delimiter should be ’)’. In parameter expansion the & must appear inside braces. or ‘}’. ‘[’. Any character can be used as the delimiter in place of ‘/’. The character ‘&’. Unless preceded immediately by a g. leaving the tail. but break into words at whitespace. A null l uses the previous string either from the previous l or from the contextual scan string s from ‘!?s’. For arrays and for filename generation. Strictly confidential and proprietary ZSHEXPN ( 1 ) h r e t p q Remove a trailing pathname component. and in filename generation it must be quoted with a backslash. Note the same record of the last l and r is maintained across all forms of expansion. but character strings. leaving the head. Does not work with parameter expansion. Like q. may be preceded immediately by a g. w and W modifiers work only with parameter expansion and filename generation.xxx’. If the form with > is selected then writing on this special file will provide input for list. A backslash quotes the delimiter character. If < is used. the shell runs process list asynchronously. if the system supports named pipes (FIFOs). Substitute r for l as described below. Remove one level of quotes from the substituted words. Q x l u s/l/r[/] & The s/l/r/ substitution works as follows.User Commands Property of BladeLogic. PROCESS SUBSTITUTION Each command argument of the form ‘<(list)’. Quote the substituted words. the command argument is the name of the device file corresponding to a file descriptor. Convert the words to all uppercase. 2001 3 . f Repeats the immediately (without a colon) following modifier until the resulting word doesn’t change any more. Inc. F. or ‘{’ is used as the opening delimiter. the rightmost ‘?’ in a context scan can similarly be omitted. Only works with history expansion.0. respectively. Convert the words to all lowercase. is replaced by the text from the left–hand–side l. the substitution is done only for the first string that matches l. then the file passed as an argument will be connected to the output of the list process.4 Last change: October 26. For example. this applies to each word of the expanded text. They are listed here to provide a single point of reference for all modifiers. ‘>(list)’ or ‘=(list)’ is subject to process substitution. In the case of the < or > forms. Works with history expansion and parameter expansion. Any character can be used instead of the ‘:’. if ‘(’. see above. You can omit the rightmost delimiter if a newline immediately follows r. Remove all but the extension. The following f. paste <(cut –f1 file1) <(cut –f3 file2)  tee >(process1) >(process2) >/dev/null zsh 4. opening parentheses are handled specially. with no colon between. This works like ‘basename’. Repeat the previous s substitution. though for parameters it is only useful if the resulting text is to be re–evaluated such as by eval. otherwise. Like s. The ‘&’ can be quoted with a backslash. the command argument will be a named pipe. The left–hand side of substitutions are not regular expressions. Remove a filename extension of the form ‘. leaving the root name. Print the new command but do not execute it. W:sep: Like w but words are considered to be the parts of the string that are separated by sep. ‘]’. This works like ‘dirname’.

In the expansions discussed below that require a pattern. some programmes may automatically close the file descriptor in question before examining the file on the command line. including arrays. Otherwise. In addition. the form of the pattern is the same as that used for filename generation. Both the /dev/fd and the named pipe implementation have drawbacks. Strictly confidential and proprietary ZSHEXPN ( 1 ) cuts fields 1 and 3 from the files file1 and file2 respectively. ${i:s/foo/bar/} performs string substitution on the expansion of parameter $i. in the second form. ‘#’ or ‘+’ appearing before ’. with KSH_ARRAYS. and arithmetic expansion. so that programmes that expect to lseek (see lseek(2)) on the file will not work. If name is an array parameter. of the parameter name is substituted. the shell actually supplies the information using a pipe. PARAMETER EXPANSION The character ‘$’ is used to introduce parameter expansions. The braces are required if the expansion is to be followed by a letter.4 Last change: October 26. if any. If = is used. or any of the characters ‘∧ ‘=’. if the programme does not actually open the file. In the former case. are a single subscript or any colon modifiers appearing after the name. this is the first element of an array. and the KSH_ARRAYS option is not set. different operating systems may have different behaviour) block for ever and have to be killed explicitly.User Commands Property of BladeLogic. ${name:–word} If name is set and is non–null then substitute its value. ${name:=word} ${name::=word} In the first form. Also note that the previous example can be more compactly and efficiently written (provided the MULTIOS option is set) as: paste <(cut –f1 file1) <(cut –f3 file2) \ > >(process1) > >(process2) The shell uses pipes instead of FIFOs to implement the latter two process substitutions in the above example. all of which work with or without braces. Inc. which only apply if the option KSH_ARRAYS is not set. otherwise ‘0’ is substituted. Note that these patterns. the value of the parameter is then substituted. digit. or underscore that is not to be interpreted as part of name. are themselves subject to parameter expansion. If name is missing. particularly if this is necessary for security reasons such as when the programme is running setuid. pastes the results together. otherwise substitute word. then the value of each element of name is substituted. In addition to the following operations. then the file passed as an argument will be the name of a temporary file containing the output of the list process. ‘˜’. In both forms. 2001 4 . the expansion results in one word only. ${name} The value. This may be used instead of the < form for a program that expects to lseek (see lseek(2)) on the input file. along with the replacement text of any substitutions. ${name:?word} zsh 4. more complicated forms of substitution usually require the braces to be present. and subscript notation to access individual array elements. the colon modifiers described in the section ‘Modifiers’ in the section ‘History Expansion’ can be applied: for example. the name. In the second case.0. In both cases. unconditionally set name to word. see the section ‘Filename Generation’. and sends it to the processes process1 and process2. associative arrays. the subshell attempting to read from or write to the pipe will (in a typical implementation. if name is unset or is null then set it to word. See zshparam(1) for a description of parameters. ${+name} If name is the name of a set parameter ‘1’ is substituted. command substitution. exceptions. one element per word. substitute word. No field splitting is done on the result unless the SH_WORD_SPLIT option is set.

If word is omitted. The repl may be an empty string. in the second form.e. just substitute the value of name. The pattern may begin with a ‘#’. Interactive shells instead return to the prompt. Note also that the ‘#’ and ‘%’ are not active if they occur inside a substituted parameter. In the following expressions. the ‘˜’ ensures that the text of $sub is treated as a pattern rather than a plain string. in which case the final ‘/’ may also be omitted. then substitute the value of name with the matched portion deleted. matching and replacement is performed on each array element separately. this is not necessary if the ‘/’ occurs inside a substituted parameter. foo=" twinkle twinkle little star" sub=" t∗ rep=" spy" ∗e" print ${foo//${˜sub}/$rep} print ${(S)foo//${˜sub}/$rep} Here. even at the start. Inc. the smallest matching pattern is preferred. The first form replaces just the first occurrence. In the first case. or ‘%’.. just substitute the value of name. the longest match for t∗ is substituted and the result is ‘spy star’. the largest matching pattern is preferred. so that expressions like ${name/$opat/$npat} will work. then substitute the empty string. otherwise. If the colon is omitted from one of the above expressions containing a colon. In the first form. then the shell only checks whether name is set. in which case the match will only succeed if it matches the entire word. 2001 5 . the largest matching pattern is preferred. in the second form. or if the ‘(@)’ flag or the name[@] syntax is used. ${name:+word} If name is set and is non–null then substitute word. or $opat is instead substituted as ${˜opat}. otherwise. when name is an array and the substitution is not quoted. E and N are not useful. If name is an array the matching array elements are removed (use the ‘(M)’ flag to remove the non–matched elements). Note also the effect of the I and S parameter expansion flags below. To quote the final ‘/’ in other cases it should be preceded by two backslashes (i. in which case it must match at the end of the string. the shortest matches are taken and the result is ‘spy spy lispy star’. not whether its value is null. a quoted backslash). the smallest matching pattern is preferred. otherwise. ${#spec} zsh 4. the second form all occurrences. but note the usual rule that pattern characters in $opat are not treated specially unless either the option GLOB_SUBST is set. B. while in the second ∗e case. print word and exit from the shell.4 Last change: October 26. the flags M. Strictly confidential and proprietary ZSHEXPN ( 1 ) If name is set and is non–null then substitute its value. then substitute the value of name with the matched portion deleted. For example. ${name%pattern} ${name%%pattern} If the pattern matches the end of the value of name. in which case the pattern must match at the start of the string.User Commands Property of BladeLogic. R. In the first form. ${name/pattern/repl} ${name//pattern/repl} Replace the longest possible match of pattern in the expansion of parameter name by string repl. The first ‘/’ may be preceded by a ‘:’. otherwise substitute nothing. just substitute the value of name. however. otherwise. Both pattern and repl are subject to double–quoted substitution.0. then a standard message is printed. ${name#pattern} ${name##pattern} If the pattern matches the beginning of the value of name. ${name:#pattern} If the pattern matches the value of name.

and ‘˜’. Note that double quotes may appear around nested expressions.. array elements are put into separate words. The form with $(.0.} in a parameter expansion may also be followed by a subscript expression as described in Array Parameters in zshparam(1). ‘${. ${∧ spec} Turn on the RC_EXPAND_PARAM option for the evaluation of spec..g. which still applies within each array element. E. Note that ‘∧ ‘=’. The name part may be a subscripted range for ordinary arrays. for example... This is done by default in most other shells.g. full prompt expansion is done on the resulting words. the string up to the matching closing parenthesis will be taken as a list of flags.. If a ${.4 Last change: October 26. ${∧ var} becomes {$var[1]. see the examples below. each such expansion is converted into the equivalent list for brace expansion. in which case only the part inside is treated as quoted. s or z flags. but regardless of whether the parameter appears in double quotes.. below. substitute the number of elements of the result. there are two sets of quotes. must appear to the left of ‘#’ when these forms are combined. such as in filename expansion and filename generation and pattern–matching contexts like the right hand side of the ‘=’ and ‘!=’ operators in conditions. using IFS as a delimiter.}. Strictly confidential and proprietary ZSHEXPN ( 1 ) If spec is one of the above substitutions. Create an array parameter with ‘${. ${(f)" $(foo)" } quotes the result of $(foo).. where the parameter xx is set to (a b c).}’. Inc. PROMPT_SUBST and PROMPT_BANG options. in " ${(@f)" $(foo)" }" .. turn it off.}’.... This affects the result of array assignments with the A flag.User Commands Property of BladeLogic. This forces parameter expansions to be split into separate words before substitution.} type parameter expression or a $(. Internally. Thus it is possible to perform nested operations: ${${foo#head}%tail} substitutes the value of $foo with both ‘head’ and ‘tail’ deleted. This is distinct from field splitting by the the f. Note that splitting is applied to word in the assignment forms of spec before the assignment to name is performed. ‘(q%q%q)’ means the same thing as the more readable ‘(%%qqq)’. E. If spec is an array expression. ${˜spec} Turn on the GLOB_SUBST option for the evaluation of spec. When this option is set.) type command substitution is used in place of name above... the repetitions need not be consecutive.... for example.. Parameter Expansion Flags If the opening brace is directly followed by an opening parenthesis. and is processed as described in the section ‘Brace Expansion’ below. turn it off. In cases where repeating a flag is meaningful. are substituted with ‘fooabar foobbar foocbar’ instead of the default ‘fooa b cbar’. If this flag is given twice..$var[2].=. ‘" ${(@)foo}" ’ is equivalent to ‘" ${foo[@]}" ’ and ‘" ${(@)foo[1. When this option is set. it is expanded first and the result is used as if it were the value of name.:=.. the word part must be converted to an @ A zsh 4.2]}" ’ is the same as ‘" $foo[1]" " $foo[2]" ’. Note further that quotes are themselves nested in this context. In double quotes. the string resulting from the expansion will be interpreted as a pattern anywhere that is possible. if the ‘∧ is doubled. create an associative array parameter. If this flag is repeated (as in ‘AA’)..}’ or ‘${. depending on the setting of the PROMPT_PERCENT. array expansions of the form foo${xx}bar. for example.. if the ‘˜’ is doubled. substitute the length in characters of the result instead of the result itself.. if the ‘=’ is doubled. Each name or nested ${..::=. Assignment is made before sorting or padding. one surrounding the whole expression. ’.. turn it ’ off. The following flags are supported: % Expand all % escapes in the resulting words in the same way as in in prompts (see the section ‘Prompt Expansion’). but the flag ‘(f)’ (see below) is applied using the rules for unquoted expansions. the other (redundant) surrounding the $(foo) as before.. ${=spec} Perform word splitting using the rules for SH_WORD_SPLIT during the evaluation of spec. If word splitting is also in effect the $var[N] may themselves be split into different list elements.) is often useful in combination with the flags described next. 2001 6 .

‘Words’ in this case refers to sequences of alphanumeric characters separated by non–alphanumerics. command substitution and arithmetic expansion on the result. Quote the resulting words with backslashes. the strings ${(P)foo}. This is a shorthand for ‘ps:\n:’. However. sort case–independently. Perform parameter expansion. With o or O. ${(P)${foo}}. If used with a nested parameter or command substitution. Used with subscripts (including ordinary arrays).4 Last change: October 26. The first keyword in the string describes the main type. Strictly confidential and proprietary ZSHEXPN ( 1 ) array.. ‘float’ or ‘association’. If this flag is given twice. Use a string describing the type of the parameter where the value of the parameter would usually appear. Capitalize the resulting words.. for example by using ‘${(AA)=name=. the words are quoted in single quotes preceded by a $. whose value will be used where appropriate. ‘array’. if you have ‘foo=bar’ and ‘bar=baz’. the words are quoted in double quotes.User Commands Property of BladeLogic. when creating an associative array.0. Inc. substitute the keys (element names) rather than the values of the elements. If name refers to an associative array. count the total number of characters in an array. this flag may not be combined with subscript ranges. as if the elements were concatenated with spaces between them. This is a shorthand for ‘pj:\n:’. Split the result of the expansion to lines. not to words that result from field splitting. Sort the resulting words in ascending order. Sort the resulting words in descending order. If it is given four times. This forces the value of the parameter name to be interpreted as a further parameter name. force indices or keys to be substituted even if the subscript form refers to values. Such expansions can be nested but too deep recursion may have unpredictable effects. the resulting words are quoted in single quotes and if it is given three times. For example. c C e f F i k With ${#name}. Convert all letters in the result to lower case. it can be one of ‘scalar’. Join the words of arrays together using newline as a separator.}’ to activate field splitting. 2001 7 . The other keywords describe the type in more detail: local left for local parameters for left justified parameters L o O P q Q t right_blanks for right justified parameters with leading blanks right_zeros for right justified parameters with leading zeros lower upper for parameters whose value is converted to all lower case when it is expanded for parameters whose value is converted to all upper case when it is expanded readonly for readonly parameters tag for tagged parameters export for exported parameters unique for arrays which keep only the first occurrence of duplicated values zsh 4. Remove one level of quotes from the resulting words. and ${(P)$(echo bar)} will be expanded to ‘baz’. ‘integer’. This string consists of keywords separated by hyphens (‘–’). the result of that will be taken as a parameter name in the same way.

. that the shortest instead of the longest match should be replaced../. s:string: Force field splitting (see the option SH_WORD_SPLIT) at the separator string. Used with k...e.. the starting position for the match moves zsh 4. i. a matched pair of delimiters must surround each argument. Any character. With the ${. force values to be substituted even if the subscript form refers to indices or keys. one has to use nested expansions as in ‘${${(z)foo}[2]}’. p j:string: Join the words of arrays together using string as a separator.%%. Without the flag they are silently ignored... The exprth match is counted such that there is either one or zero matches from each starting position in the string. to remove the quotes in the resulting words one would do: ‘${(Q)${(z)foo}}’.#.} forms.//.. Note that this occurs before field splitting by the SH_WORD_SPLIT option.} forms.} (all matches from the exprth on are substituted).)’.. The S and I flags may also be used with the ${.. l:expr::string1::string2: Pad the resulting words on the left.. substitute (as two consecutive words) both the key and the value of each associative array element.//. S Search substrings as well as beginnings or ends..%. Note that a string of two or more characters means all must all match in sequence. Each word will be truncated if required and placed in a field expr characters wide... but note that when a flag takes more than one argument. The default is to take the first match.. either with the S flag... taking into account any quoting in the value. With ${#name}. before padding.} (only the exprth match is substituted) or ${.. Make any special characters in the resulting words visible. i. The space to the left will be filled with string1 (concatenated as often as needed) or spaces if string1 is not given. may be used in place of a colon as delimiters. V w W X z I:expr: Search the exprth match (where expr evaluates to a number)... as for the ‘(s)’ flag.. Inc.User Commands Property of BladeLogic....} and ${. Note that this is done very late. but pad the words on the right and insert string2 on the right..} or ${. or ‘<. count words in arrays or strings. If both string1 and string2 are given.. Strictly confidential and proprietary ZSHEXPN ( 1 ) hide U v for parameters with the ‘hide’ flag special for special parameters defined by the shell Convert all letters in the result to upper case.%. Similar to w with the difference that empty words between repeated delimiters are also counted. 2001 8 .} or ${../. The following flags (except p) are followed by one or more arguments as shown. ‘{. with # start from the beginning and with % start from the end of the string.}. With this flag parsing errors occurring with the Q and e flags or the pattern matching forms such as ‘${name#pattern}’ are reported.... Split the result of the expansion into words using shell parsing to find the words. This only applies when searching for substrings....} forms..>’.]’. this string is inserted once directly to the left of each word. specifies non–greedy matching.}’..0..../.. Likewise. or with ${. Used with subscripts.. ‘[. r:expr::string1::string2: As l. Recognize the same escape sequences as the print builtin in string arguments to any of the flags described below.. the s flag may be used to set a word delimiter.4 Last change: October 26. although for global substitution matches overlapping previous replacements are ignored. So to access single words in the result... With substitution via ${. or the matching pairs ‘(. The following flags are meaningful with the ${.. this differs from the treatment of two or more characters in the IFS parameter.e.

At each level.4]}[2]} and also to " ${${(@)foo[2. 1. this assumes that braces are present around the substitution.} forms are present.0. whether the whole substitution is in double quotes. All the following steps take place where applicable at all levels of substitution. 2001 9 . Include the unmatched portion in the result (the Rest). Inc.e. the form using ‘##’ will match and remove ‘which switch is the right switch for Ipswich’. B E M N R Rules Include the index of the beginning of the match in the result. 4. As with 2. and what flags are supplied to the current level of substitution. unless the ‘(P)’ flag is present. the flags and any subscripts apply directly to the value of the nested substitution. Include the length of the match in the result.4]}[2]}" (the nested substitution returns a scalar because of the quotes). Note that the Zsh Development Group accepts no responsibility for any brain damage which may occur during the reading of the following rules. which treats the value so far as a parameter name and replaces it with the corresponding value. such as ${var[3]}. based on whether the value is an array or a scalar. Thus if var is an array.4 Last change: October 26.}. between each word (single word arrays are not modified). by default a space. the substitution takes account of whether the current value is a scalar or an array. the nested substitution will return either a scalar or an array as determined by the flags. 3. but ${var[2. for example. the expansion ${${foo}} behaves exactly the same as ${foo}. and the substitution appears in double quotes. ‘witch for Ipswich’ and ‘wich’. Strictly confidential and proprietary ZSHEXPN ( 1 ) backwards from the end as the index increases. ${.4]}[2]}" (the nested substitution returns an array in both cases). Nested Subscripting Any remaining subscripts (i.4][2]} is the entire third word (the second word of the range of words two through four of the original array). the effect of subscripting is applied directly to the parameter. The flags are not propagated up to enclosing substitutions. just as if the nested substitution were the outermost. 5. ${var[1][2]} is the second character of the first word. 2. ‘witch is the right switch for Ipswich’.User Commands Property of BladeLogic.4][2]} is thus equivalent to ${${foo[2. substitution is performed from the inside outwards. ‘witch’ and ‘wich’.. Nested Substitution If multiple nested ${. the words of the value are joined with the first character of the parameter $IFS. and no (@) flag is present at the current level. that is used for joining instead of $IFS. Some particular examples are given below. is applied... subsequent subscripts apply to the scalar or array value yielded by the previous subscript. Subscripts are evaluated left to right. i. of a nested substitution) are evaluated at this point. Note that ${foo[2. while with the other forms it moves forward from the start. Double–Quoted Joining If the value after this process is an array. Any number of subscripts may appear. Here is a summary of the rules for substitution.e. but in reverse order. The form using ‘%’ will remove the same matches as for ‘#’. Hence with the string which switch is the right switch for Ipswich? substitutions of the form ${(SI:N:)string#w∗ ∗ch} as N increases from 1 will match and remove ‘which’. zsh 4. Include the matched portion in the result.. Note that. Parameter Name Replacement The effect of any (P) flag.. and the form using ‘%%’ will remove the same matches as for ‘##’ in reverse order. but not to " ${${foo[2. If the (j) flag is present. ‘witch’. Include the index of the end of the match in the result. Parameter Subscripting If the value is a raw parameter reference with a subscript. multiple subscripts can appear. possibly adjusted for quoting.

fill. If a single word is not required. but then must be joined again before the P flag can be applied. The following illustrates the rules for nested parameter expansions.0. or (for = with neither of the two flags present) any of the characters in $IFS. which has no array (@) flag.. forcing it to be re–examined for new parameter substitutions. are applied to the words of the value at this level. Compare this with the effect of $(<file) alone. any words in the value are joined together using the given string or the first character of $IFS if none. ${(f)" $(<file)" } substitutes the contents of file divided so that each line is an element of the resulting array. produces a single word result " bar baz" . Then ${(s/x/)foo} produces the words ‘a’. but also for command and arithmetic substitutions. Shell Word Splitting If no ‘(s)’. In this case.[1]}" detects that this is an array and picks the first word. or the ‘=’ specifier was present (e. Re–Evaluation Any ‘(e)’ flag is applied to the value.. First. Semantic Joining In contexts where expansion semantics requires a single word to result. So in ‘${(P)${(f)lines}}’ the value of ${lines} is split at newlines. as specified by a trailing ‘#’... " ${${(@)foo}[1]}" This produces the result ‘bar’. ‘%’. too.. ${(j/x/s/x/)foo} produces ‘a’. Note this step.)’ flags is applied. ‘/’ (possibly doubled) or by a set of modifiers of the form :.4 Last change: October 26. Inc. Modifiers Any modifiers. ‘(f)’ or ‘(z)’ flags are present. the inner substitution " ${foo}" . which divides the file up by words. ${=var}). This is similar to the simple case " ${foo[1]}" . 10. or the same inside double quotes.. The outer substitution " ${(@). Examples The flag f is useful to split a double–quoted substitution line by line. 8.g. Forced Splitting If one of the ‘(s)’.. the word is split on occurrences of any of the characters in $IFS. As an example of the rules for word splitting and joining. ‘1’. Padding Any padding of the value by the ‘(l. and joining did not take place at step 4. (see the section ‘Modifiers’ in the section ‘History Expansion’). so that (despite the ‘(@)’ flag) the subscript picks the first character. Strictly confidential and proprietary ZSHEXPN ( 1 ) 6. Note that the ‘(F)’ flag implicitly supplies a string for joining in this manner. or 9.. ‘(f)’ or ‘=’ was given. the inner substitution " ${(@)foo}" produces the array ‘(bar baz)’. The outer substitution " ${.User Commands Property of BladeLogic. the word is split on occurrences of the specified string. or no ‘(j)’ flag is present but the string is to be split as given by rules 8.)’ or ‘(r. 9. which makes the entire content of the file a single string.fill. this rule is skipped. ‘1 b’ and ‘1’. For example. 7. all words are rejoined with the first character of IFS between. zsh 4. but the word is not quoted and the option SH_WORD_SPLIT is set. Suppose that $foo contains the array (bar baz): " ${(@)${foo}[1]}" This produces the result b. suppose $foo contains the array ‘(ax1 bx1)’. Forced Joining If the ‘(j)’ flag is present. 2001 10 .[1]}" detects that this is a scalar. ‘b’ and ‘1’. 11. 12. takes place at all levels of a nested substitution.

. respectively. The substitution ‘$(cat foo)’ may be replaced by the equivalent but faster ‘$(<foo)’. ‘˜–’ followed by a number is replaced by the directory that many positions from the bottom of the stack. The final empty string will then be elided.n2}’. is checked to see if it can be substituted in one of the ways described here. this is to be contrasted with ∗ ∗/(foobar).4 Last change: October 26. is replaced with its standard output. ‘ b’ and ‘’. The PUSHD_MINUS option exchanges the effects of ‘˜+’ and ‘˜–’ where they are followed by a number. A ‘˜’ followed by a ‘+’ or a ‘–’ is replaced by the value of $PWD or $OLDPWD. it is left unchanged. In either case. the output is broken into words using the IFS parameter. like ‘‘. or the end of the word if there is no ‘/’. then the word up to a ‘/’. ‘fooyybar’ and ‘foozzbar’. If it does. exp is subjected to parameter expansion. Named directories are typically home directories for users on the system.zz}bar’ is expanded to the individual words ‘fooxxbar’. This construct may be nested. which is joined to give " ax bx" . in the manner of a search set. the operation first generates the modified array (ax bx). zsh 4. and then split to give ‘a’. ‘–’ is treated specially as in a search set. where n1 and n2 are integers. 2001 11 . A ‘˜’ followed by anything not already covered is looked up as a named directory. See the section ‘Arithmetic Evaluation’. As substitution occurs before either joining or splitting.. if the option GLOB_SUBST is set. unless the BRACE_CCL option is set. like ‘$(. an expression such as ∗ ∗/{foo. then the ‘˜’ and the checked portion are replaced with the appropriate substitute value. An expression of the form ‘{n1. Strictly confidential and proprietary ZSHEXPN ( 1 ) ${(s/x/)foo%%1∗ ∗} produces ‘a’ and ‘ b’ (note the extra space). If either number begins with a zero. If the substitution is not enclosed in double quotes. If so. ‘˜+’ followed by a number is replaced by the directory at that position in the directory stack. FILENAME EXPANSION Each word is checked to see if it begins with an unquoted ‘˜’. ‘˜+0’ is equivalent to ‘˜+’. In particular. the output is eligible for filename generation. Inc.yy.‘’. with any trailing newlines deleted.0. If a brace expression matches none of the above forms. In that case. all the resulting numbers will be padded with leading zeroes to that minimum width. ‘˜–0’ is the bottom of the stack.. Commas may be quoted in order to include them literally in a word. Left–to–right order is preserved. note that this is liable to produce a ‘no match’ error if either of the two expressions does not match. A ‘˜’ by itself is replaced by the value of $HOME. It is also possible to define directory names using the –d option to the hash builtin. Note that brace expansion is not part of filename generation (globbing). BRACE EXPANSION A string of the form ‘foo{xx.User Commands Property of BladeLogic.. If the numbers are in decreasing order the resulting sequence will also be in decreasing order. as it is not in double quotes. command substitution and arithmetic expansion before it is evaluated. and replaced by the value of that named directory if found. A ‘˜’ followed by a number is replaced by the directory at that position in the directory stack.)’. or quoted with grave accents. but ‘∧ or ‘!’ as the first character is ’ treated normally.. and ‘˜+1’ is the top of the stack. ARITHMETIC EXPANSION A string of the form ‘$[exp]’ or ‘$((exp))’ is substituted with the value of the arithmetic expression exp. ‘˜0’ is equivalent to ‘˜+’. They may also be defined if the text after the ‘˜’ is the name of a string shell parameter whose value begins with a ‘/’.bar} is split into two separate words ∗ ∗/foo and ∗ ∗/bar before filename generation takes place. is expanded to every number between n1 and n2 inclusive. COMMAND SUBSTITUTION A command enclosed in parentheses preceded by a dollar sign. which is treated as a single pattern but otherwise has similar effects. and ‘˜1’ is the top of the stack. it is expanded to a sorted list of the individual characters between the braces.

These use the macros provided by the operating system to test for the given character combinations.. unless the GLOB_DOTS option is set. ‘[:xdigit:]’ hexadecimal digit. except when the directory is / itself. Quoting the first ‘=’ also inhibits this. the character ‘/’ must be matched explicitly. the word is replaced with the text of the alias. inclusive..’ or ‘. If an alias exists by that name. 2001 12 . then the prefix portion is replaced with a ‘˜’ followed by the name of the directory.. with ties broken in favour of using a named directory. a pattern for filename generation. including those appearing after commands of the typeset family. FILENAME GENERATION If a word contains an unquoted instance of one of the characters ‘∗ ‘(’..’ are not treated specially. Note that the square brackets are additional to those enclosing the whole set of characters. Named character sets can be used alongside other types. in which case the word is left unchanged. Inc. e. ‘[:cntrl:]’ control character. in which case the word is deleted. Either of the numbers may be omitted to make the range open–ended. the word is replaced by the full pathname of the command. the ‘∧ and ‘#’ characters also denote a pattern. it is regarded as ∗’. In filename generation. ‘[:punct:]’ printable character neither alphanumeric nor whitespace. ‘[:lower:]’ lowercase letter.. or ‘?’.0. If no matching pattern is found. To match individual digits. ‘[:space:]’ whitespace character.. the shell gives an error message. ‘[:upper:]’ uppercase letter. There are also several named classes of characters... [. the [. ‘[:graph:]’ printable character except whitespace. the EQUALS option is also respected. in the form ‘[:name:]’ with the following meanings: ‘[:alnum:]’ alphanumeric. No filename generation pattern matches the files ‘. If a command exists by that name. a ‘. so to test for a single alphanumeric character you need ‘[[:alnum:]]’. ‘[:digit:]’ decimal digit.. In this case. If the option MAGIC_EQUAL_SUBST is set.] [!.4 Last change: October 26.g. ‘[’. any unquoted shell argument in the form ‘identifier=expression’ becomes eligible for file expansion as described in the previous paragraph. ‘[[:alpha:]0–9]’. If so. for instance). If a word begins with an unquoted ‘=’ and the EQUALS option is set. including the null string. the ‘=’. except that it matches any character which is not in the given set. All such behaviour can be disabled by quoting the ‘˜’.’.’ must be matched explicitly at the beginning of a pattern or after a ‘/’. ’ The word is replaced with a list of sorted filenames that match the pattern. hence ‘<–>’ matches any number. also. or unless the NOMATCH option is unset. If the EXTENDED_GLOB option is set. the ‘/’ and ‘. Matches any of the enclosed characters. A ‘–’ or ‘]’ may be matched by including it as the first character in the list.] <[x]–[y]> Matches any number in the range x to y. Filename expansion is performed on the right hand side of a parameter assignment. the remainder of the word is taken as the name of a command or alias.]. when the shell prints a path. ‘’. the path is checked to see if it has a named directory as its prefix. so that a ‘˜’ or an ‘=’ following a ‘:’ is eligible for expansion. Glob Operators ∗ ? Matches any string. ‘[:blank:]’ space or tab. or the whole expression (but not simply the colon). unless the NULL_GLOB option is set. Ranges of characters can be specified by separating two characters by a ‘–’. the right hand side will be treated as a colon–separated list in the manner of the PATH parameter. Matches any character. ‘[:print:]’ printable character.User Commands Property of BladeLogic. Like [. The parameters $PWD and $OLDPWD are never abbreviated in this fashion.] [∧ .] form is more efficient. including any modifications due to local language settings: see ctype(3).. The shortest way of referring to the directory is used. ‘<’.. unless the GLOB option is unset. ‘[:alpha:]’ alphabetic. In other instances of pattern matching. Strictly confidential and proprietary ZSHEXPN ( 1 ) In certain circumstances (in prompts. otherwise they are not treated specially by the shell. zsh 4.

]’.4 Last change: October 26... The ∗’. ‘/’ and ‘. As mentioned above. ‘!(foo)#’ is invalid and must be replaced by ‘∗ ∗(!(foo))’)..) Match at least one occurrence.. ‘’ (lowest). Multiple patterns can be excluded by ‘foo˜bar˜baz’.) ∗ ∗(. (Like ‘(. ‘?’.. (Like ‘(.>’..e. with ‘#’ and ‘##’ applying to the shortest possible preceding unit (i.) ?(.) Matches zero or more occurrences of the pattern x. to avoid interpretation as a pipeline. This has a higher precedence than ‘/’. for example. option SH_GLOB prevents bare parentheses from being used in this way.. <0–9>∗ will ∗ actually match any number whatsoever at the start of the string.) Match any number of occurrences.))’. This operator has high precedence. and the ‘∗ will match any others. This character need not be unquoted to have special effects.’ and then exclude ‘foo/bar’ if there was such a match. a ‘/’ is not special.)##’.. ‘?’ or ‘!’ immediately preceding the ‘(’ is treated specially. rather than ‘(12)#’.) Matches one or more occurrences of the pattern x. It is an error for an unquoted ‘#’ to follow something which cannot be repeated. and ‘/’ is also not special after a ‘˜’ appearing outside parentheses in a filename pattern. (Requires EXTENDED_GLOB to be set. xy ∧ x Matches either x or y.) Precedence The precedence of the operators given above is (highest) ‘∧ ‘/’. so ‘∗ ∗˜foo/bar’ will search ∗/∗ for all files in all directories in ‘.User Commands Property of BladeLogic. a character. x˜y x# x## ksh–like Glob Operators If the KSH_GLOB option is set. ‘∗ ‘+’. (Requires EXTENDED_GLOB to be set.... the effects of parentheses can be modified by a preceding ‘@’.. but is in fact an inevit∗’ able consequence of the rule that the longest possible match always succeeds. while a ‘’ must do so.)#’. simply treated from left to right as part of a string. or parentheses when part of a KSH_GLOB pattern (for example.. This operator has high precedence. so ‘∧ foo/bar’ will search directories in ‘. ‘12#’ is equivalent to ‘1(2#)’...0.)’. ‘<.) +(.) !(. (Like ‘(..)’.. Note that grouping cannot extend over multiple directories: it is an error to have a ‘/’ within a group (this only applies for patterns used in filename generation). ‘12##’ is equivalent to ‘1(2##)’. This is a trap for the unwary. (Like ‘(∧ (..) Match the pattern in the parentheses.. There is one exception: a group of the form (pat/)# appearing as a complete path segment can match a sequence of directories. rather than ‘(12)##’. If the KSH_GLOB option is set.’ are not treated specially the way they usually are in globbing. In the exclusion pattern (y). For example. No more than two active ‘#’ characters may appear together.. though the KSH_GLOB option is still available. but the ‘(’ must be. Strictly confidential and proprietary ZSHEXPN ( 1 ) Be careful when using other wildcards adjacent to patterns of this form. ‘∗ ‘+’. Inc. @(. (Like ‘(. ‘?’ ∗’. foo/any/bar.) Matches the enclosed pattern. This operator has lower precedence than any other. in patterns used in other contexts than filename generation (for example. in case statements and tests within ‘[[. (Requires EXTENDED_GLOB to be set.. as detailed below.’ except ‘. and so on. foo/(a∗ ∗/)#bar matches foo/bar./foo’ for a file named ‘bar’.) Matches anything except the pattern x. ‘˜’.. foo/any/anyother/bar. since the ‘<0–9>’ will match the first digit. this includes an empty string.. a pattern already followed by ‘##’. ∗’ (. or ‘!’.. 2001 13 . This has lower precedence than any operator except ‘’. the remaining operators are ’.... zsh 4. ‘[.]]’). Expressions such as ‘<0–9>[∧ [:digit:]]∗ can be used instead. The ‘’ character must be within parentheses. or a parenthesised expression). This is used for grouping. then a ‘@’.. (Requires EXTENDED_GLOB to be set.) Match anything but the expression in parentheses. a ‘/’ used as a directory separator may not appear inside parentheses.) Match anything that matches the pattern x but does not match y.) Match zero or one occurrence.

only the data for the last match remains available. as otherwise the string matched is obvious. If some of the backreferences fail to match – – – which happens if they are in an alternate branch which fails to match.$mend[1]]} fi prints ‘string with a’.4 Last change: October 26. Sets of globbing flags are not considered parenthesised groups. $MBEGIN and $MEND will be set to the string matched and to the indices of the beginning and end of the string. Set references to the match data for the entire string matched. only the first nine active parentheses can be referenced. with the first element of each array corresponding to the first parenthesised group. or if they are followed by # and matched zero times – – – then the matched string is set to the empty string. The indices use the same convention as does parameter substitution. Inc. only the final ‘b’ is stored in match[1]. When a pattern with a set of active parentheses is matched. Activate backreferences for parenthesised groups in the pattern. This is most useful in parameter substitutions. the indices of the beginning of the matched parentheses in the array $mbegin. In the case of global replacements this may still be useful. foo=" a string with a message" if [[ $foo = (aan)’ ’(#b)(∗ ’∗ ]]. Strictly confidential and proprietary ZSHEXPN ( 1 ) Globbing Flags There are various flags which affect any text to their right up to the end of the enclosing group or to the end of the pattern.e. The flag must be in effect at the end of the pattern. but note that when performing matches on an entire array. B m Deactivate backreferences. Only the last match of the parenthesis is remembered: for example. For example. 2001 14 . the KSH_ARRAYS option is respected.User Commands Property of BladeLogic.0. i. so in some cases it may be necessary to initialise them beforehand. and so on. See the example for the m flag below. the strings matched by the groups are stored in the array $match. respectively. and the indices of the end in the array $mend. this does not work in filename generation. they require the EXTENDED_GLOB option. so that elements of $mend and $mbegin may be used in subscripts. upper case characters in the pattern still only match upper case characters. Backreferences work with all forms of pattern matching other than filename generation. such as ${array#pattern}. in ‘[[ abab = (#b)([ab])# ]]’. There are special rules for parentheses followed by ‘#’ or ‘##’. or a global substitution. These arrays are not otherwise special to the shell. The numbering of backreferences strictly follows the order of the opening parentheses from left to right in the pattern string. Case sensitive: locally negates the effect of i or l from that point on. use ‘X((abcd)#)Y’ to match a whole string of either ‘ab’ or ‘cd’ between ‘X’ and ‘Y’. negating the effect of the b flag from that point on. using the value of $match[1] rather than $match[2]. If the match fails none of the parameters is altered. and the start and end indices are set to –1. such as ${param//pat/repl}. Note that the first parenthesis is before the (#b) and does not create a backreference. then ∗)’ ∗ print ${foo[$mbegin[1]. this is similar to backreferencing and does not work in filename generation. All take the form (#X) where X may have one of the following forms: i l I b Case insensitive: upper or lower case characters in the pattern match upper or lower case characters. zsh 4. The parameters $MATCH. Lower case characters in the pattern match upper or lower case characters. not local to a group. Pattern matching with backreferences is slightly slower than without. Thus extra parentheses may be necessary to match the complete segment: for example. although sets of parentheses may be nested.

zsh 4.. so that (abcd)ef is two errors from aebf. (#i)FOO(#I)XX or ((#i)FOOX)X. Different characters. A character missing in the target string.. they correspond to ‘∧ and ‘$’ in standard reg’ ular expressions. the test string fooxx can be matched by the pattern (#i)FOOXX. you need to use ‘(" " ˜(#s))’ to match a zero–length portion of the string not at the start. as with stove and strove. including characters in character ranges: hence (#a1)??? matches strings of length four. 2001 15 . for example ‘${array/(#s)A∗ ∗Z(#e)}’ will remove only elements of an array which match the complete pattern ‘A∗ ∗Z’. however the combination of the substitution operations ‘/’ and ‘//’ with the ‘(#s)’ and ‘(#e)’ flags provides a single simple and memorable method. For example. ∗’ test/at/start. e Deactivate the m flag. so that a pattern of the form (#i)/foo/bar/. Four types of error are recognised: 1. hence no references to match data will be created. For example. which cannot exceed the number specified in the (#anum) flags. Approximate matching: num errors are allowed in the string matched by the pattern. Other characters which must match exactly are initial dots in filenames (unless the GLOB_DOTS option is set). Non–literal parts of the pattern must match exactly. 4. but not by (#l)FOOXX. They are useful for matching path segments in patterns other than those in filename generation (where path segments are in any case treated separately). errors are counted separately for non–contiguous strings in the pattern. at/end/test. The string (#ia2)readme specifies case–insensitive matching of readme with up to two errors. match anywhere except at the start of the string.. with the errors occurring by using the first rule twice and the second once.4 Last change: October 26. there is no speed penalty for using match references. the pattern (#a3)abcd matches dcba.User Commands Property of BladeLogic. as in banana and abnana. ‘∗ ∗((#s)/)test((#e)/)∗ matches a path segment ‘test’ in any of the following strings: test. other than the extra substitutions required for the replacement strings in cases such as the example shown. in/test/middle. When using the ksh syntax for grouping both KSH_GLOB and EXTENDED_GLOB must be set and the left parenthesis should be preceded by @. is potentially slow. arr=(veldt jynx grimps waqf zho buck) print ${arr//(#m)[aeiou]/${(U)MATCH}} forces all the matches (i.e. printing ‘vEldt jynx grImps wAqf zhO bUck’.0. the shell keeps a count of the errors found. as in fooxbar and fooybar.e. these have only a local effect. but not strings of length two. Transposition of characters. Unlike the other flags.. Thus. The ‘(#s)’ flag succeeds only at the start of the test string. grouping the string as [d][cb][a] and [a][bc][d]. Inc. note that when examining whole paths case–insensitively every directory must be searched for all files which match. There are other ways of performing many operations of this type. Strictly confidential and proprietary ZSHEXPN ( 1 ) For example. Similarly. Unlike backreferences. since all the ? must match. all vowels) into uppercase. so that a/bc is two errors from ab/c (the slash cannot be transposed with another character). although this actually means ‘anything except a zero–length portion at the start of the string’. M anum s. 2. The rules for this are described in the next subsection. in other words (#i)[a–z] still matches only lowercase letters. An extra character appearing in the target string. Another use is in parameter substitution. Note that assertions of the form ‘(∧ (#s))’ also work.] groups. 3. Finally. as with the pattern road and target string rod. and each must appear on its own: ‘(#s)’ and ‘(#e)’ are the only valid forms. and the ‘(#e)’ flag succeeds only at the end of the test string. Note also that the flags do not affect letters inside [. by applying rule 4 to an empty part of the pattern. and all slashes in filenames. i. Approximate Matching When matching approximately.

Strictly confidential and proprietary ZSHEXPN ( 1 ) When using exclusion via the ˜ operator. in that case. Thus. the alternative form ‘∗ ∗∗ does. For example. so that ‘(#a1)/foo/d/is/available/at/the/bar’ allows one error in any path segment. note that this therefore matches files in the current directory as well as subdirectories. This is much less efficient than without the (#a1). ‘∗ ∗/’ is equivalent to ‘(∗ ∗∗ ∗/)#’. and this can be delimited by grouping. since every directory in the path must be scanned for a possible approximate match. A glob subexpression that would normally be taken as glob qualifiers.ME but not READ_ME. This form does not follow symbolic links. but is otherwise ∗∗ ∗/’ identical. Neither of these can be combined with other forms of globbing within the same path segment. As a shorthand. Recursive Globbing A pathname component of the form ‘(foo/)#’ matches a path consisting of zero or more directories matching the pattern foo.User Commands Property of BladeLogic. Thus: ls (∗ ∗/)#bar or ls ∗ ∗/bar ∗∗ does a recursive directory search for files named ‘bar’ (potentially including the file ‘bar’ in the current directory). however. (#a1)cat((#a0)dog)fox allows one error in total. and the pattern (#a1)cat(#a0)dog(#a1)fox is equivalent. @ = p ∗ % %b %c r directories plain files symbolic links sockets named pipes (FIFOs) executable plain files (0100) device files (character or block special) block special files character special files owner–readable files (0400) zsh 4.4 Last change: October 26. Inc. ∗’ Glob Qualifiers Patterns used for filename generation may end in a list of qualifiers enclosed in parentheses. which may not occur in the dog section. as the trailing READ_ME is matched without approximation. where approximation is turned off. the maximum errors allowed may be altered locally. approximate matching is treated entirely separately for the excluded part and must be activated separately.0. (#a1)README˜READ_ME matches READ. 2001 16 . in this case producing ‘((∧ x))’. Note that the point at which an error is first found is the crucial one for establishing whether to use approximation. The qualifiers specify which filenames that otherwise match the given pattern will be inserted in the argument list. there is only one overall error count. (#a1)README˜(#a1)READ_ME does not match any pattern of the form READ?ME as all such forms are now excluded. however. However. A qualifier may be any one of the following: / . It is best to place the (#a1) after any path segments which are known to be correct. Apart from exclusions. (#a1)abc(#a0)xyz will not match abcdxyz. If the option BARE_GLOB_QUAL is set. the ‘∗ operators revert to their usual effect. Entire path segments may be matched approximately. for example. because the error occurs at the ‘x’. for example ‘(∧ can be forced to be treated as part of the glob pattern by doux)’. bling the parentheses. then a trailing set of parentheses containing no ‘’ or ‘(’ characters (or ‘˜’ if it is special) is taken as a set of glob qualifiers.

and execute permission. Each sub–spec may be either a octal number as described above or a list of any of the characters ‘u’. the behavior is the same as for ‘=’. If set to an array. and ‘t’. In addition. or a octal digit. ‘s’ for the setuid and setgid bits. and for which other users don’t have read or execute permission. those for the owner of the file are used. ‘s’. and ‘<’ match ‘]’. Inc. ‘+’. the latter is inserted into the command line word by word. This spec may be a octal number optionally preceded by a ‘=’. respectively. Giving a ‘?’ instead of a octal digit anywhere in the number ensures that the corresponding bits in the file–modes are not checked. followed by a ‘=’. the parameter may be altered to a string to be inserted into the list instead of the original filename. ‘g’. while any other character matches itself. The first list of characters specify which access rights are to be checked. which overrides the value of REPLY. ‘}’. and ‘>’ respectively. those of the group are checked. The octal number describes the mode bits to be expected. and ‘>’. ‘∗ ∗(f70?)’ gives the files for which the owner has read. ‘x’ for the right to execute the file (or to search a directory). followed by a list of any of the characters ‘r’. 2001 17 . and for which other group members have no rights. the parameter reply may be set to an array or a string. independent of the permissions for other users. and ‘t’ for the sticky bit. ‘{’. and ‘–’ again says how the modes are to be checked and have the same meaning as described for the first form above. and ‘a’.0. estring The string will be executed as shell code. write. if a ‘g’ is given. If the qualifier ‘f’ is followed by any other character anything up to the next matching character (‘[’. ‘w’ for write access. or a ‘–’. ‘{’. zsh 4. ‘o’. If none of these characters is given. a ‘+’. at least the bits in the given number must be set in the file–modes. and the ‘a’ says to test all three groups. this is only useful in combination with ‘=’. The second list of characters finally says which access rights are to be expected: ‘r’ for read access. The first character after the ‘e’ will be used as a separator and anything up to the next matching separator will be taken as the string. ‘}’. The ‘=’. or a ‘–’. If a ‘u’ is given. the value given must match the file–modes exactly.4 Last change: October 26. ‘[’. and ‘<’ match ‘]’. a ‘o’ means to test those of other users. During the execution of string the filename currently being tested is available in the parameter REPLY. and ‘∗ ∗(f:gu+w. if combined with a ‘=’. Thus. Strictly confidential and proprietary ZSHEXPN ( 1 ) w x A I E R W X s S t fspec owner–writable files (0200) owner–executable files (0100) group–readable files (0040) group–writable files (0020) group–executable files (0010) world–readable files (0004) world–writable files (0002) world–executable files (0001) setuid files (04000) setgid files (02000) files with the sticky bit (01000) files with access rights matching spec. Note that expansions must be quoted in the string to prevent them from being expanded before globbing is done.User Commands Property of BladeLogic. with a ‘+’.o–rx:)’ gives the files for which the owner and the other members of the group have at least write permission. the bits in the number must not be set. The filename will be included in the list if and only if the code returns a zero status (usually the status of the last command). a ‘+’. and with a ‘–’. The pattern ‘∗ ∗(f–100)’ gives all files for which the owner does not have execute permission. ‘w’. ‘x’. any other character matches itself) is taken as a list of comma–separated sub–specs.

‘w’. ‘m’ or ‘s’ (e.0. respectively.User Commands Property of BladeLogic.g. ‘{’.g. c[Mwhms][–+]n like the file access qualifier. if d. and ‘>’ respectively. Also note that the modifiers ∧and – are used. or exactly n bytes in length.g. ‘m’ (‘M’). megabytes. or equal to ct gid a[Mwhms][–+]n files accessed exactly n days ago. 2001 18 . like ‘o’. Note the quotation marks. except that it uses the file modification time. Files accessed more than n days ago are selected by a positive n value (+n). and c compare the age against the current time. following ∗(∧ any symbolic links. ‘echo ∗ ∗(ah–5)’ would echo files accessed within the last five hours. files in subdirectories appear before those in the current directory at each level of the search – – – this is best combined with other criteria. modification. weeks. ddev U G uid files on the device dev files owned by the effective user ID files owned by the effective group ID files owned by user ID id if it is a number. ‘∗ oc)’ is the same as ‘∗ ∗(∧ ∗(Oc)’ and ‘∗ Oc)’ is the same ∗(∧ as ‘∗ ∗(oc)’. For instance. analogous to the LIST_TYPES option. Strictly confidential and proprietary ZSHEXPN ( 1 ) For example. Oc zsh 4. ‘ah5’) cause the check to be performed with months (of 30 days). Note that a. if l they are sorted by the number of links. Files accessed within the last n days are selected using a negative value for n (–n). and ‘<’ match ‘]’. for example ‘odon’ to sort on names for files within the same directory. ‘Lk–50’) the check is performed with kilobytes. and the user ID of this user will be taken (e.2})’:)’ will cause the words ‘lonely1 lonely2’ to be inserted into the command line. If this flag is directly followed by a ‘k’ (‘K’). Optional unit specifiers ‘M’. if a. ‘u:foo:’ or ‘u[foo]’ for user ‘foo’) like uid but with group IDs or names l[–+]ct files having a link count less than ct (–). ‘h’. m. minutes or seconds instead of days. Inc. suppose a directory contains a single file ‘lonely’. ∧ – M T N D n oc negates all qualifiers following it toggles between making the qualifiers work on symbolic links (the default) and the files they point to sets the MARK_DIRS option for the current pattern appends a trailing qualifier mark to the filenames. or ‘p’ (‘P’) (e. If c is n they are sorted by name (the default). m. more than n bytes (+). i. ‘}’. Then the expression ‘∗ ∗(e:’reply=(${REPLY}{1. but sorts in descending order. or c they are sorted by the time of the last access. than the character after the ‘u’ will be used as a separator and the string between it and the next matching separator (‘[’. ‘Od’ puts files in the current directory before those in subdirectories at each level of the search. greater than ct (+). if it is L they are sorted depending on the size (length) of the files. any other character matches itself) will be taken as a user name. or blocks (of 512 bytes) instead. except that it uses the file inode change time. for the current pattern (overrides M) sets the NULL_GLOB option for the current pattern sets the GLOB_DOTS option for the current pattern sets the NUMERIC_GLOB_SORT option for the current pattern specifies how the names of the files should be sorted. hence the first name in the list is the youngest file. or inode change respectively.e. m[Mwhms][–+]n like the file access qualifier. hours. so ‘∗ –oL)’ gives a list of all files sorted by file size in descending order.4 Last change: October 26. L[+–]n files less than n bytes (–). if not.

Note that each modifier must be introduced by a separate ‘:’.[ch](∧ l1) ∗.0. E. since GLOB_DOTS is explicitly switched off) except for lex.g.h. parse. Strictly confidential and proprietary ZSHEXPN ( 1 ) [beg[. affect all matches generated. ignoring symlinks. the qualifiers in the sublists are ‘and’ed). The name of any existing file can be followed by a modifier of the form ‘(:. ‘n’.User Commands Property of BladeLogic.c. beg and the optional end may be mathematical expressions. As in parameter subscripting they may be negative to make them count from the last match backward. If a ‘:’ appears in a qualifier list.3])’ gives a list of the names of the three largest files. lex. 2001 19 . separated by commas.∗ D∧ lists all files having a link count of one whose names contain a dot (but not those starting with a dot..X) lists all files in the current directory that are world–writable or world–executable.h. and ls ∗ ∗(W. independent of the sublist in which they are given. Thus: ls ∗ ∗(–/) lists all directories and symbolic links that point to directories. These are the qualifiers ‘M’.. and ls ∗ ∗˜(lexparse). More than one of these lists can be combined. The syntax is the same as for array subscripts.)’ even if no actual filename generation is performed.c and parse. ‘O’ and the subscripts given in brackets (‘[. ‘N’. The whole list matches if at least one of the sublists matches (they are ‘or’ed.]’). and echo /tmp/foo∗ ∗(u0∧ @:t) outputs the basename of all root–owned files beginning with the string ‘foo’ in /tmp. and ls ∗ ∗(%W) lists all world–writable device files in the current directory.. however. Inc.end]] specifies which of the matched filenames should be included in the returned list. ‘T’. ‘o’. ‘D’.: ‘∗ ∗(–OL[1. zsh 4. Some qualifiers.4 Last change: October 26. Note also that the result after modification does not have to be an existing file. the remainder of the expression in parenthesis is interpreted as a modifier (see the section ‘Modifiers’ in the section ‘History Expansion’).

Note that this assigns to the entire array. value may be a scalar (a string). ARRAY PARAMETERS To assign an array value. name=(value .. The value of a scalar or integer parameter may also be assigned by writing: name=value If the integer attribute. ‘$’. deleting any elements that do not appear in the list. ‘<Z>’ indicates that the parameter does not exist when the shell initializes in sh or ksh emulation mode. or an associative array (an unordered set of name–value pairs.0. To declare the type of a parameter. use the typeset builtin..))’.. See the section ‘Array Parameters’ for additional forms of assignment. Special parameters cannot have their type changed. The ∗’..4 Last change: October 26. 2001 1 . except that no arithmetic expansion is applied to exp. A subscript of the form ‘[exp]’ selects the single element exp.. indexed by name). the braced form is the only one that works. Ordinary array parameters may also be explicitly declared with: typeset –a name Associative arrays must be declared before assignment.User Commands Property of BladeLogic.. or the single characters ‘∗ ‘@’. unless the KSH_ARRAYS option is set in which case they are numbered from zero. In the parameter lists that follow. To create an empty array (including associative arrays). and they stay special even if unset. it is replaced by a new array.) Every key must have a value in this case. To refer to the value of a parameter.. A name may be any sequence of alphanumeric characters and underscores.. is set for name.. an ordinary array parameter is created. If the KSH_ARRAYS option is set. thus ‘${foo[2]}’ is equivalent to ‘$foo[2]’. See Parameter Expansion in zshexpn(1) for complete details. by using: typeset –A name When name refers to an associative array. where exp is an arithmetic expression which will be subject to arithmetic expansion as if it were surrounded by ‘$((. or to assign a scalar or integer value to a parameter. the list in an assignment is interpreted as alternating keys and values: set –A name key value . However. Subscripts may be used inside braces used to delimit a parameter name. which affects the way that certain zsh 4. a value.) If no parameter name exists. use one of: set –A name name=() Array Subscripts Individual elements of an array may be selected using a subscript. the parsing rules for arithmetic expressions still apply. Inc. the value is subject to arithmetic evaluation. name=(key value . and a number of attributes. ‘?’. write ‘$name’ or ‘${name}’. the mark ‘<S>’ indicates that the parameter is special. ‘#’. The elements are numbered beginning with 1. –i. write one of: set –A name value . The same subscripting syntax is used for associative arrays.. If the parameter name exists and is a scalar. an integer. Strictly confidential and proprietary ZSHPARAM ( 1 ) NAME zshparam – zsh parameters DESCRIPTION A parameter has a name. as bracketed expressions otherwise are not treated as subscripts. or ‘!’. an array (indexed numerically). ‘–’.

Thus ‘$foo[–3]’ is the third element from the end of the array foo.. with elements separated by newlines. so assigning a parenthesized list of values to an element or range changes the number of elements in the array.–1]’ is the same as ‘$foo[∗ ∗]’. Array Element Assignment A subscript may be used on the left side of an assignment like so: name[exp]=value In this form of assignment the element or range specified by exp is replaced by the expression on the right side. The default word separator is whitespace.5]’ prints ‘ooba’. the string up to the matching closing one is considered to be a list of flags. See Subscript Parsing below for details. Inc. If the parameter subscripted is a scalar than this flag makes subscripting work on words instead of characters. shifting the other elements to accommodate the new values. if FOO is set to ‘foobar’. (Associative arrays are unordered. If the parameter subscripted is a scalar than this flag makes subscripting work on lines instead of characters. p f r Recognize the same escape sequences as the print builtin in the string argument of a subsequent ‘s’ flag." ’. or if it is a scalar and the ‘w’ flag is given. which may not exist even if there are values for other keys). ∗]" whereas ‘" $foo[@]" ’ evaluates to ‘" $foo[1]" " $foo[2]" .e. then ‘echo $FOO[2.(r)f∗ are possible. A subscript of the form ‘[∗ or ‘[@]’ evaluates to all elements of an array. so that pairs of subscripts such as ‘$foo[(r)??. (This is not supported for associative arrays... To delete an element of an ordinary array.. The flags currently understood are: w s:string: This gives the string that separates words (for use with the w flag). Note that quotes are necessary in this case to prevent the brackets from being interpreted as filename generation operators.3]’ and ‘$foo[(r)??. For associative arrays. but see Subscript Flags below). the exp is taken as a pattern and the result is the first matching array element.) This syntax also works as an argument to the typeset command: typeset " name[exp]" =value The value may not be a parenthesized list in this case. When an array parameter is referenced as ‘$name’ (with no subscript) it evaluates to ‘$name[∗ ∗]’. Strictly confidential and proprietary ZSHPARAM ( 1 ) special characters must be protected from interpretation. To delete an element of an associative array. in any subscript expression is directly followed by an opening parenthesis. An array (but not an associative array) may be created by assignment to a range or element.exp2]’ selects all elements in the range exp1 to exp2.0. i.) If one of the subscripts evaluates to a negative number. then the nth element from the end of the array is used. For example.’. A subscript of the form ‘[exp1. The subscript used is the number of the matching element. inclusive. only single–element assignments may be made with typeset. ‘" $foo[∗ ’ evaluates to ‘" $foo[1] $foo[2] . unless the KSH_ARRAYS option is set in which case it evaluates to ‘${name[0]}’ (for an associative array. and so do not support ranges. in which case the subscripts specify a substring to be extracted.User Commands Property of BladeLogic.4 Last change: October 26. Reverse subscripting: if this flag is given. The noglob precommand modifier could be used instead. as in ‘name[(flags)exp]’. only the value part of each pair is compared to the pattern. respectively). use the unset command: unset " name[exp]" Subscript Flags If the opening bracket. substring or word (if the parameter is an array. if it is a scalar. ‘[∗ or ‘[@]’ evaluate ∗]’ to all the values (not the keys. Subscripting may also be performed on non–array values. assign ‘()’ to that element. say –n. Arrays do not nest. 2001 2 . in no particular order. This is a shorthand for ‘pws:\n:’. this means the value of the key ‘0’. If ∗]’ the parameter is an associative array. and ‘$foo[1. or the comma in a range. zsh 4. there is no difference between ∗]’ the two except when they appear within double quotes.

However. On other types of parameters this has the same effect as ‘R’. unlike double quotes which normally cannot nest. word. for example. makes them give the nth or nth last match (if expr evaluates to n). Like ‘r’. This flag does not work on the left side of an assignment to an associative array element. ‘i’ or ‘I’. If used on another type of parameter. but it may also affect parameter substitutions that appear as part of an arithmetic expression in an ordinary subscript. However. On the left side of an assignment. behaves like ‘r’. Strictly confidential and proprietary ZSHPARAM ( 1 ) and the result is that value. this may not be combined with a second argument. but gives the index of the last match. On an associative array this is like ‘k’ but returns all values where exp is matched by the keys. R i Like ‘r’. This flag is ignored when the array is associative. note that ‘\[∧ \[]’ \[\]’ and even ‘\[∧ mean the same thing. or character (if expr evaluates to n). zsh 4. this flag can be used to force ∗ or @ to be interpreted as a single key rather than as a reference to all values. e This flag has no effect and for ordinary arrays is retained for backward compatibility only. The first difference is that brackets (‘[’ and ‘]’) must appear as balanced pairs in a subscript expression unless they are preceded by a backslash (‘\’). and therefore that the two characters ‘\" ’ remain as two characters in the subscript (in true double–quoting. subscript expressions may appear inside double–quoted strings or inside other subscript expressions (or both!). This flag may be used on the left side of an assignment. ‘\" ’ becomes ‘" ’). This makes it more difficult to write a subscript expression that contains an odd number of double–quote characters. but the reason for this difference is so that when a subscript expression appears inside true double–quotes.4 Last change: October 26. but gives the index of the match instead.0. For associative arrays. this behaves like ‘r’. within a subscript expression (and unlike true double–quoting) the sequence ‘\[’ becomes ‘[’. flags). and subscript flags are introduced by balanced parenthesis. Subscript Parsing This discussion applies mainly to associative array key strings and to patterns used for reverse subscripting (the ‘r’. because of the standard shell quoting rules. The basic rule to remember when writing a subscript expression is that all text between the opening ‘[’ and the closing ‘]’ is interpreted as if it were in double quotes (see zshmisc(1)). but gives the last match. ‘i’. the pattern ‘[∧ (to match any character other []’ than an open bracket) should be written ‘[∧ in a reverse–subscript pattern. or all possible matching keys in an associative array. However. any double–quotes that appear must occur in balanced pairs unless preceded by a backslash. If used in a subscript on an associative array. ‘i’ or ‘I’. the key part of each pair is compared to the pattern. etc. but not for assigning to associative arrays. Therefore. Like ‘i’. and similarly ‘\]’ becomes ‘]’. one can still write ‘\" ’ (rather than ‘\\\" ’) for ‘" ’. This flag is ignored when the array is associative. ‘R’. makes them begin at the nth or nth last element. I k K n:expr: If combined with ‘r’. See Parameter Expansion Flags (zshexpn(1)) for additional ways to manipulate the results of array subscripting. This is because parameter expansions may be surrounded balanced braces. The second difference is that a double–quote (‘" ’) may appear as part of a subscript expression without being preceded by a backslash. For associative arrays. this flag causes the keys to be interpreted as patterns. This applies even in cases where a backslash is not normally required. so the rules have two important differences. because backslashes are always stripped when they appear before []’ brackets! The same rule applies to parentheses (‘(’ and ‘)’) and braces (‘{’ and ‘}’): they must appear either in balanced pairs or preceded by a backslash. ‘R’. gives all possible matches. For associative arrays. and the first matching key found is the result. and backslashes that protect parentheses or braces are removed during parsing. ‘R’. Reverse subscripts may be used for assigning to ordinary array elements. b:expr: If combined with ‘r’. 2001 3 .User Commands Property of BladeLogic. Inc. and returns the value for the first key found where exp is matched by the key.

LOCAL PARAMETERS Shell function executions delimit scopes for shell parameters. use ‘${(q)name}’ (see zshexpn(1)) to quote the expanded value. it is not necessary to use additional backslashes within the inner subscript expression. the expansion must be surrounded by braces. brackets. etc. the subscript is a plain string in that case. parentheses. because the positional parameters form an array. Inc. positional parameters. they are removed only once. and its alternative forms declare. parameters behave as if GLOB_SUBST were on (and it cannot be turned off).) The typeset builtin. rather than as a pattern. backslashes are interpreted twice.)’ is allowed. etc. To match the value of a parameter literally in a reverse subscript.. once when parsing the array subscript and again when parsing the pattern. again use double quotes: typeset –A aa typeset " aa[one\" two\" three\" quotes]" =QQQ print " $aa[one\" two\" three\" quotes]" It is important to note that the quoting rules do not change when a parameter expansion with a subscript is nested inside another subscript expression.. This has two effects: first.. is the nth positional parameter.. or by direct assignment of the form ‘n=value’ where n is the number of the positional parameter to be changed. thus ‘$argv[n]’. For complex patterns. That is. To use a literal ‘∗ or ‘@’ as an associative array key. A further complication arises from a way in which subscript parsing is not different from double quote parsing. zsh 4. see the section ‘Invocation’. Parameters are also expanded from the innermost subscript first.5]’. where n is a number. (Parameters are dynamically scoped.5]’ is the entire second parameter concatenated with the filename generation pattern ‘[3. because then the backslashes. The parameter n. local and readonly (but not export). shell script. ‘${2[3. as each expansion is encountered left to right in the outer expression. the keys in the array itself are interpreted as patterns by those flags. This also creates (with empty values) any of the positions from 1 to n that do not already have values. it is often easiest to assign the desired pattern to a parameter and then refer to that parameter in the subscript. from the innermost subscript outwards. an array assignment of the form ‘n=(value . to refer to the value of that key.User Commands Property of BladeLogic.) One final note. the sequences ‘\∗ and ‘\@’ remain as two characters when they appear in ∗’. and has the effect of shifting all the values at positions greater than n by as many positions as necessary to accommodate the new values. Parameters appearing in the subscript expression are first expanded and then the complete expression is interpreted as a pattern. integer. the ‘e’ flag must be used: ∗’ typeset –A aa aa[(e)∗ ∗]=star print $aa[(e)∗ ∗] A last detail must be considered when reverse subscripting is performed. Note that the ‘k’ and ‘K’ flags are reverse subscripting for an ordinary array. to use subscript syntax to extract a substring from a positional parameter.0. it’s necessary to use four backslashes to cause a single backslash to match literally in the pattern.4 Last change: October 26. are seen only when the complete expression is converted to a pattern. not directly related to subscripting: the numeric names of positional parameters (described below) are parsed specially. POSITIONAL PARAMETERS The positional parameters provide access to the command–line arguments of a shell function. but ‘$2[3. Strictly confidential and proprietary ZSHPARAM ( 1 ) To use an odd number of double quotes as a key in an assignment. so for example ‘$2foo’ is equivalent to ‘${2}foo’. or the shell itself. In a reverse subscript.5]}’ evaluates to the third through fifth characters of the second positional parameter. The parameters ∗ @ and argv are arrays containing all the ∗. is equivalent to simply ‘$n’. but are not reverse subscripting for an associative array! (For an associative array. 2001 4 . second. Note that. a subscript expression. and also the section ‘Functions’. As in true double–quoting. by assigning to the argv array. use the typeset builtin and an enclosing pair of double quotes. Therefore. can be used to declare a parameter as being local to the innermost scope. for example. Positional parameters may be changed after the shell or function starts by using the set builtin.

EGID <S> The effective group ID of the shell process. although only the innermost positional parameter array is deleted (so ∗ and @ in other scopes are not affected). @ <S> Same as argv[@]. PARAMETERS SET BY THE SHELL The following parameters are automatically set by the shell: ! <S> # <S> The process ID of the last background command invoked. q. Note that some confusion may occur with the syntax $#param which substitutes the length of param. 2001 5 . argv <S> <Z> Same as ∗ Assigning to argv changes the local positional parameters. The number of positional parameters in decimal. ARGC <S> <Z> Same as #. unset can be used to delete a parameter while it is still in scope. The name used to invoke the current shell. In particular. assigning to a non–existent parameter. If you have sufficient privileges. Use ${#} to resolve ambiguities.v. $ <S> – <S> ∗ <S> The process ID of this shell. This may have unexpected effects: there is no default value.) However. Note that the restriction in older versions of zsh that local parameters were never exported has been removed. you may change the zsh 4. If the FUNCTION_ARGZERO option is set. Deleting argv with unset in any function deletes it everywhere. this is set temporarily within a shell function to the name of the function. An array containing the positional parameters. the sequence ‘$#–. Also. Local parameters disappear when their scope ends..’ in an arithmetic expression is interpreted as the length of the parameter –. status <S> <Z> Same as ?. (That is. Strictly confidential and proprietary ZSHPARAM ( 1 ) When a parameter is read or assigned to.4 Last change: October 26. it will be set to an empty value (or zero in the case of integers). but argv is not itself a local ∗. they retain their special attributes unless either the existing or the newly–created parameter has the –h (hide) attribute. Inc. pipestatus <S> <Z> An array containing the exit values returned by all commands in the last pipeline. and within a sourced script to the name of the script. _ <S> The last argument of the previous command. Flags supplied to the shell on invocation or by the set or setopt commands.User Commands Property of BladeLogic. so if there is no assignment at the point the variable is made local. CPUTYPE The machine type (microprocessor class or machine model).. The following: typeset PATH=/new/directory:$PATH is valid for temporarily allowing the shell or programmes called from it to find the programs in /new/directory inside a function.0. parameter. any outer parameter of the same name remains hidden. or declaring a new parameter with export. as determined at run time. Special parameters may also be made local. ? <S> 0 <S> The exit value returned by the last command. even when argv is not set. this parameter is set in the environment of every command executed to the full pathname of the command. the local parameter hides any less–local parameter. causes it to be created in the outermost scope. the innermost existing parameter of that name is used.

Inc. Also (assuming sufficient privileges). LINENO <S> The line number of the current line within the current script. PPID <S> The process ID of the parent of the shell. you may change the group ID of the shell process by assigning to this parameter. This parameter is exported by default but this can be disabled using the typeset builtin. Also (assuming sufficient privileges). The random number generator can be seeded by assigning a numeric value to RANDOM. you may start a single command under a different group ID by ‘(GID=gid. This is set when the shell initializes and whenever the directory changes. If you have sufficient privileges.4 Last change: October 26. command)’ ERRNO <S> The value of errno (see errno(3)) as set by the most recently failed system call. you may start a single command with a different effective user ID by ‘(EUID=uid. or shell function being executed. If you have sufficient privileges. as determined at compile time. sourced file. OPTARG <S> The value of the last option argument processed by the getopts command. then the value returned upon reference will be the value that was assigned plus the number of seconds since the assignment. newly generated each time this parameter is referenced. command)’ HOST The current hostname. SECONDS <S> The number of seconds since shell invocation. This value is system dependent and is intended for debugging purposes. GID <S> The real group ID of the shell process. you may change the effective user ID of the shell process by assigning to this parameter. OPTIND <S> The index of the last option argument processed by the getopts command. command)’ EUID <S> The effective user ID of the shell process. 2001 6 . PWD The present working directory. as determined at compile time. MACHTYPE The machine type (microprocessor class or machine model). Also (assuming sufficient privileges). not necessarily as displayed by the functions builtin. Strictly confidential and proprietary ZSHPARAM ( 1 ) effective group ID of the shell process by assigning to this parameter. Note that in the case of shell functions the line number refers to the function as it appeared in the original definition. zsh 4. whichever was started most recently. RANDOM <S> A random integer from 0 to 32767.User Commands Property of BladeLogic. This is set when the shell initializes and whenever the directory changes. OLDPWD The previous working directory. LOGNAME If the corresponding variable is not set in the environment of the shell.0. If this parameter is assigned a value. OSTYPE The operating system. it is initialized to the login name corresponding to the current login session. you may start a single command with a different effective group ID by ‘(EGID=gid.

its value is used as the argv[0] of external commands. Strictly confidential and proprietary ZSHPARAM ( 1 ) SHLVL <S> Incremented by one each time a new shell is started. These are similar to tied parameters created via ‘typeset –T’. it will be truncated zsh 4. while the array form is easier to manipulate within the shell. If you have sufficient privileges. ARGV0 If exported. signals An array containing the names of the signals. Inc. you may change the username (and also the user ID and group ID) of the shell by assigning to this parameter. In cases where there are two parameters with an upper– and lowercase form of the same name. Also (assuming sufficient privileges).User Commands Property of BladeLogic. PARAMETERS USED BY THE SHELL The following parameters are used by the shell.0. If the stack gets larger than this. If you have sufficient privileges. This may be profitably set to a lower value in some circumstances. in this case. DIRSTACKSIZE The maximum size of the directory stack. you may start a single command under a different username (and user ID and group ID) by ‘(USERNAME=username. this variable would be set by default to the speed of the fast link. and recreating one of the pair will recreate the other. they retain their special properties when recreated. such as path and PATH. you may change the user ID of the shell by assigning to this parameter. ZSH_NAME Expands to the basename of the command used to invoke this instance of zsh. command)’ USERNAME <S> The username corresponding to the real user ID of the shell process. Used by the line editor update mechanism to compensate for a slow terminal by delaying updates until necessary. COLUMNS <S> The number of columns for this terminal session. BAUD The baud rate of the current connection. the lowercase form is an array and the uppercase form is a scalar with the elements of the array joined together by colons. if any. ZSH_VERSION The version number of this zsh. Used for printing select lists and for the line editor. for slow modems dialing into a communications server which is connected to a host via a fast link. command)’ VENDOR The vendor. TTYIDLE <S> The idle time of the tty associated with the shell in seconds or –1 if there is no such tty. e. as determined at compile time. Also (assuming sufficient privileges).g. you may start a single command under a different user ID by ‘(UID=uid. The compensation mechanism can be turned off by setting the variable to zero. TTY The name of the tty associated with the shell. Note that unsetting either of the pair will unset the other. UID <S> The real user ID of the shell process. 2001 7 . Usually used in constructs like ‘ARGV0=emacs nethack’. The normal use for the colon–separated form is for exporting to the environment. This parameter should be set to the baud rate of the slowest part of the link for best performance. and not the modem.4 Last change: October 26. cdpath <S> <Z> (CDPATH <S>) An array (colon–separated list) of directories specifying the search path for the cd command.

fignore <S> <Z> (FIGNORE <S>) An array (colon separated list) containing the suffixes of files to be ignored during filename completion. the history is not saved. One or more IFS white space characters or one non–IFS white space character together with any adjacent IFS white space character delimit a field. However. for another key to be pressed when reading bound multi–character sequences. If you use the HIST_EXPIRE_DUPS_FIRST option. The second character signals the start of a quick history substitution (default ‘∧ The third character is the comment character (default ‘#’). ’). HISTCHARS <S> <Z> Same as histchars. Strictly confidential and proprietary ZSHPARAM ( 1 ) automatically. This path is searched when a function with the –u attribute is referenced. fpath <S> <Z> (FPATH <S>) An array (colon separated list) of directories specifying the search path for function definitions. this character is treated as if it were not an IFS white space character. KEYTIMEOUT The time the shell waits. that are used to separate words which result from command or parameter expansion and words read by the read builtin. LANG <S> This variable determines the locale category for any category not specifically selected via a variable starting with ‘LC_’. FCEDIT The default editor for the fc builtin. LC_ALL <S> This variable overrides the value of the ‘LANG’ variable and the value of any of the other variables starting with ‘LC_’.4 Last change: October 26. If an executable file is found. If an IFS white space character appears twice consecutively in the IFS. if the completion generates only files which would match if this variable would be ignored. HISTSIZE <S> The maximum number of events stored in the internal history list. Inc. then it is read and executed in the current environment. This is useful with the AUTO_PUSHD option. than these files are completed anyway. The first character signals the start of a history expansion (default ‘!’). LC_COLLATE <S> This variable determines the locale category for character collation information within ranges in glob brackets and for sorting.) HISTFILE The file to save the history in when an interactive shell exits. tab. setting this value larger than the SAVEHIST size will give you the difference as a cushion for saving duplicated history events. IFS <S> Internal field separators (by default space. HOME <S> The default argument for the cd command. If unset. in hundredths of seconds. tab and newline that appear in the IFS are called IFS white space. Any characters from the set space.0. LC_MESSAGES <S> zsh 4. 2001 8 . histchars <S> Three characters used by the shell’s history and lexical analysis mechanism. LC_CTYPE <S> This variable determines the locale category for character handling functions. (Deprecated.User Commands Property of BladeLogic. newline and NUL).

path <S> <Z> (PATH <S>) An array (colon–separated list) of directories to search for commands.User Commands Property of BladeLogic. however. the shell asks only if the top of the listing would scroll off the screen. (The ‘/usr/local/lib’ part varies from installation to installation. module_path <S> <Z> (MODULE_PATH <S>) An array (colon–separated list) of directories that zmodload searches for dynamically loadable modules. since setting it also sets MANPATH. Defaults to cat. the number of matches to list without asking first. LINES <S> The number of lines for this terminal session. manpath <S> <Z> (MANPATH <S> <Z>) An array (colon–separated list) whose value is not used by the shell. Note that zsh does not use message catalogs. For csh–like behavior. command substitution and arithmetic expansion with the variable $_ defined as the name of the file that has changed. The manpath array can be useful. These parameters only exist if the installation supports dynamic module loading. LISTMAX In the line editor. PROMPT <S> <Z> zsh 4. mailpath <S> <Z> (MAILPATH <S>) An array (colon–separated list) of filenames to check for new mail. Inc. the shell will print an error message if null commands are entered.) For security reasons. It usually contains termcap strings to reset the terminal. 2001 9 .0. Note that zsh ignores this setting when parsing floating point mathematical expressions. MAIL If this parameter is set and mailpath is not set. the list will be shown if it spans at most as many lines as given by the absolute value. and vice versa. MAILCHECK The interval in seconds between checks for new mail. If an element is a directory instead of a file the shell will recursively check every file in every subdirectory of the element. This is initialized to a standard pathname. NULLCMD <S> The command name to assume if a redirection is specified with no command. usually ‘/usr/local/lib/zsh/$ZSH_VERSION’. unset this parameter. Strictly confidential and proprietary ZSHPARAM ( 1 ) This variable determines the language in which messages should be written. each directory is scanned and all files found are put in a hash table. For sh/ksh behavior. The message will undergo parameter expansion. POSTEDIT <S> This string is output whenever the line editor exits. Used for printing select lists and for the line editor. Each filename can be followed by a ‘?’ and a message that will be printed. LOGCHECK The interval in seconds between checks for login/logout activity using the watch parameter. If set to zero. LC_NUMERIC <S> This variable affects the decimal point character and thousands separator character for the formatted input/output functions and string conversion functions. LC_TIME <S> This variable determines the locale category for date and time formatting in prompt escape sequences. the shell looks for mail in the specified file. The default message is ‘You have new mail’. change this to :. If the value is negative.4 Last change: October 26. When this parameter is set. any value set in the environment when the shell is started will be ignored.

4 Last change: October 26. but for array values rather than strings. The default is ‘?# ’. the default is ‘+ ’. printed when the shell needs more information to complete a command. SPROMPT <S> The prompt used for spelling correction. the shell runs the stty command with the value of this parameter as arguments in order to set up the terminal before executing the command. which displays the name of the current shell structure and the line number within it. and ‘%r’ expands to the proposed correction. Strictly confidential and proprietary ZSHPARAM ( 1 ) PROMPT2 <S> <Z> PROMPT3 <S> <Z> PROMPT4 <S> <Z> Same as PS1. REPORTTIME If nonnegative. Inc. SAVEHIST The maximum number of history events to save in the history file. Default is ‘+%N:%i> ’. Some modules also employ REPLY for similar purposes. In sh or ksh emulation. zsh 4. respectively. 2001 10 . the default is ‘%m%# ’. and vice versa. It is expanded in the same way as PS1. reply As REPLY. PS3 <S> Selection prompt used within a select loop. see the section ‘Prompt Expansion’.0. The default is ‘%_> ’. commands whose combined user and system execution times (measured in seconds) are greater than this value have timing statistics printed for them. This does not work if the SINGLELINEZLE option is set. printed before a command is read. PS3 and PS4. RPROMPT <S> RPS1 <S> This prompt is displayed on the right–hand side of the screen when the primary prompt is being displayed on the left.User Commands Property of BladeLogic. psvar <S> <Z> (PSVAR <S>) An array (colon–separated list) whose first nine values can be used in PROMPT strings. The read builtin and the select complex command may set REPLY. It is expanded in the same way as PS1. PS4 <S> The execution trace prompt. All other prompt escapes are also allowed. STTY If this parameter is set in a command’s environment. It is expanded in the same way as PS1. READNULLCMD <S> The command name to assume if a single input redirection is specified with no command. The sequence ‘%R’ expands to the string which presumably needs spelling correction. PS2. It undergoes a special form of expansion before being displayed. REPLY This parameter is reserved by convention to pass string values between shell scripts and shell builtins in situations where a function call or redirection are impossible or undesirable. Setting psvar also sets PSVAR. prompt <S> <Z> Same as PS1. PS2 <S> The secondary prompt. PS1 <S> The primary prompt string. Defaults to more. and filename generation both sets and examines its value when evaluating certain expressions. which displays any shell constructs or quotation marks which are currently being processed.

’. i. these will not be local to the command.ttt’ format (hours and minutes are only printed if they are not zero). as if it were not suspended. If only the IP address is available or the utmp field contains the name of an X–windows display. This cause the time to be printed in ‘hh:mm:ss. it will be executed and a new alarm is scheduled using the value of the TMOUT parameter after executing the trap.4 Last change: October 26. TMPPREFIX A pathname prefix which the shell will use for all temporary files. If it contains the single word ‘notme’. This (intentionally) does not apply if the command is continued via ‘kill –CONT’. It is necessary to make such an assignment upon any change to the terminal definition database or terminal type in order for the new settings to take effect. This is used when looking up termcap sequences. then all login/logout events are reported.. if a login/logout event matches all of them.g. zsh 4. CPU seconds spent in user mode. it is reported. WATCHFMT The format of login/logout reports if the watch parameter is set. TIMEFMT The format of process time reports with the time keyword. The full hostname of the remote host. the shell will receive an ALRM signal if a command is not entered within the specified number of seconds after issuing a prompt. Note that this should include an initial part for the file name as well as any directory names. and the idle time of the terminal is not less than the value of the TMOUT parameter. This avoids running stty at every external command by accidentally exporting it. An entry in this list may consist of a username. If it contains the single word ‘all’. A star may be inserted between the percent sign and flags printing time. ‘TERM=$TERM’). The line (tty) the user is logged in on.0. The observed action. TERM <S> The type of terminal in use. the whole name is printed. computed as (%U+%S)/%E. Strictly confidential and proprietary ZSHPARAM ( 1 ) The modes apply only to the command. If no trap is set. an ‘@’ followed by a remote hostname. "logged on" or "logged off". If the command is suspended and continued later with the fg or wait builtins it will see the modes specified by STTY. An assignment to TERM causes zsh to re–initialize the terminal. Also note that STTY should not be used for window size specifications. The default is ‘/tmp/zsh’. Any or all of these components may be present in an entry. and are reset when it finishes or is suspended.e. TMOUT If this parameter is nonzero. If there is a trap on SIGALRM. Recognizes the following escape sequences: %% %U %S %E %P %J A ‘%’. zsh terminates. Default is ‘%n has %a %l from %m’. even if the value does not change (e. The name of this job. CPU seconds spent in kernel mode. Recognizes the following escape sequences: %n %a %l %M %m The name of the user that logged in/out. and a ‘%’ followed by a line (tty). The default is ‘%E real %U user %S system %P %J’. The CPU percentage. The hostname up to the first ‘. or if it is in the environment of the shell but not explicitly assigned to in the input line. Inc. Elapsed time in seconds. STTY is ignored if the command is run in the background. 2001 11 . then all events are reported as with ‘all’ except $USERNAME. Otherwise a new alarm is scheduled to TMOUT seconds after the last keypress. watch <S> <Z> (WATCH <S>) An array (colon–separated list) of login/logout events to report.User Commands Property of BladeLogic.

%B (%b) Start (stop) boldface mode. Either or both of the branches may be empty. This may have a visible instead of an audible effect. if not $HOME.0.zshrc. Other characters evaluate to neither true nor false. that will be output to the terminal instead of beeping. %t %@ %T %w %W %D The time. zsh 4. Inc. ‘n’. ZDOTDIR The directory to search for shell startup files (. Strictly confidential and proprietary ZSHPARAM ( 1 ) NOTE: The ‘%m’ and ‘%M’ escapes will work only if there is a host name field in the utmp on your machine. %S (%s) Start (stop) standout mode. The test character x may be any one of ‘l’. in 24–hour format. which indicates a ‘true’ result if the watched user has logged in. the true–text is skipped and the false–text is formatted and printed. The time. The date in ‘day–dd’ format. you should use the string ‘\e[?5l\e[?5h’ instead). ZBEEP If set. etc). ‘m’ or ‘M’. the same character is used to separate the text for the "true" result from that for the "false" result. The character following the x is arbitrary. 2001 12 . This takes precedence over the NOBEEP option. in 12–hour. the entire expression is omitted in this case. but both separators must be present in any case. If the result is ‘true’. this gives a string of characters. which indicate a ‘true’ result if the corresponding escape sequence would return a non–empty value. or ‘false’ if he has logged out. The date in ‘mm/dd/yy’ format. and the false–text is skipped. WORDCHARS <S> A list of non–alphanumeric characters considered part of a word by the line editor. or it may be ‘a’.4 Last change: October 26. The date in ‘yy–mm–dd’ format. Ternary expressions may be nested. Both the separator and the right parenthesis may be escaped with a backslash. %U (%u) Start (stop) underline mode. Otherwise they are treated as ordinary strings.User Commands Property of BladeLogic. for example. %(x:true–text:false–text) Specifies a ternary expression. the string ‘\e[?5h\e[?5l’ on a vt100 or xterm will have the effect of flashing reverse video on and off (if you usually use reverse video. then the true–text is formatted according to the rules above and printed. If ‘false’. am/pm format. which can use all the same codes as the bindkey command as described in the zsh/zle module entry in zshmodules(1).

0. <Z> as appropriate. 2001 1 . AUTO_MENU <D> Automatically use menu completion after the second consecutive request for completion. ALWAYS_LAST_PROMPT <D> If unset. Thus. ‘allexport’ is equivalent to ‘A__lleXP_ort’. perform the cd command to that directory. DESCRIPTION OF OPTIONS In the following list. ‘setopt’ shows all options whose settings are changed from the default.User Commands Property of BladeLogic. for example the string ‘–f ’ will be treated just as ‘–f’. For example. This option is overridden by MENU_COMPLETE. There are two sets of single letter options: one used by default. the cursor is moved to the end of the word if either a single match is inserted or menu completion is performed. options set by default in all emulations are marked <D>. Some of the single letter option names refer to an option being off. those set by default only in csh. This is because many systems which implement the ‘#!’ mechanism for calling scripts do not strip trailing whitespace. but the string ‘–f i’ is an error. The single letter options can be used on the shell command line. so ‘nonobeep’ is not a synonym for ‘beep’. ALWAYS_TO_END If a completion is performed with the cursor within a word. The sense of the single letter options may be inverted by using ‘+’ instead of ‘–’. setopt and unsetopt builtins. Inc. in which case the inversion of that name refers to the option being on. zsh sessions will append their history list to the history file. zsh 4. the cursor is moved to the end of the word. ‘set –o’ or ‘set +o’).4 Last change: October 26. or zsh emulations are marked <C>. Similarly. ‘noexec’. and another used to emulate sh/ksh (used when the SH_OPTION_LETTERS option is set). These names are case insensitive and underscores are ignored. and a full completion is inserted. APPEND_HISTORY <D> If this is set. For example. rather than overwrite it. ‘tify’ is not a synonym for ‘nonotify’ (the inversion of ‘notify’). ALL_EXPORT (–a. and the command is the name of a directory. In strings of single letter options supplied to the shell at startup. for example by pressing the tab key repeatedly. The sense of an option name may be inverted by preceding it with ‘no’. <S>. If set these functions try to return to the last prompt if given no numeric argument. This inversion can only be done once. ksh. sh. or with the set. and ‘–n’ is the short name of its inversion. ksh: –a) All parameters subsequently defined are automatically exported. Some options also have one or more single letter names. Hence (unless KSH_OPTION_PRINT is set). Strictly confidential and proprietary ZSHOPTIONS ( 1 ) NAME zshoptions – zsh options SPECIFYING OPTIONS Options are primarily referred to by name. ‘unsetopt’. those turned on by default appear in the list prefixed with ‘no’. ALIASES <D> Expand aliases. key functions that list completions try to return to the last prompt if given a numeric argument. When listing options (by ‘setopt’. AUTO_CD (–J) If a command is issued that can’t be executed as a normal command. in the order they are killed. <K>. as normal Unix options preceded by ‘–’. That is. so ‘setopt No_Beep’ is equivalent to ‘unsetopt beep’. trailing whitespace will be ignored. AUTO_LIST (–9) <D> Automatically list choices on an ambiguous completion. multiple parallel zsh sessions will all have their history lists added to the history file. ‘+n’ is the short name of ‘exec’.

so that the character typed comes immediately after the parameter name. treating the character ‘!’ specially. Inc.) AUTO_PARAM_KEYS <D> If a parameter name was completed and a following character (normally a space) automatically inserted. (If this option is unset. AUTO_REMOVE_SLASH <D> When the last character resulting from a completion is a slash and the next character typed is a word delimiter. treat a trailing set of parentheses as a qualifier list. BSD_ECHO <S> Make the echo builtin compatible with the BSD echo(1) command. csh–style. ‘:’. BEEP (+B) <D> Beep on error in ZLE.’. This option is set by default. Completion in a brace expansion is affected similarly: the added character is a ‘. Strictly confidential and proprietary ZSHOPTIONS ( 1 ) AUTO_NAME_DIRS Any parameter that is set to the absolute name of a directory immediately becomes a name for that directory. that will be used by the ‘%˜’ and related prompt sequences. This takes precedence over AUTO_LIST. This disables backslashed escape sequences in echo strings unless the –e option is specified. then add a trailing slash instead of a space. BASH_AUTO_LIST On an ambiguous completion. since repeated completion calls immediately cycle through the list in that case. 2001 2 .). AUTO_PUSHD (–N) Make cd push the old directory onto the directory stack. BARE_GLOB_QUAL <Z> In a glob pattern. The setting of LIST_AMBIGUOUS is respected. BRACE_CCL Expand expressions in braces which would not otherwise undergo brace expansion to a lexically ordered list of all the characters. and will be available when completion is performed on a word starting with ‘˜’. which will be removed if ‘}’ is typed next.4 Last change: October 26. the automatically added character is deleted. the pattern will be left unchanged. Note that this will not work with MENU_COMPLETE.) BANG_HIST (+K) <C> <Z> Perform textual history expansion. or a character that ends a command (such as a semicolon or an ampersand). AUTO_RESUME (–W) Treat single word simple commands without redirection as candidates for resumption of an existing job. the parameter must be used in the form ‘˜param’ first.0. if it contains no ‘’. C_BASES zsh 4.User Commands Property of BladeLogic. a slash. If AUTO_MENU is set. AUTO_PARAM_SLASH <D> If a parameter is completed whose content is the name of a directory. etc. BAD_PATTERN (+2) <C> <Z> If a pattern for filename generation is badly formed. See the section ‘Brace Expansion’. automatically list choices when the completion function is called twice in succession. remove the slash. ‘(’ or (if special) ‘˜’ characters. print an error message. (Otherwise. the menu behaviour will then start with the third press. See the section ‘Filename Generation’. BG_NICE (–6) <C> <Z> Run all background jobs at a lower priority. and the next character typed is one of those that have to come directly after the name (like ‘}’.

. else such jobs will be killed automatically. i. instead resolve the path to the physical directory. COMPLETE_IN_WORD If unset. Otherwise it stays there and completion is done from both ends. Note that all other symbolic links in the path will also be resolved. Without this option set. and ‘>>’ to create files.. Without this option. This option is overridden by CHASE_LINKS. This option has no effect on the choice of the output base. since it is assumed the user is aware that there are background or suspended jobs.’ would be removed from the path. ksh: +C) <D> Allows ‘>’ redirection to truncate existing files. even if the preceding path segment is a symbolic link.. COMPLETE_ALIASES Prevents aliases on the command line from being internally substituted before completion is attempted. and ‘>>!’ or ‘>>’ to create a file. Otherwise ‘>!’ or ‘>’ must be used to truncate a file. done’. 2001 3 . the cursor is set to the end of the word if completion is started. CHASE_DOTS When changing to a directory containing a path segment ‘.User Commands Property of BladeLogic. for example ‘0xFF’ instead of the usual ‘16#FF’.’ path segment will be treated as referring to the physical parent. try to expand the expression as if it were preceded by a ‘˜’ (see the section ‘Filename Expansion’). a ‘. Inc. The same applies if the current directory is /foo/bar and ‘cd . defaulting to the previous command. NO_CHECK_JOBS is best used only in combination with NO_HUP. ‘foo/. CDABLE_VARS (–T) If the argument to a cd command (or an implied cd with the AUTO_CD option set) is not a directory. CSH_JUNKIE_HISTORY <C> A history reference without an event specifier will always refer to the previous command. or if ‘.’ which would otherwise be treated as canceling the previous segment in the path (in other words.’ is used. nor on the output of bases other than hexadecimal and octal. such a history reference refers to the same event as the previous history reference.e. A ‘jobs’ command run from the precmd function is not counted for this purpose. Strictly confidential and proprietary ZSHOPTIONS ( 1 ) Output hexadecimal numbers in the standard C format. The check is omitted if the commands run from the previous command line included a ‘jobs’ command. This also has the effect of CHASE_DOTS. Note that these formats will be understood on input irrespective of the setting of C_BASES. CSH_JUNKIE_LOOPS <C> Allow loop bodies to take the form ‘list. CORRECT (–0) Try to correct the spelling of commands. octal numbers will be treated similarly and hence appear as ‘077’ instead of ‘8#77’. CHASE_LINKS (–w) Resolve symbolic links to their true values when changing directory. If the option OCTAL_ZEROES is also set (it is not by default).4 Last change: October 26. CLOBBER (+C.’ changes to /foo..0. a second attempt to exit the shell will succeed. CORRECT_ALL (–O) Try to correct the spelling of all arguments in a line. ‘cd /foo/bar/. The effect is to make the alias a distinct command for completion purposes. the last part of $PWD would be deleted)..’ is the first part of the path. it changes to /alt. For example. suppose /foo/bar is a link to the directory /alt/rod. and does not begin with a slash. CHECK_JOBS <Z> Report the status of background and suspended jobs before exiting a shell with job control. end’ instead of ‘do list. CSH_JUNKIE_QUOTES <C> zsh 4.. with it set.

The format of this prefixed data is: ‘:< beginning time> :< elapsed seconds> :< command> ’. Without this option. If the option is unset. unless they were already or the flag +g is given explicitly. 2001 4 . DVORAK Use the Dvorak keyboard instead of the standard qwerty keyboard as a basis for examining spelling mistakes for the CORRECT and CORRECT_ALL options and the spell–word editor command. GLOB (+F. CSH_NULLCMD <C> Do not use the values of NULLCMD and READNULLCMD when running redirections with no command. execute the ZERR trap. This option cannot be turned off in an interactive shell. and cannot be nested.) EXTENDED_HISTORY <C> Save each command’s beginning timestamp (in seconds since the epoch) and the duration (in seconds) to the history file.User Commands Property of BladeLogic.4 Last change: October 26. integer. FLOW_CONTROL <D> If this option is unset.0. but not executed. ksh: +f) <D> Perform filename generation (globbing). EXTENDED_GLOB Treat the ‘#’. (See the section ‘Filename Expansion’. zsh 4.) ERR_EXIT (–e. commands are read and checked for syntax errors. delete the pattern from the argument list. set $0 temporarily to the name of the function/script. Inc. Note that the builtin export always sets both the –x and –g flags. ksh: +n) <D> Do execute commands. passing the –x flag to the builtins declare. exported parameters will be made local in just the same way as any other parameter. hence parameters exported to the environment will not be made local to the enclosing function. and exit. it is made impossible to escape ‘$’. Strictly confidential and proprietary ZSHOPTIONS ( 1 ) Changes the rules for single– and double–quoted text to match that of csh. readonly and typeset (but not local) will also set the –g flag. (See the section ‘Filename Generation’. In double–quoted strings. CSH_NULL_GLOB <C> If a pattern for filename generation has no matches. ‘˜’ and ‘∧ characters as part of patterns for filename generation. Overrides NOMATCH. EQUALS <Z> Perform = filename expansion. unescaped newlines will cause an error message. except when ‘–n’ is supplied to the shell at startup.) GLOBAL_EXPORT (<Z>) If this option is set. (An initial ’ unquoted ‘˜’ always produces named directory expansion. etc. it is not recommended that its behaviour be relied upon. ksh: –e) If a command has a non–zero exit status. This option is set by default for backward compatibility. and hence its effect extends beyond the scope of the enclosing function. This make such redirections fail (see the section ‘Redirection’). float. do not report an error unless all the patterns in a command have no matches. EXEC (+n. This is disabled while running initialization scripts. ‘‘’ or ‘" ’ (and ‘\’ itself no longer needs escaping). if set. output flow control via start/stop characters (usually assigned to ∧ Q) is S/∧ disabled in the shell’s editor. These require that embedded newlines be preceded by a backslash. this is the most portable way to achieve this behaviour. Command substitutions are only expanded once. FUNCTION_ARGZERO <C> <Z> When executing a shell function or sourcing a script.

do not display duplicates of a line previously found. hash the directory containing it. such as options. You should be sure to set the value of HISTSIZE to a larger number than SAVEHIST in order to give you some room for the duplicated events. so it works not only for files but for any completion. the startup files /etc/zprofile. HIST_ALLOW_CLOBBER Add ‘’ to output redirections in the history. make sure the entire command path is hashed first. GLOB_DOTS (–4) Do not require a leading ‘. etc. when CORRECT is set. including inside local startup files (. GLOB_COMPLETE When the current word has a glob pattern. If this option is unset. /etc/zshrc. This allows history references to clobber files even when CLOBBER is unset.’ in a filename to be matched explicitly. it is not possible to predict whether the result will be an array or a scalar. as well as all directories that occur earlier in the path. etc. Strictly confidential and proprietary ZSHOPTIONS ( 1 ) GLOBAL_RCS (–d) <D> If this option is unset. This makes the first completion slower. It can be disabled and re–enabled at any time. setting this option will cause the oldest history event that has a duplicate to be lost before losing a unique event from the list. ‘foo=∗ If the result has more than one ∗’). HIST_BEEP <D> Beep when an attempt is made to access a history entry which isn’t there. Subsequent invocations of the same command will use the saved location. Has no effect if neither HASH_CMDS nor CORRECT is set. user names.g. HIST_EXPIRE_DUPS_FIRST If the internal history needs to be trimmed to add the current command line. ‘foo=(∗ and this form is recommended for clarity. and any characters resulting from command substitution as being eligible for filename generation.g. HASH_DIRS <D> Whenever a command name is hashed. 2001 5 . do not insert all the words resulting from the expansion but generate matches as for completion and cycle through them like MENU_COMPLETE. GLOB_SUBST <C> <K> <S> Treat any characters resulting from parameter expansion as being eligible for file expansion and filename generation. not globbing. filename generation (globbing) is performed on the right hand side of scalar parameter assignments of the form ‘name=pattern (e. or inserted at the cursor when ∗’ COMPLETE_IN_WORD is set.4 Last change: October 26. zsh 4.User Commands Property of BladeLogic. no path hashing is done at all. ∗)’) with this option set. Inc. This actually uses pattern matching. HASH_LIST_ALL <D> Whenever a command completion is attempted.zshrc.0. Braces (and commas in between) do not become eligible for expansion. HIST_FIND_NO_DUPS When searching for history entries in the line editor. HASH_CMDS <D> Note the location of each command the first time it is executed. commands whose names do not appear in the functions or aliases hash tables are hashed in order to avoid reporting them as spelling errors. The matches are generated as if a ‘∗ was added to the end of the word. This option is provided for backwards compatibility only: globbing is always performed on the right hand side of array assignments of the form ‘name=(value)’ (e. However. avoiding a path search. GLOB_ASSIGN <C> If this option is set. word the parameter will become an array with those words as arguments. even if the duplicates are not contiguous. /etc/zlogin and /etc/zlogout will not be run.). otherwise this option will behave just like HIST_IGNORE_ALL_DUPS once the history fills up with unique events.

) This heuristic may be overridden by specifying a state for this option on the command line. the older command is removed from the list (even if it is not the previous event). IGNORE_EOF (–7) Do not exit on end–of–file. However. allowing you to briefly reuse or edit the definition. don’t execute the line directly. Also. INC_APPEND_HISTORY This options works like APPEND_HISTORY except that new history lines are added to the $HISTFILE incrementally (as soon as they are entered). The file is periodically trimmed to the number of lines specified by $SAVEHIST. (See the discussion of SHIN_STDIN. allowing you to briefly reuse or edit the line. If you want to make it vanish right away without entering another command. allowing you to briefly reuse or edit the line. HIST_NO_FUNCTIONS Remove function definitions from the history list. widgets implemented by shell functions can be bound to EOF (normally Control–D) without printing the normal warning message. HIST_VERIFY Whenever the user enters a line with history expansion. IGNORE_BRACES (–I) <S> Do not perform brace expansion. HIST_REDUCE_BLANKS Remove superfluous blanks from each command line being added to the history list. ksh: –i) This is an interactive shell. Require the use of exit or logout instead. but can exceed this value between trimmings. Note that the command lingers in the internal history until the next command is entered before it vanishes. HUP <Z> Send the HUP signal to running jobs when the shell exits. 2001 6 . HIST_IGNORE_DUPS (–h) Do not enter command lines into the history list if they are duplicates of the previous event.0.4 Last change: October 26. instead.User Commands Property of BladeLogic. This works only for normal widgets. zsh 4. HIST_SAVE_NO_DUPS When writing out the history file. older commands that duplicate newer ones are omitted. type a space and press return. Inc. This option is set upon initialisation if the standard input is a tty and commands are being read from standard input. if this option is set and the Zsh Line Editor is used. to avoid the shell hanging if its tty goes away. INTERACTIVE_COMMENTS (–k) <K> <S> Allow comments even in interactive shells. Note that the command lingers in the internal history until the next command is entered before it vanishes. ten consecutive EOFs will cause the shell to exit anyway. Note that the function lingers in the internal history until the next command is entered before it vanishes. rather than waiting until the shell is killed. not for completion widgets. or when one of the expanded aliases contains a leading space. INTERACTIVE (–i. perform history expansion and reload the line into the editing buffer. HIST_IGNORE_SPACE (–g) Remove command lines from the history list when the first character on the line is a space. Strictly confidential and proprietary ZSHOPTIONS ( 1 ) HIST_IGNORE_ALL_DUPS If a new command line being added to the history list duplicates an older one. HIST_NO_STORE Remove the history (fc –l) command from the history list when invoked. The value of this option cannot be changed anywhere other than the command line.

the interpretation of parentheses is affected by a preceding ‘@’. are processed. array elements are numbered from zero. Without this option. the –L activates LOCAL_OPTIONS. In the case of BASH_AUTO_LIST. zsh will perform normal word splitting after command and parameter expansion in arguments of an assignment. However. including declare. this means that the list will be delayed to the third call of the function. ‘off’ otherwise. KSH_TYPESET <K> Alters the way arguments to the typeset family of commands. LOCAL_TRAPS <K> zsh 4. local and readonly. marked ‘on’ if they are in the non–default state. in other words. LIST_TYPES (–X) <D> When listing files that are possible completions. ‘?’ or ∗’. If there is an unambiguous prefix to insert on the command line. show the type of each file with a trailing identifying mark. the function is defined to the contents of the file. auto–listing behaviour only takes place when nothing would be inserted. A shell function can also guarantee itself a known shell configuration with a formulation like ‘emulate –L zsh’. LIST_BEEP <D> Beep on an ambiguous completion. KSH_AUTOLOAD <K> <S> Emulate ksh function autoloading. float.User Commands Property of BladeLogic.) KSH_GLOB <K> In pattern matching.4 Last change: October 26. the most common ksh–style case – of the file containing only a simple definition of the function – is always handled in the ksh–compatible manner. all options are shown. Strictly confidential and proprietary ZSHOPTIONS ( 1 ) KSH_ARRAYS <K> <S> Emulate ksh array handling as closely as possible. ‘∗ ‘+’. LIST_PACKED Try to make the completion list smaller (occupying less lines) by printing the matches in columns with different widths. and must define the function itself. this may be modified if completion is called from a user–defined widget. that is. 2001 7 . with it. all the options (including this one) which were in force upon entry to the function are restored. KSH_OPTION_PRINT <K> Alters the way options settings are printed: instead of separate lists of set and unset options. not under it as usual. Hence if this is explicitly unset by a shell function the other options in force at the point of return will remain so. LOCAL_OPTIONS <K> If this option is set at the point of return from a shell function. only this option and the XTRACE and PRINT_EXIT_VALUE options are restored. LIST_ROWS_FIRST Lay out the matches in completion lists sorted horizontally. export. and braces are required to delimit a subscript (‘${path[2]}’ rather than just ‘$path[2]’). More accurately. This means that when a function is autoloaded. If this option is set. the second match is to the right of the first one. LIST_AMBIGUOUS <D> This option works when AUTO_LIST or BASH_AUTO_LIST is also set.0. Otherwise. (By default. ‘!’. Inc. the corresponding file is merely executed. this forces the completion widgets to return status 1 on an ambiguous completion. See the section ‘Filename Generation’. integer. an array parameter without subscript refers to the first element instead of the whole array. that is done without a completion list being displayed. which causes the shell to beep if the option BEEP is also set. word splitting does not take place in those cases.

it does not need to be set before any global trap for that to be correctly restored by a function. if both options are in effect. If this option is not explicitly set. reverse–menu–complete may be used to loop through the list in the other direction. ksh: –b) <Z> Report the status of background jobs immediately. NOMATCH (+3) <C> <Z> If a pattern for filename generation has no matches. and not used as an actual parameter assignment. arguments looking like assignments will not undergo wordsplitting. unlike LOCAL_OPTIONS. ksh: –l) This is a login shell. NOTIFY (–5. sleep 3.User Commands Property of BladeLogic. in echo foo=˜/bar:˜/rod. both occurrences of ˜ would be replaced. ksh: –X) Append a trailing ‘/’ to all directory names resulting from filename generation (globbing). delete the pattern from the argument list instead of reporting an error. This option respects the setting of the KSH_TYPESET option. Note that this happens anyway with typeset and similar statements. However. MENU_COMPLETE (–Y) On an ambiguous completion. zsh 4. trap ’’ INT. NULL_GLOB (–G) If a pattern for filename generation has no matches. Overrides NOMATCH. This option overrides AUTO_MENU. go back to the first one again. the value on exit from the function is irrelevant. etc. Note that this option must be set prior to altering the trap behaviour in a function. In other words. LONG_LIST_JOBS (–R) List jobs in the long format by default. This also applies to file expansion of an initial ‘˜’ or ‘=’. Then when completion is requested again. The argument is not otherwise treated specially. insert the first match immediately. MARK_DIRS (–8.0. 2001 8 . instead of leaving it unchanged in the argument list. MONITOR (–m. MULTIOS <Z> Perform implicit tees or cats when multiple redirections are attempted (see the section ‘Redirection’). LOGIN (–l. where expression has a leading ‘˜’ or ‘=’) performed on expression as if it were a parameter assignment. Set by default in interactive shells. it is passed to the command as a single argument. print an error. For example. MAGIC_EQUAL_SUBST All unquoted arguments of the form ‘anything=expression’ appearing after the command name have filename expansion (that is. unsetopt localtraps trap – INT fn() { setopt localtraps. then the previous status of the trap for that signal will be restored when the function exits. } will restore normally handling of SIGINT after the function exits.4 Last change: October 26. instead of listing possibilities or beeping. Strictly confidential and proprietary ZSHOPTIONS ( 1 ) If this option is set when a signal trap is set inside a function. MAIL_WARNING (–U) Print a warning message if a mail file has been accessed since the shell last checked. ksh: –m) Allow job control. For example. remove the first match and insert the second match. rather than waiting until just before printing a prompt. When there are no more matches. Inc. the shell is a login shell if the first character of the argv[0] passed to the shell is a ‘–’.

exit. OCTAL_ZEROES <S> Interpret any integer constant beginning with a 0 as octal. Turning this option off causes the effective user and group IDs to be set to the real user and group IDs. See the section ‘Prompt Expansion’. This also applies to the . PROMPT_PERCENT <C> <Z> If set. and changing it inside a function always changes it globally regardless of the LOCAL_OPTIONS option. ‘%’ is treated specially in prompt expansion. break. continue. ksh: –p) Turn on privileged mode. eval. This is not enabled by default as it causes problems with parsing of. export. local. integer. PROMPT_SUBST <K> If set. sort the filenames numerically rather than lexicographically. and he or she types ‘X11/xinit’. Parameter assignments specified before shell functions and special builtins are kept after the command completes unless the special builtin is prefixed with the command builtin. This takes place before any search indicated by this option. :. return. This option is not necessary if your system correctly returns the printability of eight bit characters (see ctype(3)). for example. Sourcing ˜/. trap and unset. This option disables sourcing user startup files. and regardless of whether ‘./’ or ‘. This option cannot be changed using the –m option of setopt and unsetopt. shift. PUSHD_IGNORE_DUPS Don’t push multiple copies of the same directory onto the directory stack. PRINT_EXIT_VALUE (–1) Print the exit value of programs with non–zero exit status./’ are not subject to the path search. the command ‘/usr/local/bin/X11/xinit’ will be executed (assuming it exists). See the section ‘Prompt Expansion’. 2001 9 . ‘. source. This is enabled automatically on startup if the effective user (group) ID is not equal to the real user (group) ID.. PROMPT_BANG <K> If set. PRINT_EIGHT_BIT Print eight bit characters literally in completion lists. set. OVERSTRIKE Start up the line editor in overstrike mode. ‘!’ is treated specially in prompt expansion. etc. POSIX_BUILTINS <K> <S> When this option is set the command builtin can be used to execute shell builtin commands. date and time strings with leading zeroes.. readonly. zsh 4. Note that subdirectories of the current directory are always searched for executables specified in this form. PRIVILEGED (–p. Thus if ‘/usr/local/bin’ is in the user’s path. Commands explicitly beginning with ‘/’. times. parameter expansion. command substitution and arithmetic expansion are performed in prompts. builtin. PATH_DIRS (–Q) Perform a path search even on command names with slashes in them. Inc. PROMPT_CR (+V) <D> Print a carriage return just before printing a prompt in the line editor.User Commands Property of BladeLogic.4 Last change: October 26. Special builtins are .’ or the current directory appear in the command search path. per IEEE Std 1003.2–1992 (ISO 9945–2:1993). Strictly confidential and proprietary ZSHOPTIONS ( 1 ) NUMERIC_GLOB_SORT If numeric filenames are matched by a filename generation pattern. This is on by default as multi–line editing is only possible if the editor knows where the start of the line appears. If zsh is invoked as ‘sh’ or ‘ksh’ with this option set.0. declare. /etc/suid_profile is sourced (after /etc/profile on interactive shells).profile is disabled and the contents of the ENV variable is ignored.

/etc/zprofile. PUSHD_TO_HOME (–D) Have pushd with no arguments act like ‘pushd $HOME’. If this option is unset. If you find that you want more control over when commands get imported. . Note this does not apply in quoted strings using the format $’.4 Last change: October 26. /etc/zshrc. but you can toggle this on and off with the set–local–history zle binding.User Commands Property of BladeLogic..g.zshenv. RESTRICTED (–r) Enables restricted mode. as described in the section ‘Files’.’. source the . you may wish to turn SHARE_HISTORY off. PUSHD_SILENT (–E) Do not print the directory stack after pushd or popd. .zlogin. it can be set at any time to prevent the remaining startup files after the currently executing one from being sourced. If this option is unset.rc}’ will work. and setting it inside a function always changes it globally regardless of the LOCAL_OPTIONS option. The wait and query can always be avoided by expanding the ‘∗ in ZLE ∗’ (with tab). RC_EXPAND_PARAM (–P) Array expansions of the form ‘foo${xx}bar’. are substituted with ‘fooabar foobbar foocbar’ instead of the default ‘fooa b cbar’. Inc. By default. and some include them. RC_QUOTES Allow the character sequence ‘’’’ to signify a single quote within singly quoted strings. SHARE_HISTORY <K> This option both imports new commands from the history file. and also causes your typed commands to be appended to the history file (the latter is like specifying INC_APPEND_HISTORY). RM_STAR_WAIT If querying the user before executing ‘rm ∗ or ‘rm path/∗ first wait ten seconds and ignore any∗’ ∗’.zprofile. it is performed after brace expansion. recognize exact matches even if they are ambiguous. /etc/zlogin. command substitution. 2001 10 . zsh 4. where the parameter xx is set to (a b c). It is also possible to create a zle widget that will make some commands ignore imported commands.zlogout files. the /etc/zshenv file is still sourced.. See the section ‘Restricted Shell’. RM_STAR_SILENT (–H) <K> <S> Do not query the user before executing ‘rm ∗ or ‘rm path/∗ ∗’ ∗’. Strictly confidential and proprietary ZSHOPTIONS ( 1 ) PUSHD_MINUS Exchanges the meanings of ‘+’ and ‘–’ when used with a number to specify a directory in the stack.0. This option cannot be changed using unsetopt. This avoids the problem of reflexively answering ‘yes’ to the query when one didn’t really mean it. so things like ‘˜$USERNAME’ and ‘˜{pfalstad. and then manually import commands whenever you need them using ‘fc –RI’. RCS (+f) <D> After /etc/zshenv is sourced on startup. REC_EXACT (–S) In completion.zshrc. ˜ expansion) before parameter expansion. thing typed in that time. SH_FILE_EXPANSION <K> <S> Perform filename expansion (e. history movement commands visit the imported lines as well as the local lines. . and . where a backslashed single quote can be used. but any of the others will not be. INC_APPEND_HISTORY on. The history lines are also output with timestamps ala EXTENDED_HISTORY (which makes it easier to find the spot where we left off reading the file after it gets re–written). arithmetic expansion and brace expansion..

This also affects the value of the – special parameter. SUN_KEYBOARD_HACK (–L) If a line ends with a backquote. any argument that would otherwise have been taken as a file to run will instead be treated as a normal positional parameter. ‘’. use ‘:’ instead (see the section ‘Redirection’). This is useful on some keyboards where the return key is too small. Strictly confidential and proprietary ZSHOPTIONS ( 1 ) SH_GLOB <K> <S> Disables the special meaning of ‘(’. unless the INTERACTIVE option is explicitly set on the command line. ksh: –x) Print commands and their arguments as they are executed. SH_OPTION_LETTERS <K> <S> If this option is set the shell tries to interpret single letter options (which are used with set and setopt) like ksh does.0. SHIN_STDIN (–s. ‘)’ and ’<’ for globbing the result of parameter and command substitutions. Set by default in interactive shells connected to a terminal. ksh: –s) Commands are being read from the standard input. but can be used just like normal option names when specifying options to the shell. Note that this option has nothing to do with word splitting. XTRACE (–x. and the backquote key lies annoyingly close to it. Commands are read from standard input if no command is specified with –c and no file of commands is specified. SHORT_LOOPS <C> <Z> Allow the short forms of for.User Commands Property of BladeLogic. SINGLE_LINE_ZLE (–M) <K> Use single–line command line editing instead of multi–line.) SINGLE_COMMAND (–t. Note that setting or unsetting this option on the command line does not necessarily affect the state the option will have while the shell is running – that is purely an indicator of whether on not commands are actually being read from standard input. UNSET (+u. and function constructs. The value of this option cannot be changed anywhere other than the command line. Otherwise they are treated as an error.4 Last change: October 26. and there are an odd number of backquotes on the line. This option is set by default if zsh is invoked as sh or ksh. ZLE (–Z) Use the zsh line editor. it exits after a single command has been executed. ksh: +u) <K> <S> <Z> Treat unset parameters as if they were empty when substituting. SH_NULLCMD <K> <S> Do not use the values of NULLCMD and READNULLCMD when doing redirections. The value of this option cannot be changed anywhere other than the command line. VERBOSE (–v. if. ksh: –v) Print shell input lines as they are read. ignore the trailing backquote. (See the section ‘Parameter Expansion’. Inc. ksh: –t) If the shell is reading from standard input. These aliases are never used for output. 2001 11 . select. OPTION ALIASES Some options have alternative names. and in some other places where the shell accepts patterns. This also makes the shell non–interactive. SH_WORD_SPLIT (–y) <K> <S> Causes field splitting to be performed on unquoted parameter expansions. zsh 4. If SHIN_STDIN is set explicitly on the command line.

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

ZSHOPTIONS ( 1 )

BRACE_EXPAND NO_IGNORE_BRACES (ksh and bash compatibility) DOT_GLOB GLOB_DOTS (bash compatibility) HASH_ALL HASH_CMDS (bash compatibility) HIST_APPEND APPEND_HISTORY (bash compatibility) HIST_EXPAND BANG_HIST (bash compatibility) LOG NO_HIST_NO_FUNCTIONS (ksh compatibility) MAIL_WARN MAIL_WARNING (bash compatibility) ONE_CMD SINGLE_COMMAND (bash compatibility) PHYSICAL CHASE_LINKS (ksh and bash compatibility) PROMPT_VARS PROMPT_SUBST (bash compatibility) STDIN SHIN_STDIN (ksh compatibility) TRACK_ALL HASH_CMDS (ksh compatibility)
SINGLE LETTER OPTIONS Default set

–0 –1 –2 –3 –4 –5 –6 –7 –8 –9 –B –C –D –E –F –G –H –I –J –K –L –M –N –O –P

CORRECT PRINT_EXIT_VALUE NO_BAD_PATTERN NO_NOMATCH GLOB_DOTS NOTIFY BG_NICE IGNORE_EOF MARK_DIRS AUTO_LIST NO_BEEP NO_CLOBBER PUSHD_TO_HOME PUSHD_SILENT NO_GLOB NULL_GLOB RM_STAR_SILENT IGNORE_BRACES AUTO_CD NO_BANG_HIST SUN_KEYBOARD_HACK SINGLE_LINE_ZLE AUTO_PUSHD CORRECT_ALL RC_EXPAND_PARAM

zsh 4.0.4

Last change: October 26, 2001

12

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

ZSHOPTIONS ( 1 )

–Q –R –S –T –U –V –W –X –Y –Z –a –e –f –g –h –i –k –l –m –n –p –r –s –t –u –v –w –x –y –C –X –a –b –e –f –i –l –m –n –p –r –s –t –u –v –x
Also note

PATH_DIRS LONG_LIST_JOBS REC_EXACT CDABLE_VARS MAIL_WARNING NO_PROMPT_CR AUTO_RESUME LIST_TYPES MENU_COMPLETE ZLE ALL_EXPORT ERR_EXIT NO_RCS HIST_IGNORE_SPACE HIST_IGNORE_DUPS INTERACTIVE INTERACTIVE_COMMENTS LOGIN MONITOR NO_EXEC PRIVILEGED RESTRICTED SHIN_STDIN SINGLE_COMMAND NO_UNSET VERBOSE CHASE_LINKS XTRACE SH_WORD_SPLIT NO_CLOBBER MARK_DIRS ALL_EXPORT NOTIFY ERR_EXIT NO_GLOB INTERACTIVE LOGIN MONITOR NO_EXEC PRIVILEGED RESTRICTED SHIN_STDIN SINGLE_COMMAND NO_UNSET VERBOSE XTRACE Used by set for setting arrays Used on the command line to specify end of option processing Used on the command line to specify a single command Used by setopt for pattern–matching option setting Used in all places to allow use of long option names

sh/ksh emulation set

–A –b –c –m –o

zsh 4.0.4

Last change: October 26, 2001

13

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

ZSHOPTIONS ( 1 )

–s

Used by set to sort positional parameters

zsh 4.0.4

Last change: October 26, 2001

14

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

ZSHBUILTINS ( 1 )

NAME

zshbuiltins – zsh built–in commands
SHELL BUILTIN COMMANDS

– simple command See the section ‘Precommand Modifiers’. . file [ arg ... ] Read commands from file and execute them in the current shell environment. If file does not contain a slash, or if PATH_DIRS is set, the shell looks in the components of $path to find the directory containing file. Files in the current directory are not read unless ‘.’ appears somewhere in $path. If a file named ‘file.zwc’ is found, is newer than file, and is the compiled form (created with the zcompile builtin) of file, then commands are read from that file instead of file. If any arguments arg are given, they become the positional parameters; the old positional parameters are restored when the file is done executing. The exit status is the exit status of the last command executed. : [ arg ... ] This command does nothing, although normal argument expansions is performed which may have effects on shell parameters. A zero exit code is returned. alias [ {+–}gmrL ] [ name[=value] ... ] For each name with a corresponding value, define an alias with that value. A trailing space in value causes the next word to be checked for alias expansion. If the –g flag is present, define a global alias; global aliases are expanded even if they do not occur in command position. For each name with no value, print the value of name, if any. With no arguments, print all currently defined aliases. If the –m flag is given the arguments are taken as patterns (they should be quoted to preserve them from being interpreted as glob patterns), and the aliases matching these patterns are printed. When printing aliases and the –g or –r flags are present, then restrict the printing to global or regular aliases, respectively. Using ‘+’ instead of ‘–’, or ending the option list with a single ‘+’, prevents the values of the aliases from being printed. If the –L flag is present, then print each alias in a manner suitable for putting in a startup script. The exit status is nonzero if a name (with no value) is given for which no alias has been defined. autoload [ {+–}UXmt ] [ –wkz ] [ name ... ] Equivalent to functions –u, with the exception of –X/+X, –w, –k and –z. The flag –X may be used only inside a shell function, and may not be followed by a name. It causes the calling function to be marked for autoloading and then immediately loaded and executed, with the current array of positional parameters as arguments. This replaces the previous definition of the function. If no function definition is found, an error is printed and the function remains undefined and marked for autoloading. The flag +X attempts to load each name as an autoloaded function, but does not execute it. The exit status is zero (success) if the function was not previously defined and a definition for it was found. This does not replace any existing definition of the function. The exit status is nonzero (failure) if the function was already defined or when no definition was found. In the latter case the function remains undefined and marked for autoloading. The flag +X may be combined with either –k or –z to make the function be loaded using ksh–style or zsh–style autoloading, respectively. If neither is given, the current setting of the KSH_AUTOLOAD options determines how the function is loaded. With ksh–style autoloading, the contents of the file will not be executed immediately. Instead, the function created will contain the contents of the file plus a call to the function itself appended to it, thus given normal ksh autoloading behaviour on the first call to the function.

zsh 4.0.4

Last change: October 26, 2001

1

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

ZSHBUILTINS ( 1 )

With the –w flag, the names are taken as names of files compiled with the zcompile builtin, and all functions defined in them are marked for autoloading. bg [ job ... ] job ... & Put each specified job in the background, or the current job if none is specified. bindkey See the section ‘Zle Builtins’ in zshzle(1). break [ n ] Exit from an enclosing for, while, until, select or repeat loop. If n is specified, then break n levels instead of just one. builtin name [ args ... ] Executes the builtin name, with the given args. bye cap Same as exit. See the section ‘The zsh/cap Module’ in zshmodules(1).

cd [ –sLP ] [ arg ] cd [ –sLP ] old new cd [ –sLP ] {+–}n Change the current directory. In the first form, change the current directory to arg, or to the value of $HOME if arg is not specified. If arg is ‘–’, change to the value of $OLDPWD, the previous directory. Otherwise, if a directory named arg is not found in the current directory and arg does not begin with a slash, search each component of the shell parameter cdpath. If no directory is found and the option CDABLE_VARS is set, and a parameter named arg exists whose value begins with a slash, treat its value as the directory. In that case, the parameter is added to the named directory hash table. The second form of cd substitutes the string new for the string old in the name of the current directory, and tries to change to this new directory. The third form of cd extracts an entry from the directory stack, and changes to that directory. An argument of the form ‘+n’ identifies a stack entry by counting from the left of the list shown by the dirs command, starting with zero. An argument of the form ‘–n’ counts from the right. If the PUSHD_MINUS option is set, the meanings of ‘+’ and ‘–’ in this context are swapped. If the –s option is specified, cd refuses to change the current directory if the given pathname contains symlinks. If the –P option is given or the CHASE_LINKS option is set, symbolic links are resolved to their true values. If the –L option is given symbolic links are followed regardless of the state of the CHASE_LINKS option. chdir clone Same as cd. See the section ‘The zsh/clone Module’ in zshmodules(1).

command simple command See the section ‘Precommand Modifiers’. comparguments See the section ‘The zsh/computil Module’ in zshmodules(1). compcall See the section ‘The zsh/compctl Module’ in zshmodules(1). compctl See the section ‘The zsh/compctl Module’ in zshmodules(1). compdescribe See the section ‘The zsh/computil Module’ in zshmodules(1).

zsh 4.0.4

Last change: October 26, 2001

2

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

ZSHBUILTINS ( 1 )

compfiles See the section ‘The zsh/computil Module’ in zshmodules(1). compgroups See the section ‘The zsh/computil Module’ in zshmodules(1). compquote See the section ‘The zsh/computil Module’ in zshmodules(1). comptags See the section ‘The zsh/computil Module’ in zshmodules(1). comptry See the section ‘The zsh/computil Module’ in zshmodules(1). compvalues See the section ‘The zsh/computil Module’ in zshmodules(1). continue [ n ] Resume the next iteration of the enclosing for, while, until, select or repeat loop. If n is specified, break out of n–1 loops and resume at the nth enclosing loop. declare Same as typeset. dirs [ –v ] [ arg ... ] With no arguments, print the contents of the directory stack. If the –v option is given, number the directories in the stack when printing. Directories are added to this stack with the pushd command, and removed with the cd or popd commands. If arguments are specified, load them onto the directory stack, replacing anything that was there, and push the current directory onto the stack. disable [ –afmr ] name ... Temporarily disable the named hash table elements. The default is to disable builtin commands. This allows you to use an external command with the same name as a builtin command. The –a option causes disable to act on aliases. The –f option causes disable to act on shell functions. The –r options causes disable to act on reserved words. Without arguments all disabled hash table elements from the corresponding hash table are printed. With the –m flag the arguments are taken as patterns (which should be quoted to prevent them from undergoing filename expansion), and all hash table elements from the corresponding hash table matching these patterns are disabled. Disabled objects can be enabled with the enable command. disown [ job ... ] job ... & job ... &! Remove the specified jobs from the job table; the shell will no longer report their status, and will not complain if you try to exit an interactive shell with them running or stopped. If no job is specified, disown the current job. echo [ –neE ] [ arg ... ] Write each arg on the standard output, with a space separating each one. If the –n flag is not present, print a newline at the end. echo recognizes the following escape sequences: \a \b \c \e \f \n \r \t \v bell character backspace suppress final newline escape form feed linefeed (newline) carriage return horizontal tab vertical tab

zsh 4.0.4

Last change: October 26, 2001

3

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

ZSHBUILTINS ( 1 )

\\ backslash \0NNN character code in octal \xNN character code in hexadecimal The –E flag, or the BSD_ECHO option, can be used to disable these escape sequences. In the latter case, –e flag can be used to enable them. echotc See the section ‘The zsh/termcap Module’ in zshmodules(1). echoti See the section ‘The zsh/terminfo Module’ in zshmodules(1). emulate [ –LR ] {zshshkshcsh} Set up zsh options to emulate the specified shell as much as possible. csh will never be fully emulated. If the argument is not one of the shells listed above, zsh will be used as a default; more precisely, the tests performed on the argument are the same as those used to determine the emulation at startup based on the shell name, see the section ‘Compatibility’ in zshmisc(1) . If the –R option is given, all options are reset to their default value corresponding to the specified emulation mode, except for certain options describing the interactive environment; otherwise, only those options likely to cause portability problems in scripts and functions are altered. If the –L option is given, the options LOCAL_OPTIONS and LOCAL_TRAPS will be set as well, causing the effects of the emulate command and any setopt and trap commands to be local to the immediately surrounding shell function, if any; normally these options are turned off in all emulation modes except ksh. enable [ –afmr ] name ... Enable the named hash table elements, presumably disabled earlier with disable. The default is to enable builtin commands. The –a option causes enable to act on aliases. The –f option causes enable to act on shell functions. The –r option causes enable to act on reserved words. Without arguments all enabled hash table elements from the corresponding hash table are printed. With the –m flag the arguments are taken as patterns (should be quoted) and all hash table elements from the corresponding hash table matching these patterns are enabled. Enabled objects can be disabled with the disable builtin command. eval [ arg ... ] Read the arguments as input to the shell and execute the resulting command in the current shell process. exec simple command See the section ‘Precommand Modifiers’. exit [ n ] Exit the shell with the exit code specified by n; if none is specified, use the exit code from the last command executed. An EOF condition will also cause the shell to exit, unless the IGNORE_EOF option is set. export [ name[=value] ... ] The specified names are marked for automatic export to the environment of subsequently executed commands. Equivalent to typeset –gx. If a parameter specified does not already exist, it is created in the global scope. false [ arg ... ] Do nothing and return an exit code of 1. fc [ –e ename ] [ –nlrdDfEim ] [ old=new ... ] [ first [ last ] ] fc –ARWI [ filename ] Select a range of commands from first to last from the history list. The arguments first and last may be specified as a number or as a string. A negative number is used as an offset to the current history event number. A string specifies the most recent event beginning with the given string. All substitutions old=new, if any, are then performed on the commands.

zsh 4.0.4

Last change: October 26, 2001

4

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

ZSHBUILTINS ( 1 )

If the –l flag is given, the resulting commands are listed on standard output. If the –m flag is also given the first argument is taken as a pattern (should be quoted) and only the history events matching this pattern will be shown. Otherwise the editor program ename is invoked on a file containing these history events. If ename is not given, the value of the parameter FCEDIT is used. If ename is ‘–’, no editor is invoked. When editing is complete, the edited command is executed. If first is not specified, it will be set to –1 (the most recent event), or to –16 if the –l flag is given. If last is not specified, it will be set to first, or to –1 if the –l flag is given. The flag –r reverses the order of the commands and the flag –n suppresses command numbers when listing. Also when listing, –d prints timestamps for each command, and –f prints full time–date stamps. Adding the –E flag causes the dates to be printed as ‘dd.mm.yyyy’, instead of the default ‘mm/dd/yyyy’. Adding the –i flag causes the dates to be printed in ISO8601 ‘yyyy–mm–dd’ format. With the –D flag, fc prints elapsed times. ‘fc –R’ reads the history from the given file, ‘fc –W’ writes the history out to the given file, and ‘fc –A’ appends the history out to the given file. If no filename is specified, the $HISTFILE is assumed. If the –I option is added to –R, only those events that are not already contained within the internal history list are added. If the –I option is added to –A or –W, only those events that are new since last incremental append/write to the history file are appended/written. In any case, the created file will have no more than $SAVEHIST entries. fg [ job ... ] job ... Bring each specified job in turn to the foreground. If no job is specified, resume the current job. float [ {+–}EFghlrtux ] [ name[=value] ... ] Equivalent to typeset –E, except that options irrelevant to floating point numbers are not permitted. functions [ {+–}UXmtu ] [ name ... ] Equivalent to typeset –f. getcap See the section ‘The zsh/cap Module’ in zshmodules(1). getln [ –AclneE ] name ... Read the top value from the buffer stack and put it in the shell parameter name. Equivalent to read –zr. getopts optstring name [ arg ... ] Checks the args for legal options. If the args are omitted, use the positional parameters. A valid option argument begins with a ‘+’ or a ‘–’. An argument not beginning with a ‘+’ or a ‘–’, or the argument ‘– –’, ends the options. optstring contains the letters that getopts recognizes. If a letter is followed by a ‘:’, that option is expected to have an argument. The options can be separated from the argument by blanks. Each time it is invoked, getopts places the option letter it finds in the shell parameter name, prepended with a ‘+’ when arg begins with a ‘+’. The index of the next arg is stored in OPTIND. The option argument, if any, is stored in OPTARG. The first option to be examined may be changed by explicitly assigning to OPTIND. OPTIND has an initial value of 1, and is normally reset to 1 upon exit from a shell function. OPTARG is not reset and retains its value from the most recent call to getopts. If either of OPTIND or OPTARG is explicitly unset, it remains unset, and the index or option argument is not stored. The option itself is still stored in name in this case. A leading ‘:’ in optstring causes getopts to store the letter of any invalid option in OPTARG, and to set name to ‘?’ for an unknown option and to ‘:’ when a required option is missing. Otherwise, getopts sets name to ‘?’ and prints an error message when an option is invalid. The exit status is nonzero when there are no more options. hash [ –Ldfmrv ] [ name[=value] ] ...

zsh 4.0.4

Last change: October 26, 2001

5

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

ZSHBUILTINS ( 1 )

hash can be used to directly modify the contents of the command hash table, and the named directory hash table. Normally one would modify these tables by modifying one’s PATH (for the command hash table) or by creating appropriate shell parameters (for the named directory hash table). The choice of hash table to work on is determined by the –d option; without the option the command hash table is used, and with the option the named directory hash table is used. Given no arguments, and neither the –r or –f options, the selected hash table will be listed in full. The –r option causes the selected hash table to be emptied. It will be subsequently rebuilt in the normal fashion. The –f option causes the selected hash table to be fully rebuilt immediately. For the command hash table this hashes all the absolute directories in the PATH, and for the named directory hash table this adds all users’ home directories. These two options cannot be used with any arguments. The –m option causes the arguments to be taken as patterns (which should be quoted) and the elements of the hash table matching those patterns are printed. This is the only way to display a limited selection of hash table elements. For each name with a corresponding value, put ‘name’ in the selected hash table, associating it with the pathname ‘value’. In the command hash table, this means that whenever ‘name’ is used as a command argument, the shell will try to execute the file given by ‘value’. In the named directory hash table, this means that ‘value’ may be referred to as ‘˜name’. For each name with no corresponding value, attempt to add name to the hash table, checking what the appropriate value is in the normal manner for that hash table. If an appropriate value can’t be found, then the hash table will be unchanged. The –v option causes hash table entries to be listed as they are added by explicit specification. If has no effect if used with –f. If the –L flag is present, then each hash table entry is printed in the form of a call to hash. history Same as fc –l. integer [ {+–}ghilrtux ] [ name[=value] ... ] Equivalent to typeset –i, except that options irrelevant to integers are not permitted. jobs [ –dlprs ] [ job ... ] jobs –Z string Lists information about each given job, or all jobs if job is omitted. The –l flag lists process IDs, and the –p flag lists process groups. If the –r flag is specified only running jobs will be listed and if the –s flag is given only stopped jobs are shown. If the –d flag is given, the directory from which the job was started (which may not be the current directory of the job) will also be shown. The –Z option replaces the shell’s argument and environment space with the given string, truncated if necessary to fit. This will normally be visible in ps (ps(1)) listings. This feature is typically used by daemons, to indicate their state. kill [ –s signal_name ] job ... kill [ –sig ] job ... kill –l [ sig ... ] Sends either SIGTERM or the specified signal to the given jobs or processes. Signals are given by number or by names, without the ‘SIG’ prefix. If the signal being sent is not ‘KILL’ or ‘CONT’, then the job will be sent a ‘CONT’ signal if it is stopped. The argument job can be the process ID of a job not in the job list. In the third form, kill –l, if sig is not specified the signal names are listed. Otherwise, for each sig that is a name, the corresponding signal number is listed. For each sig that is a signal number or a number representing the exit status of a process which was terminated or stopped by a signal the name of the signal is printed. let arg ... Evaluate each arg as an arithmetic expression. See the section ‘Arithmetic Evaluation’ for a

zsh 4.0.4

Last change: October 26, 2001

6

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

ZSHBUILTINS ( 1 )

description of arithmetic expressions. The exit status is 0 if the value of the last expression is nonzero, and 1 otherwise. limit [ –hs ] [ resource [ limit ] ] ... Set or display resource limits. Unless the –s flag is given, the limit applies only the children of the shell. If –s is given without other arguments, the resource limits of the current shell is set to the previously set resource limits of the children. If limit is not specified, print the current limit placed on resource, otherwise set the limit to the specified value. If the –h flag is given, use hard limits instead of soft limits. If no resource is given, print all limits. resource can be one of: addressspace Maximum amount of address space used. aiomemorylocked Maximum amount of memory locked in RAM for AIO operations. aiooperations Maximum number of AIO operations. cachedthreads Maximum number of cached threads. coredumpsize Maximum size of a core dump. cputime Maximum CPU seconds per process. datasize Maximum data size (including stack) for each process. descriptors Maximum value for a file descriptor. filesize Largest single file allowed. maxproc Maximum number of processes. maxpthreads Maximum number of threads per process. memorylocked Maximum amount of memory locked in RAM. memoryuse Maximum resident set size. resident Maximum resident set size. sockbufsize Maximum size of all socket buffers. stacksize Maximum stack size for each process. vmemorysize Maximum amount of virtual memory. Which of these resource limits are available depends on the system. resource can be abbreviated to any unambiguous prefix. limit is a number, with an optional scaling factor, as follows: nh nk nm [mm:]ss hours kilobytes (default) megabytes or minutes minutes and seconds

zsh 4.0.4

Last change: October 26, 2001

7

User Commands

Property of BladeLogic, Inc. Strictly confidential and proprietary

ZSHBUILTINS ( 1 )

local [ {+–}AEFLRUZahilrtux [n]] [ name[=value] ] ... Same as typeset, except that the options –g, and –f are not permitted. In this case the –x option does not force the use of –g, i.e. exported variables will be local to functions. log List all users currently logged in who are affected by the current setting of the watch parameter. logout [ n ] Same as exit, except that it only works in a login shell. noglob simple command See the section ‘Precommand Modifiers’. popd [ {+–}n ] Remove an entry from the directory stack, and perform a cd to the new top directory. With no argument, the current top entry is removed. An argument of the form ‘+n’ identifies a stack entry by counting from the left of the list shown by the dirs command, starting with zero. An argument of the form –n counts from the right. If the PUSHD_MINUS option is set, the meanings of ‘+’ and ‘–’ in this context are swapped. print [ –bnrslzpNDPoOicm ] [ –un ] [ –R [ –en ]] [ arg ... ] With no flags or with flag ‘–’, the arguments are printed on the standard output as described by echo, with the following differences: the escape sequence ‘\M–x’ metafies the character x (sets the highest bit), ‘\C–x’ produces a control character (‘\C–@’ and ‘\C–?’ give the characters NUL and delete), and ‘\E’ is a synonym for ‘\e’. Finally, if not in an escape sequence, ‘\’ escapes the following character and is not printed. –r –R Ignore the escape conventions of echo. Emulate the BSD echo command, which does not process escape sequences unless the –e flag is given. The –n flag suppresses the trailing newline. Only the –e and –n flags are recognized after –R; all other arguments and options are printed. Recognize all the escape sequences defined for the bindkey command, see zshzle(1). Take the first argument as a pattern (should be quoted), and remove it from the argument list together with subsequent arguments that do not match this pattern. Place the results in the history list instead of on the standard output. Do not add a newline to the output. Print the arguments separated by newlines instead of spaces. Print the arguments separated and terminated by nulls. Print the arguments sorted in ascending order. Print the arguments sorted in descending order. If given together with –o or –O, sorting is performed case–independently. Print the arguments in columns. Print the arguments to file descriptor n. Print the arguments to the input of the coprocess. Push the arguments onto the editing buffer stack, separated by spaces. Treat the arguments as directory names, replacing prefixes with ˜ expressions, as appropriate. Perform prompt expansion (see zshmisc(1)).

–b –m –s –n –l –N –o –O –i –c –un –p –z –D –P pushd [ arg ] pushd old new pushd {+–}n

zsh 4.0.4

Last change: October 26, 2001

8

This option may also be used within zle widgets. or the CHASE_LINKS option is set and the –L flag is not given. An argument of the form ‘+n’ identifies a stack entry by counting from the left of the list shown by the dirs command. –z Read one entry from the editor buffer stack and assign it to the first name. not in the same word. The first field is assigned to the first name. If both flags are –e –E –A –c –l zsh 4. etc. pwd [ –rLP ] Print the absolute pathname of the current working directory. If the –r or the –P flag is specified. The input read is printed (echoed) to the standard output. Note that num must be in the argument word that follows –k. the printed path will not contain symbolic links. Strictly confidential and proprietary ZSHBUILTINS ( 1 ) Change the current directory. ] Equivalent to print –nz. If the –c flag is given. the words of the current command are read. These flags are allowed only if called inside a function used for completion (specified with the –K flag to compctl). With this flag set the return value is zero only if the character was ‘y’ or ‘Y’. without word splitting. Note that this always reads from the terminal. The first name is taken as the name of an array and all words are assigned to it. with leftover fields assigned to the last name. If name is omitted then REPLY is used for scalars and reply for arrays. the whole line is assigned as a scalar. Read only one character from the terminal and set name to ‘y’ if this character was ‘y’ or ‘Y’ and to ‘n’ otherwise. If the –l flag is given. Input is read from the terminal unless one of –u or –p is present. the directory stack will be printed after a pushd is performed. exchange the top two entries). Inc. Text is pushed onto the stack with ‘print –z’ or with push–line from the line editor (see zshzle(1)). 2001 9 . no input is assigned to the parameters. read [ –rzpqAclneEt ] [ –k [ num ] ] [ –un ] [ name[?prompt] ] [ name . The meaning of old and new in the second form is also the same as for cd. change the current directory to arg. –r –q Raw mode: a ‘\’ at the end of a line does not signify line continuation and backslashes in the line don’t quote the following character and are not removed. An argument of the form ‘–n’ counts from the right. All are assigned to the first name.4 Last change: October 26.User Commands Property of BladeLogic. –k [ num ] Read only one (or num) characters. Otherwise. If the –e flag is used. See –u.. change to the second directory on the stack (that is. without word splitting. except as noted below.. If the PUSHD_MINUS option is set. and push the old current directory onto the directory stack. This flag is ignored when the –k or –q flags are present. starting with zero. If the option PUSHD_SILENT is not set. The third form of pushd changes directory by rotating the directory list. the meanings of ‘+’ and ‘–’ in this context are swapped.0. arg is interpreted as it would be by cd.. In the first form. even if used with the –p or –u or –z flags or with redirected input.. If arg is not specified. This option may also be used within zle widgets. the second field to the second name. ] Read one line and break it into fields using the characters in $IFS as separators. or change to $HOME if the PUSHD_TO_HOME option is set or if there is only one entry on the stack. pushln [ arg .. This flag is ignored when –q is present. r Same as fc –e –.

The value (exit status) of read is 1 when an end–of–file is encountered. –q. if none is. sched See the section ‘The zsh/sched Module’ in zshmodules(1).. where n is a single digit and must not be separated from –u by any whitespace. This is not available when reading from the editor buffer with –z. –u and –z flags is undefined. the given arguments will replace the initial elements of that array. it causes the specified arguments to be sorted before assigning them to the positional parameters (or to the array name if –A is used). set [ {+–}options  {+–}o option_name ] . –k cancels –z. If the first argument contains a ‘?’. if +A is used and name is an array. With zero status (or after an implicit return at the end of the trap). the effect is different for zero and non–zero return status. Note that the command name is word number 1. see zshoptions(1). the shell will return to whatever it was previously processing. Otherwise the value is 0. so the statement ‘return $((128+$1))’ will return the same status as if the signal had not been trapped. The default mode is canonical input. –p cancels –u. With –l. For the meaning of the other flags. [ {+–}A [ name ] ] [ arg . script to return to the invoking script with the return status specified by n. The –c or –l flags cancel any and all of –kpquz.User Commands Property of BladeLogic. when called from within completion with –c or –l. rehash Same as hash –r. or declare and set an array. with –q