![]() |
Table Of Contents
Utility Commands on Cisco IOS XR Software
Utility Commands on Cisco IOS XR Software
This module describes the utility commands for the Cisco IOS XR software. Utility commands provide CLI equivalents to common UNIX commands.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. For example, the keyword universal can also be entered using the UNIX-equivalent (-u). To display the UNIX-equivalent syntax online, enter the keyword usage.
utility bc
To implement an arbitrary precision calculator, use the utility bc command in EXEC mode or administration EXEC mode.
utility bc [file input-file]
Syntax Description
Defaults
If an input file is not specified, the standard input (keyboard) is used.
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Use the utility bc command to use the an interactive, programmable calculator that supports a complete set of control structures, including functions. The utility first processes any specified files, and then reads input from the keyboard (standard input).
Input files (and standard input) are ASCII text files containing sequences of bc statements to be executed.
Note
The bc utility uses the bc programming language, an arbitrary precision calculator language with syntax similar to the C programming language. The bc utility does not support character or string manipulation.
The bc utility supports:
•
26 functions
•
26 simple variables
•
26 array variables (up to 2048 elements per array).
The bc utility supports the following common programming language constructs:
•
"if", "while", and "for" statements
•
User-defined functions with parameters
•
Local variables
Information About Supported Network Protocols
In the syntax for the ftp:, rcp:, and tftp: network protocols, the location is either an IP address or a hostname. The filename is specified relative to the directory used for file transfers.
When no device is specified, the current directory is used. To view the current directory, enter the pwd command.
Table 102 describes the network protocols supported by the Cisco IOS XR software.
Task ID
Examples
In the following example, the utility bc command is used to execute the be statements contained in the ASCII text file exp.txt:
RP/0/RP0/CPU0:router# utility bc file disk0:/usr/exp.txt501525317utility cut
To extract selected characters or fields from standard input or from a file, use the utility cut command in EXEC mode or administration EXEC mode.
utility cut {list character-list | fields field-list [nodelim] [delimiter delimiter-character] | WORD} [file input-file] [usage]
Syntax Description
Defaults
If no file is specified, the keyboard input (standard input) is used.
The delimiter is tab.
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
The utility cut command cuts out columns, fields, or characters displayed from standard input or from a file.
Use the fields field-list keyword and argument if the fields vary in length from line to line. (The lines must be separated by a delimiter character.) By default, the field delimiter character is the Tab key. Use the delimiter delimiter-character keyword and argument to specify a different delimiter.
Use the list character-list keyword and argument only if the fields are of a fixed length. Replace the character-list argument with the character positions to be extracted.
For the character-list argument, use a comma (,) to indicate more than one character, or use a dash (-) to indicate a range. For example, utility list 1,2,5 outputs the first, second, and fifth characters, utility list 1-64 outputs the first 64 characters of each line, utility list 5- outputs the fifth character to the end of the line.
You can also use the cut utility as a filter. If no files are specified, the keyboard input (standard input) is used.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. For example, the keyword fields can also be entered using the UNIX-equivalent (-f). To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
In the following example, the utility cut command is entered with the list character-list keyword and argument to display the first 10 characters in each line. The output is from the results of the command show version, which is entered with the pipe (|) character:
RP/0/RP0/CPU0:router# show version | utility cut list 1-10Cisco IOSCopyrightROM: Systerouter uptSystem imacisco CRS-7457 proce16 Gigabit2 Ethernet20 Packet20 SONET/S2043k byte38079M byt1000592k b1000640k bConfiguratPackage ac--More--In the following example, the utility cut command is used to extract fields from a file:
RP/0/RP0/CPU0:router# utility cut fields 1,5 delimiter : file disk0:/usr/passwdroot:Super-Userdaemon:bin:sys:adm:Adminlp:Line Printer Adminuucp:uucp Adminnuucp:uucp Adminlisten:Network Adminnobody:NobodyIn the following example, the utility cut command is used with the delimiter keyword to specify an alternative field delimiter:
RP/0/RP0/CPU0:router# utility cut fields 1,4,5 delimiter : file disk0:/usr/passwdroot:1:Super-Userdaemon:1:bin:2:sys:3:adm:4:Adminlp:8:Line Printer Adminuucp:5:uucp Adminnuucp:9:uucp Adminlisten:4:Network AdminIn the following example, a range of fields is specified:
RP/0/RP0/CPU0:router# utility cut fields 1-4 delimiter : file disk0:/usr/passwdroot:x:0:1daemon:x:1:1bin:x:2:2sys:x:3:3adm:x:4:4lp:x:71:8uucp:x:5:5nuucp:x:9:9listen:x:37:4In the following example, the list character-list keyword and argument are used to specify the character positions to be extracted:
RP/0/RP0/CPU0:router# utility cut list 1-30 file disk0:/usr/passwdroot:x:0:1:Super-User:/:/sbin/daemon:x:1:1::/:bin:x:2:2::/usr/bin:sys:x:3:3::/:adm:x:4:4:Admin:/var/adm:lp:x:71:8:Line Printer Admin:/uucp:x:5:5:uucp Admin:/usr/libnuucp:x:9:9:uucp Admin:/var/splisten:x:37:4:Network Admin:/unobody:x:60001:60001:Nobody:/:noaccess:x:60002:60002:No Accenobody4:x:65534:65534:SunOS 4.==========================================================================In the following example, the UNIX equivalent options are used directly. First, the utility cut command is entered with the usage keyword to display the possible options. Next, the utility cut command is entered with the options to extract the desired data.
RP/0/RP0/CPU0:router# utility cut usagecut -c list [file], cut -f list [-d delim] [-s] [file]RP/0/RP0/CPU0:router# utility cut -f 1,4 -d : disk0:/usr/passwdroot:1daemon:1bin:2sys:3adm:4lp:8Related Commands
utility date
To display the date and time, use the utility date command in EXEC mode or administration EXEC mode.
utility date [universal] [format word] [usage] [WORD]
Syntax Description
Defaults
The date is displayed in local time.
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
The utility date command displays the internal time and date for the router.
Date format
Use the format word option to specify the format and content of the displayed date and time. The format is composed of ASCII characters and field descriptors prefaced with %, in a manner similar to a C-language printf() format specifier. In the output, each field descriptor is replaced by its corresponding value; all other characters are copied to the output without change. The format is specified using the following arguments:
•
%C: Century in 'CC' form. For example: 20
•
%y: Year in 'YY' form. For example: 06
•
%m: Month in 'MM' form. For example: 08
•
%d: Date in 'DD' form. For example: 28
•
%H: Hour in 'hh (24 hr.)' form. For example: 18
•
%M: Minutes in 'mm' form. For example: 55
•
%S: seconds in 'ss' form. For example: 24
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. For example, the keyword universal can also be entered using the UNIX-equivalent (-u). To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
The following example shows how to display the router date and time using the utility date command:
RP/0/RP0/CPU0:router# utility dateFri Aug 04 11:53:38 UTC 2006The following example shows how to display the router date and time using a variety of options with the format keyword:
RP/0/RP0/CPU0:router# utility date format "%y%m%d"060828RP/0/RP0/CPU0:router# utility date format "%y-%m-%d"06-08-28RP/0/RP0/CPU0:router# utility date format "%C%y-%m-%d"2006-08-28RP/0/RP0/CPU0:router# utility date format "%C%y-%m-%d:%H:%M:%S"2006-08-28:02:09:58RP/0/RP0/CPU0:router# utility date format "DATE: %y-%m-%d %nTIME: %H:%M:%S"DATE: 06-09-17TIME: 12:42:24Related Commands
utility date set
To set the router time, use the utility date set command in administration EXEC mode.
utility date set hh:mm:ss
Syntax Description
Defaults
No default behavior or values
Command Modes
Administration EXEC
Command History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
A colon (:) is required between the entry for hour, minutes, and seconds.
Note
Generally, if the system is synchronized by a valid outside timing mechanism, such as a Network Time Protocol (NTP) clock source, or if you have a networking device with calendar capability, you need not set the software clock. Use the date command or clock set command if no other time sources are available.
Note
To manually copy the hardware clock (calendar) settings into the software clock, use the clock read-calendar command in EXEC mode.
By default, the system makes a "slow adjustment" if the new time is in the range of the following:
•
-2.5 minutes + old time
•
5 minutes + old time
In a slow adjustment, the clock speed increases by less than 100 percent or decreases by less than 50 percent over a period of time from 1 second to 5 minutes until the clock catches up with the new time. This slow adjustment does not cause major discontinuities in the time flow. Use the -S0 option to disable the slow adjustment.
Task ID
Examples
The following example shows how to set the time using the utility date set command:
RP/0/RP0/CPU0:router(admin)# utility date set 13:07:00Fri Sep 15 13:07:00 UTC 2006Related Commands
utility df
To display the amount of disk space available for a directory or file, use the utility df command in EXEC mode or administration EXEC mode.
utility df [kbytes] [mountinfo] [vsfStats] [file source] [usage] [WORD]
Syntax Description
Defaults
Information is displayed for all file systems.
The results are displayed in 512-byte blocks.Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Use the utility df (disk free) command to display the amount of disk space available for a device, directory, or file. Enter the command without keywords or arguments to display information for all mounted file systems.
Use the vsfStats keyword to invoke the statvfs() function, which provides additional details for all mounted file systems.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. For example, the keyword kbytes can also be entered using the UNIX-equivalent (-k). To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
In the following example, the utility df (disk free) command is entered without keywords or arguments to display information for all file systems:
RP/0/RP0/CPU0:router(admin)# utility df/dev/hd0t6 77987744 61592 77926152 1% /harddisk://nvram: 4086 60 4026 2%/dev/disk1t6 2001280 382720 1618560 20% /disk1://dev/disk0t6 2001184 533568 1467616 27% /disk0://dev/fs0p1 121856 68 121787 1% /bootflash:See Table 104 for column descriptions.
In the following example, the kbytes keyword is used to display information in 1-K blocks (1024-byte units) instead of the default of 512-byte blocks:
RP/0/RP0/CPU0:router(admin)# utility df kbytes/dev/hd0t6 38993872 30796 38963076 1% /harddisk://nvram: 2043 30 2013 2%/dev/disk1t6 1000640 191360 809280 20% /disk1://dev/disk0t6 1000592 266784 733808 27% /disk0://dev/fs0p1 60928 34 60893 1% /bootflash:See Table 104 for column descriptions.
In the following example, the mountinfo keyword is used to display file-system mountpoints and types only:
RP/0/RP0/CPU0:router(admin)# utility df mountinfoFilesystem Mounted on Type/dev/hd0t6 /harddisk:/ dos (fat32)/nvram:/dev/disk1t6 /disk1:/ dos (fat16)/dev/disk0t6 /disk0:/ dos (fat16)/dev/fs0p1 /bootflash: flashIn the following example, the vfsStats keyword is used to invoke the statvfs() function, which provides additional details for all mounted file systems:
RP/0/RP0/CPU0:router(admin)# utility df vfsStats/dev/hd0t6 /harddisk:/Blocks: 9748468 total 9740769 avail [4096-byte blocks]Files : 0 total 0 availType : dos (fat32)Flags : 00000120 [32bit, noatime]/nvram:Blocks: 2043 total 2013 avail [1024-byte blocks]Files : 0 total 0 availType :Flags : 00000000 []/dev/disk1t6 /disk1:/Blocks: 62540 total 50580 avail [16384-byte blocks]Files : 0 total 0 availType : dos (fat16)Flags : 00000120 [32bit, noatime]/dev/disk0t6 /disk0:/Blocks: 62537 total 45863 avail [16384-byte blocks]Files : 0 total 0 availType : dos (fat16)Flags : 00000120 [32bit, noatime]/dev/fs0p1 /bootflash:Blocks: 62390272 total 62355240 avail [1-byte blocks]Files : 2 total 0 availType : flashFlags : 00000000 []Table 103 describes the significant fields shown in the display.
In the following example, the file source keyword and argument is used to specify a directory:
RP/0/RP0/CPU0:router(admin)# utility df file disk0:/usr/dev/disk0t6 2001184 533568 1467616 27% /disk0:/Table 104 describes the significant fields shown in the display.
Related Commands
utility du
To display the amount of disk space used in a device, directory, or file, use the utility du command in EXEC mode or administration EXEC mode.
utility du [all | specified] [kbytes | bytes | local] [file source] [usage] [WORD]
Syntax Description
Defaults
Information for the current directory is displayed.
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Enter the utility du command without specifying a file to display information for the current directory. The command behaves as if the filename dot (.) is entered.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. For example, the keyword kbytes can also be entered using the UNIX-equivalent (-k). To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
In the following example, the utility du command is used to display the disk space used for the subdirectories in the MPLS package directory:
RP/0/RP0/CPU0:router# utility du file disk0:/hfr-mpls-3.4.0160 /disk0:/hfr-mpls-3.4.0/schema104 /disk0:/hfr-mpls-3.4.0/lib/cerrno625 /disk0:/hfr-mpls-3.4.0/lib/mib2545 /disk0:/hfr-mpls-3.4.0/lib9658 /disk0:/hfr-mpls-3.4.0/bin39 /disk0:/hfr-mpls-3.4.0/startup840 /disk0:/hfr-mpls-3.4.0/parser37 /disk0:/hfr-mpls-3.4.0/configs35 /disk0:/hfr-mpls-3.4.0/mib35 /disk0:/hfr-mpls-3.4.0/rules34 /disk0:/hfr-mpls-3.4.0/partitions135 /disk0:/hfr-mpls-3.4.0/etc/compat167 /disk0:/hfr-mpls-3.4.0/etc66 /disk0:/hfr-mpls-3.4.0/instdb_v181 /disk0:/hfr-mpls-3.4.0/lc/bin33 /disk0:/hfr-mpls-3.4.0/lc/startup246 /disk0:/hfr-mpls-3.4.0/lc112 /disk0:/hfr-mpls-3.4.0/instdb14006 /disk0:/hfr-mpls-3.4.0In the following example, the utility du command is used to display the disk space used for a subdirectories:
RP/0/RP0/CPU0:router# utility du file disk0:/hfr-mpls-3.4.0/configs37 /disk0:/hfr-mpls-3.4.0/configsIn the following example, the utility du command is used to display the disk space used for the current working directory:
RP/0/RP0/CPU0:router# cd disk0:/hfr-mpls-3.4.0RP/0/RP0/CPU0:router# utility du160 ./schema104 ./lib/cerrno625 ./lib/mib2545 ./lib9658 ./bin39 ./startup840 ./parser37 ./configs35 ./mib35 ./rules34 ./partitions135 ./etc/compat167 ./etc66 ./instdb_v181 ./lc/bin33 ./lc/startup246 ./lc112 ./instdb14006 .Related Commands
utility egrep
To search a file or the results of standard input using full regular expressions, use the utility egrep command in EXEC mode or administration EXEC mode.
utility egrep {exp expression | script expression-file} [WORD | count | noprefix | nocase | matchfile | linenum | matchline | reverse] [file search-file] [usage]
Syntax Description
Defaults
If no files are specified, the keyboard input (standard input) is used.
If more than one input file is specified, then the filename is displayed before each line.
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
The grep utility searches files for character patterns using regular expressions and returns all lines that contain that pattern. The utility egrep command uses full regular expressions (expressions using the full set of alphanumeric and special characters) to match the patterns.
The results are displayed to the standard output (terminal screen).
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. For example, the keyword count can also be entered using the UNIX-equivalent (-c). To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
In the following example, the utility egrep command is used to locate the regular expression "uptime". The linenum keyword is also entered to display the line number before each line of output.
RP/0/RP0/CPU0:router# show version | utility egrep expr uptime linenum7:router uptime is 5 days, 19 hours, 27 minutesIn the following example, the utility egrep command is used to locate a regular expression in a file. In this example, all lines with "adm" are displayed. The * character is used as a wildcard.
RP/0/RP0/CPU0:router# utility egrep expr Adm* nofile file disk0:/usr/passwdadm:x:4:4:Admin:/var/adm:lp:x:71:8:Line Printer Admin:/usr/spool/lp:uucp:x:5:5:uucp Admin:/usr/lib/uucp:nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucicolisten:x:37:4:Network Admin:/usr/net/nls:ssadmin:x:901218:60001:Sun StorEdge(tm) Configuration Service Agent Admin:/:/bin/falseIn the following example, the nocase keyword is used to ignore the character case:
RP/0/RP0/CPU0:router# utility egrep expr Adm* nocase file disk0:/usr/passwdadm:x:4:4:Admin:/var/adm:lp:x:71:8:Line Printer Admin:/usr/spool/lp:uucp:x:5:5:uucp Admin:/usr/lib/uucp:nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucicolisten:x:37:4:Network Admin:/usr/net/nls:ssadmin:x:901218:60001:Sun StorEdge(tm) Configuration Service Agent Admin:/:/bin/falseIn the following example, the linenum keyword is used to append the line number to the beginning of each output line:
RP/0/RP0/CPU0:router# utility egrep expr Adm* linenum file disk0:/usr/passwd5:adm:x:4:4:Admin:/var/adm:6:lp:x:71:8:Line Printer Admin:/usr/spool/lp:7:uucp:x:5:5:uucp Admin:/usr/lib/uucp:8:nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico9:listen:x:37:4:Network Admin:/usr/net/nls:15:ssadmin:x:901218:60001:Sun StorEdge(tm) Configuration Service Agent Admin:/:/bin/falseRelated Commands
utility fgrep
To search a file for a fixed character string, use the utility fgrep command in EXEC mode or administration EXEC mode.
utility fgrep {exp expression | script expression-file} [WORD | count | noprefix | nocase | matchfile | linenum | matchline | reverse] [file search-file] [usage]
Syntax Description
Defaults
The keyboard input (standard input) is used if no files are specified.
If more than one input file is specified, then the filename is displayed before each line.Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
The utility fgrep command searches files for a fixed character string (as opposed to grep and egrep which search for a a pattern that matches an expression).
The results are displayed to the standard output (terminal screen).
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. For example, the keyword count can also be entered using the UNIX-equivalent (-c). To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
The following example, the utility fgrep command is used with the nocase and linenum keywords:
RP/0/RP0/CPU0:router# show version | utility fgrep expr uptime nocase linenum7:router uptime is 5 days, 20 hours, 10 minutesRelated Commands
utility find
To locate files within one or more directories, use the utility find command in EXEC mode or administration EXEC mode.
utility find {path directory-path {name filename-pattern | user user-id | LINE} | usage}
Syntax Description
Defaults
If a directory path is not specified, then the search is performed in the current directory.
If a filename name pattern is not specified, then the search return all files in the specified directory.
If a user is not specified, then the search is performed for all users.Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Use the utility find command to locate files within one or more directories. You can perform the search for a specific directory (and its subdirectories). If a directory is not specified, then the search is performed for the current directory.
To search for a regular expression string, use the name pattern keyword and argument. Replace the pattern argument with the regular expression string. If this option is not used, then all files within the specified directory are displayed.
To search for files belonging to a specific user, use the user-id argument. If this option is not used, then files belonging to all users are displayed.
Task ID
Examples
In the following example, the utility find command is used to locate the file named "hfr-fwdg-3.4.0": The path is the root directory of disk0.
RP/0/RP0/CPU0:router# utility find path disk0: name hfr-fwdg-3.4.0disk0:/instdb/admin_pkgs_mdata/hfr-fwdg-3.4.0disk0:/hfr-fwdg-3.4.0In the following example, the utility find command is used to locate files matching a pattern. In this example, all files ending in ".txt" are displayed:
RP/0/RP0/CPU0:router# utility find path disk0:/usr name *.txtdisk0:/usr/test2.txtIn the following example, the UNIX equivalent option is used to locate files matching a pattern. In this example, all files ending in ".txt" are displayed:
RP/0/RP0/CPU0:router# utility find path disk0: -name *.txtdisk0:/hfr-base-3.4.0/etc/vim/doc/editing.txtdisk0:/hfr-base-3.4.0/etc/vim/doc/help.txtdisk0:/hfr-base-3.4.0/etc/vim/doc/intro.txtdisk0:/hfr-base-3.4.0/etc/vim/doc/uganda.txtdisk0:/usr/test2.txtIn the following example, the files belonging to a specific user are displayed:
RP/0/RP0/CPU0:router# utility find path disk0:/usr user 0disk0:/usrdisk0:/usr/passwddisk0:/usr/test2.txtIn the following example, the UNIX equivalent option is used to display files belonging to a specific user:
RP/0/RP0/CPU0:router# utility find path disk0:/usr -user 0disk0:/usrdisk0:/usr/passwddisk0:/usr/test2.txtRelated Commands
utility head
To copy bytes or lines at the beginning of a file or from the standard input, use the utility head command in EXEC mode or administration EXEC mode.
utility head [bytes] [count number] [file source] [usage]
Syntax Description
Defaults
If the utility head command is entered without keywords or arguments, the first ten lines of the file or standard output are copied.
If no file is specified, then the standard input is used.
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
The utility head command copies the beginning bytes (default) or lines of one or more files to the standard output (usually the user interface display). Use the bytes or lines keywords to copy the data based on lines or bytes. Use the count number option to specify the number of bytes or lines to copy. By default, the utility head command copies the first 10 lines of each file.
If more than one file is selected, an identifying header is added before the output for each file. If no file is specified, then the standard input (keyboard) is used.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
In the following example, the utility head command is used to display the first 15 lines from the output of the command show version:
RP/0/RP0/CPU0:router# show version | utility head count 15Cisco IOS XR Software, Version 3.4.0Copyright (c) 2006 by cisco Systems, Inc.ROM: System Bootstrap, Version 1.40(20060413:002654) [CRS-1 ROMMON],router uptime is 5 days, 20 hours, 21 minutesSystem image file is "disk0:hfr-os-mbi-3.4.0/mbihfr-rp.vm"cisco CRS-8/S (7457) processor with 4194304K bytes of memory.7457 processor at 1197Mhz, Revision 1.216 GigabitEthernet/IEEE 802.3 interface(s)2 Ethernet/IEEE 802.3 interface(s)20 Packet over SONET/SDH network interface(s)RP/0/RP0/CPU0:router#In the following example, the utility head command is entered with the bytes keyword. Only the first 15 bytes of output are displayed.
RP/0/RP0/CPU0:router# show version | utility head count 15 bytesCisco IOS XR SRP/0/RP0/CPU0:router#Related Commands
utility less
To display a file page-by-page, use the utility less command in EXEC mode or administration EXEC mode.
utility less [exiteof | nocase | position line-number | startat string] [file source-file] [WORD]
Syntax Description
Defaults
If no text file is specified, standard input is assumed.
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Use the utility less command to display files page by page. You can specify regular expressions for pattern matching using the startat keyword. You can scroll up as well as down. When you enter the less mode, commands are similar to the "vi" editor.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
The following example, the utility less command is used to display the file "config_store". Only part of the file is shown here.
RP/0/RP0/CPU0:router# utility less file disk0:/usr/config_storeLast configuration change at Tue Feb 20 18:34:02 2007 by xxx!hostname H1line consoleexec-timeout 600 0session-timeout 600!line defaultexec-timeout 600 0session-timeout 600!...utility mv
To rename or move a file from one directory to another, use the utility mv command in EXEC mode or administration EXEC mode.
utility mv [force] [interactive] source source-file target target-file [usage]
Syntax Description
Defaults
No default behavior or values
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
In the following example, the utility mv command is used to move the file "aaa" from disk0a: to disk1a:
RP/0/RP0/CPU0:router# utility mv source disk0a:/aaa target disk1a:/aaaRelated Commands
utility sort
To sort, merge, or sequence-check the lines in one or more files, or from the standard input, use the utility sort command in EXEC mode or administration EXEC mode.
utility sort [[dict] [ignoreblank] [key key-definition] [lowercase] [merge] [numeric] [printable] [reverse] [unique] [merge]] [fieldSep character] [file filename] [outfile filename] [usage] [WORD]
Syntax Description
Defaults
If no file is specified, then the standard input (keyboard) is used.
If an outfile filename is not specified, then the standard output (display) is used.
The file is sorted in ascending order.
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
In the following example, the utility sort command is used to sort the contents of the file "words.txt":
RP/0/RP0/CPU0:router# utility sort disk0:/usr/words.txtThefewinquiresACode.DateDoneThisbest-sellingbestsellerbookcomeconcerningfiction,haveitslistmuscledofontoourthewaywayworkIn the following example, only the unique characters in the file "words.txt" are displayed:
RP/0/RP0/CPU0:router# utility sort unique file disk0:/usr/words.txtCode.Datebest-sellingbookconcerninghavelistofourwayworkRelated Commands
utility tail
To copy the end portion of a file or the standard input, use the utility tail command in EXEC mode or administration EXEC mode.
utility tail [bytes] [continuous] [count number] [file input-file] [usage] [WORD]
Syntax Description
Defaults
If the utility tail command is entered without keywords or arguments, the last 10 lines of the standard input are copied.
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Use the utility tail command to copy data from the end of a file.By default, the last 10 lines are copied. Use the bytes keyword to copy the data measured in bytes. Use the count number option to define the number of lines or bytes to copy. Use the file filename option to specify an input file.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
In the following example, the utility tail command is used to display the last 10 lines of the output from the command show version:
RP/0/RP0/CPU0:router# show version | utility tail count 10By iox25.cisco.com in /auto/ioxws46/nightly/ci-34_hfr_06.09.13 for c2.95.3-8hfr-base, V 3.4.0[4n_06.09.13], Cisco Systems, at disk0:hfr-base-3.4.0Built on Wed Sep 13 22:04:26 UTC 2006By iox25.cisco.com in /auto/ioxws46/nightly/ci-34_hfr_06.09.13 for c2.95.3-8hfr-os-mbi, V 3.4.0[4n_06.09.13], Cisco Systems, at disk0:hfr-os-mbi-3.4.0Built on Wed Sep 13 21:47:10 UTC 2006By iox25.cisco.com in /auto/ioxws46/nightly/ci-34_hfr_06.09.13 for c2.95.3-8RP/0/RP0/CPU0:router#In the following example, the utility tail command is used with the bytes keyword to display the last 10 bytes in the output:
RP/0/RP0/CPU0:router# show version | utility tail count 10 bytes.95.3-p8RP/0/RP0/CPU0:router#Related Commands
utility uniq
To display or remove repeated lines in a file, use the utility uniq command in EXEC mode or administration EXEC mode.
utility uniq [[afterChars number] [afterField number] [nonRepeating | repeating] [count]] [infile input-file] [outfile output-file] [usage] [WORD]
Syntax Description
Defaults
If no input file is specified, then the standard input is used.
If no output file is specified, then the standard output is used.
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Use the utility uniq command to display only lines that are repeated in a file, or to display only lines that appear once. This utility compares only adjacent lines, so the file or standard input must be sorted.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
In the following example, the utility unique command is used to display the repeating lines in the output of the show environment command:
RP/0/RP0/CPU0:router# show environment | utility uniq repeatinghost 5V 4500,5500 4250,5750 4000,6000fabricq 1.25V 1125,1375 1063,1438 1000,1500fabricq 1.25V 1125,1375 1063,1438 1000,1500ingress 1.25V 1125,1375 1063,1438 1000,1500spa5 1.5V 1500,0 1575,1425 0,0host 5V 4500,5500 4250,5750 4000,6000fabricq 1.25V 1125,1375 1063,1438 1000,1500fabricq 1.25V 1125,1375 1063,1438 1000,1500ingress 1.25V 1125,1375 1063,1438 1000,1500spa5 1.5V 1500,0 1575,1425 0,0Related Commands
Command DescriptionSorts, merges, or sequence-checks the output displayed from standard input or a file.
utility wc
To count words, lines, or bytes in a file, use the utility wc command in EXEC mode or administration EXEC mode.
utility wc [bytes] [lines] [words] [file input-file] [usage] [WORD]
Syntax Description
Defaults
Output is displayed in the order bytes, words, and lines, even if the options are entered in a different order.
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Output is displayed in the following order:
•
When keywords are entered, the output appears in the order bytes, words, and lines.
•
When no keyword is entered, the output appears in the order lines, words, and bytes.
•
When any UNIX equivalent options are entered, the output appears in the order specified by the options. For example, if the command utility wc -w -l -c is entered, the output appears in the order words, lines, and bytes.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
In the following example, the utility wc command is issued to display the number of lines, words, and bytes in the output of the show version command:
RP/0/RP0/CPU0:router# show version | utility wc221 1160 10820The output displays the following:
•
221 lines
•
1160 words
•
10820 bytes
In the following example, the utility wc command is entered with the words keyword to display the number of words in the output of the show version command:
RP/0/RP0/CPU0:router# show version | utility wc words1160utility which
To locate a program file, use the utility which command in EXEC mode or administration EXEC mode.
utility which [all] [fullname] [long [link]] program program-name [usage] [WORD]
Syntax Description
Defaults
No default behavior or values
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
In the following example, the utility which command is entered without keywords or arguments to display the location of the perl program:
RP/0/RP0/CPU0:router# utility which program perl/pkg/bin/perlIn the following example, the utility which command is entered with the fullname keyword to display the full directory path of the perl program:
RP/0/RP0/CPU0:router# utility which fullname program perl/disk0:/hfr-base-3.4.0.1I/sbin/perlIn the following example, the utility which command is entered with the long keyword to display additional details about the perl program file:
RP/0/RP0/CPU0:router# utility which long program perl-rwxrwxrwx 1 0 0 19245 Jul 28 14:31 /pkg/bin/perlRelated Commands
utility xargs
To run a program from one or more argument lists, use the utility xargs command in EXEC mode or administration EXEC mode.
utility xargs [trace] [program [program-name] [initial-arguments]] [usage] [WORD]
Syntax Description
Defaults
If no program is specified, then the echo utility is used (the input lines are displayed).
Command Modes
EXEC
Administration EXECCommand History
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.
Note
Keywords are entered using the displayed syntax, or with UNIX-equivalent syntax. The UNIX-equivalent syntax is displayed in parentheses () in the syntax description. To display the UNIX-equivalent syntax online, enter the keyword usage.
Task ID
Examples
In the following example, the utility xargs command is used to display the egress lines:
RP/0/RP0/CPU0:router# more disk0:/usr/files | utility xargs program grep EGRESSdisk0:/usr/atm.cfg:service-policy output EGRESS-GigabitEthernet0-0-0-0-101disk0:/usr/atm.cfg:service-policy output EGRESS-GigabitEthernet0-0-0-0-102disk0:/usr/atm.cfg:service-policy output EGRESS-GigabitEthernet0-0-0-0-103disk0:/usr/atm.cfg:service-policy output EGRESS-GigabitEthernet0-0-0-0-104disk0:/usr/atm.cfg:service-policy output EGRESS-GigabitEthernet0-0-0-0-105disk0:/usr/atm.cfg:service-policy output EGRESS-GigabitEthernet0-0-0-0-106disk0:/usr/atm.cfg:service-policy output EGRESS-GigabitEthernet0-0-0-0-107disk0:/usr/atm.cfg:service-policy output EGRESS-GigabitEthernet0-0-0-0-108disk0:/usr/atm.cfg:service-policy output EGRESS-commondisk0:/usr/atm.cfg:service-policy output EGRESS-commondisk0:/usr/atm.cfg:service-policy output EGRESS-commondisk0:/usr/atm.cfg:service-policy output EGRESS-commondisk0:/usr/atm.cfg:service-policy output EGRESS-common.....