You are on page 1of 568

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

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

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. version(1) NSH 2 .0 SYSTEM F454127F 1 Licensed for NSH.0.160 windowshost WindowsNT 5.3. nover (1). SEE ALSO ncpu (1). Inc.agentinfo(1) Property of BladeLogic.8 4507/51 (tmk/sw) 80F8EC76 1 Expires Mon May 12 14:58:38 2005 6. Configuration Manager ORIGIN The agentinfo utility was written by Thomas Kraus.

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

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

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

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

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

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

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

NEGLIGENCE OR OTHER TORTIOUS ACTION. 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. 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. DATA OR PROFITS. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. 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. ****************************************************************/ cat(1) NSH 6 .cat(1) Property of BladeLogic. written prior permission. INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE. Inc. Strictly confidential and proprietary granted. LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.

509 certificate SYNOPSIS bl_gen_ssl DESCRIPTION The bl_gen_ssl command creates an X. id. id.pem is stored in /<user_profile_dir>/Application Data/BladeLogic. every time a Network Shell session is invoked. Inc. 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.bladelogic. This password is used to gain access to user’s private key. such as /home/johnk. In Windows. Inc. the user is prompted for a private key password. where <user_profile_dir> specifies a path such as /Documents and Settings/johnk. On UNIX. Invoking bl_gen_ssl prompts the user to enter a password and confirm it. NSH 1 .pem is stored in /<home_dir>/.Property of BladeLogic. where <home_dir> is the user’s home directory. Once a certificate is created on a client. Creating this certificate generates a user’s public and private keys.pem.509 certificate in a file named id.

password. NSH 1 . 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. This shared memory segment is only usable for the user who ran bl_srp_agent. and role. 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.bl_srp_agent(1) Property of BladeLogic. To reuse this shared memory segment with Network Shell. OPTIONS --background Instructs bl_srp_agent to run in the background. When you run bl_srp_agent. the system prompts for a user ID. 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. Other programs can use the information cached by bl_srp_agent whether bl_srp_agent is running in the foreground or background. bl_srp_agent runs in the foreground. bl_srp_agent runs in the background with the user information cached in a shared memory segment. where <xy> is the hexadecimal value of the location of the shared memory segment. Inc. If you do not use this option. After entering your user information. EXAMPLE bl_srp_agent --background ORIGIN bl_srp_agent was developed by BladeLogic.

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

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

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

P.d "abc" ´abc´ $name function() Name Decimal Number Octal Number Percentage Floating point number Hex Number I. address (converted to integer) String supporting \ for special characters String (no special character support) Variable name (see set_variable() function) Supported function. CR. An expression consists of operands and operators. DESCRIPTION blexpr is generic expression evaluator. 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 nest these (multiple levels) using parentheses ´(´ and ´)´. then creates and evaluates an expression. LF) as optional operand/operator separators.. TAB.. OPERATOR TYPES blexpr supports the following operator types: Integers NSH 1 .c.b. It prints the result to stdout. If you do not specify any arguments.blexpr(1) Property of BladeLogic. You can use whitespaces (SPACE. OPERATORS blexpr supports the following operators.mm 0xABC a. It takes all of its arguments as input. Inc. Strictly confidential and proprietary blexpr(1) NAME blexpr − BladeLogic Expression SYNOPSIS blexpr expr . blexpr reads the expression from stdin.

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

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

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

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

//<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. and the resulting keystroke files have been digitally signed. //<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... the status displays as "Unknown. or "Unknown. e.Property of BladeLogic. e. Inc..g.. [COMMAND] [COMMAND_OPTION]. 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. 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]." hostname Name of host for which to list keystroke logfiles keystroke_logfile Full NSH Path to remote keystroke logfile. blkeylogman provides a limited set of functionality that can be used in conjunction with existing. This option displays the status of each keystroke file as either "Consistent".g.. [TARGET]. traditional logfile management systems to provide a complete solution. There are four primary functions provided by blkeylogman.... If the signature file needed for verification is missing on the target host." An "Inconsistent" status indicates that the log file may have been tampered with.. or specify a full NSH path to an individual keystroke file to request just that file’s status.. [TARGET].. and TARGETS NSH 1 .. DESCRIPTION blkeylogman allows a system administrator to manage live keystroke logfiles on the RSCD agent to accomplish basic tasks. [COMMAND] [COMMAND_OPTION]. "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. bllogkeyman [GLOBAL_OPTION]. You can request the status of all the keystroke files on a host.

The format of the timestamp is "MM/DD/YY HH:MM:SS. -b Show entries where "entry timestamp" < "specified timestamp".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. The format of the timestamp is "MM/DD/YY HH:MM:SS. Inc. //<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.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.mmm" or "MM/DD/YY HH:MM:SS" EXAMPLES The following will cat the logfile "keystroke. As a result.mmm" or "MM/DD/YY HH:MM:SS" Show sessions that were in progress before the specified timestamp. Exercising the p option.mmm" or "MM/DD/YY HH:MM:SS" Process non-printable output characters before printing Sometimes. the display gets garbled or sometimes even cleared. -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".Property of BladeLogic. makes blkeylogman process the special terminal control characters to printable ones. The format of the timestamp is "MM/DD/YY HH:MM:SS.g. e. 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.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 . executing a blkeylogman cat command causes the terminal to process and interpret special terminal handling control characters (contained in the log data).

Property of BladeLogic. 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. Inc.log1 ORIGIN blkeylogman was written by Rajesh Jangam of BladeLogic.log1" on host "solaris10": $ blkeylogman listsessions //solaris10/usr/nsh/log/keystroke. Inc. SEE ALSO bllogman (1) exports (5) NSH 3 .log2 To list nexec sessions on host "solaris10": $ blkeylogman listsessions solaris10 To list nexec sessions from file "keystroke.

..... 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 .. traditional logfile management systems to provide a complete solution. as follows: -? -v Generate run-time usage Be verbose when performing functions COMMANDS... There are six primary functions provided by bllogman. but rather provides a limited set of functionality that can be used in conjunction with existing. Use only when copying a signature file. logman [GLOBAL_OPTION]... 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. [TARGET]. Strictly confidential and proprietary bllogman(1) bllogman(1) NAME bllogman − remotely manage live RSCD agent logfiles SYNOPSIS bllogman [GLOBAL_OPTION]. DESCRIPTION bllogman allows a system administrator to manage live RSCD agent logfiles to accomplish basic tasks. [COMMAND] [COMMAND_OPTION]... Inc. and there are command-specific options affecting only particular commands. [TARGET]. 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. COMMAND_OPTIONS. [COMMAND] [COMMAND_OPTION]. bllogman is not intended to be a feature-complete logfile management solution.Property of BladeLogic.

To execute this command. privateKey_file Full path to the local privateKey file that was used to sign the log file." hostname Name of host for which to list logfiles rotate [-S] logfile/signature_file Rotate provides a simple. You can request the status of all the log files on a host.log" on the remote host "host1": $ bllogman cat //host1/usr/nsh/log/rscd." assuming "rscd.log NSH 2 . This option displays the status of each log file as either "Consistent"." An "Inconsistent" status indicates that the log file may have been tampered with.1" does not already exist. If you have not enabled secure agent logging on the remote host. Note: All files needed for this command should be local.log" to "rscd. 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. iterative rotation function which simply increments the filename extension by one until an available filename is found. this option returns a status as "Unknown.Property of BladeLogic. you must have the corresponding signature file. Inc. and the resulting log files have been digitally signed. certificate file. the rotate option will rename the file "rscd.log. "Inconsistent". signature_file Full path to corresponding local signature file. EXAMPLES The following will cat the logfile "rscd.1. or "Unknown.log. This command is intended to be used for client side verification. and private key file on the local host. certificate_file Full path to the local certificate file that was used to sign the log file. For example. Use only when rotating a signature file. or specify a full NSH path to an individual log file to request just that file’s status. logfile Full path to local log file. -S Indicates that the file you are rotating is a signature file. 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.

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

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

If the path does not exist or is not accessible it returns the value of -1. 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. otherwise it returns 0. 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 file does not exist then it returns a zero length string with the appropriate error set. NSH 2 . 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. 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 -e ’file_md5sum ("/etc/passwd")’ f59c3bfa14ac178b4098e03f9afe64fe SOFTWARE INSTALLATIONS Although the various supported platforms all have their own concept of what a software package is. 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. and bundles.Property of BladeLogic. 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. If the path does not exist or is not accessible it returns the value of -1. 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. Inc. Example: $ blquery -h solaris8 -e ’file_size ("/etc/passwd")’ 635 file_uid (path) This function returns the path’s ownership as a numeric UID. patches.

so the values are not guaranteed to be set. Note that not all platforms furnish all the above data. 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. All platforms support the concept of installed patches and software components (the names however differ from OS to OS). Note that the concept of patches is not supported on RedHat Linux systems. because the function automatically determines the platform type at runtime. which does not support patches. Bundles exist only on HPUX machines. 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. The NSH 3 . Inc. with the exception of Linux.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. where the following dynamic variables are initialized for each software/patch entry. These functions take an expression as their argument.Property of BladeLogic. 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. You do not need to specify the type of machine you dealing with. patch_installed (patch) This function will check if the software patch patch is installed on the given server. and that bundles are HP-UX specific. Example: $ blquery -h linux -e ’package_installed ("cracklib-2. 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. 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.

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

’ root daemon sys nobody noaccess nobody4 config_record_number (configfile. $1 . $N for each respective field in the current record. If you omit the expression. skip) This function returns the record number of the first record in configfile that matches the expression expr. NSH 5 . config_record_count ("/etc/passwd". 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 variable $FIELDS indicates the number of fields in the record. the function returns the total number of records. the file is found in /usr/nsh/scripts. The grammar to be used to scan a given config file is automatically determined by consulting the index file. The variable names matching the (string) fields are $0. "$5 = $HOME && printf (\"%s\n\". $0)").Property of BladeLogic. If you use it. 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". Because you often want to match against specific fields within a record.. The supported functions are: config_record_count (configfile. this function accepts an expression that it matches against each record.. The skip parameter is optional. The expr argument is optional. As its second parameter. The variable $RECORD indicates the current record number you are dealing with. it will skip over the first skip matched records allowing one to find alternate records to the first matching one. this function automatically recognizes and interprets specific variable names. the file is found in <install dir>/om/scripts. Config files are generally treated as a series of sequential records that contain a number of fields. For UNIX and Linux systems. "/"). The first record/field is 0. expr) This function returns the total number of records in the configfile that match the expression expr. Inc. For Windows systems. This function is often used with the config_field_value() function to identify the particular record you need a field value for.

"/c/WINNT/MSDFMAP. 0)’ bin NSH 6 . config_record_number ($PASSWD.BNI") set_variable ("ACCESS". 0) = $CUSTDB)"). $RECORD. records occur in a config file in no particular order. "$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". config_record_number ($INI.Property of BladeLogic. "connect CustomerDatabase") config_field_value ($INI. "/etc/passwd") set_variable ("USRBIN". "$5 = $USRBIN"). "/usr/bin") config_field_value ($PASSWD. Inc. 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". "($0 = $ACCESS) && (config_parent_field_value ($INI. If you do not know the specific record number you need a field value from. record. 0. In many cases. 1) ’ ReadWrite config_field_value (configfile. 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". field) This function returns the value of field field from record record of the config file configfile. "Access") set_variable ("CUSTDB". Example: # # Return the GCOS field of the first record in the # passwd file # $ blquery -h solaris8 -e \ ’config_field_value ("/etc/passwd". then you can use the config_record_number () function to search for a particular record.

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

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

If the user does not exist then this function returns an error message. 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. Strictly confidential and proprietary blquery(1) blquery(1) user_uid (user) This function returns the UID of the user. On Windows. Inc. the function returns an error message. 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. 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. For UNIX systems the GECOS field is returned. On Windows this value is most often not set and therefore has limited value. Example: $ blquery linux solaris -e ’user_shell ("lp")’ solaris: /bin/sh linuxdev: /sbin/nologin NSH 9 . the function returns an error message.Property of BladeLogic. If the user does not exist. 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. If the user does not exist. 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. On Windows. that field is returned. Note that the user_fullname () and user_comment () functions also return the GECOS field for UNIX systems. that field is returned. On Windows this value is most often not set and therefore has limited value. When it is set. the function refers to a start script. local user accounts have such a field associated with the account and therefore. If the user does not exist then it returns an error message. For UNIX systems the GECOS field is returned. local user accounts have such a field associated with the account and therefore.

For Windows systems.8. Example: $ blquery solaris8 -e ’user_group_gids ("root". 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. otherwise it returns 0. 2. ". or 3. Example: $ blquery solaris8 -e ’user_group_count ("root")’ 11 NSH 10 . If the user does not exist.9. The default separator is a SPACE character. with respective return values of 1. sep) This function returns a string representing a list of GIDs to which the user belongs.7. the function returns 0. The optional argument sep must be a string whose first character will be used as the separator for the list of values. 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. sep) This function returns a string representing a list of user groups to which the user belongs. Strictly confidential and proprietary blquery(1) blquery(1) user_type (user) This function returns the type of user account user is. The default separator is a SPACE character. Example: $ blquery solaris8 -e ’user_group_names ("root")’ other root bin sys adm uucp mail tty lp nuucp daemon user_group_gids (user. To display the date of last login in human readable form. Example: $ blquery win2k -e ’user_locked ("Administrator")’ 0 $ blquery solaris -e ’user_locked ("Oracle")’ 1 user_group_names (user. For Windows. If the function cannot determine a date of last login for the user. normal. There are three types of possible accounts: . Inc. The optional argument sep must be a string whose first character will be used as the separator for the list of values. and guest. There are no guest accounts for UNIX systems.2. these are inherent attributes of a user account. use the show_date () function.3.0.")’ 1.6.4. Otherwise it is a normal account.Property of BladeLogic.12 user_group_count (user) This function returns the number of groups to which the user belongs.5. account type is one of the inherent account properties while for Unix systsems an account is an administrator account if the UID is 0. administrator. the function returns an error message. For UNIX systems. 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. The users who are members of the group (space separated) COMMENT The comment string associated with the group. The numeric GID of the user.Property of BladeLogic. $ cat showgroups. Inc. NAME. 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. group_record_count (’printf ("%-10s %d\n". Example: NSH 11 . group Example: $ blquery solaris -e ’group_gid ("other")’ 1 group_comment (group) This function returns the comment field of the given local user group. The default separator is a SPACE character. Example: $ blquery win2k -e ’group_comment ("Administrators")’ Administrators have complete and unrestricted access to the computer/dom group_members (group.blq printf ("Group GID\n"). sep) This function returns a string representing a list of users who are members of the given local user group. GID)’). group_gid (group) This function returns the GID of the given local user. The group related functions are: group_exists (group) This function returns 1 if the given group exists as a local group account. Strictly confidential and proprietary blquery(1) blquery(1) For the group based functions that take an expression as an argument.blq | blquery solaris -E Group GID ----------------root 0 other 1 bin 2 . the following dynamic variables are supported. Example: blquery -e ’group_record_count ()’ 18 $ cat showgroups. NAME GID MEMBERS The groupname. printf ("-----------------\n"). If the local account does not exist it returns 0.

20. Example: $ blquery solaris8 -e ’net_subnet_mask ("IP = \"10. 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. you can use the following dynamic variables. All of these functions take an expression as an argument. The adapter’s I. ". Example: $ blquery solaris8 -e ’net_ip_address ("NAME = \"hme0\"")’ 10.*\"")’ solaris: hme0 linux: eth0 net_mac_address (expr) This function enumerates the available adapters.40\"")’ 255.Property of BladeLogic. 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. The adapter’s subnet mask in the standard 4 octet notation. and returns the I.20.P. Each hex value is treated as a two character value using lower case alpha characters. Strictly confidential and proprietary blquery(1) blquery(1) $ blquery solaris8 -e ’group_members ("uucp". address in the standard 4 octet notation.P.30.255. This argument identifies the particular adapter you want to query.")’ root. Inc. Within these expressions. address of the first interface that matches the expression expr as a string in the standard 4 octet notation.20.30.40 net_subnet_mask (expr) This function enumerates the available adapters. and returns the name of the first interface that matches the expression expr. Example: $ blquery solaris linux -e ’net_interface_name ("IP = \"10. and returns the MAC address of the first interface that matches the expression expr.0 NSH 12 . NAME MAC IP SUBNET BROADCAST The adapter’s broadcast address in the standard 4 octet notation. and returns the subnet mask of the first interface that matches the expression expr as a string in the standard 4 octet notation. The supported network functions are: net_interface_name (expr) This function enumerates the available adapters.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.uucp group_member_count (group) This function returns the number of users who are members of the local user group.255.

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

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

5100 linux: 0.Property of BladeLogic. Example: $ blquery -h solaris8 linux win2k -e ’stat_proc_count ()’ solaris8: 43 linux: 57 win2k: 38 NSH 15 .0100 linux: 0.9100 win2k: 0. Example: $ blquery -h solaris8 linux win2k -e ’stat_swap_capacity ()’ solaris8: 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. 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.0800 win2k: 0.0300 win2k: 0.0100 linux: 0. Example: $ blquery -h solaris8 linux win2k -e ’stat_mem_capacity ()’ solaris8: 0. Not all systems return a value. 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. Example: $ blquery -h solaris8 linux win2k -e ’stat_load_average ()’ solaris8: 0. Strictly confidential and proprietary blquery(1) blquery(1) sys_cpu_speed () This function returns the CPU speed in MHz.1000 stat_proc_count () This function returns the number of processes running on the system. Inc.1400 stat_mem_capacity () This function returns the percentage of memory used on the system.4100 stat_swap_capacity () This function returns the percentage of swap space used on the system.

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

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

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

There are no NSH 19 . 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. Inc. If valpath is not a valid registry path then the function returns -1. Strictly confidential and proprietary blquery(1) blquery(1) reg_value_exists (valpath) This function returns 1 if the registry value valpath exists. int. REG_MULTI_SZ Returns a string containing all strings in the multi string space separated. etc. otherwise it returns 0. REG_BINARY. REG_EXPAND_SZ Returns a string. 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. REG_NONE Returns a zero length string. use this function in conjunction with the reg_value_exists function to determine if the registry value exists. REG_SZ. Each hex value consists of two (zero filled) hex characters. and all others Returns a string consisting of the hex values of each item in the array of values. REG_DWORD_BIG_ENDIAN Returns a 32 bit integer value. REG_LINK. The supported types are: REG_DWORD. when storing the results of a reg_value command in a variable (as shown in the following examples). Since -1 is a possible valid value of a registry value. string.) depends on the registry value type.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.

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

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

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

OPTIONS --background Instructs bl_srp_agent to run in the background. 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. If you do not use this option. where <xy> is the hexadecimal value of the location of the shared memory segment. This shared memory segment is only usable for the user who ran bl_srp_agent. When you run bl_srp_agent. After entering your user information. EXAMPLE bl_srp_agent --background ORIGIN bl_srp_agent was developed by BladeLogic. 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. bl_srp_agent runs in the foreground. To reuse this shared memory segment with Network Shell. the system prompts for a user ID. After you provide this information. Inc. and role. password.bl_srp_agent(1) Property of BladeLogic. NSH 1 . Other programs can use the information cached by bl_srp_agent whether bl_srp_agent is running in the foreground or background. bl_srp_agent runs in the background with the user information cached in a shared memory segment. Inc. the system generates a message like the following: set BL_SRP_INFO to <xy> to reuse this private key.

bl_srp_agent(1) Property of BladeLogic. If you do not use this option. 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. where <xy> is the hexadecimal value of the location of the shared memory segment. After entering your user information. This shared memory segment is only usable for the user who ran bl_srp_agent. Inc. EXAMPLE bl_srp_agent --background ORIGIN bl_srp_agent was developed by BladeLogic. the system prompts for a user ID. After you provide this information. 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. To reuse this shared memory segment with Network Shell. Other programs can use the information cached by bl_srp_agent whether bl_srp_agent is running in the foreground or background. the system generates a message like the following: set BL_SRP_INFO to <xy> to reuse this private key. and role. OPTIONS --background Instructs bl_srp_agent to run in the background. When you run bl_srp_agent. bl_srp_agent runs in the foreground. password. NSH 1 . bl_srp_agent runs in the background with the user information cached in a shared memory segment.

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

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

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

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

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

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

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

To determine which password to use. -r -q host . If for some reason the user decides to revert back to the default value with which the BladeLogic agent was shipped. Inc. the RSCD Agent looks at a pre-determined registry location (see below) in which a password may be set. the RSCD Agent uses a default password shipped with the agent.. 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. then the user should remove the RSCD registry location from the registry and delete the BladeLogicRSCD user. This command does not prompt for the old password as the default password with which the agent was shipped is unknown to the user. The name of the hosts to be updated. When the RSCD Agent comes up on a Windows server. By default chapw displays information about the progress of the update. If a password was not specified with the -p option. In addition.. If the registry location is not found/set.. Servers that are not Windows servers are not updated and an appropriate error message is output. With this option only error messages are output.] 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.chapw(1) Property of BladeLogic. then this option will cause chapw to automatically randomly generate a 16 character password.. In addition. it needs to impersonate the BladeLogicRSCD user (created at install time) in order to have the privileges it requires to run properly. 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 . -p passwd By default one is prompted to enter (and confirm) the desired password. With this option one can specify the desired password as an argument. To this end. the RSCD Agent needs to supply a password to the OS. 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. SEE ALSO rscd (1) NSH 1 .

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

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

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 .e. Output a message for each file whose permissions are being changed. File whose mode you want to change. This option tells chmod to change the permissions of a file ONLY if the file is not a directory (i. and files encountered while doing a recursive (-R) permissions change. op perms OPTIONS -R -d -f -v -? mode file NSH 1 . This includes both files specifically named in the command argument list.. See the DESCRIPTION section above. This includes both files specifically named in the command argument list.. and files encountered while doing a recursive (-R) permissions change. chmod silently skips it. regular files. Inc. mode can be an absolute octal value.. This can be a useful option in a recursive change of permissions if one does not want to change the permissions of any directories. chmod silently skips it. . The permissions changes you want to make. If chmod encounters a file that is not a directory. then chmod will recursively descend the directory and change the appropriate permissions of all files and sub-directories below it. since directories usually have different permissions than files. etc). Output a brief summary of available options and then exit with a zero status without changing any permissions. This can be a useful option in a recursive change of permissions if you only want to change the permissions of directories. or a series of comma separated instructions. special files.chmod(1) Property of BladeLogic. DESCRIPTION chmod changes the mode or access permissions of the named file(s) to mode. This option tells chmod to change the permissions of a file ONLY if the file is a directory.. If chmod encounters a directory. Strictly confidential and proprietary chmod(1) NAME chmod − Change the mode (protection attributes) of a file SYNOPSIS chmod [-Rdfv?] mode file . This can be useful to monitor the progress of a recursive permissions change. 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. each having the following format: [who][op][perms] The who section determines whose permissions are to be changed.

write. Inc. 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 for user. The second example adds execute permission to other users and read. chmod was unable to access one of the directories in a recursive change of permissions. chmod was unable to access the file it was trying to change ownership of. Unknown option or missing file argument. NSH 2 . $ chmod 0755 myprog $ chmod o+x. execute permissions for the owner of the file.u+rwx //madrid/u1/myprog DIAGNOSTICS chmod: Invalid mode (mode) The mode you specified contained unknown characters. execute for both the group and other users). ORIGIN chmod was written by Thomas Kraus.chmod(1) Property of BladeLogic. Strictly confidential and proprietary chmod(1) EXAMPLE The first example changes the permissions of the file myprog to 755 (read. Unable to get a license to use the software. and read. 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.

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

Unknown option or missing file argument. Strictly confidential and proprietary chown(1) EXIT CODES 0 1 2 3 4 255 No errors detected. The -h option may have no effect on systems that do not support the appropriate system call to perform this action (lchown(2)). NSH 2 . SEE ALSO chgrp(1). Inc. chown encountered an unknown GID or UID. the UID and GID of the user/group as defined on the local host is used.chown(1) Property of BladeLogic. Consequently. 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. chown was unable to access the file it was trying to change ownership of. 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. ORIGIN chown was written by Thomas Kraus.

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

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

algorithm 2 is used. The second example uses the historic AT&T algorithm for all files in the directory /home/data on host ottawa. With the P_ATT variable set. algorithm 1 is used. 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. UNIVERSE BEHAVIOR The universe setting only takes affect when the sum version of the command is used and no checksum type has been selected. A system error message follows the output of the error message. Strictly confidential and proprietary cksum(1) EXAMPLE The first example prints out the checksum for two password files using the new improved checksum algorithm. Berkeley and its contributors. NSH 2 .cksum(1) Property of BladeLogic. SEE ALSO sum(1). When the P_BSD variable is set (Berkeley behavior). COPYRIGHT Please read the Copyright notice in intro(1) section of documentation. $ 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). Please see the intro section for complete acknowledgments. Inc. ORIGIN Cksum includes software developed by the University of California.

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

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

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

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

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

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

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

Don’t actually make any changes. cp overwrites it. so that. and access and modification times as the source file. When copying to a directory. -f -m -n -o -p -P -r -s suf NSH 1 . cp creates copied files with the same names as the source files. By default. then cp overwrites the file. Set the suffix for backup files to suf. dir DESCRIPTION cp makes copies of files. With this option. 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. By default. Preserve parent. In the first form. when cp creates a new file. The default suffix for files being backed up is "˜" (foo. You can use the -s suf option to specify a different suffix. Synchronize file permissions.cp(1) Property of BladeLogic. When the destination directory does exist. so that the target file inherits the same file permissions as the source file. This option turns off the -i option. If the target directory does not already exist. By default. In the second form. cp appends the target file name with the suffix "˜". With his option. If the destination directory does exist. then cp recursively copies all files and sub-directories from the directory into the target directory. 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. cp copies the contents of one file to a second file. two consecutive copies to the same destination directory will always produce the same result.. If the destination directory does not exist.c becomes foo. OPTIONS -b -i Backup the target file. Inc. 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 . cp copies multiple files into a directory. if the target file already exists. If the user confirms with an entry beginning with the letter y.. See UNIVERSE BEHAVIOR for details on how this option interacts with the -f option.c˜) This option alone does not turn on the file backup feature. If the target directory does already exist. before copying over the new source file. if one of the files to be copied is a directory. when cp copies a directory. This option deletes the target file before the copy begins. if it exists. it will retain its current file permissions after cp overwrites it. 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. To turn on the file backup feature. and inherits the ownership of the calling user. use the -b command. If a target file already exists. If the target file already exists. cp always acts as if the destination directory does not exist. Synchronize file ownerships. then cp will prompt the user to see if the user wants cp to overwrite the file. This also applies to new directories being created. By default. cp will attempt to give the target file the same ownerships (UID/GID). cp creates it and copies the content into it. the new file gets the same permissions as the source file. and copies the content into it. cp does not create or remove any files or directories. then it retains its current permissions and ownerships. then cp will create the new target directory within the (existing) target directory. it behaves differently depending on whether or not the destination (directory) already exists. cp creates a new directory inside of the existing directory. then cp will create the directory as required. 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. and is consequently overwritten. for example. With the -P option.

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

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

Output a usage message and exit with a 0 exit code.’) character as the field separator. This option is often used in conjunction with the -x option. Do not output the root node tag. OPTIONS -<number> By default. With this option. -h By default csv2xml assumes that the first line of the CSV input is a header line.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 . The -s option lets you specify the first character of sep as the field separator. Do not output the XML header entry.4. in the format of column-<record number>. hostname) that can be used as an identifier.21-4.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 (’. record names are numbered sequentially starting from 1.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. csv2xml uses the value of column (field) <number> of the respective line as the record name. With this option. -n name By default the master XML tag is called csv2xml. The -q option lets you specify the first character of quote as a string delimiter. and in turn XML tags. Use this option only if you will be embedding the output into another XML document. 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. This can be useful if the CSV input contains a unique field (for example. Inc. It uses this header line to name the columns of input. csv2xml generates column names. athens% nover -c -h london rome | csv2xml -1 -n "Host Overview" <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?> <csv2xml name="Host Overview"> <record name="london"> <HOSTNAME>london</HOSTNAME> <OS>RedHat ES3</OS> <MAINT>2. The -n option lets you specify name as the master XML tag.

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

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

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

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

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

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

unlike with −c. with C preprocessor controls included so that a compilation of the result without defining string is equivalent to compiling file1. . It cannot be digested by ed(1). Lines which are changed from one file to the other are marked in both files with ‘! ’. −D string Creates a merged version of file1 and file2 on the standard output. all lines to be changed (added and/or removed) are present in a single section.DIFF (1) PropertyGeneral Commands Manual System of BladeLogic. Produces output in a form suitable as input for the editor utility. −U number Like −u but produces a diff with number lines of context. differ” if files contain binary characters. 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. Output options (mutually exclusive): −c Produces a diff with 3 lines of context. Use of this option forces diff to produce a diff. Changes which lie within 3 lines of each other are grouped together on output.’. . Inc. but in the opposite order and with a count of changed lines on each insert or delete command. Extra commands are added to the output when comparing directories with −e. Just print a line when the files differ. 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. However. Normally diff will simply print “Binary files . This is the form used by rcsdiff(1). 2003 1 . those added to file2 are marked ‘+ ’. −f −n −q −u Identical output to that of the −e flag. −e −C number Like −c but produces a diff with number lines of context. which can then be used to convert file1 into file2. while defining string will yield file2. No output is produced if the files are identical. The lines removed from file1 are marked with ‘. Comparison options: −a Treat all files as ASCII text. Does not output a list of changes. 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. ed(1). A unified diff is similar to the context diff produced by the −c option. Produces a script similar to that of −e. Produces a unified diff with 3 lines of context.

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

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

BSD July 21. 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.DIFF (1) PropertyGeneral Commands Manual System of BladeLogic. 2003 4 . Inc.

while preserving the file ownerships. 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. then cp will prompt the user to see if the user wants cp to overwrite the file. cp appends the target file name with the suffix "˜". If the user confirms with an entry beginning with the letter y. it leaves it alone. If a target file already exists. changing the target file’s permissions if necessary. -d Use this option with care. turned on the following options: -r. Inc. and access times. because the security models for file permissions may differ. before copying over the new source file. You can use the -s suf option to specify a different suffix. -f. however when running dsync. -b -i Backup the target file. Note that you need root permissions to change file ownerships. The following options are the common options between cp and dsync with dsync having. All options are described here. OPTIONS The dsync command has the same options as the cp command with the addition of the -d option. permissions. 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. it attempts to synchronize the contents of two directories. if dsync finds a file that does not need to be updated.dsync(1) Property of BladeLogic. be careful about using this option when you are copying between UNIX and Windows type systems. and -u. 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. because the security models for file ownerships may differ. By default. then cp overwrites the file. if it exists. The default behavior of dsync is equivalent to making a conditional copy with the cp command. by default. Be careful about using this option when you are copying between UNIX and Windows type systems. Synchronize file permissions for files that do not need to be updated. Also. if dsync finds a file that does not need to be updated. (The -P option is not turned on by default. See UNIVERSE BEHAVIOR for details on how this option interacts with the -f option. When you run cp as dsync. then it will be created. -o Synchronize file ownerships for files that do not need to be updated. -p. $ 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. By default. it leaves it alone. 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. -m NSH 1 . because it deletes any files/directories in the target (dir2) directory that are not in the source (dir1) directory. If the target directory dir2 does not exist. 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. it has same behavior as if -P had been turned on). By default.

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

Unable to get a license to use the software. ORIGIN dsync was written by Thomas Kraus. dsync: Unable to create file filename If dsync cannot create 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. dsync: Unable to create directory dirname When dsync is recursively copying a directory. EXAMPLE The first example synchronizes the content of the www directory with the www directory on the machine webserver. indicating that the copy may not be complete. it traverses the source directory hierarchy. 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(1) Property of BladeLogic. it will output this message. it will output this message. then with the P_BSD variable set (Berkeley behavior). NSH 3 . If dsync is not able to create one of these directories. the -i option will override the -f option. dsync: Target file (filename) must be a directory When copying multiple files to a directory. dsync: Unable to access file filename dsync: Unable to read file filename If dsync is unable to access the source file filename. indicating that it cannot copy directories. along with the possible reason as to why it could not create the file filename. If dsync has a problem accessing a directory. then dsync outputs this message. Inc. this message will appear if the target directory (last argument) is not a directory. it outputs this message. dsync: Error writing to file filename If an error occurs while copying a file into the new target file. this message will appear if dsync is unable to access the target directory (last argument). dsync was unable to copy all files requested. along with the possible reason as to why it was not able to access the file. The second example does the same as the first. it may need to create new directories in the target directory tree. Unknown option or missing file argument. dsync outputs this message. 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. With the P_ATT variable set. the -f option will override the -i option. but it gives verbose output and it deletes any files and directories on the webserver which do not exist in the local www directory. UNIVERSE BEHAVIOR If you specify both the -i and -f options. dsync: Unable to access directory dirname When dsync is recursively copying a directory. it outputs this message.

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

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

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

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

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

OPTIONS -d or -D Specifies the separator character used to distinguish the individual fields. If you specify a negative field number. the entire data row is extracted. % 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 space character (’ ’) is used as the default separator. such as 5. It contains fields separated by the ’:’ character. the fifth field from the start of the data row is extracted. If this option is not provided. If the field number is 0. Inc.fields(1) Property of BladeLogic. the second field from the end of the data row is extracted. 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. A field separator distinguishes the fields in each row. EXAMPLES Consider the following input file. If you specify a positive field number. such as -2.

Inc. 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. NSH 2 .fields(1) Property of BladeLogic.

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

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

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

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

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

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

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

The operators are listed in order of decreasing precedence. It evaluates to true if the expression is false. The expression evaluates to true if either the first or the second expression is true. !expression This is the unary NOT operator. a preceding minus sign means “less than n”.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.FIND (1) PropertyGeneral Commands Manual System of BladeLogic. EXAMPLES Print out a list of all the files whose names do not end in “. and neither means “exactly n”. expression -or expression The -or operator is the logical OR operator. The second expression is not evaluated if the first expression is true.c”: $ find / \! -name ’∗. Strictly confidential and proprietary FIND (1) -type t True if the file is of the specified type. A preceding plus sign means “more than n”. then uname is treated as a user ID. All primaries which take a numeric argument allow the number to be preceded by a plus sign ( ‘+’ ) or a minus sign ( ‘−’ ) . 1999 4 . All operands and primaries must be separate arguments to find. (expression) This evaluates to true if the parenthesized expression evaluates to true. expression -and expression expression expression The -and operator is the logical AND operator. As it is implied by the juxtaposition of two expressions it does not have to be specified. OPERATORS The primaries may be combined using the following operators. If uname is numeric and there is no such user name. Inc. The expression evaluates to true if both expressions are true. 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. 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.

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

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

Inc.domaincomponent2..domaincomponent1...com The following example shows host2 being resolved from host3’s local name resolution database (/etc/hosts). in that particular sequence. DNS.Property of BladeLogic..conf like file.. <local> .. <local> <dns> .domaincomponent1.conf like file... 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. If multiple hostnames are specified. 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. in that particular sequence.. only the first hostname from the left in the given hostname list is considered.com <nis> .conf like file on the operating system. <dns> . <dns> host2. Example 2 [host3] $ fqdn -a host2 <local> .conf like file.. <dns> . and NIS.conf like file... Empty sections signify either absence of the hostname in the name resolution database or unavailability of the database. <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. -a Print fqdn of the current hostname resolved using all the name resolution databases specified along the hosts stanza of the nsswitch.. -a <hostname> Print fqdn of <hostname> resolved using all the name resolution databases specified along the hosts stanza of the nsswitch. 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.. <nis> .. <local> . <nis> ... OPTIONS -u Print usage. <nis> NSH 1 . EXAMPLES Example 1 [host1] $ fqdn host1 host1.

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

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

93) 2 .Misc. Inc. 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.

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

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

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

Inc. NSH 3 .grep(1) Property of BladeLogic. grep(1) HISTORY The grep command appeared in Version 6 AT&T UNIX. 20 or 25. 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.

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

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

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. %o. where a block is defined as the largest amount of data specified by any format string. %c %d. two and four byte counts supported. The input is manipulated in ‘‘blocks’’. Characters greater than 0xff. octal or hexadecimal respectively. Output US ASCII characters. %x %E. which is the iteration count times the byte count. %u. when all of the input data has been processed. 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. o. of the next byte to be displayed. have the iteration count incremented until the entire input block has been processed or there is not enough data remaining in NSH 2 . Strictly confidential and proprietary An asterisk (*) may not be used as a field width or precision. The conversion characters ‘‘h’’. _A[dox] Identical to the _a conversion string except that it is only performed once. The appended characters d. which are displayed as two character strings. Four byte default. Nonprinting characters are displayed in three character. %i. Inc. are displayed as hexadecimal strings. or the iteration count times the number of bytes required by the format if the byte count is not specified. %_u. %g One byte counts only. ‘‘p’’ and ‘‘q’’ are not supported. _c Output characters in the default character set. whose last format unit both interprets some number of bytes and does not have a specified iteration count.’’. cumulative across input files. %_p. hexadecimal. except for those representable by standard escape notation (see above). and x specify the display base as decimal. 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). four byte counts supported. lower-case. Output characters in the default character set. zero-padded octal. Format strings interpreting less than an input block’s worth of data. names. %f. Nonprinting characters are displayed as a single ‘‘. %e. ‘‘n’’. one. Eight byte default. with the exception that control characters are displayed using the following.hexdump(1) + + + + Property of BladeLogic. _p _u The amount of data interpreted by each format string is the sum of the data required by each format unit. %X. %G. ‘‘l’’.

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

8 Last change: 23 October 1988 1 . Inc. 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. front-end for grep. DESCRIPTION SEE ALSO grep(1) BUGS Meta-characters are not handled. but cute. It takes the results of the grep and highlights the word that was searched for. SunOS 5. Quoting is not handled.

OPTIONS hostname has no options. NSH 1 . This command does NOT let you set the name of the current host. Inc. ORIGIN hostname was written by Thomas Kraus SEE ALSO uname(1).hostname(1) Property of BladeLogic. 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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

of the specified line is known. Replaced by the percent into the current input file. of the specified line is known. True if the line number of the specified line is known. 2003 16 . True if the size of the current input file is known. Causes any trailing spaces to be removed. True if at end-of-file. Replaced by the total number of input files. based on byte offsets. are included in the prompt. any characters following the question mark and condition character. True if there is an input filename (that is. as with the %b option. Usually used at the end of the string. If the condition is true. such characters are not included. based on byte offsets. a condition is evaluated. Replaced by the name of the current input file. Replaced by the line number of a line in the input file. True if the percent into the current input file. If the condition is false. if and only if the IF condition is false. True if this is the first prompt in a new input file. The line used is determined by the X. but may appear anywhere. a question mark is printed instead. A question mark followed by a single character acts like an "IF": depending on the following character. BSD January 17. The format of the prompt string can be changed depending on certain conditions. If any item is unknown (for example. 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. Replaced by the index of the current file in the list of input files. up to a period. The line used is determined by the X. True if there is more than one input file. Inc.LESS (1) PropertyGeneral Commands Manual System of BladeLogic. True if the page number of the specified line is known. as with the %b option. See the discussion of the LESSEDIT feature below. True if the percent into the current input file. based on line numbers. 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 line number of the last line in the input file. based on line numbers. the file size if input is a pipe). Same as %B. True if the byte offset of the specified line is known. if input is not a pipe). 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. as with the %b option. True if the text is horizontally shifted (%c is not zero). Replaced by the name of the next input file in the list. or the EDITOR environment variable if VISUAL is not defined). The line to be used is determined by the X. 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.

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

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

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

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

the value of LESSKEY is used as the name of the output file. The −V or −−version option causes lesskey to print its version number and immediately exit. by default $HOME/. a standard filename is used as the name of the input file. or be prefixed by a caret to indicate a control key. If the input file is ‘-’. If the environment variable LESSKEY_SYSTEM is set. and the environment variable LESSKEY is set. If a key is defined in both a local lesskey file and in the system-wide file. less(1) uses that as the name of the system-wide lesskey file. other options and arguments are ignored. The output file is a binary file which is used by less(1). A system-wide lesskey file may also be set up to provide key bindings. The input file consists of one or more sections.less is used. Otherwise. A backslash followed by one to three octal digits may be used to specify a character by its octal value. #line-edit Defines new line-editing keys.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). a standard filename is used as the name of the output file. The string may be a single command key. Possible sections are: #command Defines new command keys. from the list below. except for the special section header lines. #env Defines environment variables. If −V or −−version is present. Otherwise. 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. If no output file is specified. If the output file already exists. Each section starts with a line that identifies the type of section. The characters in the string may appear literally. The string is the command key(s) which invoke the action. by default $HOME/. standard input is read.lesskey . The input file is a text file which describes the key bindings. COMMAND SECTION The command section begins with the line #command If the command section is the first section in the file. The action is the name of the less action. lesskey will overwrite it. less(1) looks in a standard place for the system-wide lesskey file: On NSH the system-wide lesskey file is /etc/sysless . 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 . Blank lines and lines which start with a pound sign (#) are ignored. this line may be omitted. or a sequence of up to 15 keys. key bindings in the local file take precedence over those in the system-wide file. If no input file is specified.

This feature can be used in certain cases to extend the functionality of a command. For example. The extra string has a special meaning for the "quit" action: when less quits. When such a command is entered while running less. An action may be followed by an "extra" string. see the ‘{’ and ‘:t’ commands in the example below. and then the extra string is parsed.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. tab and the backslash itself. space. Characters which must be preceded by backslash include caret. the action is performed. 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 . just as if it were typed in to 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 .

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 . 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. a key may be defined to do nothing by using the action "noaction". you must provide sufficient commands before the #stop line to enable all necessary actions. but not for a "noaction" command. 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. The line-editing section consists of a list of keys and actions. failure to provide a "quit" command can lead to frustration. Alternatively. Since all default commands are disabled.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. A default command key may be disabled by including it in the input file with the action "invalid". "noaction" is similar to "invalid" but less will give an error beep for an "incalid" command. in a manner similar to the way key bindings for ordinary commands are specified in the #command section. Be aware that #stop can be dangerous. The #stop line should be the last line in that section of the file.

/etc/sysless Default system-wide lesskey file. the main purpose of assigning variables in the lesskey file is simply to have all less configuration information stored in one file. If environment variables are defined in more than one place. Although the lesskey file can be used to override variables set in the environment. variables defined in a local lesskey file take precedence over variables defined in the system environment. in a keyboard-independent manner.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. Each line consists of an environment variable name.less Default lesskey file. Whitespace before and after the equals sign is ignored. FILES $HOME/. and specifies the character set to be "latin1" : #env LESS = -i LESSCHARSET = latin1 ENVIRONMENT LESSKEY Name of the default lesskey file. which take precedence over variables defined in the system-wide lesskey file. NSH 5 . an equals sign (‘=’) and the value to be assigned to the environment variable. SEE ALSO less(1) CAVEATS It is not possible to specify special keys. Variables assigned in this way are visible only to less. LESSKEY_SYSTEM Name of the default system-wide 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. $HOME/. such as uparrow.lesskey Default lesskey input file. The following input file sets the -i option whenever less is run.

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

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

An unknown option was given. EXIT CODES 0 1 2 255 No errors detected. This implementation was selected to closely resemble System V. The -n option causes ln not to overwrite existing target files. This is not possible to do. ORIGIN ln was written by Thomas Kraus NOTES With regards to the available options for the ln command. This message is followed my an appropriate system error message. avoid using it except in exceptional cases. and the target file already exists. ln: Will not create link file filename: File exists You used the -n option. Inc. This message is followed my an appropriate system error message.ln(1) Property of BladeLogic. ln: Unable to create symbolic link to file filename An error occurred while trying to create a symbolic link to the file filename. Unable to get a license to use the software.4 and also to be behave in a similar way as other NSH commands. SEE ALSO link(1). CAVEATS Since link does not perform any error checking. 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. NSH 2 . You should normally use the ln command. then the target file must be a directory. ln: Unable to create link to file filename An error occurred while trying to create a hard link to the file filename. The target file is not a directory. 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. One of the files to be removed was not removable.

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

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

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

The available options for the man command differ from system to system. OPTIONS -h -? The name of the host that contains the man page. Because of this. man does not know on which host to look for man pages. Normally. found on the host dublin (as defined by the P_MANHOST variable). man will check the shell variable P_MANHOST for the name of a host. man displays the output of the remote man command. $ 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. CAVEATS Some versions of man automatically redirect their output to the more command for easier browsing. EXIT CODES 0 1 2 255 No errors detected. If you do not specify this option. Unable to get a license to use the software. Output a brief summary of available options and then exit with a zero status without displaying any man pages. 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. No data was returned from the remote host. This version of man does not. Inc. man was unable to determine where to look for the man page.man(1) Property of BladeLogic. thus letting you effectively access the man page on the remote host. using the -h host option. 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. 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. NSH 1 . EXAMPLE The first example prints the man page for the command man which is found on the host dublin. The second example prints the man page for the command wait in section 2 of the man pages.

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

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

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

EXIT CODES 0 1 2 255 No errors detected. Inc. You specified an unknown option or an option was missing. NSH 1 . Unable to get a license to use the software.mkfifo(1) Property of BladeLogic. Strictly confidential and proprietary mkfifo(1) NAME mkfifo − Create named pipe (FIFO) SYNOPSIS mkfifo name ... ORIGIN mkfifo was written by Thomas Kraus SEE ALSO mknod(1). EXAMPLE The first example creates the named pipe mypipe in the local directory. mkfifo was unable to create the special file. 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. this error message will appear along with an appropriate system message. You cannot create a special file if a file of that name already exists. CAVEATS You must be a super user to create character and block special files. 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.

EXAMPLE The first example creates the named pipe mypipe in the local directory. Unable to get a license to use the software. As the second argument. As the second argument. The second argument specifies the type of special file. 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. the name of the special file you want to create. You cannot create a special file if a file of that name already exists. You specified an unknown option or an option was missing. this error message will appear along with an appropriate system message. tells mknod to create a character special file. CAVEATS You must be a super user to create character and block special files. mknod was unable to create the special file. NSH 1 . Inc. ORIGIN mknod was written by Thomas Kraus. EXIT CODES 0 1 2 255 No errors detected. If you create a character or block special file.mknod(1) Property of BladeLogic. tells mknod to create a named pipe (FIFO). tells mknod to create a block special file. As the second argument. or a block special file (b). which can be either a named pipe (FIFO) (p). you must also specify the major and minor number of the device. 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. 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. The first argument is the name of the special file. The minor number of the character/block special file. The major number of the character/block special file. a character special file (c).

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

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

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

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

Truncate each line of output to the actual screen width. EXAMPLE This example shows how to view CPU information for multiple hosts (and operating systems). Switch to memory info view. wildcards are supported. nnet(1). Inc. nmem(1). 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. ORIGIN ncpu was written by Thomas Kraus SEE ALSO blexpr(1). Switch to system info view. ndf(1). Switch to statistics view. CAVEATS The -t option mimics the top command’s behavior.Property of BladeLogic. Switch to network info view. See the EXPRESSIONS section below for more details. and OR. When an expression is used to match a string. 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. Switch to process summary view. Switch to process info view. Expressions can contain multiple operators and operands. including NOT.8 This example shows how to view non-numeric slot information using ncpu2. 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. but does not mimic it exactly. The expression should be a single argument surrounded by single quotes. For full details on expressions.8 GenuineIntel Intel(R) Pentium(R) 4 CPU 2. see the man page for blexpr. nstats(1) NSH 2 . AND. Switch to disk info view. nps(1).

Only show entries which match the given expression. Inc. addresses. The values must be resolvable hostnames or valid I.] [-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. 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.P. Inc.P. 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 . You can specify multiple space separated hostnames without needing to re-specify the -h option. -h hosts Specify the list of hosts from which to get the disk usage information. With the -i option you can specify an alternate field to sort on. This option overrides the -t option. -r -s field Sort in reverse order. Property of BladeLogic.. The data it displays is displayed in columns as follows: HOSTNAME The name of the host the entry applies to. Behave top like. See the -s option below. Load the list of servers from which to get disk usage information. The field should be one of the column headers as described above.. By default ndf sorts in reverse order (largest to smallest) on the disk usage capacity. The file should be a flat file containing either resolvable hostnames or valid I. Do not show a header on output. With this option the data is displayed such that it is truncated by screen size and repeated periodically. Comparisons are made case neutral. The following keyboard commands are available while in top mode. addresses. MOUNTED ON The directory (or drive) associated with the disk partition OPTIONS The following options are available to modify the behaviour of ndf. See the -f option below. -c -e expr -f file -H Output disk usage information as a set of comma separated values. <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 . Please see the EXPRESSIONS section below for more details.ndf(1) Property of BladeLogic.

7. Switch to network info view. nmem(1). Switch to memory info view. Inc. Switch to system info view. Inc.e. Switch to process summary view.4. nover(1).6.8. nstats(1) NSH 2 . Property of BladeLogic. and OR. ndf(1) Define an expression used to filter the output data. Switch to process info view. or 0 (10). Please see the EXPRESSIONS section below for more details. 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. AND. Truncate each line of output to the actual screen width.3. Expressions can contain multiple operators and operands. When an expression is used to match a string. nps(1).9. ORIGIN ndf was written by Thomas Kraus SEE ALSO blexpr(1).2.5. CAVEATS The top like behaviour is not meant to exactly mimic the top command. wildcards are supported. Switch to disk info view. nnet(1). enclose the expression in single quotes). The expression should be a single argument (i. 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. including NOT. Switch to statistics view. see the man page for blexpr. you can define an expression used to filter the output data.ndf(1) Property of BladeLogic. For full details on expressions..

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

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

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

To deal with this nexec will now. then one should use the -r (raw) option to have no transcoding done. With this option stdin is not read and as such should only be used with commands that do not require any input.0 introduced some synchronization fixes to the nexec protocol. input (stdin) captured by the nexec client is converted to UTF-8 before it is sent to the agent where. Tells nexec to ignore the value of the TERM variable and use term instead as the terminal type. This assumes that the generated output consists of proper code page sequences. It must be a batch (output only) command. Inc. 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. Imagine for example. By default. by default. If this type of behaviour is not wanted. 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. It should be noted that if there are any transcoding issues. In the same way. See INTERNATIONALIZATION ISSUES below for more details. As such the output will be not very useful. -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. When using the nexec command to execute a command on a Windows host. As such. 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. As this automatic transcoding may not always be desired there is the -r option to have all data dealt with in raw mode. is converted to the local code page. 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. nexec will read all data it gets from stdin and sent it to the remote command as standard input (stdin). -nohup hostname "cmd &" Executes a command in the background on the specified server.3 or later. -o -r -u Use the legacy version of the nexec protocol. Now imagine that from the Windows server one kicks off a command (via nexec) on the Solaris server that generates Japanese output. Do not transcode input/output. random binary data may not be converted properly and invalid and/or unrecognized sequences will be converted to question marks (’?’). Strictly confidential and proprietary -n nexec(1) Leave stdin alone (do not read any data from stdin).nexec(1) Property of BladeLogic. automatically transcode data. 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. See examples below. meaning no auto transcoding. Use this option to tell nexec not to use the synchronization fixes. This allows you to securely tunnel X11 traffic using the same security features as other NSH utilities.0. before it is passed to the application. that unrecognized characters are replaced with question marks (’?’). the command to be executed cannot be an interactive command. Release 7. This option is available on agents running 7. 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 .

the second field (<path_to_foobar>) is an optional path to the remote executable. nexec(1) NETWORK SHELL UTILITIES To have the Network Shell seamlessly execute remote programs.. 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. 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. Inc. For more information. 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. take the following steps. see the nsh man page. 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. In the second example all entries in the file are handled as nexec is not reading stdin input. 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. In the first instance. First. # # # # # cd ‘cat /usr/lib/rsc/HOME‘ cd bin ln -s nexec foobar cd . The following example shows how a remote utility called foobar can be configured for remote execution.nexec(1) Property of BladeLogic. host% cat hosts NSH 3 ./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.

SEE ALSO rsh(1).com In the following example. ORIGIN nexec was written by Thomas Kraus. 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. 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. Similarly. An option may not be universal to all platforms.com Hostname for rome is: rome.nexec(1) Property of BladeLogic.com Hostname for lisbon is: lisbon. The best example of this is the ps command. While the nexec command does support the ability to interface remote interactive commands.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.bletch. NSH 4 . and programs needing full Console support may hang or not function as expected. this capability is currently limited on Windows machines to simple input/output programs.bletch. Its options vary drastically between BSD and ATT systems. Inc.bletch.

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

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

nmem(1) Property of BladeLogic. you can define an expression used to filter output data. When an expression is used to match a string.6. Property of BladeLogic. Expressions can contain multiple operators and operands. nmem(1) Define an expression used to filter the output data. 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. The expression should be a single argument (i.4.5. Switch to system info view. ORIGIN nmem was written by Thomas Kraus SEE ALSO blexpr(1). -w Truncate each line of output to the actual screen width.3. Inc.9. For full details on expressions. CAVEATS The top like behaviour is not meant to exactly mimic the top command. Switch to disk info view. or 0 (10). Switch to process summary view. Please see the EXPRESSIONS section below for more details. 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). see the man page for blexpr.2.e. ndf(1). AND. Switch to network info view. Inc.. Switch to process info view. Switch to statistics view. Switch to memory info view. wildcards are supported. nstats(1) NSH 2 .7. and OR. including NOT. enclose the expression in single quotes).8. nps(1).

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

2.3. but does not mimic it exactly. Strictly confidential and proprietary # -w Decrease wait time between refreshes by 1 second. Replace the # character with 1. see the man page for blexpr. nmem(1). Truncate each line of output to the actual screen width. nps(1). 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. For full details on expressions. nnet(1) Sort on the specified column. ORIGIN nnet was written by Thomas Kraus SEE ALSO blexpr(1). or 7. The expression should be a single argument surrounded by single quotes. CAVEATS The -t option mimics the top command’s behavior.nnet(1) Property of BladeLogic.5. nstats(1). Inc.4.6. nover(1). ndf(1) NSH 2 .

Otherwise. .out cannot be created in the current directory. it is directed to the same place as the standard output. The nohup utility shall exit with one of the following values: 126 127 The utility was found but could not be invoked.2”) compatible. BSD June 6. 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. If standard error is a terminal. the nohup utility uses the directory named by HOME to create the file.out in the current directory. ENVIRONMENT HOME If the output file nohup. the standard output is appended to the file nohup. Inc.NOHUP (1) PropertyGeneral Commands Manual System of BladeLogic. 1993 1 . The utility could not be found or an error occurred in nohup.2 (“POSIX. . 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. SEE ALSO signal(3) STANDARDS The nohup command is expected to be IEEE Std 1003.

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

Switch to memory info view. CAVEATS The top like behaviour is not meant to exactly mimic the top command. you can define an expression used to filter output data. Expressions can contain multiple operators and operands. nover(1) Define an expression used to filter the output data. Switch to statistics view. Property of BladeLogic. For full details on expressions. Please see the EXPRESSIONS section below for more details. and OR. enclose the expression in single quotes). host% nover -h solaris8 linux HOSTNAME OS MAINT linux RedHat ES3 2. wildcards are supported. Switch to process info view. The expression should be a single argument (i. nps(1).8. Switch to network info view.9.6. When an expression is used to match a string.4.21-4. Switch to process summary view.5. Switch to system info view.e.2. Truncate each line of output to the actual screen width. 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. nmem(1). ORIGIN nover was written by Thomas Kraus SEE ALSO blexpr(1).nover(1) Property of BladeLogic.4. EXAMPLE The following illustrates a simple example of viewing an overview of multiple hosts (and operating systems). including NOT. see the man page for blexpr.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. Switch to disk info view.7.3. ndf(1). nstats(1) NSH 2 . AND.EL solaris8 SunOS 5. Inc. Inc.. or 0 (10). nnet(1).

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

Switch to process info view. nmem(1). Define an expression to filter the output data. Switch to network info view. Switch to system info view. Replace the # character with 1. including NOT. For full details on expressions. Truncate each line of output to the actual screen width. Sort on the specified column.5.4. See the EXPRESSIONS section below for more details. Expressions can contain multiple operators and operands. nnet(1).2. When an expression is used to match a string. nps(1). Inc. Switch to statistics view.6. CAVEATS The -t option mimics the top command’s behavior. AND. wildcards are supported. nstats(1) NSH 2 . but does not mimic it exactly. 7 or 8.3. 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. The expression should be a single argument surrounded by single quotes. ORIGIN nprocsum was written by Thomas Kraus SEE ALSO blexpr(1). Switch to disk info view. nover(1). and OR. see the man page for blexpr. 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. Switch to memory info view. Switch to process summary view.Property of BladeLogic.

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

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

You can never access the root of a drive. NSH 1 . then a drive is irrelevant because the root directory itself is the highest point you can access on the directory tree. 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 -. The Network Shell is a link to a distributed version of zsh. When you cd to a new host. If you have set a root directory. the \h sequence takes on a new value. such as C:. Inc. you do not have to include the drive letter in the name.34 #1 Fri May 8 16:05:57 EDT 1998 i586 i386 otter $ vi termcap When you access a remote host. then the Network Shell environment defaults to the <SYSTEMDRIVE> drive. If you have not set a root directory and you do not provide a drive letter. explicitly mention the drive letter as shown in the following examples: $ /bin/nsh unix $ cat //windows/c/autoexec. 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.EXE In Network Shell. the shell connects you to the // (root) directory. 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. you should also specify a directory.assuming the default shell prompt (PS1) has not been previously set. To access other drives on the computer. nor can you access any other drives. If you do not. you should treat the drive letter as a directory even though that differs from how Windows treats drives. 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. It does not provide a detailed description of Network Shell behavior. as the following example illustrates.0. 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.bat unix $ cd //nt/d nt $ ls /e/*.Property of BladeLogic.

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

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

Next. Inc. it is a good idea to call the disconnect command occasionally.nshprofile $ZDOTDIR/. The network connection to the host on which the current directory exists is not closed even if specifically asked to do so. They can be included in your PATH or expressed as an absolute pathname. which causes the output file to be opened for both read and write. The NSH differs from ZSH in that all startup/shutdown files are prepended with nsh instead of z or zsh. When accessing relatively few remote hosts.nshlogin $ZDOTDIR/. these connections remain open until the user exits the shell or executes the disconnect command.nshrc $ZDOTDIR/. STARTUP/SHUTDOWN FILES See the zsh(1) man page for more information on startup/shutdown files.Property of BladeLogic. This command closes the network connections of the hosts given to it as arguments. All of the Network Shell utilities ignore this variable and always use /bin/nsh when a shell process is required. calling the disconnect command is not required. 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. If no arguments are given.. you must escape the -? option as shown below: agentinfo -\? NSH 4 . the shell closes all connections. Other values may produce unexpected results. If the Network Shell again needs access to a remote host. For example: $ agentinfo -? Usage: agentinfo [-?] [-c] [-H] [-f file] [hostname . REMOTE SHELL SCRIPTS It is possible to execute remote shell scripts. To ensure that you do not exhaust system resources. The remaining types of redirections work (with the restrictions described above). the redirection type <>. For efficiency reasons. The following is a list of valid startup/shutdown files for NSH. For example.] -? 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. especially if you are accessing large numbers of remote hosts.nshenv $ZDOTDIR/. then a new dynamic network connection is created. $ZDOTDIR/. Strictly confidential and proprietary nsh(1) nsh(1) supported for redirection.. 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.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. THE DISCONNECT COMMAND The Network Shell dynamically creates network connections to the remote hosts that it accesses. is treated the same as the < redirection type.

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

0777). NSH::. NSH::chmod ("bar". $fd = NSH::open ("//hostname/foo/bar". 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. NSH::rmdir ("bar"). If no hostname is included in the argument. NSH::chmod ("//hostname/foo/bar".. NSH::unlink("file"). 100). int mode) Change the mode (protection attributes) of the file path to mode. 0777). If dirname is a full UNC path (includes a hostname). NSH::chmod (char *path. The following examples will help clarify their use. 0) || die "Cant open file: $!\n". $count = NSH::read ($fd. 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. $buf. then the file on the current host is used. Inc. NSH::chdir ("//hostname/foo". NSH::close($fd). NSH::close($fd). $buf. 0777). 0. Network Shell Perl Module 1 . The NSH module currently supports 45 calls which interface the corresponding Network Shell distributed API."). NSH::chdir ("//hostname/foo/") || die "Can’t cd: $!\n". $fd = NSH::open ("bar".NSH::(1) Property of BladeLogic. SYNOPSIS use NSH. NSH::chdir (". 100). The NSH module acts as glue between Perl and the Network Shell core technology.. The NSH calls emulate their C function counter parts. $count = NSH::read ($fd. 0) || die "Cant open file: $!\n".Network Shell Perl module to access and manipulate remote files. (R_OK) Test for read permission. processes. 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. use NSH. (W_OK) Test for write permission. 0. DESCRIPTION The NSH Perl Module gives Perl programmers the ability to access remote files and commands. NSH::chdir ("//hostname/foo/bar") !! die "Can’t cd: $!\n"). Perl Module Strictly confidential and proprietary NSH::(1) NAME NSH:: . and commands.. NSH::chdir (char *dirname) Change you current directory to dirname. If mode is ommitted it checks for file readability (R_OK).

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

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

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

Inc. char *buffer. 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. 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. it is assumed to be ’r’. 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’.NSH::(1) Property of BladeLogic. $fd = NSH::opendir ("foo") || die "Can’t access foo: $!\n". NSH::popen (char *cmd. Network Shell Perl Module 5 . returning a file descriptor which can be used in subsequent calls to NSH::readdir() to determine the contents of the given directory. NSH::closedir($fd). NSH::pclose (int fd) Close a file descriptor returned by a successfull call to NSH::popen(). 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(). int nbytes) Read the next nbytes bytes from the file descriptor fd storing the result in buf which will always be ’null’ terminated. 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::read (int fd. If mode is ommited. $buf. $fd = NSH::popen ("cd //hostname/foo. 100)) { print $buf. 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. This function pushes the filename and the filename’s inode number on the stack. $fd = NSH::opendir("//hostname/foo") || die "Can’t read directory: $!\n (filename) = NSH::readdir($fd). ls") while (NSH::read ($fd. subsequent NSH::write() will write data to the standard input of the command.

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

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

%d\n". [10]). %d\n". 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". %d\n".NSH::(1) Property of BladeLogic. [12]). [6]). %d\n". %d\n". %d\n". [11]). %d\n". [9]). @PROPS @PROPS @PROPS @PROPS @PROPS @PROPS @PROPS @PROPS [5]). [7]). Inc. [8]). NSH::(1) Network Shell Perl Module 8 .

EXAMPLE The following example tests the host hpux. 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.. but sometimes this value may not be optimal. using specific write buffer sizes when communicating with remote hosts can improve the net throughput of data.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. done. The default write buffer size is 4480 bytes.. done.. use a file size KB large. . 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. 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).012 seconds for 2048 KB = 39 (3. 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). -b When writing data to the remote host. perform a bulk write rather than a regular write. By default nshopt starts with a buffer size equivalent to the increment size (512 bytes). (52. done. Inc. . nshopt prints the results of each test to the standard output for review. . done. NSH 1 .173 seconds for 2048 KB = 40 (51. This lets you determine the optimal network write buffer size to use when communicating with the given host.145 seconds for 2048 KB = 40 (51..nshopt(1) Property of BladeLogic. It does not test how fast it can receive 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 . OPTIONS -i size -k size Instead of starting with a write buffer size of 512 and using an increment of 512 bytes. To determine the optimal write buffer size. .. If you anticipate that you will be receiving large amounts of data.. done. each time using different network write buffer sizes and determining the time it takes to send the file... (See EXAMPLE.. # secadmin -W hpux to to to to to to hpux hpux hpux hpux hpux hpux . start with a write buffer size and use an increment size of size. use the secadmin command to configure the new buffer size.) Once nshopt has determined an optimal buffer size.. This example then uses the command secadmin to update the configuration file with the desired buffer size.... ORIGIN nshopt was written by Thomas Kraus. The cp command performs bulk writes when copying a file to a remote host.. # nshopt hpux Trying 512 bytes Trying 1024 bytes Trying 1536 bytes Trying 2048 bytes Trying 2560 bytes Trying 3072 bytes .020 seconds for 2048 KB = 678 (51. nshopt writes a 2MB file to a remote host multiple times. -s bytes Start off with a buffer size of bytes. DESCRIPTION Depending on the network. A regular write does perform those checks and therefore will take a little longer. . Instead of transferring a 2 MB (2048 KB) test file as a sample.

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

] DESCRIPTION The nshpath command displays the path where an nsh executable resides on a local or remote machine. 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 .nshpath(1) Property of BladeLogic... OPTIONS None EXAMPLE To determine the path of nsh installed on a remote machine called ’host2’. 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. Inc. ORIGIN nshpath was developed by BladeLogic. NSH 1 .

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

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

. nmem. please read the individual man page for each command.ntop(1) Property of BladeLogic.. ndf(1) NSH 1 . nover.. Strictly confidential and proprietary ntop(1) NAME ndf.] [-r] [-s field] [-t] nstats [-c] [-e expr] [-f file] [-H] [-h host . nstats(1). blquery(1).... nps(1).. nps.. Inc..] [-r] [-s field] [-t] nover [-c] [-e expr] [-f file] [-H] [-h host .. For more information. nover(1).] [-r] [-s field] [-t] nmem [-c] [-e expr] [-f file] [-H] [-h host . SEE ALSO blexpr(1). nmem(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 .] [-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.

server1 [<server2> <server2>] A space-delimited list of the names or IP addresses of the servers from which certificates should be removed. Inc. OPTIONS user_name The user for whom certificates should be removed. EXAMPLE nukecert johnk linuxBuild solarisQA ORIGIN nukecert was developed by BladeLogic.nukecert(1) Property of BladeLogic. SEE ALSO putcert(NSH) NSH 1 . 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.

tgz. the name of the resulting uncompressed file is config. gzcat. Display the name and percentage reduction for each file compressed or decompressed. gzip -c file1 > foo. copy the time stamp from the compressed file. The resulting file is an uncompressed (or compressed) file without the original extension. 1 . gunzip. Instead. 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. EXAMPLES ORIGIN nunzip was developed by BladeLogic. provided that the file has the correct header. This option is the default when decompressing. OPTIONS -c -v Uncompress to stdout. when config.TGZ. --help file Display a help screen and quit.gz Suppress all warnings.gz nunzip --verbose foo.tar. . Inc.gz. For example.gz is uncompressed.gz nunzip foo. Inc. --no-name When decompressing.gz gzip -c file2 >> foo. File or files to be compressed or decompressed.nunzip1(NSH) Property of BladeLogic. --quiet --verbose Same as -v. .tar.GZ. Strictly confidential and proprietary nunzip1(NSH) NAME nunzip. Verbose output. or . 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 .

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

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 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.txt europe order(1) NSH 2 .order(1) Property of BladeLogic. Inc.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.

Inc. 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 .order(1) Property of BladeLogic.

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

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

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

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

with the default format being ustar. The trailing <newline>. During write. or subexpression matching. -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.pax(1) -s replstr Property of BladeLogic. The first unsuccessful substitution stops the operation of the g option. old is a basic regular expression and new can contain an ampersand (&). The default blocksize for this format is 5120 bytes. 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. 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. read or accessed them. You can specify multiple -s expressions. pax writes pathnames and flushes them to standard error without a trailing <newline> as soon as processing begins on that file or archive member. using the syntax of the ed(1) utility regular expressions. for all the other operational modes ( read. Any non-null character can be used as a delimiter (/ is shown here). terminating with the first successful substitution. The default blocksize for this format is 5120 bytes. During read. 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. write. During a list operation. is not buffered. If this format truncates inode and device information about a file (used for detecting file hard links). \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. and is written only after the file has been read or written. 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 format of these regular expressions is: /old/new/[gp] As in ed(1). -x format Specify the output archive format. and copy). Ignore files that are older (having a less recent file modification time) than a pre-existing file or archive member with the same name. Inc. Otherwise. Therefore. pax applies the expressions in the order you specify them on the command line. The old binary cpio format. produce a verbose table of contents using the format of the ls(1) utility with the -l option. 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. 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. For pathnames representing a hard link to a previous member of the archive. the output has the format: <ls -l listing> == <link name> For pathnames representing a symbolic link. During copy. pax detects the truncation and repairs it. The old string may also contain <newline> characters. This format is not very portable. pax currently supports the following formats: cpio The extended cpio interchange format specified in the IEEE Std1003.2 (‘‘POSIX’’) standard. do not use this format if other formats are -v bcpio NSH 4 .

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

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

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

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

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

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

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

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

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

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

. users. ORIGIN rsu was written by Thomas Kraus SEE ALSO users(1). 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. exports (1).. EXIT CODES rsu exits with the same exit code as that of the finished command. rscd(1) NSH 2 . See the users and/or exports man pages for more details.) in the users.local. Inc.rsu(1) Property of BladeLogic. Appropriate entries (rsu=. and/or exports file must exist.

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

In other words. you may not want to do things in parallel. Tag each line with the name of the host the output is coming from. but be advised that since things are running in parallel. The host name is preceded by a ( and followed by a ) as in (hostname). if you are going to make assumptions about the output produced by each instance. This includes the default header or any header you defined using the -H option. Execute a Network Shell script on each host. -v -V -s -? EXAMPLE Some simple examples. Inc. Run up to n commands/scripts in parallel.runcmd(1) Property of BladeLogic. This is implicit if the program name is runscript. the output generated by each instance may overall not be output in a linear way. If an error occurs or if a command or script exits with a non zero status. 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. Output the effective command executed for each host. Strictly confidential and proprietary runcmd(1) -NH -p n This option tells runcmd and runscript not to display a header. Output a brief explanation of the available options. then these programs will exit with a non-zero status. ORIGIN runcmd and runscript were written by Thomas Kraus NSH 2 . then these programs will exit with a status of 0. This can significantly speed things up.

-l [name] Show the list of scripts in the library and exit. grp_uniq_gid grp_uniq_grpname net_disabled_uucp.] Add host to the list of hosts one wants to run the script on. then it will show all scripts (for all OSes) of that name. EXAMPLE Show all scripts host% scriptutil -l .. then the script library will be searched with the OS type extension filter applied.[ALL] Audit non-unique GIDs in /etc/group .. -o file By default. If a name is given. As a particular task may have different implementations on various UNIX type servers. Strictly confidential and proprietary scriptutil(1) NAME scriptutil − Copy and execute scripts on remote servers SYNOPSIS scriptutil [-d dir] [-f file] -h host1 [host2 . As such. With this option one can override the staging directory. Inc. the output (stdout) of the script is sent to stdout on the local machine. If the script refers to an existing file then that file will be the one copied and executed. Scripts in the library with an OS name extension (output of uname command) are treated as overrides for the particular platform (i. If it does not refer to an existing file. one still wants to have a single point of access for all platforms for that task. when looking to run a script.AIX .e. 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.. -s script Specify the name of the script one want to run on the given remote servers. See also -h -h host [host .scriptutil(1) Property of BladeLogic. file contains a list of servers one wants to run the scripts on (one entry per line).] [-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).[ALL] Audit non-unique group names in /etc/group .. no OS name extension). -d dir -f file The default staging directory for the script is /tmp. Scriptutil also supports the concept of a script library that in turn supports the concept of OS abstraction. With this option one can specify a file to which the output is sent.[AIX] Audit that UUCP is disabled NSH 1 . Can specify multiple hosts and can also be used in conjunction with the -f file option. .

HP-UX . NSH 2 . Inc. . nexec (NSH). Strictly confidential and proprietary net_disabled_uucp.scriptutil(1) Property of BladeLogic.[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). scriptutil(1) .

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

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

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> .k. then the software looks for a default entry. BladeLogic can access those passwords without any user interaction. Thus. It is also necessary when using secure communication to deploy assets via repeaters (that is. for BladeLogic clients and RSCD servers running on the local host. use the special hostname default. When configuring communication parameters for a specific host (client or server). When entering a value for hostname. CREATING ENTRIES IN THE SECURE FILE When using secadmin to create a secure file. See CREATING ENTRIES IN THE SECURECERT FILE. default.. BladeLogic clients and servers use a communication protoccol called protocol 5 that is based on a TLS transportation mechanism (a. use the special hostname rscd. On the agent side.. By default.secadmin(1) Property of BladeLogic. through an indirect deployment). For an Application Server. Accessing passwords non-interactively is essential for setting up secure. which stores encrypted password information needed to access the private key for X. it uses the rscd entry. SSL). 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. If the agent does not find a match. CREATING ENTRIES IN THE SECURECERT FILE When using secadmin to edit a securecert file. or a subnet designation that defines a range of addresses (see SUBNET DESIGNATIONS below). Secadmin also lets you edit the securecert file. you do not have to create an entry for each remote host needing access to those agents. When configuring default communication parameters for servers. place the rscd or default entry at the end of the list. a resolvable host name. when the agent detects that a host is attempting to make a connection. 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. if you are using the same communication parameters for all your RSCD Agents. it uses the default entry.509 certificates. certificate-based communication between an Application Server and agents and repeaters. When a client attempts to establish a connection with a server. you can provide a host’s IP address. The order of entries in the secure file matters. 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. When configuring default communication parameters for BladeLogic clients.a. you can create entries for an Application Server and entries for repeaters. Protocol 5 auto-negotiates the most secure connection between a client and server. If the client does not find a match. If an entry does not exist for a particular remote host. create a hostname entry in the secure file. By storing passwords in the securecert file. or hostname. If you are creating entries for individual hostnames as well as an rscd or default entry. including encryption and authentication parameters. Inc. you can specify communication parameters by creating three types of entries: rscd. 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. create an entry that stores the password for the owner of the process that NSH 1 .

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

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

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

241/28 @192.100.100.192 255.168.249/29 secadmin(1) EXAMPLES The following examples illustrate actions you can take to modify the secure file.224 255.255.129/25 @192.255.128 255.255. 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.secadmin(1) 255.255.255.255.240 255.255.100.255.0/24 @192. To delete the entry for host foo. # secadmin -a <server_host> -r 999 -e tls SEE ALSO nshopt (1). Inc. enter # secadmin -a foo -p 5 -e tls To specify use of port 999 rather than the default port of 4750.255.000 255.100.255.168.248 Property of BladeLogic. enter # secadmin -d foo To create a standard entry for host foo so it communicates using protocol 5 (the default communication protocol).168.168.168.193/26 @192.255. NSH 5 . Strictly confidential and proprietary @192.168.225/27 @192.100. enter the following command.100.255.

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

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

) Write the pattern space to the standard output in a visually unambiguous form. using an embedded newline character to separate the appended material from the original contents. [2addr]d [2addr]D [2addr]g [2addr]G [2addr]h [2addr]H [1addr]i\ text Write text to the standard output. [2addr]l (The letter ell. Copy the contents of file to the standard output immediately before the next attempt to read a line of input. [2addr]s/re/replacement/flags Substitute the replacement string for the first instance of the regular expression in the pattern space. With 0 or 1 address or at the end of a 2-address range. text is written to the standard output. with the point of folding indicated by displaying a backslash followed by a newline. and replace the pattern space with the next line of input. Write the pattern space. Long lines are folded. Branch to the end of the script and quit without starting a new cycle. [2addr]n [2addr]N Write the pattern space to the standard output if the default output has not been suppressed. 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).SED (1) PropertyGeneral Commands Manual System of BladeLogic. Append the next line of input to the pattern space. Strictly confidential and proprietary SED (1) [2addr]c\ text Delete the pattern space. 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. If file cannot be read for any reason. Replace the contents of the hold space with the contents of the pattern space. Inc. Write the pattern space to standard output. The end of each line is marked with a ‘$’. 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. 1993 3 . Replace the contents of the pattern space with the contents of the hold space. Append a newline character followed by the contents of the hold space to the pattern space. it is silently ignored and no error condition is set. up to the first newline character to the standard output. Note that the current line number changes. Delete the initial segment of the pattern space through the first newline character and start the next cycle.

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

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

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

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. 1995 2 . Inc.2 (“POSIX. BSD April 28.TOUCH (1) PropertyGeneral Commands Manual System of BladeLogic.2”) specification.

In the third synopsis form. that is ‘‘-c ab’’ includes every character except for ‘‘a’’ and ‘‘b’’. In the fourth synopsis form. The following options are available: –c –d –s Complements the set of characters in string1. The –d option causes characters to be deleted from the input. the characters in string1 are deleted from the input. Shpink October 27. the characters in string1 are compressed as described for the –s option. the characters in string1 are deleted from the input. 1991 1 . Inc. 2 or 3 octal digits represents a character with that encoded value. the last character found in string2 is duplicated until string1 is exhausted. If string1 is longer than string2.TR ( 1 ) Property of Reference Manual BSD BladeLogic. and the characters in string2 are compressed as described for the –s option. In the second synopsis form. 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. In the first synopsis form. left zero-pad the octal sequence to the full 3 octal digits. 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. \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. This occurs after all deletion and translation is completed. 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. A backslash followed by 1. A backslash followed by certain special characters maps to special values. Strictly confidential and proprietary TR ( 1 ) NAME tr – Translate Characters. To follow an octal sequence with a digit as a character. 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.

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

Strictly confidential and proprietary TR ( 1 ) Z]’’ will work as it will map the ‘‘[’’ character in string1 to the ‘‘[’’ character in string2. However. 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. The tr utility has historically been extremely forgiving of syntax errors. the –c and –s options were ignored unless two strings were specified. Shell scripts attempting to be portable to other POSIX systems should use the ‘‘[#∗]’’ convention instead of relying on this behavior. The tr utility has historically not permitted the manipulation of NUL bytes in its input and. for example. This implementation will not permit illegal syntax.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. additionally. stripped NUL’s from its input stream. This implementation has removed this behavior as a bug. Inc. Shpink October 27. any scripts that depended on the sequence ‘‘a-z’’ to represent the three characters ‘‘a’’. Additionally.TR ( 1 ) Property of Reference Manual BSD BladeLogic. 1991 3 . if the shell script is deleting or squeezing characters as in the command ‘‘tr -d [a-z]’’. STANDARDS The tr utility is expected to be IEEE Std1003. ‘‘-’’ and ‘‘z’’ will have to be rewritten as ‘‘a\-z’’.

BSD January 26. Print the operating system name. uname(3) STANDARDS The uname utility conforms to IEEE Std 1003.4 BSD. HISTORY The uname command appeared in 4. 1994 1 . Inc. 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. Print the operating system version. Print the processor type in more detail.2”). The options are as follows: −a −m −n −p −r −s −l −v Behave as though all of the options −mnrsv were specified. Print the machine hardware name. Print the operating system release. uname prints the operating system name as if the −s option had been specified. machine(1).UNAME (1) PropertyGeneral Commands Manual System of BladeLogic. If no options are specified. SEE ALSO hostname(1). Print the nodename (the nodename may be a name that the system is known by to a communications network).2-1992 (“POSIX. Print the patch level.

It does not rename any files. The default suffix is ˜ (foo -> foo˜). Inc. NSH 1 . 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. Set the suffix to suf. uncp does not rename directories as it will automatically recursively travel through the directories passed to it as arguments. just delete the files. The backup is done by renaming the target file with a suffix. uncp looks for the suffix ˜. Do not actually make any changes. dsync(1). OPTIONS -d -n Instead of restoring the files to their previous names.. This option tells it to look for a different suffix. SEE ALSO cp(1). 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. When uncp finds files with the specified suffix. 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). Output a message for each file being renamed. it renames them (removes the suffix).. This is a useful option when you want to remove any files that the dsync or cp commands previously backed up. -v -s suf ORIGIN uncp was written by Thomas Kraus. By default. Strictly confidential and proprietary uncp(1) NAME uncp − Uncopy files backed up during a cp or dsync SYNOPSIS uncp [-dnv] [-s suf] file1 .uncp(1) Property of BladeLogic.

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

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

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

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

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

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

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

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

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

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

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

GRR) Info-ZIP (Zip-Bugs subgroup. Reference Manual Pages Property of BladeLogic. Smith Samuel H.41 v5.x v3. Inc.12 v5.1 v4. 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. GRR) Info-ZIP (Zip-Bugs subgroup.2 v2. GRR) Info-ZIP (Zip-Bugs subgroup. SPC) Info-ZIP (Zip-Bugs subgroup.3 v5. GRR) Info-ZIP (Zip-Bugs subgroup. maintainer) Info-ZIP Info-ZIP (Zip-Bugs subgroup.0 v3. consolidator) Info-ZIP (GRR.0 v2.2 v5. SPC) Info-ZIP Last change: 14 January 2001 (v5.42) 10 .4 v5.0 v4.2 v5. SPC) Info-ZIP (Zip-Bugs subgroup. GRR) Info-ZIP (Zip-Bugs subgroup. Smith many Usenet contributors Info-ZIP (DPK. Strictly confidential and proprietary UNZIP ( 1L ) VERSIONS v1.1 v4. GRR) Info-ZIP (Zip-Bugs subgroup.32 v5.11 v5.01 v5.31 v5. GRR) Info-ZIP (Zip-Bugs subgroup.0 v5.1 v5. GRR) Info-ZIP (Zip-Bugs subgroup.Misc. GRR) Info-ZIP (Zip-Bugs subgroup. consolidator) Info-ZIP (DPK.

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

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

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

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

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

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

494 [Oct 20 2002 16:41:59] Copyright (C) 1996 . Sample output is: BladeLogic RSCD Agent 4.2002 BladeLogic Inc. SEE ALSO agentinfo(1). ORIGIN version was written by Thomas Kraus. 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. Inc.2002 BladeLogic Inc.0.494 [Oct 20 2002 16:41:59] Copyright (C) 1996 .version(1) Property of BladeLogic. BladeLogic Network Shell 4.5.5.0. NSH 1 .

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

The first type are the control characters (ASCII 0-31).} { > >= < <= = != } & | 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. ORIGIN vshview was written by Thomas Kraus SEE ALSO vsh (1). The second type are 8 bit characters. 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. These are are displayed as (for example) ’ˆD’. Inc. Operators of the same precedence are grouped together by { }: operator = + | . These are are displayed as (for example) ’207’.vshview(1) Property of BladeLogic.| / | * | % | & | \| | > | >= | < | <= | = | != \ { * / % } { + . NSH 2 .

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

" written by David S. Hayes at the Army Artificial Intelligence Center at the Pentagon. Inc. NSH 2 . 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.vtree(1) Property of BladeLogic.

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

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

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

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

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

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

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

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

use backslash to make zip do the pattern matching with the –f (freshen) and –d (delete) options. If it does not find it. The pattern matching includes the path. Processing may have completed successfully anyway. 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. some broken zipfiles created by other archivers have simple workarounds. gzip(1L) DIAGNOSTICS The exit status (or error level) approximates the exit codes defined by PKWARE and takes on the following values. For each match. a generic error in the zipfile format was detected. it then adds it to the list of files to do. Reference Manual Pages Property of BladeLogic.e.o match names that end in ".o". no errors or warnings detected. ?∗[]).3) 8 . no matter what the path prefix is. If it finds it. tar(1). using the pattern matching characters described above. Inc. 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. –f. or –d). unexpected end of zip file. shar(1L). 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. it will add that name to the list of files to be processed. zip ZIP_OPTS [VMS] see ZIPOPT SEE ALSO compress(1). Processing probably failed immediately. when zip encounters a name in the list of files to do. –u. unzip(1L). or does not match any name given with the –i option. on the list of files to be operated on. it looks for the name in the zip archive being modified (if it exists). by using backslashes or quotes to tell the shell not to do the name expansion. zip was unable to allocate memory for one or more buffers during program initialization. it first looks for the name in the file system. and so patterns like \∗. and sometimes after the –x (exclude) option when used with an appropriate operation (add. a severe error in the zipfile format was detected. Note that the backslash must precede every special character (i. unless this name matches one given with the –x option. In general. except under VMS: 0 2 3 normal.Misc. In general. in the case of the –x (exclude) or –i (include) options. or the entire argument must be enclosed in double quotes (""). if present.

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

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

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

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

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

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

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

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

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.User Commands Property of BladeLogic. AVAILABILITY Primary site ftp://ftp.org/pub/zsh/ http://www. The sites marked with (H) may be mirroring ftp.0.org/pub/zsh/ Australia ftp://ftp. Of the standard shells. The development is currently coordinated by Peter Stephenson <pws@zsh.funet.cs.hu instead of the primary site.au/pub/packages/zsh/ (H) Denmark ftp://sunsite.org/pub/zsh/ http://www.elte. zsh most closely resembles ksh but includes many enhancements. Inc.zsh.uni–trier.org>.cena. the zsh manual has been split into a number of sections. Strictly confidential and proprietary ZSHALL ( 1 ) NAME zshall – the Z shell meta–man page SYNOPSIS Because zsh contains many features. Zsh is now maintained by the members of the zsh–workers mailing list <zsh–workers@sunsite. 2001 1 .zsh.cenatls.org>. a history mechanism.dk/pub/unix/shells/zsh/ Finland ftp://ftp.de/packages/zsh/ ftp://ftp.cs. The coordinator can be contacted at <coordinator@zsh.org>.dk>. builtin spelling correction.fu–berlin.fr/shells/zsh/ Germany ftp://ftp. Zsh has command line editing.fi/pub/unix/shells/zsh/ France ftp://ftp.zsh.de/pub/unix/shells/zsh/ (H) ftp://ftp.zsh. shell functions (with autoloading).dgac.gmd.4 Last change: October 26. but matters relating to the code should generally go to the mailing list. These mirror sites are kept frequently up to date.de/pub/unix/shell/zsh/ Hungary ftp://ftp.org/pub/zsh/ ftp://ftp.elte. programmable command completion. Zsh is available from the following anonymous FTP sites.hu/pub/zsh/ zsh 4.ips.hu/pub/zsh/ http://www. and a host of other features. AUTHOR Zsh was originally written by Paul Falstad <pf@zsh.cs.gov.elte.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Special parameters may also be made local. @ <S> Same as argv[@]. EGID <S> The effective group ID of the shell process. and within a sourced script to the name of the script. even when argv is not set. In particular. Deleting argv with unset in any function deletes it everywhere. 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. This may have unexpected effects: there is no default value. it will be set to an empty value (or zero in the case of integers). Flags supplied to the shell on invocation or by the set or setopt commands. An array containing the positional parameters. they retain their special attributes unless either the existing or the newly–created parameter has th