You are on page 1of 98

M2000 V200

Command Reference

Issue Date

02 2009-10-31

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Huawei Technologies Co., Ltd. provides customers with comprehensive technical support and service. For any assistance, please contact our local office or company headquarters.

Huawei Technologies Co., Ltd.


Address: Huawei Industrial Base Bantian, Longgang Shenzhen 518129 People's Republic of China http://www.huawei.com support@huawei.com

Website: Email:

Copyright Huawei Technologies Co., Ltd. 2009. All rights reserved. No part of this document may be reproduced or transmitted in any form or by any means without prior written consent of Huawei Technologies Co., Ltd.

Trademarks and Permissions


and other Huawei trademarks are the property of Huawei Technologies Co., Ltd. All other trademarks and trade names mentioned in this document are the property of their respective holders.

Notice
The purchased products, services and features are stipulated by the contract made between Huawei and the customer. All or part of the products, services and features described in this document may not be within the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements, information, and recommendations in this document are provided "AS IS" without warranties, guarantees or representations of any kind, either express or implied. The information in this document is subject to change without notice. Every effort has been made in the preparation of this document to ensure accuracy of the contents, but all statements, information, and recommendations in this document do not constitute the warranty of any kind, express or implied.

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Command Reference

Contents

Contents
About This Document.....................................................................................................................1 1 M2000 Commands......................................................................................................................1-1
1.1 kill_svc............................................................................................................................................................1-3 1.2 start_svc...........................................................................................................................................................1-3 1.3 stop_svc...........................................................................................................................................................1-4 1.4 svc_adm -cmd reload......................................................................................................................................1-4 1.5 svc_adm -cmd status.......................................................................................................................................1-5 1.6 svc_adm -cmd status -sysagent all..................................................................................................................1-5 1.7 svc_profile.sh Script........................................................................................................................................1-6 1.8 svc_ps..............................................................................................................................................................1-6 1.9 svc_stacks........................................................................................................................................................1-7

2 Operating System Commands.................................................................................................2-1


2.1 Files and Directories........................................................................................................................................2-3 2.1.1 cd............................................................................................................................................................2-4 2.1.2 chgrp.......................................................................................................................................................2-4 2.1.3 chmod.....................................................................................................................................................2-5 2.1.4 chown.....................................................................................................................................................2-7 2.1.5 cp............................................................................................................................................................2-8 2.1.6 ls.............................................................................................................................................................2-8 2.1.7 mkdir....................................................................................................................................................2-10 2.1.8 mv.........................................................................................................................................................2-10 2.1.9 pwd.......................................................................................................................................................2-11 2.1.10 rm.......................................................................................................................................................2-11 2.1.11 rmdir...................................................................................................................................................2-12 2.2 Backup and Compression..............................................................................................................................2-13 2.2.1 compress...............................................................................................................................................2-13 2.2.2 gtar........................................................................................................................................................2-14 2.2.3 gzip.......................................................................................................................................................2-15 2.2.4 pack......................................................................................................................................................2-16 2.2.5 tar..........................................................................................................................................................2-16 2.2.6 uncompress...........................................................................................................................................2-18 2.2.7 unpack..................................................................................................................................................2-18 Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. i

Contents

Command Reference

2.3 File View and Modification..........................................................................................................................2-19 2.3.1 cat.........................................................................................................................................................2-20 2.3.2 clear......................................................................................................................................................2-20 2.3.3 diff........................................................................................................................................................2-21 2.3.4 echo......................................................................................................................................................2-22 2.3.5 grep.......................................................................................................................................................2-23 2.3.6 head......................................................................................................................................................2-23 2.3.7 less........................................................................................................................................................2-24 2.3.8 more......................................................................................................................................................2-24 2.3.9 tail.........................................................................................................................................................2-25 2.3.10 vi.........................................................................................................................................................2-26 2.4 Account Management...................................................................................................................................2-28 2.4.1 groupadd...............................................................................................................................................2-29 2.4.2 groupdel................................................................................................................................................2-29 2.4.3 groupmod.............................................................................................................................................2-29 2.4.4 passwd..................................................................................................................................................2-30 2.4.5 useradd.................................................................................................................................................2-30 2.4.6 userdel..................................................................................................................................................2-31 2.4.7 usermod................................................................................................................................................2-32 2.5 Find and Help................................................................................................................................................2-33 2.5.1 find.......................................................................................................................................................2-34 2.5.2 man.......................................................................................................................................................2-36 2.5.3 whereis.................................................................................................................................................2-37 2.5.4 which....................................................................................................................................................2-37 2.6 System Information.......................................................................................................................................2-38 2.6.1 date.......................................................................................................................................................2-39 2.6.2 df...........................................................................................................................................................2-40 2.6.3 du..........................................................................................................................................................2-41 2.6.4 hostname...............................................................................................................................................2-42 2.6.5 prtconf..................................................................................................................................................2-43 2.6.6 uname...................................................................................................................................................2-45 2.6.7 who.......................................................................................................................................................2-46 2.7 Process-Related.............................................................................................................................................2-47 2.7.1 kill.........................................................................................................................................................2-47 2.7.2 prstat.....................................................................................................................................................2-49 2.7.3 ps..........................................................................................................................................................2-49 2.7.4 top.........................................................................................................................................................2-50 2.8 Network Communications.............................................................................................................................2-51 2.8.1 finger....................................................................................................................................................2-51 2.8.2 ftp.........................................................................................................................................................2-52 2.8.3 ifconfig.................................................................................................................................................2-54 2.8.4 netstat...................................................................................................................................................2-56 ii Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

Contents

2.8.5 ping.......................................................................................................................................................2-58 2.8.6 route......................................................................................................................................................2-59 2.8.7 telnet.....................................................................................................................................................2-62 2.9 Other Common Commands...........................................................................................................................2-63 2.9.1 bc..........................................................................................................................................................2-63 2.9.2 script.....................................................................................................................................................2-64 2.9.3 pkgadd..................................................................................................................................................2-65 2.9.4 pkgrm...................................................................................................................................................2-65

3 Summary of Commonly Used Cluster Commands.............................................................3-1 4 Common Commands and Parameters of the Veritas Cluster............................................4-1 5 Common VVR Commands and Parameters..........................................................................5-1

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

iii

Command Reference

Tables

Tables
Table 2-1 Common options in symbol mode of the chmod command ...............................................................2-6 Table 2-2 Option description of the ls command.................................................................................................2-9 Table 2-3 Descriptions of gtar command options..............................................................................................2-14 Table 2-4 Option description for the tar command...........................................................................................2-17 Table 2-5 Option description about the diff command options..........................................................................2-21 Table 2-6 Option description of the echo command..........................................................................................2-22 Table 2-7 Option description of the more command..........................................................................................2-25 Table 2-8 Operations in the text input mode......................................................................................................2-27 Table 2-9 Operations related to moving the cursor in the text input mode........................................................2-27 Table 2-10 Operation for exiting the text input mode and switching to the command mode............................2-27 Table 2-11 Operations related to deleting characters in the command mode.....................................................2-27 Table 2-12 Commands for exiting the vi editor.................................................................................................2-28 Table 2-13 Option description of the useradd command...................................................................................2-31 Table 2-14 Option description of the usermod command..................................................................................2-32 Table 2-15 Conditions for file search.................................................................................................................2-34 Table 2-16 Logical operators of conditions........................................................................................................2-35 Table 2-17 Format of the command output........................................................................................................2-39 Table 2-18 Description of the uname options....................................................................................................2-46 Table 2-19 Examples of the finger command....................................................................................................2-52 Table 2-20 Common ftp commands...................................................................................................................2-53 Table 2-21 Description of routing flags.............................................................................................................2-57 Table 2-22 Description of the route commands.................................................................................................2-59 Table 2-23 Description of routing flags.............................................................................................................2-61 Table 3-1 Common maintenance commands of the Cluster3.0............................................................................3-1 Table 4-1 Common maintenance commands of the VCS....................................................................................4-1 Table 5-1 Common VVR commands and parameters..........................................................................................5-1

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Command Reference

About This Document

About This Document

Purpose
This document provides the M2000 system routine maintenance common commands.

Related Versions
The following table lists the product versions related to this document. Product Name M2000 Version V200

Intended Audience
The intended audiences of this document are network administrators.

Update History 02(2009-10-31)


Second commercial release. Compared with V200 01 issued on June 30 of 2009, this version has the following modifications: The content descriptions are optimized in 3 Summary of Commonly Used Cluster Commands.

01(2009-06-30)
Initial release. Also, the first formal release.
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 1

Organization

Command Reference

Organization
1 M2000 Commands This describes the functions of common commands related to the M2000 service, along with application examples. The path M2000 Server Installation Path/bin stores all the commands used for the M2000 system maintenance. Before running commands, ensure that the database works properly and that you already run the M2000 environment setting script svc_profile.sh. M2000 commands can run both the Solaris operating system and Linux operating system. 2 Operating System Commands This provides the reference to the common commands on the Solaris and Linux operating systems. The commands consist of files and directories commands, backup and compression commands, file view and modification, account management commands, find and help commands, system information commands, process-related commands, network communication commands, and other common commands. 3 Summary of Commonly Used Cluster Commands This describes the common maintenance commands of the Cluster 3.0. 4 Common Commands and Parameters of the Veritas Cluster This describes the common commands and parameters of the Veritas Cluster. 5 Common VVR Commands and Parameters The following table describes the common VVR commands and parameters.

Conventions
Symbol Conventions The symbols that may be found in this document are defined as follows. Symbol Description Indicates a hazard with a high level of risk, which if not avoided,will result in death or serious injury. Indicates a hazard with a medium or low level of risk, which if not avoided, could result in minor or moderate injury. Indicates a potentially hazardous situation, which if not avoided,could result in equipment damage, data loss, performance degradation, or unexpected results. Indicates a tip that may help you solve a problem or save time. Provides additional information to emphasize or supplement important points of the main text.

General Conventions
2 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

Organization

The general conventions that may be found in this document are defined as follows. Convention Times New Roman Boldface Italic Courier New Description Normal paragraphs are in Times New Roman. Names of files, directories, folders, and users are in boldface. For example, log in as user root. Book titles are in italics. Examples of information displayed on the screen are in Courier New.

Command Conventions The command conventions that may be found in this document are defined as follows. Convention Boldface Italic [] { x | y | ... } [ x | y | ... ] { x | y | ... }* Description The keywords of a command line are in boldface. Command arguments are in italics. Items (keywords or arguments) in brackets [ ] are optional. Optional items are grouped in braces and separated by vertical bars. One item is selected. Optional items are grouped in brackets and separated by vertical bars. One item is selected or no item is selected. Optional items are grouped in braces and separated by vertical bars. A minimum of one item or a maximum of all items can be selected. Optional items are grouped in brackets and separated by vertical bars. Several items or no item can be selected.

[ x | y | ... ]*

GUI Conventions The GUI conventions that may be found in this document are defined as follows. Convention Boldface > Description Buttons, menus, parameters, tabs, window, and dialog titles are in boldface. For example, click OK. Multi-level menus are in boldface and separated by the ">" signs. For example, choose File > Create > Folder.

Keyboard Operations
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 3

Organization

Command Reference

The keyboard operations that may be found in this document are defined as follows. Format Key Key 1+Key 2 Key 1, Key 2 Description Press the key. For example, press Enter and press Tab. Press the keys concurrently. For example, pressing Ctrl+Alt +A means the three keys should be pressed concurrently. Press the keys in turn. For example, pressing Alt, A means the two keys should be pressed in turn.

Mouse Operations The mouse operations that may be found in this document are defined as follows. Action Click Double-click Drag Description Select and release the primary mouse button without moving the pointer. Press the primary mouse button twice continuously and quickly without moving the pointer. Press and hold the primary mouse button and move the pointer to a certain position.

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

1 M2000 Commands

1
About This Chapter

M2000 Commands

This describes the functions of common commands related to the M2000 service, along with application examples. The path M2000 Server Installation Path/bin stores all the commands used for the M2000 system maintenance. Before running commands, ensure that the database works properly and that you already run the M2000 environment setting script svc_profile.sh. M2000 commands can run both the Solaris operating system and Linux operating system. 1.1 kill_svc This describes the function of the kill_svc command and the users authorized to run this command. This also gives examples for the application of this command. Use the kill_svc command only in the case of a deadlock and an abnormal process. 1.2 start_svc This describes the function of the start_svc command and the users authorized to run this command. This also gives examples for the application of this command. 1.3 stop_svc This describes the function of the stop_svc command and the users authorized to run this command. This also gives examples for the application of this command. 1.4 svc_adm -cmd reload This describes the function and user identity of the svc_adm -cmd reload command. The command is used to update the M2000 configuration information. This also gives an example to explain the application of the command. 1.5 svc_adm -cmd status This describes the function of the svc_adm -cmd status command and the users authorized to run this command. It also provides an example to explain the application. 1.6 svc_adm -cmd status -sysagent all This describes the function of the svc_adm -cmd status -sysagent all command used for viewing the status of the M2000 services and the users authorized to run this command. This also provides some application examples for the command. This command is applicable to only the Solaris operating system. 1.7 svc_profile.sh Script

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

1-1

1 M2000 Commands

Command Reference

This describes the function, path, and method of running the svc_profile.sh script. Before you run the commands on the M2000, you must run svc_profile.sh to set the operating environment. 1.8 svc_ps This describes the function of the svc_ps command and the users authorized to run this command. This also gives examples for the application of this command. 1.9 svc_stacks This describes the function of the svc_stacks command and the users authorized to run this command. It also provides an example to explain the application of this command.

1-2

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

1 M2000 Commands

1.1 kill_svc
This describes the function of the kill_svc command and the users authorized to run this command. This also gives examples for the application of this command. Use the kill_svc command only in the case of a deadlock and an abnormal process.

Function
The kill_svc command stops services and processes of the M2000 system through the process killing mechanism supported by the primary layer operating system. Running this command may lead to service data loss or abnormal services. Therefore, use this command only when all other measures to restore the services of the system fail. Generally, the stop_svc command is used to stop the M2000 services. Therefore, run kill_svc only in the case of a deadlock and an abnormal process.

Permitted Users
User root is authorized to run the kill_svc command.

Example
# kill_svc

1.2 start_svc
This describes the function of the start_svc command and the users authorized to run this command. This also gives examples for the application of this command.

Function
The start_svc command starts all M2000 services. After the system starts, this command attempts to start each service again and displays a message to indicate that the service is started.
NOTE

If the installed match version is of V200R0051.a.0.0.XX or of earlier, run the start_svc command. The following message is displayed.
iManagerM2000_SGSN_MATCH_ENG_V200R005C01B002 has not been executed commands{DcNeIns and DcInit}, please run them if necessary! OMCSTMATCH-GGSN_1.a.0.0.30 has not been executed commands{DcNeIns and DcInit}, please execute them if necessary!

Ensure that the M2000 system services are stopped. Initiate the mediation layer. # cd /opt/OMC/med/RNCNE/iManagerM2000_RNC_MATCH_ENG_V200R008C03SPC001 # DcNeIns -i . # DcInit Run the command start_svc to start the M2000 system service.

Permitted Users
User root is authorized to run the start_svc command.
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 1-3

1 M2000 Commands

Command Reference

Example
# start_svc
==================== Starting Services ... TAO Naming Service is running TAO Notification Service is running Monitor_Service already running. imapsysd already running. LogServer [starting... ] svc_adm:info:service with this name is already running ... ============================ Finished Starting Services.

1.3 stop_svc
This describes the function of the stop_svc command and the users authorized to run this command. This also gives examples for the application of this command.

Function
The stop_svc command stops all M2000 services. If the system is not started, this command attempts to stop each service and then displays error messages.

Permitted Users
User root is authorized to run the stop_svc command.

Example
# stop_svc
============= Stopping System ... SystemMonitor [stopped ] EventManager [stopped ] LogServer [stopped ] ... ==================== Finished Stopping System.

1.4 svc_adm -cmd reload


This describes the function and user identity of the svc_adm -cmd reload command. The command is used to update the M2000 configuration information. This also gives an example to explain the application of the command.

Function
This command loads the configuration file to the configuration module to update the configuration in real time. This means that the M2000 services are not stopped when the system updates the configuration information.

Permitted Users
Users root and omcuser are authorized to run the svc_adm -cmd reload command.
1-4 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

1 M2000 Commands

Example
-bash-3.00$ svc_adm -cmd reload After you run the command, the data in the configuration module is the same as the data in the configuration files.

1.5 svc_adm -cmd status


This describes the function of the svc_adm -cmd status command and the users authorized to run this command. It also provides an example to explain the application.

Function
The svc_adm -cmd status command is used to check the operational status of all the M2000 services.

Permitted Users
Users root and omcuser are authorized to run the svc_adm -cmd status command.

Example
-bash-3.00$ svc_adm -cmd status The status of the M2000 services is Running, or Not Running.

1.6 svc_adm -cmd status -sysagent all


This describes the function of the svc_adm -cmd status -sysagent all command used for viewing the status of the M2000 services and the users authorized to run this command. This also provides some application examples for the command. This command is applicable to only the Solaris operating system.

Function
This command is used for viewing the current running status of the M2000 services in the M2000 single-server system, HA system, or SLS system.

Authorized Users
Users root, omcuser, and dbuser are authorized to run this command.

Application Example
l

In the M2000 single-server system Log in to the server and run the following command: # svc_adm -cmd status -sysagent all The system output displays the running status of the services. The status can be Running, or Not Running.

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

1-5

1 M2000 Commands
l

Command Reference

In the M2000 HA system Log in to the active node and run the following command: # svc_adm -cmd status -sysagent all The system output displays the running status of the services on the active and standby nodes. The status can be Running, or Not Running.

In the M2000 SLS system Log in to the master node and any of the slave node and run the following command: # svc_adm -cmd status -sysagent all The system output displays the running status of the services on each node. The status can be Running, or Not Running.

1.7 svc_profile.sh Script


This describes the function, path, and method of running the svc_profile.sh script. Before you run the commands on the M2000, you must run svc_profile.sh to set the operating environment.

Function
Before you run the commands on the M2000, run svc_profile.sh. This script sets the user operating environment such as the searching path and the dynamic searching path.

Path
The script is saved in the M2000 Server Installation Directory.

Operating Method
There are two ways to run the script: manually and automatically.
l

Run the script manually

Take the M2000 default directory /opt/OMC as an example. To manually run the script, run the following command: -bash-3.00$ . /opt/OMC/svc_profile.sh
NOTE

The symbol . exists before the command, and a space exists between the mark . and the mark /.
l

Run the script automatically

After the system is installed correctly, the script is added to the .profile file of user omcuser and user root. If you log in to the system as user omcuser or user root, the system automatically runs the script.

1.8 svc_ps
This describes the function of the svc_ps command and the users authorized to run this command. This also gives examples for the application of this command.
1-6 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

1 M2000 Commands

Function
The svc_ps command is used to check the operational status of the M2000 service processes.

Permitted Users
Users root, omcuser are authorized to run the svc_ps command.

Example
-bash-3.00$ svc_ps The command result shows all the M2000 processes that are running.

1.9 svc_stacks
This describes the function of the svc_stacks command and the users authorized to run this command. It also provides an example to explain the application of this command.

Function
The svc_stacks command collects the stack information on the M2000 service processes for locating and debugging system faults.

Permitted Users
User root is authorized to run this command.

Example
# svc_stacks The queried stack information is stored in the file /M2000 server installation path/var/logs/ imap_stacks.YY_MM_DD__HH_NN_SS.trace. The default installation path of the M2000 server software is /opt/OMC. The result file is identified on the basis of the query time. In the file name, YY stands for year, MM for month, DD for day, HH for hour, NN for minute, and SS for second.

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

1-7

Command Reference

2 Operating System Commands

2
About This Chapter

Operating System Commands

This provides the reference to the common commands on the Solaris and Linux operating systems. The commands consist of files and directories commands, backup and compression commands, file view and modification, account management commands, find and help commands, system information commands, process-related commands, network communication commands, and other common commands. 2.1 Files and Directories This describes the reference of the Files and Directories common commands. This also gives function descriptions and examples. 2.2 Backup and Compression This describes the functions of the commands used for backup and compression and provides some application examples. 2.3 File View and Modification This describes the functions of the file view and modification and provides some application examples. 2.4 Account Management This describes the functions of the account management commands and provides some application examples. Only user root and authorized users can add, modify, or delete users and user groups. 2.5 Find and Help This describes the functions of the find and help commands and provides some application examples. 2.6 System Information This describes the system information commands and provides some application examples. 2.7 Process-Related This describes the process-related commands and provides some application examples. 2.8 Network Communications This describes the commands used for network communications and provides some application examples.
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-1

2 Operating System Commands

Command Reference

2.9 Other Common Commands This describes the functions of other common commands and provides some application examples.

2-2

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

2.1 Files and Directories


This describes the reference of the Files and Directories common commands. This also gives function descriptions and examples. 2.1.1 cd This describes the function and example of the cd command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.1.2 chgrp This describes the function, format, option, parameter, and example of chgrp command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.1.3 chmod This describes the function, format, option, and example of the chmod command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.1.4 chown This describes the function, format, option, parameter, and example of the chown command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.1.5 cp This describes the function, format, option, and parameter of the cp command. It also provides an example of the cp command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.1.6 ls This describes the function, format, option, parameter, and example of the ls command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.1.7 mkdir This describes the function and example of the mkdir command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.1.8 mv This describes the function, format, and example of the mv command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.1.9 pwd This describes the function and example of the pwd command. The pwd command is used to view the current working folder. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.1.10 rm This describes the function, format, option, and example of the rm command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.1.11 rmdir This describes the function and example of the rmdir command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

2-3

2 Operating System Commands

Command Reference

2.1.1 cd
This describes the function and example of the cd command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The cd command is used to switch the current folder to another folder. This command applies to both absolute and relative paths.

Example
l

To switch to the home folder, run the following command:

# cd
l

To switch to the system root directory, run the following command:

# cd /
l

To switch back one folder, run the following command:

# cd ..
l

To switch back two folders, run the following command:

# cd ../..
l

To switch to the /export/home folder by the absolute path, run the following command:

# cd /export/home
NOTE

If you run the cd command that is not followed by any parameter, the system is switched back to the home folder.

2.1.2 chgrp
This describes the function, format, option, parameter, and example of chgrp command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The chgrp command is used to move all files from the user group to which you belong, to another user group. That is, you belong to at least two user groups at the same time.

Command Format
chgrp Option group file

Option Description
l l

-f: runs the command forcibly without displaying errors -R: recursive folder
Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

2-4

Command Reference

2 Operating System Commands

Parameter Description
l l

Group: the modified user group File: the file the user group of which is to be modified

Example
To change the user group file to new_group, run the following command: # chgrp new_group file

CAUTION
The new user group to which a file is moved should be created. Run the groups command to list the groups to which you belong. After the owner or group of a folder is changed, the folder does not belong to that user or user group any more. The attributes of the subfolders and files in the folder, however, are retained. Run the chown command to modify the owner and the user group of a file at the same time: # chown omc:staff file1 For example, run the command to modify the owner of file1 to omc and the group to staff.

2.1.3 chmod
This describes the function, format, option, and example of the chmod command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The chmod command is used to change the access rights of a directory or a file.

Format
chmod option directory or file Based on different notation methods of the option in the command, two modes are available:
l

Symbol mode chmod objectoperatorrights file Digit mode chmod lmn file

Option Description
l

Symbol mode Table 2-1 lists common options in symbol mode of the chmod command.

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

2-5

2 Operating System Commands

Command Reference

Table 2-1 Common options in symbol mode of the chmod command Option Object Option Detail u g o Description Owner of a file Users sharing the same group with the file owner Other users except the file owner and the users sharing the same group with the file owner All users Add a right Cancel a right Set a right

a Operator + =

Digit mode The option lmn represents the following digits:


l: the rights of the owner m: the rights of the users sharing the same group with the owner n: the rights of other users in the system

The value of each digit is equal to the sum of the values of r (read right), w (write right), x (execute right), or - (no right) in each group. In each group, r = 4, w = 2, x = 1, and - = 0. In the following example -rwxr-xr-- 1 rms sbsrms 46098432 May 12 16:02 sdh*, the access rights of the file sdh is represented by the symbols rwxrxr--. The nine symbols are divided into three groups, with three symbols as a group. The three groups represent the rights of the file owner, the rights of the users sharing the same group with the file owner, and the rights of other users in the system. The three groups can be represented in digits 754, which is calculated according to the formulas: 7 = 4 + 2 + 1, 5 = 4 + 0 + 1, and 4 = 4 + 0 + 0.

Parameter Description
File: indicates the name of the file whose rights are changed.

Example
l

Symbol mode Authorize the file1 owner with the read, write, and execute rights. Authorize the users sharing the same group with the file owner with the read and execute rights. Authorize other users with the read and execute rights. Run the following command: # chmod u=rwx,go=rx file1 To authorize all the users with the read and write rights, run the following command: # chmod a=rw file2

Digit mode
Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

2-6

Command Reference

2 Operating System Commands

Authorize the file1 owner with the read, write, and execute rights. Authorize the users sharing the same group with the file owner with the read and execute rights. Authorize other users with the read and execute rights. Run the following command: # chmod 755 file1 To authorize all the users with the read and write rights, run the following command: # chmod 666 file2
NOTE

To configure the rights of a file for users in a group and other users in the system in symbol mode, you must authorize these users with the execute right of the directory where a file exists. Run the following command for the directory that requires you to set rights: # chmod u=rw,+x . You can also run the following command: # chmodu=rwx,go=x . In this command, the symbol "." indicates the current directory.

In digit mode, r = 4, w = 2, x = 1, and - = 0. These mappings are set according to the binary mode. For the three symbols in a group, which represent the read right, the write right, and the execute right, assign the binary value 1 if a symbol has the corresponding right and assign the binary value 0 if a symbol does not have the corresponding rights. Take the previous file sdh as an example. The file rights are represented by the symbols rwxr-xr--. After converting the symbols into a binary value, you can obtain "111101100". The binary value is divided into three 3-digit groups, with each group representing a file right. After converting the binary value of each group into a decimal value, you can obtain three values: 7, 5, and 4.

2.1.4 chown
This describes the function, format, option, parameter, and example of the chown command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The chown command is used to modify the owner of a file. In most Unix/Linux systems, this command can be run only by the super user.

Command Format
chown Option owner file

Option Description
l l

-f: runs the command forcibly without displaying errors -R: recursive folder

Parameter Description
l l

Owner: the modified owner File: the file of the owner to be modified

Example
l

Assume that there is a user new_owner and a file in the system. Run the following command to change the owner of the file to new_owner:
Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-7

Issue 02 (2009-10-31)

2 Operating System Commands

Command Reference

# chown new_owner file


l

Assume that there is a user M2000 in the system. Change the owner of all files in the / export/home folder and the subfolders to M2000: # chown -R M2000 /export/home

2.1.5 cp
This describes the function, format, option, and parameter of the cp command. It also provides an example of the cp command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The cp command is used to copy the contents of a file to another file.

Command Format
cp option source file object file

Option Description
The option -r indicates recursively copying a folder. That is, when copying a folder, copy the files and subfolders included in the folder, and files and subfolders in the subfolders until the last level of the folder.

Example
To copy the old_filename file in the current folder to the file new_filename, run the following command: # cp old_filename new_filename

2.1.6 ls
This describes the function, format, option, parameter, and example of the ls command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The ls command is used to list the files and subfolders in a folder. Run the ls command without any parameter to list the content of the current folder. Run the ls command with parameters to list the information about the size, type, and privileges of the file, and the date when the file was created and modified.

Command Format
ls Option Directory or File

Option Description
Several individual options and a combination of options can be used for the ls command. Place the prefix - before the options. Table 2-2 lists some common options.
2-8 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

Table 2-2 Option description of the ls command Option -a -F Description Lists all files including the hidden files, that is, the files starting with a dot ., for example, the .login file. Specifies the type of a file by suffix signs. The meaning of the suffixes are as follows:
l l l l

/: for folder files =: for pipe files @: for sign-linking files *: for executable files

-l

Lists the detailed information about a file, such as the file type, privileges, number of links, owner, file group, file size, file name, and the date of the last modification.

If the file is a sign-linking file, then the -> sign is added at the end of the file name for pointing to the linked file.

Example
To view the long-form content of the files in the current folder, run the following command: # ls -l |more
total 11094632 drwxr-xr-x 2 drwxr-xr-x 14 drwxr-xr-x 3 drwxr-xr-x 2 -rw-r--r-1 drwxr-xr-x 2 drwxr-xr-x 7 drwxr-xr-x 2 drwxr-xr-x 2 drwxr-xr-x 7 drwxr-xr-x 3 -rw-r--r-1 -rw-r--r-1 drwxr-xr-x 2 drwxr-xr-x 2 drwxr-xr-x 6 -rw-r--r-1 -rw-r--r-1 drwxr-xr-x 5 -rw-r--r-1 drwxr-xr-x 8 --More-root root root root root root root root root root root root root root root root root root root root root staff staff staff staff staff staff staff staff staff staff staff staff staff staff staff staff staff staff staff staff staff 1024 Sep 5 2001 bin 512 Sep 5 2001 charsets 512 Sep 5 2001 collate 512 Sep 5 2001 config 2048000000 Mar 6 09:50 data_dev.dat 512 Sep 5 2001 devlib 512 Sep 5 2001 diag 512 Sep 5 2001 hs_data 512 Sep 5 2001 include 512 Sep 5 2001 init 512 Sep 5 2001 install 268 Sep 5 2001 interf.old 402 Oct 29 15:25 interfaces 1024 Sep 5 2001 lib 512 Sep 5 2001 license 512 Sep 5 2001 locales 2048000000 Mar 6 10:51 log_dev.dat 2048000000 Mar 6 10:36 log_dev1.dat 512 Sep 5 2001 pad 5242880 Feb 19 10:10 phase2.dat 512 Sep 5 2001 sample

After you run the ls -l command, the result may be displayed in several screens. To view the file contents, one screen at a time, run one of the following commands:
l l

# ls -la | more $ ls -la>ccc


Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-9

Issue 02 (2009-10-31)

2 Operating System Commands

Command Reference

Save the command output to the ccc file, and then run the following command to view the output on screen at a time: # more ccc After you run the ls -l command, seven columns of information are displayed, which are described as follows:
l

The first column consists of 10 characters. The first character indicates the file type. For example, the character - refers to a common file and the character d refers to a folder. The following nine characters are three triplets indicating the access privileges of the file owner. The first triplet pertains to the owner, the middle triplet pertains to members of the user group, and the right-most one pertains to other users in the system. For example, the characters r, w, and x indicate that the user has the privileges to read, write, and execute a file, whereas the character - indicates that the user does not have any relevant privileges for the file. The second column indicates the number of links of the file. The third and fourth columns display information such as the owner of the file, and the user group to which the file belongs. The fifth column shows the size of the file in bytes. The sixth column shows the time and date when the file is last modified. The seventh column shows the file name.

l l

l l l

2.1.7 mkdir
This describes the function and example of the mkdir command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The mkdir command is used to create a folder. When the path to the created folder is determined, absolute and relative paths can be used.

Example
To create a subfolder data in /home1/omc, run the following command: # mkdir /home1/omc/data If the current folder is /home1/omc, run the following command: # mkdir data

2.1.8 mv
This describes the function, format, and example of the mv command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The mv command is used to move and rename a file.
2-10 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

CAUTION
l l

After you run the mv command, only the target file instead of the source file exists. After you run the cp command, the source file still exists and the target file is generated.

Command Format
mv source file object file

Example
To move the old_filename file in the root directory to the /home1/omc folder, and rename the source file to new_filename, run the following command: # mv old_filename /home1/omc/new_filename

2.1.9 pwd
This describes the function and example of the pwd command. The pwd command is used to view the current working folder. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
View the current working folder.

Example
# pwd
/export/home
NOTE

Unlike DOS, the Solaris/Linux system does not always display the folder name. You must run the pwd command periodically to view the current working folder.

2.1.10 rm
This describes the function, format, option, and example of the rm command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The rm command is used to delete a file.

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

2-11

2 Operating System Commands

Command Reference

CAUTION
l

In the Unix/Linux system, a file, once deleted, cannot be restored. Therefore, use the -i option to avoid the deletion of a file by mistake. To delete a folder, run either of the following commands: rmdir or rm -r. The difference between the two commands is: rmdir deletes only empty folders but rm -r deletes any folder.

Command Format
rm Option file

Option Description
l l

-i: refers to interactive operations. Your confirmation is required before a command is run. -r: recursively deletes a folder. That is, when deleting a folder, delete the files and subfolders included in the folder, and files and subfolders in the subfolders until the root folder.

Example
To delete the old_filename file in the current folder, run the following command: # rm -i old_filename

2.1.11 rmdir
This describes the function and example of the rmdir command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The rmdir command is used to delete an empty folder.

CAUTION
l

If the folder to be deleted is not empty, you must delete the files in the folder before running the rmdir command. To delete the current folder, you must switch to the upper-level folder.

Example
To delete the data subfolder in the /home1/omc folder, run the following command: # rmdir /home1/omc/data If the current folder is /home1/omc, run the following command: # rmdir data
2-12 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

2.2 Backup and Compression


This describes the functions of the commands used for backup and compression and provides some application examples. 2.2.1 compress This describes the function, format, and example of the compress command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.2.2 gtar This describes the function, format, parameter options, and instance of the gtar command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.2.3 gzip This describes the function, format, parameter options, and application example of the gzip command. You can run the gzip command to compress files. The command is only used on the Linux operating system. 2.2.4 pack This describes the function, format, and example of the pack command. The pack command is used to compress files and save memory space. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.2.5 tar This describes the function, format, option, and example of the tar command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.2.6 uncompress This describes the function, format, and example of uncompress command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.2.7 unpack This describes the function, format, and example of the unpack command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

2.2.1 compress
This describes the function, format, and example of the compress command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The compress command is used to compress files and save the memory space. The name of the compressed files ends with .Z. The command for decompressing such files is uncompress.

Command Format
compress file

Example
To compress a file, run the following command:
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-13

2 Operating System Commands

Command Reference

# compress file

CAUTION
The difference between the tar command and the file compressing commands is as follows: The tar command packs or combines files and packs many folders or files into a package. To compress the combined files *.tar, use the compress or pack command.

2.2.2 gtar
This describes the function, format, parameter options, and instance of the gtar command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The gtar command can merge multiple files into an archive and store it in tapes or disks. You can obtain the required files from an archive, if required.

Format
gtar function options modification options file to be backed up or restored

Option Description
l l

Function option: sets the actions of the gtar command, such as read or write. Modification option: modifies the actions of the gtar command.

Table 2-3 lists some options. Table 2-3 Descriptions of gtar command options Option Function option Example r x c g Modification option v w Description Adds the specified file to end of an archive. Reads a file in the archive. If the name is a directory, its sub directories are also read. This option is common. Creates a new archive. This option is common. Creates a file from the beginning of the archive instead of the end of the last file. Starts the display mode. The gtar command can display all names of the processed file. This option is common. Activates the confirm mode. The gtar command requests you to confirm before processing each file.

2-14

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

Option

Example f

Description Indicates that the archive is a file. Omission of this option indicates that the object is the preset disk or tape. This option is common.

Instance
l

Run the gtar command to back up files. In the current directory, back up all the files and folders in /export/home/sybdev to the default device. During the backup, the file information is displayed. # gtar cv /export/home/sybdev In the current directory, back up all the files and folders in /export/home/sybdev and save them as databak.tar. During the backup, the file information is displayed. # gtar cvf databak.tar /export/home/sybdev

Run the gtar command to restore files. Restore the files of default devices in the backup files to a hard disk. During the restoration, the file information is displayed. # gtar xv In the current directory, decompress the backup file databak.tar to /export/home/ sybdev. During the restoration, the file information is displayed. # gtar xvf databak.tar

CAUTION
l l

There is no - symbol before the function option and modification option of gtar. The gtar command can pack multiple files. The command is as follows: # gtar cvf filebak.tar file1 file2 file3 This command packs the three files, that is, file1, file2, and file3, into the file named filebak.tar. Under different UNIX systems, when using gtar to back up or restore files, note that names of the floppy disk and tape are different. Ensure that you use the right names.

2.2.3 gzip
This describes the function, format, parameter options, and application example of the gzip command. You can run the gzip command to compress files. The command is only used on the Linux operating system.

Function
The gzip command can compress files. To extract files, use the gunzip command. The compressed files are in .gz format.
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-15

2 Operating System Commands

Command Reference

Format
gzip file name

Application Example
The command for compressing filename file is as follows: # gzip filename

2.2.4 pack
This describes the function, format, and example of the pack command. The pack command is used to compress files and save memory space. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
Run the pack command to compress files. The name of the compressed files ends with .Z. The space achieved through compression depends on file types. To extract files, use the unpack command.

Command Format
pack file

Example
To pack a file, run the following command: # pack file

CAUTION
l

Do not run the pack command to compress files of small sizes. To compress such files, use the pack command with the option -f for forced compression. # pack -f filename The difference between the tar command and the file compression commands is as follows: The tar command packs or combines files and packs many folders or files into a package. To compress the combined files *.tar, use the compress or pack command.

2.2.5 tar
This describes the function, format, option, and example of the tar command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The tar command is used to combine several files into one archive and save it to a tape or disk. When one of the files is required, obtain the file directly from an archive.
2-16 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

Command Format
tar function options modification options file

Option Description
l l

function options: sets the actions, such as read and write, of the tar command modification options: modifies the actions of the tar command

Table 2-4 describes the options of the tar command. Table 2-4 Option description for the tar command Option Function options Specified Option r x Description Adds the specified file to an archive. Reads a file in an archive. If the file name is a folder, this option reads the subfolders included in the folder. This option is often used. Creates an archive. This option is often used. Creates a file at the beginning of an archive rather than add the file in the last file. Activates the display mode. The names of all the processed files are displayed. This option is often used. Activates the confirmation mode. Your confirmation is required before each file is processed. Indicates that an archive is a file. If this parameter is skipped, the preset tape or disk is used as the object. This option is often used.

c g Modification options v

Example
l

Run the tar command to back up files. To back up all the files and subfolders in the /export/home folder in the current folder to the default device and view the file information during the backup, run the following command: # tar cv /export/home In current folder, back up all the files and subfolders in the /export/home folder to the databak.tar file, and to view the file information during the backup, run the following command: # tar cvf databak.tar /export/home

Use tar to restore files.


Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-17

Issue 02 (2009-10-31)

2 Operating System Commands

Command Reference

To restore the files in the default device to a hard disk, and to view the file information during the restoration, run the following command: # tar xv In current folder, restore the databak.tar file to the /export/home folder, and to view the file information during the restoration, run the following command: # tar xvf databak.tar

CAUTION
l l

Do not enter "-" on the left of the function and modification options in the tar command. Run the following tar command to pack several files into a package: # tar cvf filebak.tar file1 file2 file3 Run the previous command to pack file1, file2, and file3 into a package named filebak.tar. The names of the disk and tape devices used in file backup and restoration in the tar command may vary according to the operating system. Check carefully before running the command.

2.2.6 uncompress
This describes the function, format, and example of uncompress command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The uncompress command is used to decompress the compressed files. The command for compressing files is compress.

Command Format
uncompress compressed file ending with ".Z"

Example
To decompress the file.Z file, run the following command: # uncompress file.Z

2.2.7 unpack
This describes the function, format, and example of the unpack command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The unpack command is used to extract the packed files. To pack files, use the pack command.
2-18 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

Command Format
unpack compressed file ending with ".Z"

Example
To extract the file.Z file, run the following command: # unpack file.Z

2.3 File View and Modification


This describes the functions of the file view and modification and provides some application examples. 2.3.1 cat This describes the function, format, option, and example of the cat command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.3.2 clear This describes the function and example of the clear command. The command is only used on the Solaris operating system. 2.3.3 diff This describes the function, format, parameter options, and application example of the diff command. You can run the diff command to compare files. The command is only used on the Linux operating system. 2.3.4 echo This describes the function, format, option, and example of the echo command. The command is only used on the Solaris operating system. 2.3.5 grep This describes the function, format, and example of the grep command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.3.6 head This describes the function, format, and example of the head command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.3.7 less This describes the function, format, parameter options, and application example of the less command. You can run the less command to view files. The command is only used on the Linux operating system. 2.3.8 more This describes the function, format, option, and example of the more command. The more command is used to view a file one screen at a time. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.3.9 tail This describes the function, format, and example of the tail command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.3.10 vi
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-19

2 Operating System Commands

Command Reference

This describes the function and format of the vi command. The vi command can be used to create and modify text files. The usage of the command is the same on the Solaris operating system and the Linux operating system.

2.3.1 cat
This describes the function, format, option, and example of the cat command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The cat command is used to view the contents of a text file.

Command Format
cat option file

Option Description
l l

-n: number of each line of the displayed text -v: to view nonprinting characters rather than TAB and RETURN

Example
To view the contents of the cat_Table.txt file, run the following command: # cat cat_Table.txt
Name Object_type --------------------------------------------------tbl128Addr user table tbl128IP user table tbl128Name user table tblAdapterIP user table tblAdjCell user table ... ...
NOTE

Owner -----------------------------cat cat cat cat cat ...

To view several files at the same time, run the following command: # cat file1 file2 file3

2.3.2 clear
This describes the function and example of the clear command. The command is only used on the Solaris operating system.

Function
The clear command is used to clear the contents on the screen.
2-20 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

Example
To clear the screen, run the following command: # clear

2.3.3 diff
This describes the function, format, parameter options, and application example of the diff command. You can run the diff command to compare files. The command is only used on the Linux operating system.

Function
You can run the diff command to compare files and display differences between the files. It can be used to compare single files or directories.
NOTE

The diff command is applicable to text files.

Format
diff option file1 file2

Option Description
For details about options of the diff command, see Table 2-5. Table 2-5 Option description about the diff command options Option -b Description Compare any number of space characters that are regarded as new line tags at the end of each line with other space character strings except new line tags. The space characters in front of new line characters are ignored. Ignore the spaces and TAB characters and consider all the strings of blanks as the same. For example, "if ( a == b )" is considered the same as "if(a==b)". Inform you of identical files. The different files are not mentioned. Be not case sensitive. For example, letter "a" in lower case is considered the same as letter "A" in upper case.

-w -s -i

If the file is a sign-linking file, then the -> sign is added at the end of the file name for pointing to the linked file.

System Output
The system outputs of the diff command are as follows:
l

If 0 is displayed, you can infer that no difference is found.


Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-21

Issue 02 (2009-10-31)

2 Operating System Commands


l l

Command Reference

If 1 is displayed, you can infer that differences are found. If >1 is displayed, you can infer that errors occur.

Application Example
To compare the chap1.bak file and the chap1 file, run the following command: # diff chap1.back chap1 The system output displays the differences between the chap1.bak file and the chap1 file.

2.3.4 echo
This describes the function, format, option, and example of the echo command. The command is only used on the Solaris operating system.

Function
The echo command is used to send a character string to a standard output device such as the monitor screen.

Command Format
echo character string option

Option Description
Table 2-6 lists five options that are frequently used. Table 2-6 Option description of the echo command Option \c \0n \t \n \v Description The RETURN character is not displayed. n is an 8-digit ASCII character code. The TAB character is displayed. The RETURN character is displayed. The vertical TAB character is displayed.

Example
# echo $HOME /export/home /export/home displayed on the screen is the meaning of the character string "$HOME". To prevent the system from displaying RETURN, run the following command: # echo $HOME "\c"
2-22 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

/export/home Or: # echo "$HOME \c" /export/home


NOTE

The options \c, \0n, \t, \n, and \v are displayed in the character string enclosed in quotation marks. The quotation marks can quote either one option or multiple options.

2.3.5 grep
This describes the function, format, and example of the grep command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The grep command is used to search for a character string in a text file and to print all the lines that contain the character string.

Command Format
grep character string file

Example
To search the character string operation in the ifconfig.txt file, run the following command: # grep operation ifconfig.txt
used to control operation of dhcpagent(1M), the DHCP client operation, be used to modify the address or characteristics dhcpagent wakes up to conduct another DHCP operation on the given, and the operation is one that requested operation will continue.

To search the character string "The following options are supported" in the ifconfig.txt file, run the following the command: # grep "The following options are supported" ifconfig.txt
The following options are supported:
NOTE

The character string "The following options are supported" includes spaces. Remember to enclose the character string within quotation marks in the command line.

2.3.6 head
This describes the function, format, and example of the head command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The head command is used to view the first few lines of a text file. By default, the first 10 lines are displayed.
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-23

2 Operating System Commands

Command Reference

Command Format
head value file

Example
To view the first three lines of the A_Table.txt file, run the following command: # head -3 A_Table.txt
Name Owner Object_type ------------------------------ ------------------------------

2.3.7 less
This describes the function, format, parameter options, and application example of the less command. You can run the less command to view files. The command is only used on the Linux operating system.

Function
A text file is displayed on a PC by page. The function of the less command is the same as that of the more command. You can run either command to view a file by page. The difference is that, the less command enables you to turn to the previous or next page. For details about the more, see 2.3.8 more.

Format
less option file

Application Example
To view the contents of the cat_Table.txt file on screen at a time, run the following command: # less cat_Table.txt
NOTE

To view a file on screen at a time, press the following keys to perform relevant operations:
l l l

b: Turn to the previous page. p: Turn to the next page. q: Exit.

2.3.8 more
This describes the function, format, option, and example of the more command. The more command is used to view a file one screen at a time. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
View a file one screen at a time. You can also use this command to browse the previous screens and to search for character strings.
2-24 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

Command Format
more option file

Option Description
Remember to insert the prefix - before the options when multiple options and combination of options are used. Table 2-7 lists four options that are frequently used. Table 2-7 Option description of the more command Option -c -w -lines +/mode Description Clears the screen before the content is displayed. Indicates that the system does not exit at the end of the input but waits for the prompt. Displays the number of lines on each screen. Searches files in a preset mode.

Example
To view the contents of the cat_Table.txt file on screen at a time, run the following command: # more cat_Table.txt
Name Object_type --------------------------------------------------tbl128Addr user table tbl128IP user table tbl128Name user table tblAdapterIP user table tblAdjCell user table ... ...
NOTE

Owner -----------------------------cat cat cat cat cat ...

To view a file on screen at a time, press the following keys to perform relevant operations: Space key: to view the next screen Return key: to view the next line q: to exit h: to view the online help b: to switch back to the previous screen /word: to search the character string "word" backward

2.3.9 tail
This describes the function, format, and example of the tail command. The usage of the command is the same on the Solaris operating system and the Linux operating system.
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-25

2 Operating System Commands

Command Reference

Function
The tail command is used to view the last few lines of a text. By default, the last 10 lines are displayed.

Command Format
tail value file

Example
To view the last ten lines of the cat_Table.txt file, run the following command: # tail cat_Table.txt
Name Object_type --------------------------------------------------tbl128Addr user table tbl128IP user table tbl128Name user table tblAdapterIP user table tblAdjCell user table ... ...
NOTE

Owner -----------------------------cat cat cat cat cat ...

A special function of the tail command is to view the latest changes of a log file, because all the latest changes are added at the end of the log file. The command format is as follows: # tail -f commdrv.log The option -f refers to the function of monitoring a file.

2.3.10 vi
This describes the function and format of the vi command. The vi command can be used to create and modify text files. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
As a powerful text editing tool, the vi editor is used to create and modify text files. The vi editor works in two modes:
l l

Text input mode: to enter the text Command mode: to enter the control command

Format
l

To start the vi editor, enter the following command: vi file name

2-26

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference
l

2 Operating System Commands

Table 2-8 lists the operations in the text input mode. Table 2-8 Operations in the text input mode Command a A i I o O Function Insert text immediately after the cursor (append). Insert text at the end of the line where the cursor is. Insert text immediately before the cursor (insert). Insert text before the first nonblank character in the line where the cursor is. Insert a new line below the current one and insert text (open). Insert a new line above the current one and insert text.

Table 2-9 lists the operations related to moving the cursor in the text input mode. Table 2-9 Operations related to moving the cursor in the text input mode Command h j k l Line No. G G Function Move the cursor one character left. Move the cursor one character down. Move the cursor one character up. Move the cursor one character right. Move the cursor to a specified line. For example, 1G means that the cursor is moved to the first line. Move the cursor to the end of the text.

Table 2-10 lists the operation for exiting the text input mode and switching to the command mode. Table 2-10 Operation for exiting the text input mode and switching to the command mode Command ESC Function Exit the text input mode and switches to the command mode.

Table 2-11 lists the operations related to deleting characters in the command mode. Table 2-11 Operations related to deleting characters in the command mode Command x Function Delete a character.
Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-27

Issue 02 (2009-10-31)

2 Operating System Commands

Command Reference

Command dd Exit the vi editor.

Function Delete a line.

All the commands that exit vi editor must be run in the command mode. Therefore press ESC before running the commands. Table 2-12 describes the commands for exiting the vi editor. Table 2-12 Commands for exiting the vi editor Command :wq :q :q! :w Function Save a file and exit the vi editor. Exit from the vi editor without saving the file. Exit from the vi editor and discard all the changes. Save a file other than exit the vi editor.

2.4 Account Management


This describes the functions of the account management commands and provides some application examples. Only user root and authorized users can add, modify, or delete users and user groups. 2.4.1 groupadd This describes the function, format, and example of the groupadd command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.4.2 groupdel This describes the function, format, and example of the groupdel command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.4.3 groupmod This describes the function, format, parameter, and example of the groupmod command. The command is only used on the Solaris operating system. 2.4.4 passwd This describes the function, format, and example of the passwd command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.4.5 useradd This describes the command function, command format, command option, and example of the useradd command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.4.6 userdel This describes the function, format, and example of the userdel command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.4.7 usermod
2-28 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

This describes the function, format, parameter, and example of the usermod command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

2.4.1 groupadd
This describes the function, format, and example of the groupadd command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The groupadd command is used to add a user group in the operating system.

Command Format
groupadd user group name

Example
To add the user group staff1 in the operating system, run the following command: # groupadd staff1

2.4.2 groupdel
This describes the function, format, and example of the groupdel command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The groupdel command is used to delete a user group in the Unix/Linux system.

Command Format
groupdel user group name

Example
To delete the user group staff1, run the following command: # groupdel staff1

2.4.3 groupmod
This describes the function, format, parameter, and example of the groupmod command. The command is only used on the Solaris operating system.

Function
The groupmod command is used to modify the information about a user group.

Command Format
groupmod user group name
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-29

2 Operating System Commands

Command Reference

Parameter Description
-n name: the name of the modified user group

Example
To modify the name of the user group staff1 to staff2, run the following command: # groupmod -n staff2 staff1

2.4.4 passwd
This describes the function, format, and example of the passwd command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The passwd command is used to set a password for an added user or to change the user password.

Command Format
passwd user name

Example
Assume that the user omc1 is added. To set the password of omc1, run the following command: # passwd omc1
New Password: Re-enter new Password: passwd: password successfully changed for omc1
NOTE

The input password is not displayed.

2.4.5 useradd
This describes the command function, command format, command option, and example of the useradd command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The useradd command is performed to add a user in the Unix/Linux system.

Command Format
useradd option new user name

Option Description
You can combine options of the useradd command. Add the prefix - before these options. Table 2-13 lists the common options.
2-30 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

Table 2-13 Option description of the useradd command Option -c comment -d directory -m -g group -s shell -u uid -k directory Remark Indicate the comment. Indicate the home folder. Indicate the automatic creation of a home folder if the home folder does not exist. Indicate the user group that the user belongs to. Indicate the shell that the user uses. indicates the user ID. A user account has a unique ID. indicates that a template file in a specified directory is copied to the main directory. Common template files include .profile and .cshrc. Template files enable each user to operate in the same environment. If you plan to run the useradd command to copy a template file to the main directory, you must check whether the main directory exists. If the main directory does not exist, run the useradd -m command to create one. If the main directory exists, the user group to which the created user belongs must have the read, write, and execute rights over the main directory.

Example
Create a user named omc1 in the Unix/Linux system. The user omc1 belongs to the staff user group and the home folder is /home1/omc that is created automatically. In addition, the comment is Test User and B shell is applied. To create a user named omc1 in the Unix/Linux system, run the following commands: # useradd -c "Test User" -d /home1/omc -m -g staff -s /bin/bash omc1

CAUTION
After a user is added, set the password for the added user. For details of setting the password, refer to 2.4.4 passwd. After the password is set, the user can log in as a new user.

2.4.6 userdel
This describes the function, format, and example of the userdel command. The usage of the command is the same on the Solaris operating system and the Linux operating system.
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-31

2 Operating System Commands

Command Reference

Function
The userdel command is used to delete a user. Some operating system systems do not allow deleting users completely. Run the userdel command to revoke the privileges granted to the user.

Command Format
userdel user name

Example
Assume that there is user omc1 in the system. To delete user omc1, run the following command: # userdel omc1 If the following message is displayed, you can infer that no timing task created by the user is being performed.
no crontab for omc1

CAUTION
When a user has logged in, do not run the userdel command to delete the user. If you run the userdel command, the following error message is displayed: UX: userdel: ERROR: omc1 is in use. Cannot remove it.

2.4.7 usermod
This describes the function, format, parameter, and example of the usermod command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The usermod command is used to modify the user login information.

Command Format
usermod option user name

Option Description
The combined option of the usermod command can be used. Add the prefix - before the options. Table 2-14 lists the common options. Table 2-14 Option description of the usermod command Option -c comment
2-32

Description Modified comment


Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

Option -d directory -m -g group -s shell -l new_logname

Description Modified home folder Create a home folder automatically if the home folder does not exist Modified user group Used shell Modified user name

Example
To modify the login information about omc1, you need modify the user name to test, user group to new_group, home folder to /home1, and comment to Tester. Run the following command: # usermod -c "Test User" -d /home1 -g new_group -l test omc1

CAUTION
Do not run the usermod command to modify a user when the user has logged in. If you use the usermod command, the following error message is displayed: UX: usermod: ERROR: omc1 is in use. Cannot change it.

2.5 Find and Help


This describes the functions of the find and help commands and provides some application examples. 2.5.1 find This describes the function, format, parameter, and example of the find command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.5.2 man This describes the function, format, and example of the man command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.5.3 whereis This describes the function, format, option, parameter, and example of the whereis command. The whereis command is used to view the location of a source file, binary file, and online help of a command. The command is only used on the Solaris operating system. 2.5.4 which This describes the function, format, and example of which command. The command is only used on the Solaris operating system.

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

2-33

2 Operating System Commands

Command Reference

2.5.1 find
This describes the function, format, parameter, and example of the find command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The find command is used to search for a file that meets the preset conditions in the specified folders and subfolders. By using this command, you can find the file even if you forget the correct path of the file.

Command Format
find folder condition

Parameter Description
l

Folder: indicates the folder to be searched. You can enter multiple folder names. Separate the folder names by using spaces. Condition: indicates the conditions for file search, such as the file name, owner, and time of the last modification.

Table 2-15 describes the conditions for file search. Table 2-15 Conditions for file search Condition -name name -print -size n -type x Description The name of the file or folder to be searched. Wildcards, such as -name '*.c', can be used. Prints the path that meets the conditions. Searches for the files that use n blocks. Searches for files by file type. The file type x includes:
l l l l l

d: directory f: file b: block c: character p: pipe

-user user -group group -links n -atime n -mtime n


2-34

Searches all files of user. The value of user can be a user name or UID. Searches all files of the user group. The value of group can be a user group name or GID. Searches all files with the number of links as n. Searches the files accessed before n days. Searches the files modified before n days.
Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

Condition -exec command {}\;

Description Uses the found file as the object of the command to be run. Put the parameters to be used in the command execution between { and }.

Table 2-16 describes the logical operators of conditions. Table 2-16 Logical operators of conditions Logical Operator ! -o Mean ing non or and Example ! -name "*.c" -size +10 -o -links 3 -size +10 -links 3 Description All the files except those with the extension name as .c All the files with more than 10 blocks or with 3 links All the files with more than 10 blocks and with 3 links

In the preceding table, +10 stands for more than 10 blocks and -10 for fewer than 10 blocks.

Example
To search for files in the /tmp folder with the file name starting with c, and then print the paths, run the following command: # find /tmp -name "c*" -print
/tmp/ctisql_0WBJgt /tmp/ctisql_0dznJ_ /tmp/ctisql_0CpW34 /tmp/ctisql_0FO4vs

To search the file test in the current folder and then print the paths, run the following command: # find . -name test -print
./Report/reloc/resin1.2.0/conf/test ./Report/reloc/resin1.2.0/doc/examples/login/WEB-INF/classes/test ./Report/reloc/resin1.2.0/doc/examples/tags/WEB-INF/classes/test

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

2-35

2 Operating System Commands


NOTE

Command Reference

The search may take several minutes. To save time, you can run this command in the background. That is, the output for the command is exported to a file for later query. End the command line with & so that the operating system runs the command in the background. For example, # find / -name "abc*" -print > abc.file & After the search is complete, run the following command to view the result of the search: # cat abc.file Different users may have different privileges for the same file. Therefore, ordinary users may find only some files of the system. To list all the files that meet the set conditions, log in as a super user and search from the root directory.

2.5.2 man
This describes the function, format, and example of the man command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The man command is used to view the online help about a command.

Command Format
man option command

Example
To view the online help about the pwd command, run the following command: # man pwd
Reformatting page. User Commands NAME pwd - return working directory name SYNOPSIS /usr/bin/pwd DESCRIPTION pwd writes an absolute path name directory to standard output. of the Korn current shell, working ksh(1), Wait... done pwd(1)

Both the Bourne shell, sh(1), and the also have a built-in pwd command.

ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the execution of pwd: LC_MESSAGES and NLSPATH. EXIT STATUS --More--(30%)
NOTE

Not all parameters in the man command are command names. For example, the man ascii command displays all the ASCII characters and their expressions.

2-36

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

2.5.3 whereis
This describes the function, format, option, parameter, and example of the whereis command. The whereis command is used to view the location of a source file, binary file, and online help of a command. The command is only used on the Solaris operating system.

Function
The whereis command is used to view the location of a source file, binary file, and online help of a command.

Command Format
whereis option command

Option Description
l l l

-b : to view the location of the binary file -m: to view the location of the help manual -s: to view the location of the source file

Parameter Description
command: the command for which the location is to be displayed

Example
l

To view the exact location of files of various versions for the ls command, run the following command: # whereis ls
ls: /usr/bin/ls /usr/ucb/ls /usr/man/man1/ls.1 /usr/man/man1b/ls.1b

To view the exact location of the binary file for the ls command, run the following command: # whereis -b ls
ls: /usr/bin/ls /usr/ucb/ls

To view the exact location of the help manual for the ls command, run the following command: # whereis -m ls
ls: /usr/man/man1/ls.1 /usr/man/man1b/ls.1b

2.5.4 which
This describes the function, format, and example of which command. The command is only used on the Solaris operating system.

Function
The which command is used to view the location where a command is run. The result may be an absolute path or alias of the command found in the user environment variant PATH.
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-37

2 Operating System Commands

Command Reference

Command Format
which command

Example
To view the position where the commands pwd, who, and which are run, run the following command: # which pwd who which
/usr/bin/pwd /usr/bin/who /usr/bin/which
NOTE

If the command to be located does not exist in the file, the following error messages are displayed after you run the which command: # which qqqq
no qqqq in /usr/bin /usr/ucb /etc

2.6 System Information


This describes the system information commands and provides some application examples. 2.6.1 date This describes the function, format, parameter options, and application examples of the data command. The data command is used to view the current date and time of the system. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.6.2 df This describes the function, format, option, and example of the df command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.6.3 du This describes the function, format, option, and example of the du command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.6.4 hostname This describes the function, format, and example of the hostname command. The command is only used on the Solaris operating system. 2.6.5 prtconf This describes the function, format, parameter options, and instances of the prtconf command. The command is only used on the Solaris operating system. 2.6.6 uname This describes the function, format, parameter options, and application examples of the uname command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.6.7 who This describes the functions, command format, option description, parameter description, and example of the who command. The usage of the command is the same on the Solaris operating system and the Linux operating system.
2-38 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

2.6.1 date
This describes the function, format, parameter options, and application examples of the data command. The data command is used to view the current date and time of the system. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The data command is used to view the current date and time of the system. The super user can run the date command to set the system date and time.

Format
date option +format

Option Description
l l

-u: to use the Greenwich mean time. +format: to specify the command output format.

Table 2-17 describes the format of the command output. Table 2-17 Format of the command output Format %h %j %n %t %y %D %H %M %S %T Description Abbreviation of the month: from January to December A day in a year: from 001 to 366 Switch to next line The tab key The last two digits of the year: from 00 to 99 Output format of the date: month/date/year Hour: from 00 to 23 Minute: from 00 to 59 Second: from 00 to 59 Output format of time: hour:minute:second

Example
l

To view the current date and time of the system, run the following command: date
Mon Feb 4 20:26:16 GMT 2002

To view the current system date and time in the Greenwich Mean Time, run the following command: date -u

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

2-39

2 Operating System Commands


Mon Feb l 4 12:27:26 GMT 2002

Command Reference

To view the current date of the system in the format of month/day/year, run the following command: date +%D
02/04/02

2.6.2 df
This describes the function, format, option, and example of the df command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The df command is used to view the free disk space. The system administrator runs this command frequently to check the usage of the disk space to avoid disk failure due to data overflow.

Command Format
df option file system

Option Description
l l

-l : the local file system -k: to view the free disk space (unit: KB)

Example
To check the free disk space, run the following command: # df -k
Filesystem /dev/dsk/c0t0d0s0 /proc fd /dev/dsk/c0t1d0s7 swap kbytes used avail capacity 2053605 997684 994313 51% 0 0 0 0% 0 0 0 0% 35009161 2562019 32097051 8% 3431792 6664 3425128 1% Mounted on / /proc /dev/fd /export/home /tmp

The command result contains the following information:


l l l l l

File system name File size (unit: KB) Used space Free space Capacity percentage of the filled file system and the mounting point

When you run the df command without any parameters, the free disk space in each mounted device is displayed. When the free disk space is reduced to the bottom line, the system administrator must take immediate measures to locate the faulty file system.
2-40 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

2.6.3 du
This describes the function, format, option, and example of the du command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The du command is used to view the disk space used by a specific folder or file.

Command Format
du option folder or file

Option Description
l l l

-a : to view the disk space used by each file -s: to view the used total disk space -k: to view the result (unit: KB)

Example
l

To view the disk space used by the files in the /etc folder, run the following command: # du -k /etc |more
4 4 84 157 721 52 16 8 44 44 285 81 28 16 84 8 32 4 12 4 4 850 40 8 93 181 16 12 108 2345 4 4 16 4 4 12 /etc/X11/fs /etc/X11/twm /etc/X11/xdm/pixmaps /etc/X11/xdm /etc/X11/xkb/rules /etc/X11/xkb/types /etc/X11/xkb/semantics /etc/X11/xkb/geometry/ibm_vndr /etc/X11/xkb/geometry/digital_vndr /etc/X11/xkb/geometry/sgi_vndr /etc/X11/xkb/geometry /etc/X11/xkb/compat /etc/X11/xkb/symbols/sun_vndr /etc/X11/xkb/symbols/fujitsu_vndr /etc/X11/xkb/symbols/macintosh_vndr /etc/X11/xkb/symbols/nec_vndr /etc/X11/xkb/symbols/digital_vndr /etc/X11/xkb/symbols/sony_vndr /etc/X11/xkb/symbols/xfree68_vndr /etc/X11/xkb/symbols/hp_vndr /etc/X11/xkb/symbols/sgi_vndr /etc/X11/xkb/symbols /etc/X11/xkb/keymap/sun_vndr /etc/X11/xkb/keymap/digital_vndr /etc/X11/xkb/keymap/sgi_vndr /etc/X11/xkb/keymap /etc/X11/xkb/keycodes/digital_vndr /etc/X11/xkb/keycodes/sgi_vndr /etc/X11/xkb/keycodes /etc/X11/xkb /etc/X11/xsm /etc/X11/lbxproxy /etc/X11/fvwm2 /etc/X11/xserver/C/print/ddx-config/raster /etc/X11/xserver/C/print/ddx-config /etc/X11/xserver/C/print/attributes

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

2-41

2 Operating System Commands


245 /etc/X11/xserver/C/print/models/PSdefault/fonts --More l

Command Reference

To view the disk space used by all file systems in the current folder and send the results to the sort command for sorting, run the following command: # du -s * |sort -rn |more
28672 opt 3757 X11 2522 cups 1282 bootsplash 822 xscreensaver 808 sysconfig 661 services 661 init.d 473 postfix 428 apparmor 416 mono 389 joe 193 profile.d 165 ssl 165 apparmor.d 164 ssh 145 pam.d 145 lvm 112 fonts 109 xinetd.d --More

To list the first ten file systems according to the file size, run the following command: # du -s * |sort -rn |head -10
28672 3757 2522 1282 822 808 661 661 473 428 opt X11 cups bootsplash xscreensaver sysconfig services init.d postfix apparmor

2.6.4 hostname
This describes the function, format, and example of the hostname command. The command is only used on the Solaris operating system.

Function
The hostname command is used to view or set the host name.

Command Format
hostname host name

Example
To view the host name, run the following command: # hostname
2-42 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference
NOTE

2 Operating System Commands

If you run the hostname command without parameters, the host name of the equipment is displayed. If you run the hostname command with parameters, the host name is set. Only the super user can run the hostname command.

2.6.5 prtconf
This describes the function, format, parameter options, and instances of the prtconf command. The command is only used on the Solaris operating system.

Function
The prtconf command is used to check the system configuration information.

Format
prtconf option device path

Instance
l

Check all the configuration information about the system. # prtconf


System Configuration: Sun Microsystems Memory size: 4096 Megabytes System Peripherals (Software Nodes): sun4u

SUNW,Netra-240 scsi_vhci, instance #0 packages (driver not attached) SUNW,builtin-drivers (driver not attached) deblocker (driver not attached) disk-label (driver not attached) terminal-emulator (driver not attached) dropins (driver not attached) kbd-translator (driver not attached) obp-tftp (driver not attached) SUNW,i2c-ram-device (driver not attached) SUNW,fru-device (driver not attached) SUNW,asr (driver not attached) ufs-file-system (driver not attached) chosen (driver not attached) openprom (driver not attached) client-services (driver not attached) options, instance #0 aliases (driver not attached) memory (driver not attached) virtual-memory (driver not attached) SUNW,UltraSPARC-IIIi, instance #0 (driver not attached) memory-controller, instance #0 SUNW,UltraSPARC-IIIi, instance #1 (driver not attached) memory-controller, instance #1 pci, instance #0 network, instance #0 network, instance #1 pci, instance #1 isa, instance #0 flashprom (driver not attached) rtc (driver not attached) i2c, instance #0 i2c-bridge (driver not attached) i2c-bridge (driver not attached) motherboard-fru-prom, instance #0 (driver n

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

2-43

2 Operating System Commands


chassis-fru-prom, instance #1 (driver not a alarm-fru-prom, instance #2 (driver not att power-supply-fru-prom, instance #3 (driver power-supply-fru-prom, instance #4 (driver dimm-spd, instance #5 (driver not attached) dimm-spd, instance #6 (driver not attached) dimm-spd, instance #7 (driver not attached) dimm-spd, instance #8 (driver not attached) rscrtc (driver not attached) nvram, instance #9 (driver not attached) idprom (driver not attached) gpio, instance #0 (driver not attached) gpio, instance #1 (driver not attached) gpio, instance #2 (driver not attached) gpio, instance #3 (driver not attached) gpio, instance #4 (driver not attached) gpio, instance #5 (driver not attached) power, instance #0 serial, instance #0 serial, instance #1 (driver not attached) rmc-comm, instance #0 pmu, instance #0 i2c, instance #0 gpio, instance #0 usb, instance #0 ide, instance #0 disk (driver not attached) cdrom (driver not attached) sd, instance #3 pci, instance #2 scsi, instance #0 disk (driver not attached) tape (driver not attached) sd, instance #0 sd, instance #1 (driver not attached) sd, instance #2 (driver not attached) sd, instance #4 (driver not attached) sd, instance #5 (driver not attached) sd, instance #6 (driver not attached) sd, instance #7 (driver not attached) sd, instance #8 (driver not attached) sd, instance #9 (driver not attached) sd, instance #10 (driver not attached) sd, instance #11 (driver not attached) sd, instance #12 (driver not attached) sd, instance #13 (driver not attached) sd, instance #14 (driver not attached) sd, instance #15 (driver not attached) st, instance #1 (driver not attached) st, instance #2 (driver not attached) st, instance #3 (driver not attached) st, instance #4 (driver not attached) st, instance #5 (driver not attached) st, instance #6 (driver not attached) ses, instance #1 (driver not attached) ses, instance #2 (driver not attached) ses, instance #3 (driver not attached) ses, instance #4 (driver not attached) ses, instance #5 (driver not attached) ses, instance #6 (driver not attached) ses, instance #7 (driver not attached) ses, instance #8 (driver not attached) ses, instance #9 (driver not attached) ses, instance #10 (driver not attached) ses, instance #11 (driver not attached) ses, instance #12 (driver not attached) ses, instance #13 (driver not attached) ses, instance #14 (driver not attached) ses, instance #15 (driver not attached)

Command Reference

2-44

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference
scsi, instance #1 disk (driver not attached) tape (driver not attached) sd, instance #16 (driver not attached) sd, instance #17 (driver not attached) sd, instance #18 (driver not attached) sd, instance #19 (driver not attached) sd, instance #20 (driver not attached) sd, instance #21 (driver not attached) sd, instance #22 (driver not attached) sd, instance #23 (driver not attached) sd, instance #24 (driver not attached) sd, instance #25 (driver not attached) sd, instance #26 (driver not attached) sd, instance #27 (driver not attached) sd, instance #28 (driver not attached) sd, instance #29 (driver not attached) sd, instance #30 (driver not attached) st, instance #8 (driver not attached) st, instance #9 (driver not attached) st, instance #10 (driver not attached) st, instance #11 (driver not attached) st, instance #12 (driver not attached) st, instance #13 (driver not attached) ses, instance #16 (driver not attached) ses, instance #17 (driver not attached) ses, instance #18 (driver not attached) ses, instance #19 (driver not attached) ses, instance #20 (driver not attached) ses, instance #21 (driver not attached) ses, instance #22 (driver not attached) ses, instance #23 (driver not attached) ses, instance #24 (driver not attached) ses, instance #25 (driver not attached) ses, instance #26 (driver not attached) ses, instance #27 (driver not attached) ses, instance #28 (driver not attached) ses, instance #29 (driver not attached) ses, instance #30 (driver not attached) ses, instance #31 (driver not attached) pci, instance #3 network, instance #2 network, instance #3 iscsi, instance #0 pseudo, instance #0

2 Operating System Commands

2.6.6 uname
This describes the function, format, parameter options, and application examples of the uname command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The uname command is used to view the information about the operating system. If you run this command without parameters, only the name of the operating system is displayed. If you run this command with parameters, more details about the operating system are displayed.

Format
uname option

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

2-45

2 Operating System Commands

Command Reference

Option Description
The options of the uname command can be combined. Add the prefix - before the options. Table 2-18 lists some frequently used options. Table 2-18 Description of the uname options Option -a -i -m Description Views all the information. Views hardware information. Views the name of the equipment hardware. It is recommended that -p be used instead of -m. Views the name of the network equipment. Views the ISA of the host or the type of the processor. Views the serial number of the operating system of the host. Views the name of the operating system of the host (it is the default option). Views the version of the operating system of the host. Sets the host name of the machine.

-n -p -r -s -v -S system_name

Example
To view the name, version, and serial number of the operating system on the host, run the following command: # uname -svr

2.6.7 who
This describes the functions, command format, option description, parameter description, and example of the who command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The who command reports the login information about all the users in the current system.

Command Format
who Option
2-46 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

Option Description
l l

-b : display the system date and time of the last startup -m: display the related information about the users who run the command (the same as the command who with two parameters am i

Parameter Description
am i: display the login information about the users who run the command

Example
l

Display the login information about all the users in the current system: # who
root root root pts/3 pts/5 pts/6 Feb 4 10:08 Feb 4 08:45 Feb 4 11:25 (10.129.16.60) (10.129.28.44) (10.129.16.60)

Display the login information about the users who run the command: # who am i
root pts/5 Feb 4 08:45 (10.129.28.44)

or: # who -m
root pts/5 Feb 4 08:45 (10.129.28.44)

2.7 Process-Related
This describes the process-related commands and provides some application examples. 2.7.1 kill This describes the function, format, option, and example of the kill command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.7.2 prstat This describes how to use the CPU to check the function and user identity of the prstat command. It also provides an example to explain the application. The command is only used on the Solaris operating system. 2.7.3 ps This describes the function, format, option, and example of the ps command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.7.4 top This describes the function and application example of the top command. It also describes the users authorized to run the top command. You can run the top command to view the CPU usage. The command is only used on the Linux operating system.

2.7.1 kill
This describes the function, format, option, and example of the kill command. The usage of the command is the same on the Solaris operating system and the Linux operating system.
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-47

2 Operating System Commands

Command Reference

Function
The kill command is used to terminate a process.

Command Format
kill option process No.

Option Description
l l

-l : lists the names of all the signals -s signal: sends a signal named signal to the processes

Parameter Description
Process No.: the ID of the process to be terminated, that is, the process ID

Example
l

To list all the signal names on the Solaris operating system, run the following command: # kill -l
EXIT HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM USR1 USR2 CLD PWR WINCH URG POLL STOP TSTP CONT TTIN TTOU VTALRM PROF XCPU XFSZ WAITING LWP FREEZE THAW CANCEL LOST RTMIN RTMIN+1 RTMIN+2 RTMIN+3 RTMAX-3 RTMAX-2 RTMAX-1 RTMAX

To list all the signal names on the Linux operating system, run the following command: # kill -l
1) 5) 9) 13) 17) 21) 25) 29) 35) 39) 43) 47) 51) 55) 59) 63) SIGHUP SIGTRAP SIGKILL SIGPIPE SIGCHLD SIGTTIN SIGXFSZ SIGIO SIGRTMIN+1 SIGRTMIN+5 SIGRTMIN+9 SIGRTMIN+13 SIGRTMAX-13 SIGRTMAX-9 SIGRTMAX-5 SIGRTMAX-1 2) 6) 10) 14) 18) 22) 26) 30) 36) 40) 44) 48) 52) 56) 60) 64) SIGINT SIGABRT SIGUSR1 SIGALRM SIGCONT SIGTTOU SIGVTALRM SIGPWR SIGRTMIN+2 SIGRTMIN+6 SIGRTMIN+10 SIGRTMIN+14 SIGRTMAX-12 SIGRTMAX-8 SIGRTMAX-4 SIGRTMAX 3) 7) 11) 15) 19) 23) 27) 31) 37) 41) 45) 49) 53) 57) 61) SIGQUIT SIGBUS SIGSEGV SIGTERM SIGSTOP SIGURG SIGPROF SIGSYS SIGRTMIN+3 SIGRTMIN+7 SIGRTMIN+11 SIGRTMIN+15 SIGRTMAX-11 SIGRTMAX-7 SIGRTMAX-3 4) 8) 12) 16) 20) 24) 28) 34) 38) 42) 46) 50) 54) 58) 62) SIGILL SIGFPE SIGUSR2 SIGSTKFLT SIGTSTP SIGXCPU SIGWINCH SIGRTMIN SIGRTMIN+4 SIGRTMIN+8 SIGRTMIN+12 SIGRTMAX-14 SIGRTMAX-10 SIGRTMAX-6 SIGRTMAX-2

To terminate the process with PID as 256, run the following command: # kill -s KILL 256

2-48

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference
NOTE

2 Operating System Commands

The previous signal names can be expressed by code. For example, -1 for HUP, -2 for INT, -3 for QUIT, -9 for KILL, -15 for TERM. The signal KILL can be replaced with -9. This signal is the most frequently used one in the kill command, and thus it has the highest priority. The default signal 15 is used when no option is specified for the kill command. Run the following command to terminate the process with the PID as 256: # kill -9 256

l l

Run the ps command to check the execution of the kill command by listing the PIDs of the terminated processes. The kill command may lead to a data loss. Run this command with care.

2.7.2 prstat
This describes how to use the CPU to check the function and user identity of the prstat command. It also provides an example to explain the application. The command is only used on the Solaris operating system.

Function
The CPU usage may be high when a large number of NE alarms are reported in a short period. This command is used to find out the cause of these alarms.

Permitted Users
Users root, omcuser, and dbuser are authorized to run the prstat command.

Example
-bash-3.00$ prstat The command result contains the CPU usage of each process.

2.7.3 ps
This describes the function, format, option, and example of the ps command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The ps command is used to view the status of the processes currently running in the system..

Command Format
ps option

Option Description
l l l

-e : to view the status of all the processes that are running in the system -l: to view the running processes in a long-form list -u user: to view the process status of a specific user
Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-49

Issue 02 (2009-10-31)

2 Operating System Commands


l

Command Reference

-f : to view all the status information about the processes that are running in the system

Example
l

To view the status of all the running processes controlled by the login device (the terminal), run the following command: # ps
PID TTY 13726 pts/5 TIME CMD 0:00 ksh

To view the complete information about the active processes, run the following command: # ps -f
UID root PID 1489 PPID 1426 C STIME TTY 0 Jun24 pts/4 TIME CMD 00:00:00 -bash

To view the process related to the "xinetd", run the following command: # ps -ef | grep xinetd
root root
NOTE

26930 1 4346 29413

0 Oct15 ? 0 10:01 pts/1

00:00:00 /usr/sbin/xinetd 00:00:00 grep xinetd

l l

After you run the ps command without any parameters, the screen displays information about all running processes that are controlled by the login device (terminal). After you specify the -f parameter, more information is displayed. The information includes the user name (UID), process ID (PID), parent process ID (PPID), technical number that indicates the running time of the process (C), process start time (STIME), name of the terminal that activates the process (TTY), and the process name (CMD). If TTY displays ?, infer that this process is not associated with the terminal. To view all the processes related to specific characters, for example, the process related to the "xinetd", run the grep command with the ps command.

2.7.4 top
This describes the function and application example of the top command. It also describes the users authorized to run the top command. You can run the top command to view the CPU usage. The command is only used on the Linux operating system.

Function
The CPU usage may be high when a large number of NE alarms or performance data are reported in a short period. This command is used to find out the cause of these alarms.

Authorized Users
User root and user omcuser are authorized to run the top command.

Application Example
# top The system output contains the CPU usage of each process.

2-50

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

2.8 Network Communications


This describes the commands used for network communications and provides some application examples. 2.8.1 finger This describes the function, format, parameters, and example of the finger command. The command is only used on the Solaris operating system. 2.8.2 ftp This describes the function, format, parameter options, and application example of the ftp command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.8.3 ifconfig This describes the function, format, option, and example of the ifconfig command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.8.4 netstat This describes the function, format, options, and example of the netstat command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.8.5 ping This describes the function, format, parameter options, and application examples of the ping command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.8.6 route This describes the function, format, parameter options, and application example of the route command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.8.7 telnet This describes the functions, format, parameters, and example of the telnet command. The telnet command is used to log in to remote hosts through network connection. The usage of the command is the same on the Solaris operating system and the Linux operating system.

2.8.1 finger
This describes the function, format, parameters, and example of the finger command. The command is only used on the Solaris operating system.

Function
The finger command is used to view the information about online users of the UNIX system.

Command Format
finger user name@host domain|IP address

Parameter Description
l

user nam: the user that has currently logged in to the local system.
Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-51

Issue 02 (2009-10-31)

2 Operating System Commands


l l

Command Reference

host domain: the UNIX host domain. IP address: the IP address of the UNIX host.

Example
Table 2-19 lists some common examples of the finger command. Table 2-19 Examples of the finger command Example # finger # finger root # finger @omcsyb2 # finger @omcsyb2.Huawei.com.cn # finger abc@omcsyb2 # finger abc@129.6.114.202 Description View the information about all local users. View the information about user root. View the information about all users in the host omcsyb2. View the information about all users in the host omcsyb2.Huawei.com.cn. View the information about user abc in the host omcsyb2. View the information about user abc in the host 129.6.114.202.

2.8.2 ftp
This describes the function, format, parameter options, and application example of the ftp command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The ftp command is used to transfer files between the local computer and the remote host. You can transfer one or multiple files at a time between the remote operating system and the local computer.

Format
ftp IP address or domain

Parameter Description
l l

IP address: the IP address of the remote host Domain name: the domain name of the remote host

Example
Run the ftp command on the local computer. Assume that the IP address of the remote host is 129.9.169.143.
2-52 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

Choose Start > Run on the local computer. In the displayed dialog box, enter ftp 129.9.169.143 and click OK. When the ftp window is displayed, enter the operating system user name and password. User (129.9.169.143: (none) : ) ftpuser Password:password of ftpuser
230 Login successful. ftp>
NOTE

Enter the password after Password: . The password is not displayed.

Enter the ftp command behind the prompt ftp>. Table 2-20 describes the ftp commands that are commonly used. Table 2-20 Common ftp commands ftp Command !command ?|help command ascii binary cd folder close dir r-folder l-file Description Use a local command and return to ftp immediately. View the command help. Transfer files in ASCII format (default). Transfer files in binary format. Modify the remote folder. Break the remote connection. View the remote folder. r-folder refers to the remote folder. l-file refers to the local file. If there is a local file, save the result to the local file. Copy the remote file1 to the local file2. Modify the local folder. Same as dir, but the display format is different. Copy several remote files to the local computer. Reestablish a connection. Copy the remote file1 to the local file2. List the folders of the current remote host. Exit from the ftp. View the current ftp status.

get file1 file2 cd folder ls r-folder l-file mget several files open IP address or domain put file1 file2 pwd quit|bye status

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

2-53

2 Operating System Commands


l

Command Reference

Copy all the files in the path C:\mydoc on the local computer to the /usr/local/tmp folder on the remote host. ftp> binary ftp> lcd c:\mydoc ftp> cd /usr/local/tmp ftp> mput *.*

Copy the .login file in the /usr/home/rms folder on the remote host to the path C: \mydoc folder on the local computer. ftp> ascii ftp> lcd c:\temp\from ftp> cd /usr/home/rms ftp> get .login

Copy all files in the /usr/home/rms folder on the remote computer to the path C:\temp \from on the local computer in binary format. ftp> binary ftp> lcd c:\temp\from ftp> cd /usr/home/rms ftp> mget *

To exit ftp. ftp> quit

CAUTION
The Telnet and FTP protocols belong to the TCP/IP family. They are the protocols at the application layer. They work in client/server mode. The telnet/ftp program running on the local computer is a telnet/ftp client program. The telnet/ftp program connects to the server program in the remote host through the TCP/IP protocol. Any system installed with the telnet/ftp serverside software can serve as a remote host. In addition to the default network protocol TCP/IP, the Unix/Linux system supports the Telnet/FTP protocols. Because a Unix/Linux host is installed with both the telnet/ftp server software and the client software, the Unix/Linux host can serve as either a telnet/ftp server or a telnet/ftp client. Please do not put or get the files on PC's desktop. Special characters in file name, including spaces, may fail the upload or download operations. Please quote the file names with while transferring files with ftp.

2.8.3 ifconfig
This describes the function, format, option, and example of the ifconfig command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The ifconfig command is used to view the IP address of the host.
2-54 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

Command Format
ifconfig option

Option Description
-a: to view all the address information

Example
To view the IP address of the host on the Solaris operating system, run the following command: # ifconfig -a
lo0: flags=849<UP,LOOPBACK,RUNNING,MULTICAST> mtu 8232inet 127.0.0.1 netmask ff000000 hme0: flags=863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST>mtu 1500 inet 129.9.169.143 netmask ffff0000 broadcast 129.9.255.255 hme0:1:flags=863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST> mtu 1500 inet 129.6.253.136 netmask ffff0000 broadcast 129.6.255.255

To view the IP address of the host on the Linux operating system, run the following command: # ifconfig -a
bond0 Link encap:Ethernet HWaddr 00:1A:4B:07:C1:18 inet addr:10.121.77.235 Bcast:10.121.77.255 Mask:255.255.254.0 inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:3065894 errors:0 dropped:0 overruns:0 frame:0 TX packets:33607 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:261315320 (249.2 Mb) TX bytes:3767548 (3.5 Mb) Link encap:Ethernet HWaddr 00:1A:4B:07:C1:18 inet6 addr: fe80::21a:4bff:fe07:c118/64 Scope:Link UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:1533670 errors:0 dropped:0 overruns:0 frame:0 TX packets:16806 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:130737659 (124.6 Mb) TX bytes:1906432 (1.8 Mb) Base address:0x1000 Memory:f0080100000-f0080120000 Link encap:Ethernet HWaddr 00:1A:4B:07:C1:19 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Base address:0x1040 Memory:f0080120000-f0080140000 Link encap:Ethernet HWaddr 00:1A:4B:07:C1:18 inet6 addr: fe80::21a:4bff:fe07:c118/64 Scope:Link UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:1532224 errors:0 dropped:0 overruns:0 frame:0 TX packets:16801 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:130577661 (124.5 Mb) TX bytes:1861116 (1.7 Mb) Base address:0x1200 Memory:f0180480000-f01804a0000 Link encap:Ethernet HWaddr 00:1E:0B:83:71:A1 inet addr:192.168.9.140 Bcast:192.168.9.255 Mask:255.255.255.0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

eth0

eth1

eth2

eth3

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

2-55

2 Operating System Commands


Base address:0x1240 Memory:f01804a0000-f01804c0000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:4337 errors:0 dropped:0 overruns:0 frame:0 TX packets:4337 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:404946 (395.4 Kb) TX bytes:404946 (395.4 Kb) Link encap:IPv6-in-IPv4 NOARP MTU:1480 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

Command Reference

sit0

NOTE

In the Unix/Linux system, a network adapter can bind several logical IP addresses, which realizes communications between different network segments.

2.8.4 netstat
This describes the function, format, options, and example of the netstat command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The netstat command is used to display the current network status. The netstat command is powerful but complex in format. This describes common applications of the netstat command.

Command Format
netstat options

Option Description
l

For viewing all the sockets and routing tables (netstat -anv)

-a: views all socket information. -n: views the information by number. If you do not specify this parameter, the information is displayed by logical name. -v: views the information about sockets and routing tables of the additional information.

For viewing the IP address of the network adapter (netstat -i -I interface interval interval)

-i: views the information about the network interface. -I interface: specifies an interface, for example, hme0:1 interval: indicates a time interval. -r: views the information about the routing table. -anv: refers to For viewing all the sockets and routing tables. -M: views broadcast routing tables.
Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

For viewing the routing table status (netstat -r -anv)


For viewing the broadcast information (netstat -M -ns)

2-56

Command Reference
l

2 Operating System Commands

-s: summarizes the status of each protocol.

For viewing the DHCP status (netstat -D -I interface) -D: views the DHCP information.

Example
Use the command netstat -rn to view the information about the routing tables: root@ts-007 # netstat -rn
Routing Table: Destination 10.105.28.0 10.0.0.0 224.0.0.0 127.0.0.1 Gateway 10.105.28.202 10.105.31.254 10.105.28.202 127.0.0.1 Flags U UG U UH Ref 4 0 4 0 0 0 896 hme0 lo0 Use 2 Interface hme0

A router can be in any of the following five different flags: U, G, H, D, and M, as described in Table 2-21. Table 2-21 Description of routing flags Flag U G Description U indicates that a route is currently available. G indicates that a route is destined for a gateway such as a router. If this flag is not set, you can infer that the destination is connected directly. Flag G distinguishes between direct and indirect routes. Flag G is unnecessary for direct routes. The difference is that the packet sent through a direct route carries both the destination IP address and the link-layer address. In the packet sent through an indirect route, however, the IP address points to the destination and the link layer address points to the gateway (for example, the next router). H H indicates a route destined for a host. That is, the destination address is a complete host address. If this flag is not set, you can infer that the route leads to a network and that the destination address is a network address: either a network number or a network. The part in the address for the host is 0. When you search the routing table for an IP address, the host address must exactly match the destination address. The network address, however, is required to match only the network number and subnet number of the destination address. D M D indicates that a route is created by a redirected packet. M indicates that a route is modified by a redirected packet.

The Ref (Reference count) column lists the number of routing progresses. The protocol for connection, such as TCP, requires a fixed route when a connection is established. If the telnet connection is established between the host svr4 and the host slip, the Ref is 1. If another telnet connection is established, its value is changed to 2. The next column (Use) displays the number of packets sent through a specified route. After you run the ping command as the unique user of this route, the program sends five groups and the
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-57

2 Operating System Commands

Command Reference

number of packets is displayed as 5. The last column (Interface) indicates the name of the local interface. The second row of the output is a loop-back interface. The interface name is permanent set to lo0. Flag G is not set because the route is not destined for a gateway. Flag H indicates that the destination address, 127.0.0.1, is a host address and not a network address. Because flag G is not set, the route here is a direct route and the gateway column shows the outgoing IP address. Each host has one or multiple default routes. That is, if a particular route is not found in the table, the packet is sent to the router. In addition, the current host can access other systems through the Sun router (and the slip link) on the internet, based on the settings of the routing table. The flag UG refers to the gateway.

2.8.5 ping
This describes the function, format, parameter options, and application examples of the ping command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The ping command is used to check the physical connection of the network when the communication between a user computer and the hosts in the network is interrupted.

Format
ping IP address of a host

Example
Check the physical connection between the current host and the host whose IP address is 129.9.0.1 on the Solaris operating system. # ping 129.9.0.1
129.9.0.1 is alive

Check the physical connection between the current host and the host whose IP address is 10.71.15.1 on the Linux operating system. # ping 10.71.15.1
PING 10.71.15.1 (10.71.15.1) 56(84) bytes of 64 bytes from 10.71.15.1: icmp_seq=1 ttl=255 64 bytes from 10.71.15.1: icmp_seq=2 ttl=255 64 bytes from 10.71.15.1: icmp_seq=3 ttl=255 data. time=11.5 ms time=7.11 ms time=7.77 ms

The Internet Control Message Protocol (ICMP) is used through the ping command to check the network connection. An ICMP echo request message is sent to a specific host to request an ICMP echo response message. If the response message is not received within a specified time, the Host unreachable message is displayed on the screen. The Host unreachable message is displayed in the following cases:
l l

The specified host is invalid. The physical connection of the network is not secure.
Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

2-58

Command Reference
l

2 Operating System Commands

The two communicating hosts do not support the same communication protocol.

To analyze the causes, run the ping command to connect to other hosts in the same network segment. If the ping command is successful, you can infer that the connection is functional. In this case, check the physical connection and the operational status of the specified host. If the ping command fails, check whether the physical network connection of the current host is secure or whether the TCP/IP protocol is set correctly only for Windows 95 users.

2.8.6 route
This describes the function, format, parameter options, and application example of the route command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The routing table relays IP address between network segments. The route command is used to modify and maintain the routing table.

Format
route -fnvq command modifiers args route -fnvq add | change | delete | get host/net destination gateway args route -n monitor route -n flush
NOTE

The meaning of "|" is the same as that of the word "or".

Parameter Description
Options of the route command can be combined. Table 2-22 lists some common options. Table 2-22 Description of the route commands Option -f -n -v -q -commond -destination Description Refresh routing tables for all gateways. View the information in characters instead of symbols. View the additional information. Suspend all outputs. Have the command add/chang/flush (clear the gateways in the routing table)/get/monitor. Indicate the destination network segment. For example, 10.0.0.0 stands for section 10, and 10.11.0.0 stands for section 10.11. Indicate the IP address of the gateway.
Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-59

-gateway
Issue 02 (2009-10-31)

2 Operating System Commands

Command Reference

Option net host

Description Indicate the network segment. For example, 10.11.12.0 stands for section 10.11.12. Indicate the IP address of the host.

The example of running on the Solaris operating system


l

Obtain the routing information about network segment 10. root@ts-007 # route -n get 10.0.0.0
route to: 10.0.0.0 destination: 10.0.0.0 mask: 255.0.0.0 gateway: 10.105.31.254 interface: hme0 flags: <UP,GATEWAY,DONE,STATIC> recvpipe sendpipe ssthresh rtt,msec 0 0 0 0

rttvar 0

hopcount 0

mtu expire 1500

Clear the gateways in the routing table. root@ts-007 # route -n flush


10 10.105.31.254 done

root@ts-007 # netstat -rn


Routing Table: Destination -------------------10.105.28.0 224.0.0.0 127.0.0.1 Gateway Flags Ref Use Interface -------------------- ----- ----- ------ --------10.105.28.202 U 4 6 hme0 10.105.28.202 U 4 0 hme0 127.0.0.1 UH 0 1500 lo0

root@ts-007 # telnet 10.129.3.4


Trying 10.129.3.4... telnet: Unable to connect to remote host: Network is unreachable

After the gateways in the routing table are cleared, the network segments beyond 10.105.28.202/34 are no longer accessible.
l

Add a routing record. root@ts-007 # route add 129.9.0.0 10.105.28.202


add net 129.9.0.0: gateway 10.105.28.202

root@ts-007 # netstat -rn


Routing Table: Destination -------------------10.105.28.0 129.9.0.0 10.0.0.0 224.0.0.0 127.0.0.1
NOTE

Gateway Flags Ref Use Interface -------------------- ----- ----- ------ --------10.105.28.202 U 4 2 hme0 10.105.28.202 UG 0 0 10.105.31.254 UG 0 0 10.105.28.202 U 4 0 hme0 127.0.0.1 UH 0 313 lo0

129.9.0.0 10.105.28.202 UG 0 0 is the newly-added routing record.


l

Modify the routing table. root@ts-007 # route change 129.9.0.0 1.2.3.4


change net 129.9.0.0: gateway 1.2.3.4

2-60

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

root@ts-007 # netstat -rn


Routing Table: Destination -------------------10.105.28.0 129.9.0.0 10.0.0.0 224.0.0.0 127.0.0.1
NOTE

Gateway Flags Ref Use Interface -------------------- ----- ----- ------ --------10.105.28.202 U 4 2 hme0 1.2.3.4 UG 0 0 10.105.31.254 UG 0 0 10.105.28.202 U 4 0 hme0 127.0.0.1 UH 0 445 lo0

129.9.0.0 1.2.3.4 UG 0 0 is the routing record of the modified gateway.

The example of running on the Linux operating system


Use the command netstat -rn to view the information about the routing tables: root@ts-007 # netstat -rn
Routing Table: Destination 10.105.28.0 10.0.0.0 224.0.0.0 127.0.0.1 Gateway 10.105.28.202 10.105.31.254 10.105.28.202 127.0.0.1 Flags U UG U UH Ref 4 0 4 0 0 0 896 hme0 lo0 Use 2 Interface hme0

A router can be in any of the following five different flags: U, G, H, D, and M, as described in Table 2-23. Table 2-23 Description of routing flags Flag U G Description U indicates that a route is currently available. G indicates that a route is destined for a gateway such as a router. If this flag is not set, you can infer that the destination is connected directly. Flag G distinguishes between direct and indirect routes. Flag G is unnecessary for direct routes. The difference is that the packet sent through a direct route carries both the destination IP address and the link-layer address. In the packet sent through an indirect route, however, the IP address points to the destination and the link layer address points to the gateway (for example, the next router). H H indicates a route destined for a host. That is, the destination address is a complete host address. If this flag is not set, you can infer that the route leads to a network and that the destination address is a network address: either a network number or a network. The part in the address for the host is 0. When you search the routing table for an IP address, the host address must exactly match the destination address. The network address, however, is required to match only the network number and subnet number of the destination address. D M D indicates that a route is created by a redirected packet. M indicates that a route is modified by a redirected packet.

The Ref (Reference count) column lists the number of routing progresses. The protocol for connection, such as TCP, requires a fixed route when a connection is established. If the telnet
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-61

2 Operating System Commands

Command Reference

connection is established between the host svr4 and the host slip, the Ref is 1. If another telnet connection is established, its value is changed to 2. The next column (Use) displays the number of packets sent through a specified route. After you run the ping command as the unique user of this route, the program sends five groups and the number of packets is displayed as 5. The last column (Interface) indicates the name of the local interface. The second row of the output is a loop-back interface. The interface name is permanent set to lo0. Flag G is not set because the route is not destined for a gateway. Flag H indicates that the destination address, 127.0.0.1, is a host address and not a network address. Because flag G is not set, the route here is a direct route and the gateway column shows the outgoing IP address. Each host has one or multiple default routes. That is, if a particular route is not found in the table, the packet is sent to the router. In addition, the current host can access other systems through the Sun router (and the slip link) on the internet, based on the settings of the routing table. The flag UG refers to the gateway.

2.8.7 telnet
This describes the functions, format, parameters, and example of the telnet command. The telnet command is used to log in to remote hosts through network connection. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
NOTE

Before running the telnet command, ensure that a local computer is connected to the remote host according to the TCP/IP protocol.

Telnet is the software used to log in to remote hosts through network connection. Telnet takes the local computer as a simulated terminal of the remote host and enables you to log in to the remote server from the local computer. After you log in to the remote host successfully through telnet, you become a remote simulated terminal user and you can use the local computer as a real terminal. In this case, the resources and functions available and the operating mode depend on the settings of the remote host and the access privileges of the login account.

Command Format
telnet IP address or domain name

Parameter Description
l l

IP address: the IP address of a remote host Domain: the domain name of a remote host

Example
Run the telnet command on a local computer and log in to a remote host. Assume that the IP address of the remote host is 129.9.169.143. On the local computer, choose Start > Run. Enter telnet 129.9.169.143 and click OK. The Telnet dialog box appears and prompts you to enter the user name and password of the remote host.
2-62 Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

login: root Password:root password


NOTE

Enter the password on the right of Password:. The entered password is not displayed.

The previous steps are the same as those when you operate on the host.

2.9 Other Common Commands


This describes the functions of other common commands and provides some application examples. 2.9.1 bc This describes the function and example of the bc command. The command is only used on the Solaris operating system. 2.9.2 script This describes the function, format, parameter options, and application examples of the script command. You use this command to record all the screen input and output in a script file. You must start recording the screen input and output after running the script command and end recording them after running the exit command. The command is only used on the Solaris operating system. 2.9.3 pkgadd This describes the function, format, option, and example of the pkgadd command. The usage of the command is the same on the Solaris operating system and the Linux operating system. 2.9.4 pkgrm This describes the function, format, and example of the pkgrm command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

2.9.1 bc
This describes the function and example of the bc command. The command is only used on the Solaris operating system.

Function
The bc command is used to perform a simple calculation.

Example
To multiply 4 by 5, run the following command: # bc 4*5
20
NOTE

To get the result, run the bc command, and then press Enter. Type the formula 4*5, and then press Enter. The result is displayed on the screen. Press Ctrl+D to exit from the bc program.

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

2-63

2 Operating System Commands

Command Reference

2.9.2 script
This describes the function, format, parameter options, and application examples of the script command. You use this command to record all the screen input and output in a script file. You must start recording the screen input and output after running the script command and end recording them after running the exit command. The command is only used on the Solaris operating system.

Function

CAUTION
Close the script file before running the exit command to terminate the recording of the screen I/O. If you do not close the script file, the script file builds up and hinders the normal operation of the system. Record in a script file all the screen input and output that occur from the time when the script command is run to the time when the exit command is entered. The script command is helpful for programming and debugging.

Format
script option file

Option Description
-a: appends the screen I/O content to a file. If you do not set this parameter, the screen I/O overwrites the content of the file.

Parameter Description
file: the file used to save the screen I/O content. If you do not specify the file name, the screen I/O content is saved to the typescript file.

Example
To save the screen I/O content in the default destination file typescript, run the following commands: # script
Script started, file is typescript

# ps
PID TTY 775 pts/8 TIME CMD 0:00 ksh

# pwd
/export/home

# date
Mon Feb 4 19:12:14 GMT 2002

2-64

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

2 Operating System Commands

# exit
Script done, file is typescript

To view the content of the typescript file, run the following command: # cat typescript
Script started on Mon Feb 04 19:11:49 2002 $ ps PID TTY TIME CMD 775 pts/8 0:00 ksh $ pwd /export/home $ date Mon Feb 4 19:12:14 GMT 2002 $ exit script done on Mon Feb 04 19:12:24 2002

2.9.3 pkgadd
This describes the function, format, option, and example of the pkgadd command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The pkgadd command is used to send a file package to the system for execution. To remove a package from the system, run the pkgrm command.

Command Format
pkgadd option file package name

Option Description
-d device: to install or copy a package from the device. The device can be an absolute path, the identifier of a tape, or a disk such as /var/tmp or /floppy/floppy_name, or a device name such as /floppy/floppy0.

Example
To send a file package in the current folder to the file1 file, run the following command: # pkgadd -d . file1 The dot in the command indicates that the folder is the current folder.

2.9.4 pkgrm
This describes the function, format, and example of the pkgrm command. The usage of the command is the same on the Solaris operating system and the Linux operating system.

Function
The pkgrm command is used to remove a package from the system. To pack and send a package to the system, use the pkgadd command.
Issue 02 (2009-10-31) Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd. 2-65

2 Operating System Commands

Command Reference

Command Format
pkgrm option file package name

Example
To remove the file1 file, run the following command: # pkgrm file1

2-66

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

3 Summary of Commonly Used Cluster Commands

Summary of Commonly Used Cluster Commands

This describes the common maintenance commands of the Cluster 3.0. Table 3-1 Common maintenance commands of the Cluster3.0 Command scstat scstat -g scrgadm -a -g oss_rg scrgadm -r -g oss_rg scrgadm -a -g oss_rg -h osssvr-1,osssvr-2 scrgadm -a -L -g oss_rg -l osssvr scrgadm -a -j ossdg_rs -g oss_rg -t SUNW.HAStoragePlus -x FilesystemMountPoints=data,/export/home scrgadm -a -t HW.M2000 Description Check the Cluster status. Check the status of a resource group. Create the resource group oss_rg. Delete the resource group oss_rg. Register osssvr-1 and osssvr-2 to the resource group oss_rg. Register the logical host osssvr to the resource group oss_rg. Register the volume group ossdg_rg-t and mounting point data,/export/home to the resource group oss_rg. Register the resource type HW.M2000 in the Sun Cluster 3.0. The link file named HW.M2000 must be created in the /usr/ cluster/lib/rgm/rtreg folder. Delete the resource type HW.M2000 . Add the resource ossapp_rs of the HW.M2000 type to the resource group oss_rg. Delete the resource sybase_rs.

scrgadm -r -t HW.M2000 scrgadm -a -j ossapp_rs -t HW.M2000 -g oss_rg scrgadm -r -j sybase_rs

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

3-1

3 Summary of Commonly Used Cluster Commands

Command Reference

Command scswitch -Z -g oss_rg

Description Start all resources in the resource group oss_rg, including the resources deactivated by scswitch -n -j. Close the resource group oss_rg. Start the resource group oss_rg on the host osssvr-1. Set the disk device group and resource group to offline state at the osssvr-1 node. If the disk device group at the osssvr-1 node is online, the disk device group is switched to the osssvr-2 node after you run the command. If both the disk device group and resource group at the osssvr-1 node are online, they are switched to the osssvr-2 node after you run the command.

scswitch -F -g oss_rg scswitch -z -g oss_rg -h osssvr-1 scswitch -S -h osssvr-1

scswitch -e -j sybase_rs

Activate the resource sybase_rs and enable the Cluster monitoring over the Sybase. Deactivate the resource sybase_rs and stop the Cluster monitoring over the Sybase.

scswitch -n -j sybase_rs

NOTE

l l

After you run the command scswitch -S -h nodename, all online resource groups are switched to the target PC. The offline resource groups on the original host remain offline on the target PC. After you run the command scswitch -z -g rgname -h nodename, the resource group rgname is switched to the target PC.

3-2

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

4 Common Commands and Parameters of the Veritas Cluster

Common Commands and Parameters of the Veritas Cluster


This describes the common commands and parameters of the Veritas Cluster. Table 4-1 Common maintenance commands of the VCS Command hastart Meaning Starts the VCS.
NOTE After you run the command on a certain node, the VCS service is started on this node. The nic_rs resource is automatically started at the same time. If this node serves as the active node, the other resources of the oss_sg resource group are also automatically started.

Example hastart

hastop -all

Stops the VCS.


NOTE After you run the command, all resources in the HA system and the VCS service are stopped. Therefore, run the command with caution.

hastop -all

hastop -all -force

Forcibly stops the VCS. If you fail to stop the VCS by running the hastop -all command, you need to use this command to forcibly stop the VCS. Adds a heartbeat link. Deletes a heartbeat link.

hastop -all -force

/opt/VRTSvcs/ bin/hahb -add hb /opt/VRTSvcs/ bin/hahb -delete hb


Issue 02 (2009-10-31)

/opt/VRTSvcs/bin/hahb -add IcmpS /opt/VRTSvcs/bin/hahb -delete IcmpS

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

4-1

4 Common Commands and Parameters of the Veritas Cluster

Command Reference

Command /opt/VRTSvcs/ bin/hahb -display /opt/VRTSvcs/ bin/hahb -state hb /opt/VRTSvcs/ bin/hahb -list /opt/VRTSvcs/ bin/hahb -modify hb attr value hagrp -add group hagrp -delete group hagrp -link parent group child group dependency hagrp -unlink parent group child group hagrp -clear group

Meaning Displays the detailed information about a heartbeat link. Displays the status of a heartbeat link. Lists the information about a heartbeat link. Modifies the parameters of a heartbeat link. Adds a resource group. Deletes a resource group. Sets the dependency between resource groups. Deletes the dependency between resource groups. Clears the fault state and nopersistent state of each resource in a resource group. Clears the ADMIN_WAIT state of each resource in a resource group. When a resource in a resource group is blocked due to an exception during the online or offline process, you can run this command to stop the online or offline process and set the resource to the to-be-started state or the stopped state. Starts a resource group. Stops a resource group. Switches a resource group. Freezes a resource group permanently.

Example /opt/VRTSvcs/bin/hahb -display

/opt/VRTSvcs/bin/hahb -state IcmpS /opt/VRTSvcs/bin/hahb -list /opt/VRTSvcs/bin/hahb -modify IcmpS Arguments 10.10.10.31 clus osscluster-2 hagrp -add OssService hagrp -delete OssService hagrp -link OssService RvgService dependency hagrp -unlink OssService RvgService hagrp -clear OssService

hagrp clearadminwait group -sys system hagrp -flush group -sys system

hagrp -clearadminwait OssService -sys osssvr-2 hagrp -flush OssService -sys osssvr-1

hagrp -online group -sys system hagrp -offline group -sys system hagrp -switch group -to system hagrp -freeze group -persistent
4-2

hagrp -online OssService -sys osssvr-1 hagrp -offline OssService -sys osssvr-1 hagrp -switch OssService -to osssvr-1 hagrp -freeze OssService persistent
Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Command Reference

4 Common Commands and Parameters of the Veritas Cluster

Command hagrp -unfreeze group -persistent hagrp -freeze group

Meaning Unfreezes a permanently frozen resource group. Freezes a resource group temporarily.
NOTE A temporarily frozen resource group is unfrozen after the VCS is restarted.

Example hagrp -unfreeze OssService persistent hagrp -freeze OssService

hagrp -unfreeze group hagrp -enable group hagrp -disable group hagrp enableresources group hagrp disableresources group hagrp -display

Unfreezes a temporarily frozen resource group. Activates a resource group. A resource group can be started only after it is activated. Disables a resource group. A resource group cannot be started after it is disabled. Activates all the resources in a resource group. Disables all the resources in a resource group. Displays the detailed information about a resource group. Displays the status of a resource group. Lists the names of resource groups. Displays the values of the parameters of a resource group. Displays the dependency between resource groups. Displays the resources of a resource group. Adds a resource. Deletes a resource. Sets the dependency between resources.

hagrp -unfreeze OssService hagrp -enable OssService

hagrp -disable OssService

hagrp -enableresources OssService hagrp -disableresources OssService hagrp -display

hagrp -state hagrp -list hagrp -value group attr hagrp -dep hagrp -resources group hares -add res type group hares -delete res hares -link parent res child res

hagrp -state hagrp -list hagrp -value RvgService Probed hagrp -dep hagrp -resources OssService hares -add oss_app Application OssService hares -delete oss_app hares -link oss_app oss_sybase_back

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

4-3

4 Common Commands and Parameters of the Veritas Cluster

Command Reference

Command

Meaning

Example hares -unlink oss_app oss_sybase_back hares -clear oss_app hares -online oss_app -sys osssvr-1 hares -online -force oss_app -sys osssvr-1 hares -offline oss_app -sys osssvr-1 hares -probe oss_app -sys osssvr-1 hares -dep hares -display oss_app hares -state oss_app hares -list hares -value oss_app Type

hares -unlink Deletes the dependency parent res child res between resources. hares -clear res hares -online res sys system hares -online force res -sys system hares -offline res sys system hares -probe res sys system hares -dep hares -display res hares -state res hares -list hares -value res attr Clears the alarms of a resource. Starts a resource. Starts a resource forcibly.

Stops a resource. Monitors the status of a resource. Displays the dependency between resources. Displays the detailed information about a resource. Displays the status of a resource. Lists the names of resources. Displays the values of the parameters of a resource.

4-4

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

5 Common VVR Commands and Parameters

Common VVR Commands and Parameters


The following table describes the common VVR commands and parameters. Table 5-1 Common VVR commands and parameters Command vradmin -g diskgroup createpri rvg_name dv01_name,dv02_name. .. srl_name vradmin -g diskgroup addsec local_rvgname pri_hostname sec_hostname vradmin -g diskgroup changeip local_rvgname attrs.... vradmin -g diskgroup -l repstatus local_rvgname vradmin -l printrvg Meaning Creates the active node in an RVG. Example vradmin -g ossdg createpri ossrvg exportsync,fmdb_data_lv001,fmd b_data_lv002 srl vradmin -g ossdg addsec ossrvg 192.168.8.20 192.168.8.22

Adds the standby node in the created RVG.

Changes the IP address of an active or a standby replication link. Displays the replication relation of an RVG. Displays the information about the active and standby nodes in an RVG. Displays the information about the active and standby nodes in a specified RVG. Displays the volume information in an RVG. Displays the volume information in a specified RVG.

vradmin -g ossdg changeip ossrvg newpri=10.10.10.30 newsec=10.10.10.31 vradmin -g ossdg -l repstatus ossrvg vradmin -l printrvg

vradmin -g diskgroup -l printrvg local_rvgname

vradmin -g ossdg -l printrvg ossrvg

vradmin printvol vradmin -g diskgroup printvol local_rvgname

vradmin printvol vradmin -g ossdg printvol ossrvg

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

5-1

5 Common VVR Commands and Parameters

Command Reference

Command vradmin -g diskgroup pauserep local_rvgname sec_hostname vradmin -g diskgroup resumerep local_rvgname sec_hostname vradmin -g diskgroup -a startrep local_rvgname sec_hostname

Meaning Pauses the synchronization of data to the standby node. Resumes the synchronization of data to the standby node. Uses automatic synchronization to synchronize data to the standby node and establish the replication link. Stops copying data to the standby node. Compares the data based on the volumes, and then synchronizes the different data to the standby node based on the RVGs.

Example vradmin -g ossdg pauserep ossrvg 192.168.8.22

vradmin -g ossdg resumerep ossrvg 192.168.8.22

vradmin -g ossdg -a startrep ossrvg 192.168.8.22

vradmin -g diskgroup stoprep local_rvgname sec_hostname vradmin -g diskgroup syncrvg local_rvgname sec_hostname....

vradmin -g ossdg stoprep ossrvg 192.168.8.22 vradmin -g ossdg syncrvg ossrvg 192.168.8.22

vradmin -g diskgroup syncvol local_vols_list remote_hostname....

Compares the data based vradmin -g ossdg syncvol on the volumes, and then exportsync,fmdb_data_lv001,fmd synchronizes the different b_data_lv002 192.168.8.22 data in a specified volume to the standby node. Checks the data differences between the synchronization volumes of the active and standby nodes, and then generates a report. Adds a specified volume to an RVG. Deletes a specified volume from an RVG. vradmin -g ossdg -verify syncrvg ossrvg 192.168.8.22

vradmin -g diskgroup verify syncrvg local_rvgname sec_hostname

vradmin -g diskgroup addvol local_rvgname volume_name vradmin -g diskgroup delvol local_rvgname volume_name

vradmin -g ossdg addvol ossrvg oss_v1 vradmin -g ossdg delvol ossrvg oss_v1

5-2

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

5 Common VVR Commands and Parameters

Command vradmin -g diskgroup migrate local_rvgname newprimary_name

Meaning Switches the replication relation between the active and standby nodes. After the switchover, the original active node becomes the new standby node and the original standby node becomes the new active node. In addition, the data synchronization direction changes. Takes over the Primary role of the original active node and enables the fast failback function. Takes over the primary role of the original active node, enables the fast failback function, and automatically synchronizes data to the original active node after the original active node is available. Switches the standby node to the active node for data replication, while the fast failback function is not enabled. Switches the original active node to the standby node and uses the fast failback function to synchronize data from the new active node. Switches the original active node to the standby node and uses the fast failback function to synchronize data from the new active node. The system returns to the command line interface for the next command after the synchronization is complete.

Example vradmin -g ossdg migrate ossrvg 192.168.8.22

vradmin -g diskgroup takeover local_rvgname

vradmin -g ossdg takeover ossrvg

vradmin -g diskgroup autofb takeover local_rvgname

vradmin -g ossdg -autofb takeover ossrvg

vradmin -g diskgroup -N takeover local_rvgname

vradmin -g ossdg -N takeover ossrvg

vradmin -g diskgroup fbsync local_rvgname

vradmin -g ossdg fbsync ossrvg

vradmin -g diskgroup wait fbsync local_rvgname

vradmin -g ossdg -wait fbsync ossrvg

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

5-3

5 Common VVR Commands and Parameters

Command Reference

Command vradmin -g diskgroup makesec local_rvgname newprimary_name

Meaning Switches the original active node to the standby node when the fast failback function is not enabled. Deletes the standby node from an RVG. Deletes the active node from an RVG before the application runs. Deletes the active node forcibly from an RVG after the application runs. Displays the information about all the volumes assigned to a specified RVG. Displays the information about all the links assigned to a specified RVG. Starts the I/O access to the volumes in a specified RVG. Stops the I/O access to the volumes in a specified RVG. Resumes the operation of an RVG after the nodes are restarted. Sets the current position of the SRL to the check end point on the active node. Displays all the check points existing in a specified RVG. Displays the statistics of the application of a specified RVG. This command can be executed only on the active node.

Example vradmin -g ossdg makesec ossrvg 192.168.8.22

vradmin -g diskgroup delsec local_rvgname sec_hostname vradmin -g diskgroup delpri rvg_name vradmin -g diskgroup -f delpri rvg_name vxrvg -g diskgroup -l getdatavols rvg_name

vradmin -g ossdg delsec ossrvg 192.168.8.22 vradmin -g ossdg delpri ossrvg

vradmin -g ossdg -f delpri ossrvg

vxrvg -g ossdg -l getdatavols ossrvg

vxrvg -g diskgroup getrlinks rvg_name vxrvg -g diskgroup start rvg_name vxrvg -g diskgroup stop rvg_name vxrvg -g diskgroup recover rvg_name vxrvg -g diskgroup checkend rvg_name vxrvg -g diskgroup cplist rvg_name vxrvg -g diskgroup stats rvg_name

vxrvg -g ossdg getrlinks ossrvg

vxrvg -g ossdg start ossrvg

vxrvg -g ossdg stop ossrvg

vxrvg -g ossdg recover ossrvg

vxrvg -g ossdg checkend ossrvg

vxrvg -g ossdg cplist ossrvg

vxrvg -g ossdg stats ossrvg

5-4

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

Command Reference

5 Common VVR Commands and Parameters

Command vxrlink -g diskgroup assoc rvg_name rlink_name vxrlink -g diskgroup dis rlink_name vxrlink -g diskgroup -a att rlink_name vxrlink -g diskgroup -f att rlink_name vxrlink -g diskgroup det rlink_name vxrlink -g diskgroup pause rlink_name

Meaning Assigns a replication link to an RVG. Deletes a replication link from an RVG.

Example vxrlink -g ossdg assoc ossrvg to_secondary vxrlink -g ossdg dis to_secondary

Uses the auto attach mode vxrlink -g ossdg -a att to set a replication link to to_secondary the connected state. Uses the force attach method to set a replication link to the connected state. Sets a replication link to the disconnected state. Pauses the synchronization of data to the standby node through a specified replication link. Resumes the synchronization of data to the standby node through a specified replication link. Recovers a replication link after the nodes are restarted. Displays the configuration status of a specified link. Displays the usage status of a specified link. Displays the SRL space occupied by a specified link, and the remaining data of the standby node that needs to be synchronized. Displays all the RVGs. Displays all the RLINKGS. vxrlink -g ossdg -f att to_secondary vxrlink -g ossdg det to_secondary vxrlink -g ossdg pause to_secondary

vxrlink -g diskgroup resume rlink_name

vxrlink -g ossdg resume to_secondary

vxrlink -g diskgroup recover rlink_name vxrlink -g diskgroup verify rlink_name vxrlink -g diskgroup -e stats rlink_name vxrlink -g diskgroup status rlink_name

vxrlink -g ossdg recover to_secondary vxrlink -g ossdg verify to_secondary vxrlink -g ossdg -e stats to_secondary vxrlink -g ossdg status to_secondary

vxprint -V vxprint -P

vxprint -V vxprint -P

Issue 02 (2009-10-31)

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

5-5

5 Common VVR Commands and Parameters

Command Reference

Command vxmake -g diskgroup rlink rlink_name protocol=protocol_name remote_host=sec_hostn ame remote_rlink=rlink_na me vxmemstat

Meaning Uses a specified network transport protocol to create a replication link. The value of the protocol_name parameter can be set to TCP or UDP. Displays the usage statistics of the memory of the Veritas Volume Manager. Manages the ports of the VVR. Displays the event notifications of the VVR. Selects a network transport protocol. You can select the TCP or UDP protocol.

Example vxmake -g ossdg rlink to_secondary protocol=UDP remote_host=192.168.8.22 remote_rlink=to_secondary

vxmemstat

vrport vrnotify -g diskgroup vxedit -g diskgroup set protocol=protocol_name rlink_name

vrport vrnotify -g diskgroup vxedit -g ossdg set protocol=UDP to_secondary

5-6

Huawei Proprietary and Confidential Copyright Huawei Technologies Co., Ltd.

Issue 02 (2009-10-31)

You might also like