- Table of Contents
-
- 01-Fundamentals Command Reference
- 00-Preface
- 01-CLI commands
- 02-RBAC commands
- 03-Login management commands
- 04-FTP and TFTP commands
- 05-File system management commands
- 06-Configuration file management commands
- 07-Software upgrade commands
- 08-ISSU commands
- 09-Emergency shell commands
- 10-Device management commands
- 11-MDC commands
- 12-TCL commands
- 13-License management commands
- Related Documents
-
Title | Size | Download |
---|---|---|
05-File system management commands | 143.19 KB |
|
IMPORTANT: · Before managing storage media, files, and directories, make sure you know the possible impacts. · Files and directories with a name starting with a dot (.) are hidden. For common files and directories, do not specify a name starting with a dot. · Some system files are hidden. For normal operation of the system, do not modify or delete hidden files or directories. |
Before you use the copy, delete, fixdisk, format, gunzip, gzip, mkdir, move, rename, rmdir, or undelete command on a USB disk, make sure the disk is not write protected.
cd
Use cd to change the current working directory.
Syntax
cd { directory | .. }
Views
User view
Predefined user roles
network-admin
mdc-admin
Parameters
directory: Specifies the name of the target directory, case insensitive, in the format [drive:/]path. For more information about how to enter the drive and path arguments, see Fundamentals Configuration Guide. If no drive information is provided, the argument represents a folder or subfolder in the current directory.
..: Returns to an upper directory. If the current working directory is the root directory, or if no upper directory exists, the system displays an error message when you execute the cd .. command. No online help information is available for this keyword.
Examples
# Access the test folder after logging in to the device.
<Sysname> cd test
# Return to the upper directory.
<Sysname> cd ..
· In standalone mode:
# Display the number of the slot where the standby MPU resides.
<Sysname> display device
Slot No. Brd Type Brd Status Software Version
0 LST1MRPNC1 Master S12500-CMW710-A7121
1 LST1MRPNC1 Standby S12500-CMW710-A7121
2 LST1GT48LEC1 Normal S12500-CMW710-A7121
3 NONE Absent NONE
4 NONE Absent NONE
5 LST1GT48LEC1 Normal S12500-CMW710-A7121
6 NONE Absent NONE
7 NONE Absent NONE
8 NONE Absent NONE
9 NONE Absent NONE
10 NONE Absent NONE
11 NONE Absent NONE
12 LST1SF08B1 Normal S12500-CMW710-A7121
13 LST1SF08B1 Normal S12500-CMW710-A7121
14 LST1SF08B1 Normal S12500-CMW710-A7121
15 LST1SF08B1 Normal S12500-CMW710-A7121
16 LST1SF08B1 Normal S12500-CMW710-A7121
17 LST1SF08B1 Normal S12500-CMW710-A7121
18 LST1SF08B1 Normal S12500-CMW710-A7121
The output shows that the slot number of the standby MPU is 1.
# Access the root directory of the Flash on the standby MPU.
<Sysname> cd slot1#flash:/
# Change to the test folder in the root directory of the active MPU.
<Sysname> cd flash:/test
· In IRF mode:
# Display the member IDs and slot numbers of the IRF fabric's MPUs.
<Sysname> display irf
Member Slot Role Priority CPU-Mac Description
2 0 Standby 20 00e0-fc0f-8c0f ---
2 1 Standby 20 00e0-fc0f-8c1f ---
*+3 5 Master 20 00e0-fc0f-8c22 ---
3 6 Standby 20 00e0-fc0f-8c32 ---
--------------------------------------------------
* indicates the device is the master.
+ indicates the device through which the user logs in.
The Bridge MAC of the IRF is: 00e0-fc00-0a00
Auto upgrade : yes
Mac persistent : 6 min
Domain ID : 0
Auto merge : no
The output shows that the active MPU of the IRF fabric resides in slot 5 of member device 3 and the IRF fabric has three standby MPUs: one resides in slot 0 of member device 2, one in slot 1 of member device 2, and one in slot 6 of member device 3.
# Access the test folder in the Flash root directory of the IRF fabric's active MPU.
<Sysname> cd flash:/test
# Change to the Flash root directory of the standby MPU that resides in slot 1 of member device 2.
<Sysname> cd chassis2#slot1#flash:/
# Change to the test folder in the Flash root directory of the IRF fabric's active MPU.
<Sysname> cd flash:/
copy
Use copy to copy a file.
Syntax
copy fileurl-source fileurl-dest [ vpn-instance vpn-instance-name ] [ source interface interface-type interface-number ]
Views
User view
Predefined user roles
network-admin
mdc-admin
Parameters
fileurl-source: Specifies the name or URL of the file to be copied. If the file resides on an FTP or TFTP server rather than on the device, specify the URL of the file. The file name is case insensitive. Whether a URL is case sensitive depends on the server.
fileurl-dest: Specifies the name or URL of the destination file or directory. To copy the source file to an FTP or TFTP server, specify a URL. If you specify a directory, the device copies the specified file to the directory and saves it with its original file name. The destination file name is case sensitive, and the destination directory name is case insensitive. Whether a URL is case sensitive depends on the server.
vpn-instance vpn-instance-name: Specifies the MPLS L3VPN to which the destination FTP or TFTP server belongs. The vpn-instance-name argument is a case-sensitive string of 1 to 31 characters. If the server is on the public network, do not specify this option.
source interface interface-type interface-number: Specifies the source interface used to connect to the server. After you specify the source interface, the device uses the primary IP address of the source interface as the source IP address for outgoing packets. If you do not specify this option, the device uses the outgoing interface as the source interface.
Usage guidelines
You can use the copy command to perform the following operations:
· Copy a local file and save it locally.
· Copy a local file and save it to an FTP or TFTP server.
· Copy a file on an FTP or TFTP server and save it locally.
To specify a file or directory on the device, follow the file name guidelines in Fundamentals Configuration Guide.
To specify a file or directory on an FTP server, enter the URL in the format ftp://FTP username[:password]@server address[:port number]/file path[/file name]. The username and password must be the same as those configured on the FTP server. If the server authenticates users only by the username, you do not need to enter the password. For example, to use the username 1 and password 1 to specify the startup.cfg file under the authorized working directory on FTP server 1.1.1.1, enter the URL ftp://1:[email protected]/startup.cfg.
To specify a file or directory on a TFTP server, enter the URL in the format tftp://server address[:port number]/file path[/file name]. For example, to specify the startup.cfg file under the working directory on TFTP server 1.1.1.1, enter the URL tftp://1.1.1.1/startup.cfg.
The FTP or TFTP server address can be an IPv4 or IPv6 address. If you specify a colon (:) after the server address, you must specify the port number, which must be the number of the listening port on the server.
Examples
# Copy the test.cfg file in the current folder and save it to the current folder as testbackup.cfg.
<Sysname> copy test.cfg testbackup.cfg
Copy flash:/test.cfg to flash:/testbackup.cfg?[Y/N]:y
Copying file flash:/test.cfg to flash:/testbackup.cfg... Done.
# Copy the 1.cfg file from the Flash's test folder to the CF card and save it to the testbackup folder on the first partition with the file name 1backup.cfg.
<Sysname> copy flash:/test/1.cfg cfa0:/testbackup/1backup.cfg
Copy flash:/test/1.cfg to cfa0:/testbackup/1backup.cfg?[Y/N]:y
Copying file flash:/test/1.cfg to cfa0:/testbackup/1backup.cfg... Done.
# Copy test.cfg from the working directory on FTP server 1.1.1.1 and save it to the local current folder as testbackup.cfg. In this example, the FTP username and password are user and private.
<Sysname> copy ftp://user:[email protected]/test.cfg testbackup.cfg
Copy ftp://user:[email protected]/test.cfg to flash:/testbackup.cfg?[Y/N]:y
Copying file ftp://user:[email protected]/test.cfg to flash:/testbackup.cfg... Done.
# Copy test.cfg from the current folder and save it to the working directory on FTP server 1.1.1.1 as testbackup.cfg. In this example, the FTP username and password are user and private.
<Sysname> copy test.cfg ftp://user:[email protected]/testbackup.cfg
Copy flash:/test.cfg to ftp://user:[email protected]/testbackup.cfg?[Y/N]:y
Copying file flash:/test.cfg to ftp://user:[email protected]/testbackup.cfg... Done.
# Copy test.cfg from the working directory on TFTP server 1.1.1.1 and save it to the local current folder as testbackup.cfg.
<Sysname> copy tftp://1.1.1.1/test.cfg testbackup.cfg
Copy tftp://1.1.1.1/test.cfg to flash:/testbackup.cfg?[Y/N]:y
Copying file tftp://1.1.1.1/test.cfg to flash:/testbackup.cfg... Done.
# Copy test.cfg from the current folder and save it to the working directory on TFTP server 1.1.1.1 as testbackup.cfg.
<Sysname> copy test.cfg tftp://1.1.1.1/testbackup.cfg
Copy flash:/test.cfg to tftp://1.1.1.1/testbackup.cfg?[Y/N]:y
Copying file flash:/test.cfg to tftp://1.1.1.1/testbackup.cfg... Done.
# Copy test.cfg from the working directory on FTP server 1.1.1.1 and save it to the local current folder as testbackup.cfg. In this example, the FTP username and password are user and private, and the FTP server resides in VPN vpn1.
<Sysname> copy ftp://user:[email protected]/test.cfg testbackup.cfg vpn-instance vpn1
Copy ftp://user:[email protected]/test.cfg to flash:/testbackup.cfg?[Y/N]:y
Copying file ftp://user:[email protected]/test.cfg to flash:/testbackup.cfg... Done.
# Copy test.cfg from the working directory on TFTP server 1.1.1.1 and save it to the local current folder as testbackup.cfg. In this example, the TFTP server resides in VPN vpn1.
<Sysname> copy tftp://1.1.1.1/test.cfg testbackup.cfg vpn-instance vpn1
Copy tftp://1.1.1.1/test.cfg to flash:/testbackup.cfg?[Y/N]:y
Copying file tftp://1.1.1.1/test.cfg to flash:/testbackup.cfg... Done.
# In standalone mode, copy the active MPU's configuration file test.cfg to the standby MPU's Flash root directory.
<Sysname> copy test.cfg slot1#flash:/
Copy flash:/test.cfg to slot1#flash:/test.cfg?[Y/N]:y
Copying file flash:/test.cfg to slot1#flash:/test.cfg...Done.
# In IRF mode, copy a configuration file of the IRF fabric's active MPU to the Flash root directory of the standby MPU that resides in slot 1 of member device 1.
<Sysname> copy test.cfg chassis1#slot1#flash:/
Copy flash:/test.cfg to chassis1#slot1#flash:/test.cfg?[Y/N]:y
Copying file flash:/test.cfg to chassis1#slot1#flash:/test.cfg...Done.
# In IRF mode, copy a configuration file of the standby MPU that resides in slot 1 of member device 1 to the Flash root directory of the standby MPU that resides in slot 1 of member device 2.
<Sysname> copy chassis1#slot1#flash:/test.cfg chassis2#slot1#flash:/
Copy chassis1#slot1#flash:/test.cfg to chassis2#slot1#flash:/test.cfg?[Y/N]:y
Copying file chassis1#slot1#flash:/test.cfg to chassis2#slot1#flash:/test.cfg...Done.
delete
Use delete to delete a file.
Syntax
delete [ /unreserved ] file-url
Views
User view
Predefined user roles
network-admin
mdc-admin
Parameters
/unreserved: Permanently deletes the specified file. If you do not specify this keyword, the command moves the file to the recycle bin.
file-url: Specifies the name of the file to be deleted. Asterisks (*) are acceptable as wildcards. For example, to remove files with the .txt extension in the current directory, enter delete *.txt.
Usage guidelines
Use the delete /unreserved file-url command with caution. A file deleted with this command cannot be restored.
Whether the delete file-url command permanently deletes a file or just moves it to the recycle bin depends on the following:
· When the device is running out of storage space, this command permanently deletes a file.
· If you are logged in to the default MDC and using this command to delete a file of a non-default MDC, this command permanently deletes the file.
· In other cases, this command moves a file to the recycle bin.
A file moved to the recycle bin can be restored by using the undelete command.
Do not use the delete command to delete files from the recycle bin. To delete files from the recycle bin, use the reset recycle-bin command.
If you successively delete two files that have the same name from the same directory, only the latter is retained in the recycle bin. If you delete two files that have the same name but reside in different directories, both files are retained in the recycle bin.
Examples
# In standalone mode, remove file 1.cfg from the root directory of the active MPU's storage medium.
<Sysname> delete 1.cfg
Delete flash:/1.cfg?[Y/N]:y
Deleting file flash:/1.cfg...Done.
# In standalone mode, permanently delete file 2.cfg from the root directory of the active MPU's storage medium.
<Sysname> delete /unreserved 2.cfg
The file cannot be restored. Delete flash:/2.cfg?[Y/N]:y
Deleting the file permanently will take a long time. Please wait...
Deleting file flash:/2.cfg...Done.
# In standalone mode, remove the 1.cfg file from the root directory of the storage medium on the standby MPU (in slot 1):
· Approach 1
<Sysname> delete slot1#flash:/1.cfg
Delete slot1#flash:/1.cfg?[Y/N]:y
Deleting file slot1#flash:/1.cfg...Done.
· Approach 2
<Sysname> cd slot1#flash:/
<Sysname> delete 1.cfg
Delete slot1#flash:/1.cfg?[Y/N]:y
Deleting file slot1#flash:/1.cfg...Done.
# In IRF mode, remove the 1.cfg file from the root directory of the storage medium on the IRF fabric's active MPU.
<Sysname> delete 1.cfg
Delete flash:/1.cfg?[Y/N]:y
Deleting file flash:/1.cfg...Done.
# In IRF mode, permanently delete file 2.cfg from the root directory of the storage medium on the IRF fabric's active MPU.
<Sysname> delete /unreserved 2.cfg
The file cannot be restored. Delete flash:/2.cfg?[Y/N]:y
Deleting the file permanently will take a long time. Please wait...
Deleting file flash:/2.cfg...Done.
# In IRF mode, remove the 1.cfg file from the Flash root directory of the standby MPU that resides in slot 1 of member device 1:
· Approach 1
<Sysname> delete chassis1#slot1#flash:/1.cfg
Delete chassis1#slot1#flash:/1.cfg?[Y/N]:y
Deleting file chassis1#slot1#flash:/1.cfg...Done.
· Approach 2
<Sysname> cd chassis1#slot1#flash:/
<Sysname> delete 1.cfg
Delete chassis1#slot1#flash:/1.cfg?[Y/N]:y
Deleting file chassis1#slot1#flash:/1.cfg...Done.
Related commands
· undelete
· reset recycle-bin
dir
Use dir to display files or folders.
Syntax
dir [ /all ] [ file-url | /all-filesystems ]
Views
User view
Predefined user roles
network-admin
mdc-admin
Parameters
/all: Displays all files and folders in the current directory, visible or hidden. If you do not specify this option, only visible files and folders are displayed.
file-url: Displays a specific file or folder. The file-url argument is case insensitive and can use the asterisk (*) as a wildcard. For example, to display files with the .txt extension in the current directory, enter dir *.txt.
/all-filesystems: Displays files and folders in the root directory of all storage media on the device.
Usage guidelines
If no option is specified, the command displays all visible files and folders in the current directory.
The folder name of the recycle bin is .trash. To display files in the recycle bin, use either of the following methods:
· Execute the dir /all .trash command.
· Execute the cd .trash command and then the dir command.
Examples
# In standalone mode, display information about all files and folders in the current directory.
<Sysname> dir /all
Directory of flash:
0 drw- - Dec 20 2011 09:00:05 logfile
1 -rw- 30500864 Dec 16 2011 13:56:22 boot-r7122.bin
2 -rw- 8575 Dec 20 2011 20:02:14 startup.cfg
3 -rw- 61551 Dec 20 2011 20:02:14 startup.mdb
4 -rw- 375660 Dec 16 2011 12:20:05 Leopard_LC_OAM_210.btw
5 -rw- 71969792 Dec 16 2011 13:59:29 system-r7122.bin
6 -rwh 17 Dec 27 2011 08:34:23 .pathfile
131072 KB total (24888 KB free)
# In standalone mode, display information about all files and folders in the storage medium of the standby MPU (in slot 1).
<Sysname> cd slot1#flash:/
<Sysname> dir /all
Directory of slot1#flash:/
0 drw- - Dec 20 2011 09:00:05 logfile
1 -rw- 30500864 Dec 16 2011 13:56:22 boot-r7122.bin
2 -rw- 8575 Dec 20 2011 20:02:14 startup.cfg
3 -rw- 61551 Dec 20 2011 20:02:14 startup.mdb
4 -rw- 375660 Dec 16 2011 12:20:05 Leopard_LC_OAM_210.btw
5 -rw- 71969792 Dec 16 2011 13:59:29 system-r7122.bin
6 -rwh 17 Dec 27 2011 08:34:23 .pathfile
131072 KB total (24888 KB free)
# In IRF mode, display information about all files and folders in the storage medium of the IRF fabric's active MPU.
<Sysname> dir /all
Directory of flash:
0 drw- - Dec 20 2011 09:00:05 logfile
1 -rw- 30500864 Dec 16 2011 13:56:22 boot-r7122.bin
2 -rw- 8575 Dec 20 2011 20:02:14 startup.cfg
3 -rw- 61551 Dec 20 2011 20:02:14 startup.mdb
4 -rw- 375660 Dec 16 2011 12:20:05 Leopard_LC_OAM_210.btw
5 -rw- 71969792 Dec 16 2011 13:59:29 system-r7122.bin
6 -rwh 17 Dec 27 2011 08:34:23 .pathfile
131072 KB total (24888 KB free)
# In IRF mode, display information about all files and folders in the storage medium of the standby MPU that resides in slot 1 of member device 1:
· Approach 1
<Sysname> dir /all chassis1#slot1#flash:/
0 drw- - Dec 20 2011 09:00:05 logfile
1 -rw- 30500864 Dec 16 2011 13:56:22 boot-r7122.bin
2 -rw- 8575 Dec 20 2011 20:02:14 startup.cfg
3 -rw- 61551 Dec 20 2011 20:02:14 startup.mdb
4 -rw- 375660 Dec 16 2011 12:20:05 Leopard_LC_OAM_210.btw
5 -rw- 71969792 Dec 16 2011 13:59:29 system-r7122.bin
6 -rwh 17 Dec 27 2011 08:34:23 .pathfile
131072 KB total (24888 KB free)
· Approach 2
<Sysname> cd chassis1#slot1#flash:/
<Sysname> dir /all
Directory of chassis1#slot1#flash:/
0 drw- - Dec 20 2011 09:00:05 logfile
1 -rw- 30500864 Dec 16 2011 13:56:22 boot-r7122.bin
2 -rw- 8575 Dec 20 2011 20:02:14 startup.cfg
3 -rw- 61551 Dec 20 2011 20:02:14 startup.mdb
4 -rw- 375660 Dec 16 2011 12:20:05 Leopard_LC_OAM_210.btw
5 -rw- 71969792 Dec 16 2011 13:59:29 system-r7122.bin
6 -rwh 17 Dec 27 2011 08:34:23 .pathfile
131072 KB total (24888 KB free)
Table 1 Command output
Field |
Description |
Directory of |
Current directory. |
0 -rwh 3144 Apr 26 2008 13:45:28 xx.xx |
File or folder information: · 0—File or folder number, which is automatically allocated by the system. · -rwh—Attributes of the file or folder. The first character is the folder indicator (d for folder and – for file). The second character indicates whether the file or folder is readable (r for readable). The third character indicates whether the file or directory is writable (w for writable). The fourth character indicates whether the file or directory is hidden (h for hidden, - for visible). Modifying, renaming, or deleting hidden files might affect functions. · 3144—File size in bytes. For a folder, a hyphen (-) is displayed. · Apr 26 2008 13:45:28—Last date and time when the file or folder was modified. · xx.xx—File or folder name. |
fdisk
Use fdisk to partition a storage medium.
Syntax
fdisk medium-name [ partition-number ]
Views
User view
Predefined user roles
network-admin
Parameters
medium-name: Specifies the name of the storage medium to be partitioned, a case-insensitive string.
partition-number: Specifies the number of partitions, in the range of 1 to 4.
Usage guidelines
The Flash cannot be partitioned.
This command is supported only on the default MDC.
If the partition-number argument is specified, the storage medium is divided into the specified number of partitions. Otherwise, partitioning is performed in an interactive way.
It is normal that the specified partition size and the actual partition size have an error less than 5% of the total memory.
A partition cannot be partitioned.
Before partitioning a CF card or USB disk:
· Back up the files in the storage medium. The partition operation clears all data in the medium.
· If you are partitioning a USB disk, make sure the disk is not write protected. Otherwise, the partition operation will fail, and you must remount or reinstall in the disk to restore normal access to the USB disk.
· Make sure no other users are accessing the medium. Otherwise, the partition operation fails.
Examples
# Divide the CF card on the device evenly into three partitions in simple mode.
<Sysname> fdisk cfa: 3
Capacity of cfa: : 247M bytes
cfa: will be divided into the following partition(s):
DeviceName Capacity
cfa0: 78MB
cfa1: 78MB
cfa2: 90MB
All data on cfa: will be lost, continue?[Y/N]:y
Partitioning cfa:... Done.
# Divide the CF card on the device into one partition in an interactive way.
<Sysname> fdisk cfa:
Capacity of cfa: : 247M bytes
Partition 1 (32MB~215MB, 247MB. Press CTRL+C to quit or Enter to use all available space):
// Press Enter or enter 256.
cfa: will be divided into the following partition(s):
DeviceName Capacity
cfa0: 247MB
All data on cfa: will be lost, continue?[Y/N]:y
Partitioning cfa:... Done.
# Divide the CF card on the device into three partitions and specify the size for each partition:
<Sysname> fdisk cfa:
Capacity of cfa: : 256M bytes
Partition 1 (32MB~224MB, 256MB, Press CTRL+C to quit or Enter to use all available space):128
// Enter 128 to set the size of the first partition to 128 MB.
Partition 2 (32MB~96MB, 128MB, Press CTRL+C to quit or Enter to use all available space):31
// Enter 31 to set the size of the second partition to 31 MB.
The partition size should be greater than or equal to 32MB.
Partition 2 (32MB~96MB, 128MB, Press CTRL+C to quit or Enter to use all available space):1000
// Enter 1000 to set the size of the second partition to 1000 MB.
The partition size should be less than or equal to 128MB.
Partition 2 (32MB~96MB, 128MB, Press CTRL+C to quit or Enter to use all available space):127
// Enter 127 to set the size of the second partition to 127 MB.
The remaining space is less than 32MB. Please reenter the size of partition 2.
Partition 2 (32MB~96MB, 128MB, Press CTRL+C to quit or Enter to use all available space):
// Enter 56 to set the size of the second partition to 56 MB.
Partition 3 (32MB~40MB, 72MB, Press CTRL+C to quit or Enter to use all available space):
// Press Enter to assign the remaining space to the third partition.
cfa: will be divided into the following partition(s):
DeviceName Capacity
cfa0: 128MB
cfa1: 56MB
cfa2: 72MB
All data on cfa: will be lost, continue?[Y/N]:y
Partitioning cfa:... done.
file prompt
Use file prompt to set the operation mode for files and folders.
Syntax
file prompt { alert | quiet }
undo file prompt
Default
The alert mode applies and the system prompts for confirmation when you perform a destructive file or folder operation.
Views
System view
Predefined user roles
network-admin
mdc-admin
Parameters
alert: Prompts for confirmation when a destructive file or folder operation is being performed.
quiet: Gives no confirmation prompt for file or folder operations.
Usage guidelines
In quiet mode, the system does not prompt for confirmation when a user performs a file or folder operation. To avoid operation mistakes, use the alert mode.
Examples
# Set the file and folder operation mode to alert.
<Sysname> system-view
[Sysname] file prompt alert
fixdisk
Use fixdisk to check a storage medium for damage and repair any damage.
Syntax
fixdisk medium-name
Views
User view
Predefined user roles
network-admin
Parameters
medium-name: Specifies the name of a storage medium name, case insensitive.
Usage guidelines
This command is supported only on the default MDC.
Use this command to fix a storage medium when some space on the medium cannot be used or released due to abnormal operations.
Before you repair a storage medium, make sure no other users are accessing the medium. Otherwise, the repair operation fails.
Examples
# Restore the space of the Flash.
<Sysname> fixdisk flash:
Restoring flash: may take some time...
Restoring flash:... Done.
format
Use format to format a storage medium.
Syntax
format medium-name
Views
User view
Predefined user roles
network-admin
Parameters
medium-name: Specifies the name of a storage medium, case insensitive.
Usage guidelines
This command is supported only on the default MDC.
Formatting a storage medium permanently deletes all files on the storage medium. If a startup configuration file exists on the storage medium, back it up if necessary.
You can format a storage medium only when no one is accessing the medium.
To format a storage medium that has been partitioned, you must format all the partitions individually, instead of formatting the medium as a whole.
Examples
# Format the Flash.
<Sysname> format flash:
All data on flash: will be lost, continue?[Y/N]:y
Formatted flash:... Done.
# Format the third partition on the CF card. (In this example the CF card has been partitioned.)
<Sysname> format cfa2:
All data on cfa2: will be lost, continue?[Y/N]:y
Formatted cfa2:... Done.
gunzip
Use gunzip to decompress a file.
Syntax
gunzip filename
Views
User view
Predefined user roles
network-admin
mdc-admin
Parameters
filename: Specifies the name of the file to be decompressed. This argument must have .gz as the extension.
Usage guidelines
This command deletes the specified file after decompressing it.
Examples
# Decompress the file system.bin.gz.
1. Before decompressing the file, you can display files whose names start with system..
<Sysname> dir system.*
Directory of flash:
1 -rw- 20 Jun 14 2012 10:18:53 system.bin.gz
472972 KB total (472840 KB free)
2. Decompress the file system.bin.gz.
<Sysname> gunzip system.bin.gz
3. Verify the decompress operation.
<Sysname> dir system.*
Directory of flash:
1 -rw- 0 May 30 2012 11:42:25 system.bin
472972 KB total (472844 KB free)
gzip
Use gzip to compress a file.
Syntax
gzip filename
Views
User view
Predefined user roles
network-admin
mdc-admin
Parameters
filename: Specifies the name of the file to be compressed. The compressed file will be saved to file filename.gz.
Usage guidelines
This command deletes the specified file after compressing it.
Examples
# Compress the file system.bin.
1. Before compressing the file, you can display files whose names start with system.
<Sysname> dir system.*
Directory of flash:
1 -rw- 0 May 30 2012 11:42:24 system.bin
472972 KB total (472844 KB free)
2. Compress the file system.bin.
<Sysname> gzip system.bin
3. Verify the compress operation.
<Sysname> dir system.*
Directory of flash:
1 -rw- 20 Jun 14 2012 10:18:53 system.bin.gz
472972 KB total (472840 KB free)
mkdir
Use mkdir to create a folder in the current directory.
Syntax
mkdir directory
Views
User view
Predefined user roles
network-admin
mdc-admin
Parameters
directory: Specifies the name of a folder, a case-sensitive string.
Usage guidelines
The name of the folder to be created must be unique in the specified directory.
To use this command to create a folder, the specified directory must exist. For example, to create the flash:/test/mytest folder, the test folder must exist. Otherwise, the mytest folder is not created.
Examples
# Create the test folder in the current directory.
<Sysname> mkdir test
Creating directory flash:/test... Done.
# Create the test/subtest folder in the current directory.
<Sysname> mkdir test/subtest
Creating directory flash:/test/subtest... Done.
# In standalone mode, create the test folder on the standby MPU (in slot 1).
<Sysname> mkdir slot1#flash:/test
Creating directory slot1#flash:/test... Done.
# In IRF mode, create the test folder on the active MPU of the IRF fabric.
<Sysname> mkdir test
Creating directory flash:/test... Done.
# In IRF mode, create the test folder on the standby MPU that resides in slot 1 of member device 2.
<Sysname> mkdir chassis2#slot1#flash:/test
Creating directory chassis2#slot1#flash:/test... Done.
more
Use more to display the contents of a text file.
Syntax
more file-url
Views
User view
Predefined user roles
network-admin
mdc-admin
Parameters
file-url: Specifies a file name, case insensitive.
Examples
# Display the contents of the test.txt file.
<Sysname> more test.txt
Welcome to ****.
# Display the contents of the testcfg.cfg file.
<Sysname> more testcfg.cfg
#
version 7.1.028, Alpha 7122
#
sysname Sysname
#
vlan 2
#
return
<Sysname>
# In standalone mode, display the contents of the testcfg.cfg file on the standby MPU (in slot 1).
<Sysname> more slot1#flash:/testcfg.cfg
#
version 7.1.028, Alpha 7122
#
sysname Test
#
---- More ----
# In IRF mode, display the contents of the testcfg.cfg file on the IRF fabric's active MPU.
<Sysname> more testcfg.cfg
#
version 7.1.028, Alpha 7122
#
sysname Sysname
#
---- More ----
# In IRF mode, display the contents of the testcfg.cfg file on the standby MPU that resides in slot 1 of member device 2.
<Sysname> more chassis2#slot1#flash:/testcfg.cfg
#
version 7.1.028, Alpha 7122
#
sysname Sysname
#
---- More ----
mount
Use mount to mount a hot swappable storage medium.
Syntax
mount medium-name
Default
A storage medium is automatically mounted and in mounted state after being connected to the device, and you can use it without mounting it.
Views
User view
Predefined user roles
network-admin
Parameters
medium-name: Specifies the name of a storage medium, case insensitive.
Usage guidelines
This command is supported only on the default MDC.
To avoid file system corruption in standalone mode, do not install or remove storage media or cards or perform active/standby switchover while the system is mounting a storage medium.
To avoid file system corruption in IRF mode, do not install or remove storage media or perform a switchover between the active MPU of the IRF fabric and a standby MPU of the IRF fabric while the system is mounting a storage medium.
To avoid file system corruption, do not create, delete, start, or stop an MDC while the system is mounting or unmounting a storage medium.
To mount a partitioned storage medium, you must mount all the partitions individually, instead of mounting the CF card as a whole.
Examples
# In standalone mode, mount a CF card on the active MPU.
<Sysname> mount cfa0:
# In standalone mode, mount a CF card on the standby MPU (in slot 1).
<Sysname> mount slot1#cfa0:
# In IRF mode, mount a CF card on the master.
<Sysname> mount cfa0:
# In IRF mode, mount a CF card on the MPU that resides in slot 1 of member device 2.
<Sysname> mount chassis2#slot1#cfa0:
Related commands
umount
move
Use move to move a file.
Syntax
move fileurl-source fileurl-dest
Views
User view
Predefined user roles
network-admin
mdc-admin
Parameters
fileurl-source: Specifies the name of the source file, case insensitive.
fileurl-dest: Specifies the name of the target file or folder, case sensitive.
Usage guidelines
If you specify a target folder, the system moves the source file to the specified folder without changing the file name.
Examples
# Move the flash:/test/sample.txt file to flash:/, and save it as 1.txt.
<Sysname> move test/sample.txt 1.txt
Move flash:/test/sample.txt to flash:/1.txt?[Y/N]:y
Moving file flash:/test/sample.txt to flash:/1.txt ...Done.
# Move the b.cfg file to the folder test2.
<Sysname> move b.cfg test2
Move flash:/b.cfg to flash:/test2/b.cfg?[Y/N]:y
Moving file flash:/b.cfg to flash:/test2/b.cfg... Done.
pwd
Use pwd to display the current working directory.
Syntax
pwd
Views
User view
Predefined user roles
network-admin
mdc-admin
Examples
# Display the current working directory.
<Sysname> pwd
flash:
rename
Use rename to rename a file or folder.
Syntax
rename fileurl-source fileurl-dest
Views
User view
Predefined user roles
network-admin
mdc-admin
Parameters
fileurl-source: Specifies the name of the source file or folder, case insensitive.
fileurl-dest: Specifies the name of the destination file or folder, case sensitive.
Usage guidelines
If the destination file or folder name is the same as the name of an existing file or folder in the current working directory, this command is not executed.
Examples
# Rename the copy.cfg file as test.cfg.
<Sysname> rename copy.cfg test.cfg
Rename flash:/copy.cfg as flash:/test.cfg?[Y/N]:y
Renaming flash:/copy.cfg as flash:/test.cfg... Done.
reset recycle-bin
Use reset recycle-bin to delete files from the recycle bin.
Syntax
reset recycle-bin [ /force ]
Views
User view
Parameters
/force: Forcibly deletes all files in the recycle bin. If you do not specify this keyword, the command asks you to confirm the operation. If not, the command silently deletes all files in the recycle bin.
Usage guidelines
The delete file-url command only moves a file to the recycle bin. To permanently delete the file, use the reset recycle-bin command to clear the recycle bin.
If a file is corrupted, you might not be able to delete the file by using the reset recycle-bin command. In this case, use the reset recycle-bin /force command.
Examples
# Empty the recycle bin. (In this example there are two files in the recycle bin.)
<Sysname> reset recycle-bin
Clear flash:/a.cfg?[Y/N]:y
Clearing file flash:/a.cfg... Done.
Clear flash:/b.cfg?[Y/N]:y
Clearing file flash:/b.cfg... Done.
# Delete the b.cfg file from the recycle bin. (In this example there are two files in the recycle bin.)
<Sysname> reset recycle-bin
Clear flash:/a.cfg?[Y/N]:n
Clear flash:/b.cfg?[Y/N]:y
Clearing file flash:/b.cfg... Done.
Related commands
delete
rmdir
Use rmdir to remove a folder.
Syntax
rmdir directory
Views
User view
Predefined user roles
network-admin
mdc-admin
Parameters
directory: Specifies a folder name, case insensitive.
Usage guidelines
To remove a directory, you must delete all files and subfolders in the directory permanently or move them to the recycle bin. If you move them to the recycle bin, executing the rmdir command permanently deletes them.
Examples
# Remove the subtest folder.
<Sysname>rmdir subtest/
Remove directory flash:/test/subtest and the files in the recycle-bin under this directory will be deleted permanently. Continue?[Y/N]:y
Removing directory flash:/test/subtest... Done.
umount
Use umount to unmount a hot swappable storage medium.
Syntax
umount medium-name
Default
A storage medium is automatically mounted and placed in mounted state.
Views
User view
Predefined user roles
network-admin
Parameters
medium-name: Specifies the name of a storage medium, case insensitive.
Usage guidelines
This command is supported only on the default MDC.
Before you remove a mounted storage medium from the system, first unmount it to avoid damaging the medium.
Before you unmount a storage medium, make sure no other users are accessing the medium. Otherwise, the unmount operation fails.
When a storage medium is connected to a lower version system, the system might not be able to automatically recognize the device. In this case, you must first execute the mount command for the storage medium to function properly.
To avoid file system corruption in standalone mode, do not install or remove storage media or cards or perform active/standby switchover while the system is unmounting a storage medium.
To avoid file system corruption in IRF mode, do not install or remove storage media or perform a switchover between the active MPU of the IRF fabric and a standby MPU of the IRF fabric while the system is unmounting a storage medium.
To avoid file system corruption, do not create, delete, start, or stop an MDC while the system is mounting or unmounting a storage medium.
Examples
# In standalone mode, unmount a CF card of the active MPU.
<Sysname> umount cfa0:
# In standalone mode, unmount a CF card of the standby MPU (in slot 5).
<Sysname> umount slot5#cfa0:
# In IRF mode, unmount a CF card on the IRF fabric's active MPU.
<Sysname> umount cfa0:
# In IRF mode, unmount a CF card on the standby MPU that resides in slot 5 of member device 2.
<Sysname> umount chassis2#slot5#cfa0:
Related commands
mount
undelete
Use undelete to restore a file from the recycle bin.
Syntax
undelete file-url
Views
User view
Predefined user roles
network-admin
mdc-admin
Parameters
file-url: Specifies the name of the file to be restored, case insensitive.
Usage guidelines
If another file that has the same name exists in the directory, the system prompts you about whether to overwrite the existing file. If you enter Y, the existing file is overwritten. If you enter N, the command is not executed.
Examples
# Restore the copy.cfg file, which was moved from the flash: directory to the recycle bin.
<Sysname>undelete copy.cfg
Undelete flash:/copy.cfg?[Y/N]:y
Undeleting file flash:/copy.cfg... Done.
# Restore the startup.cfg file, which was moved from the flash:/seclog directory to the recycle bin:
· Approach 1
<Sysname>undelete seclog/startup.cfg
Undelete flash:/seclog/startup.cfg?[Y/N]:y
Undeleting file flash:/seclog/startup.cfg... Done.
<Sysname>
· Approach 2
<Sysname> cd seclog
<Sysname> undelete startup.cfg
Undelete flash:/seclog/startup.cfg?[Y/N]:y
Undeleting file flash:/seclog/startup.cfg... Done.