3.3. File Command Reference

3.3.1. Command Hierarchy

3.3.1.1. File Commands

attrib [+r | -r] file-url
attrib
cd [file-url]
copy source-file-url dest-file-url [force]
delete file-url [force]
dir [file-url] [sort-order {d | n | s}] [reverse]
format [cflash-id] [reliable]
md file-url
move old-file-url new-file-url [force]
rd file-url rf
rd file-url [force]
repair [cflash-id]
scp local-file-url destination-file-url [router router-instance] [force]
scp local-file-url destination-file-url [force] service service-name
[no] shutdown [active] [standby]
[no] shutdown cflash-id
type file-url
version file-url [check]
vi local-url

3.3.2. Command Descriptions

3.3.2.1. File System Commands

shutdown

Syntax 
[no] shutdown [active] [standby]
[no] shutdown [cflash-id]
Context 
file
Description 

This command shuts down (unmounts) the specified CPM(s).

Use the no shutdown [active] [standby] command to enable one or both CPM.

Use the no shutdown [cflash-id] command to enable a compact flash (cf1:, cf2:, or cf3:) on the CPM/CFM/CCM. The no shutdown command can be issued for a specific slot when no compact flash is present. When a flash card is installed in the slot, the card will be activated upon detection.

In redundant systems, use the no shutdown command on cf3: on both SF/CPMs or CCMs in order to facilitate synchronization. See the synchronize command.

Note:

The shutdown command must be issued prior to removing a flash card. If no parameters are specified, then the drive referred to by the current working directory will be shut down.

LED Status Indicators

Table 27 lists the possible states for the compact flash and their LED status indicators.

Table 27:  LED Status Indicators  

State

Description

Operational

If a compact flash is present in a drive and operational (no shutdown), the respective LED is lit green. The LED flickers when the compact flash is accessed. Note: Do not remove the compact flash during a read/write operation.

Flash defective

If a compact flash is defective, the respective LED blinks amber to reflect the error condition and a trap is raised.

Flash drive shut down

When the compact flash drive is shut down and a compact flash present, the LED is lit amber. In this state, the compact flash can be ejected.

No compact flash present, drive shut down

If no compact flash is present and the drive is shut down the LED is unlit.

No compact flash present, drive enabled

If no compact flash is present and the drive is not shut down the LED is unlit.

Ejecting a compact flash

The compact flash drive should be shut down before ejecting a compact flash card. The LED should turn to solid (not blinking) amber. This is the only mode to safely remove the flash card. If a compact flash drive is not shut down before a compact flash is ejected, the LED blinks amber for approximately 5 seconds before shutting off.

The shutdown or no shutdown state is not saved in the configuration file. Following a reboot all compact flash drives are in their default state.

Default 

no shutdown

Parameters 
cflash-id—
Specifies the compact flash slot ID to be shut down or enabled. If cflash-id is specified, the drive is shut down or enabled. If no cflash-id is specified, the drive referred to by the current working directory is assumed. If a slot number is not specified, then the active CPM/CFM is assumed.
Values—
cf1:, cf1-A:, cf1-B:, cf2:, cf2-A:, cf2-B:, cf3:, cf3-A:, cf3-B:

 

Default—
the current compact flash device
active—
Specifies that all drives on the active CPM are shutdown or enabled.
standby—
Specifies that all drives on the standby CPM are shutdown or enabled.

When both active and standby keywords are specified, then all drives on both CPM are shutdown.

3.3.2.2. File Commands

file

Syntax 
file
Context 
root
Description 

the context to enter and perform file system operations. When entering the file context, the prompt changes to reflect the present working directory. Navigating the file system with the cd .. command results in a changed prompt.

The exit all command leaves the file system/file operation context and returns to the <root> CLI context. The state of the present working directory is maintained for the CLI session. Entering the file command returns the cursor to the working directory where the exit command was issued.

attrib

Syntax 
attrib [+r | -r] file-url
attrib
Context 
file
Description 

This command sets or clears/resets the read-only attribute for a file in the local file system. To list all files and their current attributes enter attrib or attrib x where x is either the filename or a wildcard (*).

When an attrib command is entered to list a specific file or all files in a directory, the file’s attributes are displayed with or without an “R” preceding the filename. The “R” implies that the +r is set and that the file is read-only. Files without the “R” designation implies that the -r is set and that the file is read-write-all. For example:

ALA-1>file cf3:\ # attrib
cf3:\bootlog.txt
cf3:\bof.cfg
cf3:\boot.ldr
cf3:\sr1.cfg
cf3:\test
cf3:\bootlog_prev.txt
cf3:\BOF.SAV 
Parameters 
file-url—
Specifies the URL for the local file.
Values—

file url

local-url | remote-url: 255 chars max

local-url

[cflash-id/][file-path] 200 chars max, including cflash-id directory length 99 chars max each

remote-url

[{ftp:// | tftp://}login:pswd@remote-locn/][file-path]

247 chars max

directory length 99 chars max each

remote-locn

[hostname | ipv4-address | [ipv6-address] ]

ipv4-address

a.b.c.d

ipv6-address

x:x:x:x:x:x:x:x[-interface]

x:x:x:x:x:x:d.d.d.d[-interface]

x - [0 to FFFF]H

d - [0 to 255]D

interface - 32 chars max, for link local addresses 255

cflash-id

cf1:, cf1-A:, cf1-B:, cf2:, cf2-A:, cf2-B:, cf3:, cf3-A:, cf3-B:

 

+r—
Sets the read-only attribute on the specified file.
-r—
Clears/resets the read-only attribute on the specified file.

cd

Syntax 
cd [file-url]
Context 
file
Description 

This command displays or changes the current working directory in the local file system.

Parameters 
file-url—
Specifies the file URL.
Values—

file url

local-url | remote-url: 255 chars max

local-url

[cflash-id/][file-path] 200 chars max, including cflash-id directory length 99 chars max each

remote-url

[{ftp:// | tftp://}login:pswd@remote-locn/][file-path]

247 chars max

directory length 99 chars max each

remote-locn

[hostname | ipv4-address | ipv6-address]

ipv4-address

a.b.c.d

ipv6-address

x:x:x:x:x:x:x:x[-interface]

x:x:x:x:x:x:d.d.d.d[-interface]

x - [0 to FFFF]H

d - [0 to 255]D

interface - 32 chars max, for link local addresses 255

cflash-id

cf1:, cf1-A:, cf1-B:, cf2:, cf2-A:, cf2-B:, cf3:, cf3-A:, cf3-B:

 

If no file-url is entered, the current working directory is displayed.
..—
signifies the parent directory. This can be used in place of an actual directory name in a directory-url.
directory-url—
Specifies the destination directory.

copy

Syntax 
copy source-file-url dest-file-url [force]
Context 
file
Description 

This command copies a file or all files in a directory from a source URL to a destination URL. At least one of the specified URLs should be a local URL. The optional wildcard (*) can be used to copy multiple files that share a common (partial) prefix and/or (partial) suffix.

When a file is copied to a destination with the same file name, the original file is overwritten by the new file specified in the operation. The following prompt appears if the destination file already exists:

“Overwrite destination file (y/n)?”

For example:

To copy a file named srcfile in a directory called test on cf2 in slot B to a file called destfile in a directory called production on cf1 in slot A, the syntax is:

sr1>file cf2:\ # copy cf2-B/test/srcfile cf1-A/production/destfile

To FTP a file named 121201.cfg in directory mydir stored on cf1 in slot A to a network FTP server with IP address 131.12.31.79 in a directory called backup with a destination file name of 121201.cfg, the FTP syntax is:

copy cf1-A/mydir/121201.cfg 131.12.31.79/backup/121201.cfg

Parameters 
source-file-url—
Specifies the location of the source file or directory to be copied.
Values—

file url

local-url | remote-url: 255 chars max

local-url

[cflash-id/][file-path] 200 chars max, including cflash-id directory length 99 chars max each

remote-url

[{ftp:// | tftp://}login:pswd@remote-locn/][file-path]

247 chars max

directory length 99 chars max each

remote-locn

[hostname | ipv4-address | ipv6-address]

ipv4-address

a.b.c.d

ipv6-address

x:x:x:x:x:x:x:x[-interface]

x:x:x:x:x:x:d.d.d.d[-interface]

x - [0 to FFFF]H

d - [0 to 255]D

interface - 32 chars max, for link local addresses 255

cflash-id

cf1:, cf1-A:, cf1-B:, cf2:, cf2-A:, cf2-B:, cf3:, cf3-A:, cf3-B:

 

dest-file-url—
Specifies the destination of the copied file or directory.
force—
Specifies to force an immediate copy of the specified file(s). Executes the command without displaying a user prompt message.

delete

Syntax 
delete file-url [force]
Context 
file
Description 

This command deletes the specified file.

The optional wildcard (*) can be used to delete multiple files that share a common (partial) prefix and/or (partial) suffix. When the wildcard is entered, the following prompt displays for each file that matches the wildcard:

“Delete file <filename> (y/n)?”

Parameters 
file-url—
Specifies the file name to delete.
Values—

file url

local-url | remote-url: 255 chars max

local-url

[cflash-id/][file-path] 200 chars max, including cflash-id directory length 99 chars max each

remote-url

[{ftp:// | tftp://}login:pswd@remote-locn/][file-path]

247 chars max

directory length 99 chars max each

remote-locn

[hostname | ipv4-address | “[“ipv6-address”]”]

ipv4-address

a.b.c.d

ipv6-address

x:x:x:x:x:x:x:x[-interface]

x:x:x:x:x:x:d.d.d.d[-interface]

x - [0 to FFFF]H

d - [0 to 255]D

interface - 32 chars max, for link local addresses 255

cflash-id

cf1:, cf1-A:, cf1-B:, cf2:, cf2-A:, cf2-B:, cf3:, cf3-A:, cf3-B:

 

force—
Forces an immediate deletion of the specified file(s). The command file delete * force deletes all the wildcard matching files without displaying a user prompt message.

dir

Syntax 
dir [file-url] [sort-order {d | n | s}] [reverse]
Context 
file
Description 

This command displays a list of files and subdirectories in a directory.

Parameters 
file-url—
Specifies the path or directory name.

Use the file-url with the optional wildcard (*) to reduce the number of files to list.

Default—
Lists all files in the current working directory.
sort-order {d | n | s}—
Specifies the sort order.
Values—
d — date
n — name
s — size

 

reverse—
Reverses the sort order.
Output 

The following output is an example of directory information.

Sample Output
A:cses-E12>file cf3:\ # dir
  - dir [<file-url>] [sort-order { d | n | s}] [reverse]
 
 <file-url>           : <local-url>|<remote-url>
                        local-url      - [<cflash-id>/][<file-path>]
                                         200 chars max, including cflash-id
                                         directory length 99 chars max each
                        remote-url     - [ftp://<login>:<pswd>@<remote-locn>/
                                         ][<file-path>]
                                         255 chars max
                                         directory length 99 chars max each
                        remote-locn    - [ <hostname> | <ipv4-address> |
                                         [<ipv6-address>]]
                        ipv4-address   - a.b.c.d
                        ipv6-address   - x:x:x:x:x:x:x:x[-interface]
                                         x:x:x:x:x:x:d.d.d.d[-interface]
                                         x - [0..FFFF]H
                                         d - [0..255]D
                                         interface - 32 chars max, for link
                                         local addresses
                        cflash-id      - cf1:|cf1-A:|cf1-B:|cf2:|cf2-A:|
                                         cf2-B:|cf3:|cf3-A:|cf3-B:
 < d | n | s>         : Sort order: d - date, n - name, s - size
 <reverse>            : keyword - reverse order
A:cses-E12>file cf3:\ # dir

format

Syntax 
format [cflash-id] [reliable]
Context 
root>file
Description 

This command formats the compact flash. The compact flash must be shut down before starting the format.

Parameters 
cflash-id—
Specifies the compact flash type.
Values—
cf1:, cf1-A:, cf1-B:, cf2:, cf2-A:, cf2-B:, cf3:, cf3-A:, cf3-B:

 

reliable—
Enables the reliance file system and disables the default DOS file system. This option is valid only on compact flashes 1 and 2.

md

Syntax 
md file-url
Context 
file
Description 

This command creates a new directory in a file system.

Directories can only be created one level at a time.

Parameters 
file-url—
Specifies the directory name to be created.
Values—

file url

local-url | remote-url: 255 chars max

local-url

[cflash-id/][file-path] 200 chars max, including cflash-id directory length 99 chars max each

remote-url

[{ftp:// | tftp://}login:pswd@remote-locn/][file-path]

247 chars max

directory length 99 chars max each

remote-locn

[hostname | ipv4-address | “[“ipv6-address”]”]

ipv4-address

a.b.c.d

ipv6-address

x:x:x:x:x:x:x:x[-interface]

x:x:x:x:x:x:d.d.d.d[-interface]

x - [0 to FFFF]H

d - [0 to 255]D

interface - 32 chars max, for link local addresses 255

cflash-id

cf1:, cf1-A:, cf1-B:, cf2:, cf2-A:, cf2-B:, cf3:, cf3-A:, cf3-B:

 

move

Syntax 
move old-file-url new-file-url [force]
Context 
file
Description 

This command moves a local file, system file, or a directory. If the target already exists, the command fails and an error message displays.

The following prompt appears if the destination file already exists:

“Overwrite destination file (y/n)?”

Parameters 
old-file-url—
Specifies the file or directory to be moved.
Values—

file url

local-url | remote-url: 255 chars max

local-url

[cflash-id/][file-path] 200 chars max, including cflash-id directory length 99 chars max each

remote-url

[{ftp:// | tftp://}login:pswd@remote-locn/][file-path]

247 chars max

directory length 99 chars max each

remote-locn

[hostname | ipv4-address | “[“ipv6-address”]”]

ipv4-address

a.b.c.d

ipv6-address

x:x:x:x:x:x:x:x[-interface]

x:x:x:x:x:x:d.d.d.d[-interface]

x - [0 to FFFF]H

d - [0 to 255]D

interface - 32 chars max, for link local addresses 255

cflash-id

cf1:, cf1-A:, cf1-B:, cf2:, cf2-A:, cf2-B:, cf3:, cf3-A:, cf3-B:

 

new-file-url—
The new destination to place the old-file-url.
Values—

file url

local-url | remote-url: 255 chars max

local-url

[cflash-id/][file-path] 200 chars max, including cflash-id directory length 99 chars max each

remote-url

[{ftp:// | tftp://}login:pswd@remote-locn/][file-path]

247 chars max

directory length 99 chars max each

remote-locn

[hostname | ipv4-address | “[“ipv6-address”]”]

ipv4-address

a.b.c.d

ipv6-address

x:x:x:x:x:x:x:x[-interface]

x:x:x:x:x:x:d.d.d.d[-interface]

x - [0 to FFFF]H

d - [0 to 255]D

interface - 32 chars max, for link local addresses 255

cflash-id

cf1:, cf1-A:, cf1-B:, cf2:, cf2-A:, cf2-B:, cf3:, cf3-A:, cf3-B:

 

force—
Forces an immediate move of the specified file(s).

The file move force command moves the specified file(s) without displaying a user prompt message.

rd

Syntax 
rd file-url rf
rd file-url [force]
Context 
file
Description 

If the directory is empty, the rd command is used to remove it. The force option executes the command without prompting the user to confirm the action.

If the directory contains files and/or subdirectories, the rf parameter must be used to remove the directory.

Example:

A:nE1>file cf1:\ # rd test 
Are you sure (y/n)? y 
Deleting directory cf1:\test ..MINOR: CLI Cannot delete cf1:\test.
A:nE1>file cf1:\ # rd test force 
Deleting directory cf1:\test .MINOR: CLI Cannot delete cf1:\test.
 
 
A:nE1>file cf1:\ # rd testbase rf 
Deleting all subdirectories and files in specified directory. y/n ?y 
Deleting directory cf1:\testbase\testbase1 ..OK
Deleting directory cf1:\test .OK
 
Parameters 
file-url—
Specifies the directory to be removed.
Values—

local-url | remote-url

local-url

[cflash-id/][file-path] 200 chars max, including cflash-id

directory length 99 chars max each

remote-url

[ftp://login:pswd@remote-locn/][file-path]

247 chars max

directory length 99 chars max each

remote-locn

[hostname | ipv4-address | “[“ipv6-address”]”]

ipv4-address

a.b.c.d

ipv6-address

x:x:x:x:x:x:x:x[-interface]

x:x:x:x:x:x:d.d.d.d[-interface]

x - [0 to FFFF]H

d - [0 to 255]D

interface - 32 chars max, for link local addresses

cflash-id

cf1:, cf1-A:, cf1-B:, cf2:, cf2-A:, cf2-B:, cf3:, cf3-A:, cf3-B:

 

rf—
Forces a recursive delete.
force—
Forces an immediate deletion of the specified directory. The rd file-url force command executes the command without displaying a user prompt message.

repair

Syntax 
repair [cflash-id]
Context 
file
Description 

This command checks a compact flash device for errors and repairs any errors found.

Parameters 
cflash-id—
Specifies the compact flash slot ID to be shut down or enabled. When a specific cflash-id is specified, then that drive is shut down. If no flash-id is specified, the drive referred to by the current working directory is assumed. If a slot number is not specified, then the active CSM is assumed.
Values—
cf1:, cf1-A:, cf1-B:, cf2:, cf2-A:, cf2-B:, cf3:, cf3-A:, cf3-B:

 

Default—
the current compact flash device.

scp

Syntax 
scp local-file-url destination-file-url [router router-instance] [force]
scp local-file-url destination-file-url [force] service service-name
Context 
file
Description 

This command copies a local file to a remote host file system. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh. The following prompt appears:

“Are you sure (y/n)?” The destination must specify a user and a host.

Parameters 
local-file-url—
Specifies the local source file or directory.
Values—

[cflash-id/] file-path

200 characters max

cflash-id

cf1:, cf1-A:, cf1-B:, cf2:, cf2-A:, cf2-B:, cf3:, cf3-A:, cf3-B:

 

destination-file-url—
Specifies the destination file.
Values—

destination-file-*: user@hostname:file-path - [255 chars max]

user

32 chars max

hostname

[dns-name | ipv4-address | “[“ipv6-address”]”]

ipv4-address

a.b.c.d

ipv6-address

x:x:x:x:x:x:x:x[-interface]

x:x:x:x:x:x:d.d.d.d[-interface]

x - [0 to FFFF]H

d - [0 to 255]D

interface - 32 chars max, mandatory for link local addresses

dns-name

128 chars max

file-path

200 chars max

 

user—
Specifies the SSH user.
hostname—
Specifies the remote host IP address of DNS name.
file-path—
Specifies the destination path.
router-instance—
Specifies the router name or service ID used to specify the router instance.
Values—

router-name

“Base”, “management”, “vpls-management”

vprn-service-id

1 to 2147483647

 

Default—
Base
force—
Forces an immediate copy of the specified file. The command file scp local-file-url destination-file-url [router router-instance] force executes the command without displaying a user prompt message.
service-name
Specifies the service name used to identify the router instance. The service name can be a maximum of 64 characters long.

type

Syntax 
type file-url
Context 
file
Description 

This command displays the contents of a text file.

Parameters 
file-url—
Specifies the file contents to display.
Values—

local-url | remote-url

local-url

[cflash-id/][file-path]

200 chars max, including cflash-id

directory length 99 chars max each

remote-url

[{ftp://|tftp://}login:pswd@remote-locn/ [file-path]

255 chars max

directory length 99 chars max each

remote-locn

[hostname | ipv4-address | ipv6-address]

ipv4-address

a.b.c.d

ipv6-address

x:x:x:x:x:x:x:x[-interface]

x:x:x:x:x:x:d.d.d.d[-interface]

x - [0 to FFFF]H

d - [0 to 255]D

interface - 32 chars max, for link local addresses

cflash-id

cf1:, cf1-A:, cf1-B:

 

version

Syntax 
version file-url [check]
Context 
file
Description 

This command displays the version of an SR OS *.tim or iom.tim file. The iom.tim file is used for the XCM on the 7950 XRS.

Parameters 
file-url—
Specifies the file name of the target file.
Values—

local-url | remote-url

local-url

[cflash-id/][file-path]

200 chars max, including cflash-id

directory length 99 chars max each

remote-url

[{ftp://|tftp://}login:pswd@remote-locn/ [file-path]

255 chars max

directory length 99 chars max each

remote-locn

[hostname | ipv4-address | ipv6-address]

ipv4-address

a.b.c.d

ipv6-address

x:x:x:x:x:x:x:x[-interface]

x:x:x:x:x:x:d.d.d.d[-interface]

x - [0 to FFFF]H

d - [0 to 255]D

interface - 32 chars max, for link local addresses

cflash-id

cf1:, cf1-A:, cf1-B:

 

check—
Validates the .tim file.
Output 

The following output is an example of SR OS version information.

Sample Output
A:Redundancy>file cf3:\ # version  ftp://test:1234@xxx.xxx.xxx.xx/usr/global/images/
6.1/R4/cpm.tim
TiMOS-C-6.1.R4 for 7750
Thu Oct 30 14:21:09 PDT 2008 by builder in /rel6.1/b1/R4/panos/main
A:Redundancy>file cf3:\ # version check ftp://test:1234@xxx.xxx.xxx.xx/usr/global/
images/6.1/R4/cpm.tim 
TiMOS-C-6.1.R4 for 7750
Thu Oct 30 14:21:09 PDT 2008 by builder in /rel6.1/b1/R4/panos/main
Validation successful
A:Redundancy>file cf3:\ #
 

vi

Syntax 
vi local-url
Context 
file
Description 

Edit files using the vi editor. For more information, refer to VI Editor.

Parameters 
local-url—
Specifies the local source file or directory.
Values—
[cflash-id/]file-path
cflash-id: cf1:, cf2:, cf3: