01-Fundamentals Command Reference

HomeSupportResource CenterRoutersH3C SR6600-X Router SeriesH3C SR6600-X Router SeriesTechnical DocumentsReference GuidesCommand ReferencesH3C SR6602-X Routers Command References-R7607-6W10001-Fundamentals Command Reference
05-File system management commands
Title Size Download
05-File system management commands 99.22 KB

File system management commands

IMPORTANT

IMPORTANT:

·     Before managing storage media, file systems, directories, and files, make sure you know the possible impact.

·     A file or directory whose name starts with a dot character (.) is a hidden file or directory. To prevent the system from hiding a file or directory, make sure the file or directory name does not start with a dot character.

·     Some system files and directories are hidden. For correct system operation and full functionality, do not modify or delete hidden files or directories.

 

File system names, directory names, or file names must be compliant with the naming conventions. For more information about the naming conventions and the methods for specifying the names, see Fundamentals Configuration Guide.

You cannot access a file system that is being formatted or repaired. To access a file system after it is formatted or repaired, use one of the following methods:

·     Use the absolute path to specify a file or directory. For example, use the dir cfa0:/ command to display the files and directories in the cfa0: file system.

·     Use the cd command to change the working directory to the root directory of the file system before accessing a file or directory in the file system. For example, to display the files and directories in the root directory of the cfa0: file system, perform the following tasks:

a.     Use the cd cfa0:/ command to change the working directory to the root directory of the file system.

b.     Execute the dir command.

The device supports the FIPS mode that complies with NIST FIPS 140-2 requirements. Support for features, commands, and parameters might differ in FIPS mode and non-FIPS mode. For more information about FIPS mode, see Security Configuration Guide.

cd

Use cd to change the working directory.

Syntax

cd { directory | .. }

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

directory: Specifies the destination directory.

..: Specifies the parent directory. If the working directory is the root directory, an error message appears when you execute the cd .. command. No online help information is available for this keyword.

Examples

# Change to the test directory after logging in to the device.

<Sysname> cd test

# Change to the parent directory.

<Sysname> cd ..

# (In standalone mode.) Change to the root directory of the cfa0: file system on slot 0.

<Sysname> cd slot0#cfa0:/

# (In standalone mode.) Change back to the test directory of the cfa0: file system on the device.

<Sysname> cd cfa0:/test

# (In IRF mode.) Change the working directory.

1.     Display the member IDs.

<Sysname> display irf

 Member   Slot   Role    Priority    CPU-Mac

   1      0      Standby 20          00e0-fc0f-8c0f

 *+2      0      Master  20          00e0-fc0f-8c22

 

--------------------------------------------------

 * 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

2.     Access the test directory in the root directory of the cfa0: file system on the master.

<Sysname> cd cfa0:/test

3.     Access the root directory of the cfa0: file system on a subordinate member.

<Sysname> cd chassis2#slot0#cfa0:/

4.     Change back to the root directory of the cfa0: file system on the master.

<Sysname> cd cfa0:/

copy

Use copy to copy a file.

Syntax

In non-FIPS mode:

copy source-file { dest-file | dest-directory } [ vpn-instance vpn-instance-name ] [ source interface interface-type interface-number ]

In FIPS mode:

copy source-file { dest-file | dest-directory }

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

source-file: Specifies the name or URL of the file to be copied in non-FIPS mode, and specifies the name of the file to be copied in FIPS mode. If the file resides on an FTP or TFTP server rather than on the device, specify the URL of the file. Whether a URL is case sensitive depends on the server.

dest-file: Specifies the name or URL for the destination file in non-FIPS mode, and specifies the name for the destination file in FIPS mode. To copy the source file to an FTP or TFTP server, specify a URL. Whether a URL is case sensitive depends on the server.

dest-directory: Specifies the destination directory or URL in non-FIPS mode, and specifies the destination directory in FIPS mode. To copy the source file to an FTP or TFTP server, specify a URL. The device copies the source file to the destination location and saves the file with its original file name. Whether a URL is case sensitive depends on the server.

vpn-instance vpn-instance-name: Specifies the VPN instance 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 belongs to 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

In FIPS mode, you can use the copy command only to copy a local file and save it locally.

In non-FIPS mode, you can use the copy command to perform the following tasks:

·     Copy a local file and save it locally.

·     Copy a local file and save it to an FTP or TFTP server.

·     Copy a file from an FTP or TFTP server and save it locally.

To specify a file or directory, use the following guidelines:

 

Location

Name format

Remarks

On the device

Use the file name guidelines in Fundamentals Configuration Guide.

N/A

On an FTP server

Enter the URL in the format of 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 are not required to enter the password.

For example, to use the username 1 and password 1 and specify the startup.cfg file in the authorized working directory on the FTP server 1.1.1.1, enter ftp://1:1@1.1.1.1/startup.cfg.

To specify an IPv6 address, enclose the IPv6 address in square brackets ([ ]), for example, ftp://test:test@[2001::1]:21/test.cfg.

On a TFTP server

Enter the URL in the format of tftp://server address[:port number]/file path[/file name].

For example, to specify the startup.cfg file in the working directory on TFTP server 1.1.1.1, enter the URL tftp://1.1.1.1/startup.cfg.

To enter an IPv6 address, enclose the IPv6 address in square brackets ([ ]), for example, tftp://test:test@[2001::1]:21/test.cfg.

 

Examples

# Copy the test.cfg file in the current directory and save it to the current directory as testbackup.cfg.

<Sysname> copy test.cfg testbackup.cfg

Copy cfa0:/test.cfg to cfa0:/testbackup.cfg? [Y/N]:y

Copying file cfa0:/test.cfg to cfa0:/testbackup.cfg...Done.

# Copy test.cfg from the working directory on the FTP server 1.1.1.1. Save the copy to the local current directory as testbackup.cfg. The FTP username is user. The password is private.

<Sysname> copy ftp://user:private@1.1.1.1/test.cfg testbackup.cfg

Copy ftp://user:private@1.1.1.1/test.cfg to cfa0:/testbackup.cfg? [Y/N]:y

Copying file ftp://user:private@1.1.1.1/test.cfg to cfa0:/testbackup.cfg... Done.

# Copy test.cfg from the current directory. Save the copy to the working directory on the FTP server 1.1.1.1 as testbackup.cfg.  The FTP username is user. The password is private.

<Sysname> copy test.cfg ftp://user:private@1.1.1.1/testbackup.cfg

Copy cfa0:/test.cfg to ftp://user:private@1.1.1.1/testbackup.cfg? [Y/N]:y

Copying file cfa0:/test.cfg to ftp://user:private@1.1.1.1/testbackup.cfg... Done.

# Copy test.cfg from the working directory on the TFTP server 1.1.1.1. Save the copy to the local current directory as testbackup.cfg.

<Sysname> copy tftp://1.1.1.1/test.cfg testbackup.cfg

Copy tftp://1.1.1.1/test.cfg to cfa0:/testbackup.cfg? [Y/N]:y

Copying file tftp://1.1.1.1/test.cfg to cfa0:/testbackup.cfg... Done.

# Copy test.cfg from the current directory. Save the copy to the working directory on the TFTP server 1.1.1.1 as testbackup.cfg.

<Sysname> copy test.cfg tftp://1.1.1.1/testbackup.cfg

Copy cfa0:/test.cfg to tftp://1.1.1.1/testbackup.cfg? [Y/N]:y

Copying file cfa0:/test.cfg to tftp://1.1.1.1/testbackup.cfg... Done.

# Copy test.cfg from the working directory on the FTP server 1.1.1.1. Save the copy to the local current directory as testbackup.cfg. The FTP username is user. The password is private. The FTP server belongs to VPN instance vpn1.

<Sysname> copy ftp://user:private@1.1.1.1/test.cfg testbackup.cfg vpn-instance vpn1

Copy ftp://user:private@1.1.1.1/test.cfg to cfa0:/testbackup.cfg? [Y/N]:y

Copying file ftp://user:private@1.1.1.1/test.cfg to cfa0:/testbackup.cfg... Done.

# Copy test.cfg from the working directory on the TFTP server 1.1.1.1. Save the copy to the local current directory as testbackup.cfg. The TFTP server belongs to VPN instance vpn1.

<Sysname> copy tftp://1.1.1.1/test.cfg testbackup.cfg vpn-instance vpn1

Copy tftp://1.1.1.1/test.cfg to cfa0:/testbackup.cfg? [Y/N]:y

Copying file tftp://1.1.1.1/test.cfg to cfa0:/testbackup.cfg... Done.

# Copy test.cfg from the working directory on the FTP server 2001::1. Save the copy to the local current directory as testbackup.cfg. The FTP username is user. The password is private.

<Sysname> copy ftp://user:private@[2001::1]/test.cfg testbackup.cfg

Copy ftp://user:private@[2001::1]/test.cfg to cfa0:/testbackup.cfg? [Y/N]:y

Copying file ftp://user:private@[2001::1]/test.cfg to cfa0:/testbackup.cfg... Done.

# Copy test.cfg from the working directory on the TFTP server 2001::1. Save the copy to the local current directory as testbackup.cfg.

<Sysname> copy tftp://[2001::1]/test.cfg testbackup.cfg

Copy tftp://[2001::1]/test.cfg to cfa0:/testbackup.cfg? [Y/N]:y

Copying file tftp://[2001::1]/test.cfg to cfa0:/testbackup.cfg... Done.

# (In standalone mode.) Copy the configuration file test.cfg of the flash: file system to the root directory of the cfa0: file system.

<Sysname> copy test.cfg slot0#cfa0:/

Copy flash:/test.cfg to slot0#cfa0:/test.cfg? [Y/N]:y

Copying file flash:/test.cfg to slot0#cfa0:/test.cfg...Done.

# (In IRF mode.) Copy the master's configuration file test.cfg to the subordinate member. Save the copy to the root directory of the cfa0: file system.

<Sysname> copy test.cfg chassis1#slot0#cfa0:/

Copy cfa0:/test.cfg to chassis1#slot0#cfa0:/test.cfg? [Y/N]:y

Copying file cfa0:/test.cfg to chassis1#slot0#cfa0:/test.cfg...Done.

delete

Use delete to delete a file.

Syntax

delete [ /unreserved ] file

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: 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 command with caution. You cannot restore a file that was deleted with this command.

The delete file command (without /unreserved) moves the specified file to the recycle bin, except in the following two situations, where the file is permanently deleted:

·     The file system is running out of storage space.

·     You are logged in to the default MDC and are using this command to delete a file from a non-default MDC.

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 delete two files that have the same name from different directories, both files are retained in the recycle bin. If you successively delete two files that have the same name from the same directory, only the most recently deleted file is retained in the recycle bin.

Examples

# (In standalone mode.) Remove the file 1.cfg from the root directory of the cfa0: file system on the  device.

<Sysname> delete 1.cfg

Delete cfa0:/1.cfg? [Y/N]:y

Deleting file cfa0:/1.cfg...Done.

# (In standalone mode.) Permanently delete the file 1.cfg from the root directory of the cfa0: file system on the device.

<Sysname> delete /unreserved 1.cfg

The file cannot be restored. Delete cfa0:/1.cfg? [Y/N]:y

Deleting the file permanently will take a long time. Please wait...

Deleting file cfa0:/1.cfg...Done.

# (In IRF mode.) Remove the file 1.cfg from the root directory of the cfa0: file system on the master.

<Sysname> delete 1.cfg

Delete cfa0:/1.cfg? [Y/N]:y

Deleting file cfa0:/1.cfg...Done.

# (In IRF mode.) Permanently delete the file 1.cfg from the root directory of the cfa0: file system on the master.

<Sysname> delete /unreserved 1.cfg

The file cannot be restored. Delete cfa0:/1.cfg? [Y/N]:y

Deleting the file permanently will take a long time. Please wait...

Deleting file cfa0:/1.cfg...Done.

# (In IRF mode.) Remove the file 1.cfg from the root directory of the cfa0: file system on a subordinate member.

·     Method 1:

<Sysname> delete chassis1#slot0#cfa0:/1.cfg

Delete chassis1#slot0#cfa0:/1.cfg? [Y/N]:y

Deleting file chassis1#slot0#cfa0:/1.cfg...Done.

·     Method 2:

<Sysname> cd chassis1#slot0#cfa0:/

<Sysname> delete 1.cfg

Delete chassis1#slot0#cfa0:/1.cfg? [Y/N]:y

Deleting file chassis1#slot0#cfa0:/1.cfg...Done.

Related commands

reset recycle-bin

undelete

dir

Use dir to display files or directories.

Syntax

dir [ /all ] [ file | directory | /all-filesystems ]

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

/all: Displays all files and directories in the current directory, visible or hidden. If you do not specify this option, only visible files and directories are displayed.

file: Displays a specific file. This argument can use the asterisk (*) as a wildcard. For example, to display files with the .txt extension in the current directory, enter dir *.txt.

directory: Displays a specific directory.

/all-filesystems: Displays files and directories in the root directories of all file systems on the device.

Usage guidelines

If no option is specified, the command displays all visible files and directories in the current directory.

The directory 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 directories in the current directory.

<Sysname> dir /all

Directory of cfa0:/

...

# (In standalone mode.) Display files and directories in the root directories of all file systems on the device.

<Sysname> dir /all-filesystems

Directory of cfa0:/

...

# (In IRF mode.) Display information about all files and directories in the cfa0: file system of the master.

<Sysname> dir /all

Directory of cfa0:/

...

# (In IRF mode.) Display files and directories in the root directories of all file systems in the IRF fabric.

<Sysname> dir /all-filesystems

Directory of cfa0:/

...

 

Directory of chassis1#slot0#cfa0:/

...

# (In IRF mode.) Display information about all files and directories in the cfa0: file system of a subordinate member.

·     Method 1:

<Sysname> dir /all chassis1#slot0#cfa0:/

Directory of chassis1#slot0#cfa0:/

...

·     Method 2:

<Sysname> cd chassis1#slot0#cfa0:/

<Sysname> dir /all

...

Table 1 Command output

Field

Description

Directory of

Current directory.

0     -rwh      3144  Apr 26 2014 13:45:28   xx.xx

File or directory information:

·     0—File or directory number, which is automatically allocated by the system.

·     -rwh—Attributes of the file or directory. The first character is the directory indicator (d for directory and for file). The second character indicates whether the file or directory 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 directory, a hyphen (-) is displayed.

·     Apr 26 2014 13:45:28—Last date and time when the file or directory was modified.

·     xx.xx—File or directory name.

 

file prompt

Use file prompt to set the operation mode for files and directories.

Use undo file prompt to restore the default.

Syntax

file prompt { alert | quiet }

undo file prompt

Default

The operation mode is alert. The system prompts for confirmation when you perform a destructive file or directory operation.

Views

System view

Predefined user roles

network-admin

mdc-admin

Parameters

alert: Prompts for confirmation when a destructive file or directory operation is being performed.

quiet: Gives no confirmation prompt for file or directory operations.

Usage guidelines

In quiet mode, the system does not prompt for confirmation when a user performs a file or directory operation. The alert mode provides an opportunity to cancel a disruptive operation.

Examples

# Set the file and directory operation mode to alert.

<Sysname> system-view

[Sysname] file prompt alert

fixdisk

Use fixdisk to check a file system for damage and repair any damage.

Syntax

fixdisk filesystem

Views

User view

Predefined user roles

network-admin

Parameters

filesystem: Specifies the name of a file system.

Usage guidelines

This command is supported only on the default MDC.

Use this command to fix a file system when space in the file system cannot be used or released.

You can repair a file system only when no other users are accessing the file system.

Examples

# Repair the file system cfa0:.

<Sysname> fixdisk cfa0:

Restoring cfa0: may take some time...

Restoring cfa0:...Done.

format

Use format to format a file system.

Syntax

format filesystem

Views

User view

Predefined user roles

network-admin

Parameters

filesystem: Specifies the name of a file system.

Usage guidelines

This command is supported only on the default MDC.

Formatting a file system permanently deletes all files in the file system. If a startup configuration file exists in the file system, back it up if necessary.

You can format a file system only when no other users are accessing the medium.

Examples

# Format the file system cfa0:.

<Sysname> format cfa0:

All data on cfa0: will be lost, continue? [Y/N]:y

Formatting cfa0:... Done.

gunzip

Use gunzip to decompress a file.

Syntax

gunzip file

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

file: 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 the system. string.

<Sysname> dir system.*

Directory of cfa0:

   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

Decompressing file cfa0:/system.bin.gz..... Done.

3.     Verify the decompress operation.

<Sysname> dir system.*

Directory of cfa0:

   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 file

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

file: Specifies the name of the file to be compressed. The compressed file will be saved to the file.gz file.

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 the system. string.

<Sysname> dir system.*

Directory of cfa0:

   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

Compressing file cfa0:/system.bin..... Done.

3.     Verify the compress operation.

<Sysname> dir system.*

Directory of cfa0:

   1 -rw-          20 Jun 14 2012 10:18:53   system.bin.gz

 

 

472972 KB total (472840 KB free)

md5sum

Use md5sum to use the MD5 algorithm to calculate the digest of a file.

Syntax

md5sum file

Views

User view

Predefined user roles

network-admin

network-operator

Parameters

file: Specifies the name of a file.

Usage guidelines

You can use file digests to verify file integrity.

Examples

# Use the MD5 algorithm to calculate the digest of the file system.bin.

<Sysname> md5sum system.bin

MD5 digest:

4f22b6190d151a167105df61c35f0917

mkdir

Use mkdir to create a directory.

Syntax

mkdir directory

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

directory: Specifies a directory.

Usage guidelines

The name of the directory to be created must be unique in the parent directory.

You can create a directory only in an existing directory. For example, to create the cfa0:/test/mytest directory, make sure the test directory already exists.

Examples

# Create the test directory in the current directory.

<Sysname> mkdir test

Creating directory cfa0:/test... Done.

# Create the test/subtest directory in the current directory.

<Sysname> mkdir test/subtest

Creating directory cfa0:/test/subtest... Done.

# (In standalone mode.) Create the test directory in the root directory of the cfa0: file system on slot 0.

<Sysname> mkdir slot0#cfa0:/test

Creating directory slot0#cfa0:/test... Done.

# (In IRF mode.) Create the test directory on the master.

<Sysname> mkdir test

Creating directory cfa0:/test... Done.

# (In IRF mode.) Create the test directory on the subordinate member with the member ID 2.

<Sysname> mkdir chassis2#slot0#cfa0:/test

Creating directory chassis2#slot0#cfa0:/test... Done.

more

Use more to display the contents of a text file.

Syntax

more file

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

file: Specifies the name of a file.

Examples

# Display the contents of the test.txt file.

<Sysname> more test.txt

Have a nice day.

# Display the contents of the testcfg.cfg file.

<Sysname> more testcfg.cfg

...

# (In standalone mode.) Display the contents of the testcfg.cfg file in slot 0.

<Sysname> more slot0#cfa0:/testcfg.cfg

...

# (In IRF mode.) Display the contents of the testcfg.cfg file on the master.

<Sysname> more testcfg.cfg

...

# (In IRF mode.) Display the contents of the testcfg.cfg file on the subordinate member with the member ID 2.

<Sysname> more chassis2#slot1#cfa0:/testcfg.cfg

...

mount

Use mount to mount a file system.

Syntax

mount filesystem

Views

User view

Predefined user roles

network-admin

Parameters

filesystem: Specifies the name of a file system.

Usage guidelines

This command is supported only on the default MDC.

Generally, file systems on a hot-swappable storage medium are automatically mounted when the storage medium is connected to the device. If the system cannot recognize a file system, however, you must mount the file system before you can access it.

To avoid file system corruption, do not perform the following tasks while the system is mounting a file system:

·     Install or remove storage media.

·     Install or remove cards.

·     Performing a master/subordinate switchover. (In IRF mode.)

·     Creating, deleting, starting, or stopping an MDC.

Examples

# (In standalone mode.) Mount the file system on a CF card of the device.

<Sysname> mount cfa0:

# (In IRF mode.) Mount the file system on a CF card of the master.

<Sysname> mount cfa0:

# (In IRF mode.) Mount the file system on a CF card of the subordinate device with the member ID 2.

<Sysname> mount chassis2#slot0#cfa0:

Related commands

umount

move

Use move to move a file.

Syntax

move source-file { dest-file | dest-directory }

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

source-file: Specifies the name of the source file.

dest-file: Specifies the name of the destination file.

dest-directory: Specifies the name of the destination directory.

Usage guidelines

If you specify a destination directory, the system moves the source file to the specified directory without changing the file name.

Examples

# Move the cfa0:/test/sample.txt file to cfa0:/, and save it as 1.txt.

<Sysname> move test/sample.txt 1.txt

Move cfa0:/test/sample.txt to cfa0:/1.txt? [Y/N]:y

Moving file cfa0:/test/sample.txt to cfa0:/1.txt ...Done.

# Move the b.cfg file to the directory test2.

<Sysname> move b.cfg test2

Move cfa0:/b.cfg to cfa0:/test2/b.cfg? [Y/N]:y

Moving file cfa0:/b.cfg to cfa0:/test2/b.cfg... Done.

pwd

Use pwd to display the working directory.

Syntax

pwd

Views

User view

Predefined user roles

network-admin

mdc-admin

Examples

# Display the working directory.

<Sysname> pwd

cfa0:

rename

Use rename to rename a file or directory.

Syntax

rename { source-file | source-directory } { dest-file | dest-directory }

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

source-file: Specifies the name of the source file.

source-directory: Specifies the name of the source directory.

dest-file: Specifies the name of the destination file.

dest-directory: Specifies the name of the destination directory.

Usage guidelines

This command is not executed if the destination file or directory name is already used by an existing file or directory in the working directory.

Examples

# Rename the copy.cfg file as test.cfg.

<Sysname> rename copy.cfg test.cfg

Rename cfa0:/copy.cfg as cfa0:/test.cfg? [Y/N]:y

Renaming cfa0:/copy.cfg as cfa0:/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

Predefined user roles

network-admin

mdc-admin

Parameters

/force: Deletes all files in the recycle bin without prompting for confirmation. If you do not specify this option, the command prompts you to confirm the deletion operation for each file.

Usage guidelines

The delete file command only moves a file to the recycle bin. To permanently delete the file, use the reset recycle-bin command to delete the file from the recycle bin.

Examples

# Empty the recycle bin. (In this example there are two files in the recycle bin.)

<Sysname> reset recycle-bin

Clear cfa0:/a.cfg? [Y/N]:y

Clearing file cfa0:/a.cfg... Done.

Clear cfa0:/b.cfg? [Y/N]:y

Clearing file cfa0:/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 cfa0:/a.cfg? [Y/N]:n

Clear cfa0:/b.cfg? [Y/N]:y

Clearing file cfa0:/b.cfg... Done.

Related commands

delete

rmdir

Use rmdir to delete a directory.

Syntax

rmdir directory

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

directory: Specifies a directory.

Usage guidelines

To delete a directory, you must delete all files and subdirectories 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

# Delete the subtest directory.

<Sysname>rmdir subtest/

Remove directory cfa0:/test/subtest and the files in the recycle-bin under this directory will be deleted permanently. Continue? [Y/N]:y

Removing directory cfa0:/test/subtest... Done.

sha256sum

Use sha256sum to use the SHA-256 algorithm to calculate the digest of a file.

Syntax

sha256sum file

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

file: Specifies the name of a file.

Usage guidelines

You can use file digests to verify file integrity.

Examples

# Use the SHA-256 algorithm to calculate the digest of file system.bin.

<Sysname> sha256sum system.bin

SHA256 digest:

0851e0139f2770e87d01ee8c2995ca9e59a8f5f4062e99af14b141b1a36ca152

tar create

Use tar create to archive files and directories.

Syntax

tar create [ gz ] archive-file dest-file [ verbose ] source { source-file | source-directory }&<1-5>

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

gz: Uses gzip to compress the files and directories before archiving them. If you do not specify this keyword, the command archives the files and directories without compressing them.

archive-file dest-file: Specifies the archive file name. If you specified the gz keyword, the suffix of the archive file name must be .tar.gz. If you did not specify the gz keyword, the suffix of the archive file name must be .tar.

verbose: Displays the names of the successfully archived files and directories. If you do not specify this keyword, the command does not display the names of the successfully archived files and directories.

source { source-file | source-directory }&<1-5>: Specifies the files and directories to be archived. The argument can be a space-separated list of up to five items. Each item can be a file or directory name.

Examples

# Archive the files 1.cfg, 2.cfg, and the directory test to the file a.tar.

<Sysname> tar create archive-file a.tar source 1.cfg 2.cfg test

Creating archive cfa0:/a.tar Done.

# Compress and archive the files 1.cfg, 2.cfg, and the directory test to b.tar.gz.

<Sysname> tar create gz archive-file b.tar.gz source 1.cfg 2.cfg test

Creating archive cfa0:/b.tar.gz Done.

# Compress and archive files and directories, and display the successfully archived files and directories.

<Sysname> tar create gz archive-file c.tar.gz verbose source 1.cfg 2.cfg test

1.cfg

2.cfg

test/

test/a.log

test/subtest/

test/subtest/aa.log

Related commands

tar extract

tar list

tar extract

Use tar extract to extract files and directories.

Syntax

tar extract archive-file file [ verbose ] [ screen | to directory ]

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

archive-file file: Specifies the archive file name. The suffix can be .tar or .tar.gz.

verbose: Displays the names of the successfully extracted files and directories.

screen: Displays the content of the extracted files and directories on the screen. The extracted files are not saved.

to directory: Saves the extracted files and directories to a different directory. The directory argument specifies the directory.

Usage guidelines

If you do not specify the screen keyword or the to directory option, the command saves the extracted files and directories to the working directory.

The command saves the extracted files and directories by using their original names. If a file or directory that has the same name as an extracted file or directory already exists in the destination directory, the file or directory is overwritten.

Examples

# Extract files and directories from the archive file a.tar.

<Sysname> tar extract archive-file a.tar

Extracting archive cfa0:/a.tar Done.

# Extract files and directories from the archive file a.tar, and display the names of the successfully extracted files and directories.

<Sysname> tar extract archive-file a.tar.gz verbose

1.cfg

2.cfg

test/

test/a.log

test/subtest/

test/subtest/aa.log

# Extract files and directories from the archive file a.tar, and display the content of the files on the screen.

<Sysname> tar extract archive-file a.tar.gz screen

#

 version 7.1.055, Demo 2501008

#

 sysname Sysname

#

...

Related commands

tar create

tar list

tar list

Use tar list to display the names of archived files and directories.

Syntax

tar list archive-file file

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

archive-file file: Specifies the archive file name. The suffix can be .tar or .tar.gz.

Examples

# Display the names of archived files and directories.

<Sysname> tar list archive-file a.tar

1.cfg

2.cfg

test/

test/a.log

test/subtest/

test/subtest/aa.log

Related commands

tar create

tar extract

umount

Use umount to unmount a file system.

Syntax

umount filesystem

Views

User view

Predefined user roles

network-admin

Parameters

filesystem: Specifies the name of a file system.

Usage guidelines

This command is supported only on the default MDC.

File systems on a storage medium are automatically mounted when the storage medium is connected to the device. To remove a hot-swappable storage medium from the device, you must first unmount all file systems on the storage medium to disconnect the medium from the device. Removing a connected hot-swappable storage medium might damage files on the storage medium or even the storage medium.

You can unmount a file system only when no other users are accessing the file system.

To avoid file system corruption, do not perform the following tasks while the system is unmounting a file system:

·     Install or remove storage media.

·     Install or remove cards.

·     Performing a master/subordinate switchover. (In IRF mode.)

·     Creating, deleting, starting, or stopping an MDC.

Examples

# (In standalone mode.) Unmount the file system on a CF card of the device.

<Sysname> umount cfa0:

# (In IRF mode.) Unmount the file system on a CF card of the master.

<Sysname> umount cfa0:

# (In IRF mode.) Unmount the file system on a CF card of the subordinate device with the member ID 2.

<Sysname> umount chassis2#slot0#cfa0:

Related commands

mount

undelete

Use undelete to restore a file from the recycle bin.

Syntax

undelete file

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

file: Specifies the name of the file to be restored.

Usage guidelines

If a file with the same name already exists in the directory, the system prompts whether or not you want 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 root directory of the cfa0: file system to the recycle bin.

<Sysname>undelete copy.cfg

Undelete cfa0:/copy.cfg? [Y/N]:y

Undeleting file cfa0:/copy.cfg... Done.

# Restore the startup.cfg file, which was moved from the cfa0:/seclog directory to the recycle bin.

·     Method 1:

<Sysname>undelete seclog/startup.cfg

Undelete cfa0:/seclog/startup.cfg? [Y/N]:y

Undeleting file cfa0:/seclog/startup.cfg... Done.

<Sysname>

·     Method 2:

<Sysname> cd seclog

<Sysname> undelete startup.cfg

Undelete cfa0:/seclog/startup.cfg? [Y/N]:y

Undeleting file cfa0:/seclog/startup.cfg... Done.

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become a Partner
  • Partner Resources
  • Partner Business Management
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网