i p m i t o o l工具常用命
令汇总
Document serial number【UU89WT-UU98YT-UU8CB-UUUT-UUT108】
ipmitool工具常用命令汇总目录
1.工具的安装
yum install -y OpenIPMI ipmitool
开启服务
/etc/ipmi status
/etc/ipmi start
[root@cell83 ~]# ipmitool -V
ipmitool version 命令的help
明细的命令参考man ipmitool
或者附件
[root@cell83 ~]# ipmitool -h
ipmitool version ipmitool [options...]
-h This help
-V Show version information
-v Verbose (can use multiple times)
-c Display output in comma separated format -d N Specify a /dev/ipmiN device to use (default=0)
-I intf Interface to use
-H hostname Remote host name for LAN interface
-p port Remote RMCP port [default=623]
-U username Remote session username
-f file Read remote session password from file
-z size Change Size of Communication Channel (OEM) -S sdr Use local file for remote SDR cache
-D tty:b[:s] Specify the serial device, baud rate to use
and, optionally, specify that interface
is the system one
-4 Use only IPv4
-6 Use only IPv6
-a Prompt for remote password
-Y Prompt for the Kg key for IPMIv2 authentication
-e char Set SOL escape character
-C ciphersuite Cipher suite to be used by lanplus interface
-k key Use Kg key for IPMIv2 authentication
-y hex_key Use hexadecimal-encoded Kg key for IPMIv2 authentication
-L level Remote session privilege level
[default=ADMINISTRATOR]
Append a '+' to use name/privilege lookup in RAKP1
-A authtype Force use of auth type NONE, PASSWORD, MD2, MD5 or OEM
-P password Remote session password
-E Read password from IPMI_PASSWORD environment variable
-K Read kgkey from IPMI_KGKEY environment variable
-m address Set local IPMB address
-b channel Set destination channel for bridged request
-t address Bridge request to remote target address
-B channel Set transit channel for bridged request (dual bridge)
-T address Set transit address for bridge request (dual bridge)
-l lun Set destination lun for raw commands
-o oemtype Setup for OEM (use 'list' to see
available OEM types)
-O seloem Use file for OEM SEL event descriptions
-N seconds Specify timeout for lan [default=2] / lanplus [default=1] interface
-R retry Set the number of retries for lan/lanplus interface [default=4]
Interfaces:
open Linux OpenIPMI Interface [default]
imb Intel IMB Interface
lan IPMI LAN Interface
lanplus IPMI RMCP+ LAN Interface
serial-terminal Serial Interface, Terminal Mode
serial-basic Serial Interface, Basic Mode
usb IPMI USB Interface(OEM Interface for AMI Devices)
Commands:
raw Send a RAW IPMI request and print response
i2c Send an I2C Master Write-Read command and print response
spd Print SPD info from remote I2C device
lan Configure LAN Channels
chassis Get chassis status and set power state
power Shortcut to chassis power commands
event Send pre-defined events to MC
mc Management Controller status and global enables
sdr Print Sensor Data Repository entries and readings
sensor Print detailed sensor information
fru Print built-in FRU and scan SDR for FRU locators
gendev Read/Write Device associated with Generic Device locators sdr
sel Print System Event Log (SEL)
pef Configure Platform Event Filtering (PEF)
sol Configure and connect Serial-over-LAN
tsol Configure and connect with Tyan Serial-over-LAN
isol Configure Serial-over-LAN
user Configure Management Controller users
channel Configure Management Controller channels
session Print session information
dcmi Data Center Management Interface
nm Node Manager Interface
sunoem OEM Commands for Sun servers
kontronoem OEM Commands for Kontron devices
picmg Run a PICMG/ATCA extended cmd
fwum Update IPMC using Kontron OEM Firmware Update Manager
firewall Configure Firmware Firewall
delloem OEM Commands for Dell systems
shell Launch interactive IPMI shell
exec Run list of commands from file
set Set runtime variable for shell and exec
hpm Update HPM components using PICMG file
ekanalyzer run FRU-Ekeying analyzer using FRU files
ime Update Intel Manageability Engine Firmware vita Run a VITA extended cmd
lan6 Configure IPv6 LAN Channels
3.查看管理口的IP地址
[root@cell83 ~]# ipmitool -I open lan print
[root@cell83 ~]# ipmitool -I open lan print | grep IP
IP Address Source : Static Address
IP Address :
IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
Default Gateway IP :
Backup Gateway IP :
4.管理底盘chassis配置
[root@cell83 ~]# ipmitool -I open chassis help
Chassis Commands: status, power, identify, policy,
restart_cause, poh, bootdev, bootparam, selftest
查看底盘配置汇总
[root@cell83 ~]# ipmitool -I open chassis status
System Power : on
Power Overload : false
Power Interlock : inactive
Main Power Fault : false
Power Control Fault : false
Power Restore Policy : previous
Last Power Event :
Chassis Intrusion : inactive
Front-Panel Lockout : inactive
Drive Fault : false
Cooling/Fan Fault : false
Sleep Button Disable : not allowed
Diag Button Disable : allowed
Reset Button Disable : not allowed
Power Button Disable : allowed
Sleep Button Disabled: false
Diag Button Disabled : true
Reset Button Disabled: false
Power Button Disabled: false
管理电源
查看当前电源状态
[root@cell83 ~]# ipmitool -I open chassis power status Chassis Power is on
打开电源
ipmitool -I open chassis power on
关闭电源
ipmitool -I open chassis power off
重启电源
ipmitool -I open chassis power cycle
重置电源
ipmitool -I open chassis power reset
其他配置
ipmitool -I open chassis power diag
ipmitool -I open chassis power soft
管理时间间隔
查询时间间隔:
[root@cell83 ~]# ipmitool -I open chassis identify Chassis identify interval: default (15 seconds)
设置时间间隔:
[root@cell83 ~]# ipmitool -I open chassis identify help chassis identify
default is 15 seconds
0 to turn off
force to turn on indefinitely
管理电源恢复策略
[root@cell83 ~]# ipmitool -I open chassis policy help chassis policy
list : return supported policies
always-on : turn on when power is restored
previous : return to previous state when power is restored
always-off : stay off after power is restored
查看上次重启原因
[root@cell83 ~]# ipmitool -I open chassis restart_cause System restart cause: unknown
查询上电时间
[root@cell83 ~]# ipmitool -I open chassis poh
Get Chassis Power-On-Hours failed: Invalid command
管理启动项
[root@cell83 ~]# ipmitool -I open chassis bootdev help bootdev
bootdev
none : Do not change boot device order
pxe : Force PXE boot
disk : Force boot from default Hard-drive
safe : Force boot from default Hard-drive, request Safe Mode diag : Force boot from Diagnostic Partition
cdrom : Force boot from CD/DVD
bios : Force boot into BIOS Setup
floppy: Force boot from Floppy/primary removable media
设置启动项的参数
[root@cell83 ~]# ipmitool -I open chassis bootparam help bootparam get
bootparam set bootflag
Legal devices are:
none : No override
force_pxe : Force PXE boot
force_disk : Force boot from default Hard-drive
force_safe : Force boot from default Hard-drive, request Safe Mode
force_diag : Force boot from Diagnostic Partition
force_cdrom : Force boot from CD/DVD
force_bios : Force boot into BIOS Setup
Legal options are:
help : print this message
PEF : Clear valid bit on reset/power cycle cause by PEF timeout : Automatically clear boot flag valid bit on timeout watchdog: Clear valid bit on reset/power cycle cause by watchdog
reset : Clear valid bit on push button reset/soft reset
power : Clear valid bit on power up via power push button or wake event
Any Option may be prepended with no- to invert sense of operation
5.使用delloem进行管理
查看帮助
[root@cell83 ~]# ipmitool -I open delloem help
usage: delloem
commands:
lcd
mac
lan
setled
powermonitor
vFlash
For help on individual commands type:
delloem
配置lcd
[root@cell83 ~]# ipmitool -I open delloem lcd help
Generic DELL HW:
lcd set {none}|{default}|{custom
Set LCD text displayed during non-fault conditions iDRAC 11g or iDRAC 12g or iDRAC 13g :
lcd set {mode}|{lcdqualifier}|{errordisplay}
Allows you to set the LCD mode and user-defined string. lcd set mode {none}|{modelname}|{ipv4address}|{macaddress}| {systemname}|{servicetag}|{ipv6address}|{ambienttemp}
{systemwatt }|{assettag}|{userdefined}
Allows you to set the LCD display mode to any of the preceding
parameters
lcd set lcdqualifier {watt}|{btuphr}|{celsius}|{fahrenheit} Allows you to set the unit for the system ambient temperature mode.
lcd set errordisplay {sel}|{simple}
Allows you to set the error display.
lcd info
Show LCD text that is displayed during non-fault conditions
lcd set vkvm{active}|{inactive}
Set vKVM active and inactive, message will be displayed on lcd
when vKVM is active and vKVM session is in progress
lcd set frontpanelaccess
{viewandmodify}|{viewonly}|{disabled}
Set LCD mode to view and modify, view only or disabled lcd status
Show LCD Status for vKVM display
and Front Panel access mode
{viewandmodify}|{viewonly}|{disabled}
查看MAC地址
[root@cell83 ~]# ipmitool -I open delloem mac help
mac list
Lists the MAC address of LOMs
mac get
Shows the MAC address of specified LOM. 0-7 System LOM, 8- DRAC/iDRAC.
[root@cell83 ~]# ipmitool -I open delloem mac list
System LOMs
NIC Number MAC Address Status
0 b8:2a:72:db:56:2a Enabled
1 b8:2a:72:db:56:2b Enabled
2 b8:2a:72:db:56:28 Enabled
3 b8:2a:72:db:56:29 Enabled
iDRAC7 MAC Address b0:83:fe:c9:6d:31
设置lan的模式
[root@cell83 ~]# ipmitool -I open delloem lan help
lan set
sets the NIC Selection Mode :
on iDRAC12g OR iDRAC13g :
dedicated, shared with lom1, shared with
lom2,shared with lom3,shared
with lom4,shared with failover lom1,shared with failover lom2,shared
with failover lom3,shared with failover
lom4,shared with Failover all
loms, shared with Failover None).
on other systems :
dedicated, shared, shared with failover lom2,
shared with Failover all loms.
lan get
on iDRAC12g or iDRAC13g :
returns the current NIC Selection Mode (dedicated, shared with lom1, shared
with lom2, shared with lom3, shared with
lom4,shared with failover lom1,
shared with failover lom2,shared with failover lom3,shared with failover
lom4,shared with Failover all loms,shared with Failover None).
on other systems :
dedicated, shared, shared with failover,
lom2, shared with Failover all loms.
lan get active
returns the current active NIC (dedicated, LOM1, LOM2, LOM3, LOM4).
设置背板led的状态
[root@cell83 ~]# ipmitool -I open delloem setled help
setled
Set backplane LED state
b: = PCI Bus: of drive (lspci format)
state = present|online|hotspare|identify|rebuilding|
fault|predict|critical|failed
H3C交换机配置命令 创建汇聚组link-aggregation group mode{manual / static} 加入端口Port link-aggregation group 汇聚接口配置interface Bridge-Aggregation 1 description ==TO-IDF-1== port link-type trunk undo port trunk permit vlan 1 port trunk permit vlan 21 100 (1)采用手工聚合方式 # 创建汇聚组1。 [H3C] link-aggregation group 1 mode manual # 将以太网端口Ethernet2/1/1至Ethernet2/1/3加入聚合组1。 [H3C] interface ethernet2/1/1 [H3C-Ethernet2/1/1] port link-aggregation group 1 [H3C-Ethernet2/1/1] interface ethernet2/1/2 [H3C-Ethernet2/1/2] port link-aggregation group 1 [H3C-Ethernet2/1/2] interface ethernet2/1/3
[H3C-Ethernet2/1/3] port link-aggregation group 1 # 当聚合组端口序号连续时,可以直接把多个端口聚成一组,组号由系统自行分 配。 [H3C] link-aggregation ethernet2/1/1 to ethernet2/1/3 both (2)采用静态LACP聚合方式 # 创建静态汇聚组1。 [H3C] link-aggregation group 1 mode static # 将以太网端口Ethernet2/1/1至Ethernet2/1/3加入聚合组1。 [H3C] interface ethernet2/1/1 [H3C-Ethernet2/1/1] port link-aggregation group 1 [H3C-Ethernet2/1/1] interface ethernet2/1/2 [H3C-Ethernet2/1/2] port link-aggregation group 1 [H3C-Ethernet2/1/2] interface ethernet2/1/3 [H3C-Ethernet2/1/3] port link-aggregation group 1 (3)采用动态LACP聚合方式 # 开启以太网端口Ethernet2/1/1至Ethernet2/1/3的LACP协议。 [H3C] interface ethernet2/1/1 [H3C-Ethernet2/1/1] lacp enable [H3C-Ethernet2/1/1] interface ethernet2/1/2 [H3C-Ethernet2/1/2] lacp enable [H3C-Ethernet2/1/2] interface ethernet2/1/3 [H3C-Ethernet2/1/3] lacp enable 设置以太网端口的速率speed { 10 | 100 | 1000 | 10000 | auto } 设置以太网端口连接的网线的类型mdi { across | auto | normal }
SecureCRT 常用命令 2010年4月26日 | 分类: Linux | 标签: SecureCRT 常用命令: 一、ls 只列出文件名(相当于dir,dir也可以使用) -A:列出所有文件,包含隐藏文件。 -l:列表形式,包含文件的绝大部分属性。 -R:递归显示。 –help:此命令的帮助。 二、cd 改变目录 cd /:进入根目录 cd :回到自己的目录(用户不同则目录也不同,root为/root,xxt为/home/xxt cd ..:回到上级目录 pwd:显示当前所在的目录 三.less 文件名:查看文件内容。 四.q 退出打开的文件。 五.上传文件: rz 选择要传送的文件,确定。 六.下载文件: sz 指定文件名,enter敲,即下载到了secureCRT/download目录下。 七:删除文件: rm 删除文件,rmdir 删除空目录。 八.显示最近输入的20条命令:history 20 九.获得帮助命令–help查看命令下详细参数:如:rz –help , sz –help 。 十.cd 进入某个文件夹的命令: mkdir+文件夹名创建某个文件夹的命令 sz+文件名从服务器端向本机发送文件的命令 rz 从本机向服务器端传送文件的命令 ll 列出当前目录下的所有文件,包括每个文件的详细信息 dir 对当前文件夹 vi 打开当前文件 十一.在编辑某个文件的时候: a 切换到编辑模式 ctrl+c 退出编辑模式
dd 删除整行 :q 退出当前文件 :w 写入并保存当前文件 -f 强行xx的参数。。。 其它命令: 1.ps -ef //查看server的进程,以列表形式显示的server进程。 ps 显示当前在系统运行的进程 /usr/bin/ps [选项] -e 显示每个现在运行的进程 -f 生成一个完全的列表 实际操作: ————————————– 1 SSH客户端连接到10.5.1.55系统(参见《启动远程客户端说明SecureCRT.doc》) $ cd /home/bea2/user_projects/csdomain/bin 2 查看weblogic92服务进程 $ ps -eaf | grep weblogic bea2 327926 331940 0 13:08:45 pts/4 0:00 grep weblogic webadmin 421908 368956 0 Sep 24 - 4:13 /usr/java5_64/bin/java -Xms256m -Xmx512m -da -Dplatform.home=/home/weblogic/bea/weblogic92 -Dwls.home=/home/weblogic/bea/weblogic92/server -Dwli.home=/home/weblogic/bea/weblogic92/integration -Dweblogic.management.discover=true -Dwlw.iterativeDev=false -Dwlw.testConsole=false -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=/home/weblogic/bea/patch_weblogic923/profiles/de fault/sysext_manifest_classpath https://www.doczj.com/doc/325033126.html,=AdminServer -Djava.security.policy=/home/weblogic/bea/weblogic92/server/lib/webl ogic.policy weblogic.Server bea2 491796 385044 17 00:12:50 pts/6 182:55 /usr/java5_64/bin/java -Xms6g -Xmx8g -javaagent:/home/bea2/user_projects/csdomain/Introscope/wily/Agent.j ar -Dcom.wily.introscope.agentProfile=/home/bea2/user_projects/csdomain /Introscope/wily/IntroscopeAgent.profile -Dcom.wily.introscope.agent.agentName=AdminServer -da -Dplatform.home=/home/weblogic/bea/weblogic92 -Dwls.home=/home/weblogic/bea/weblogic92/server -Dwli.home=/home/weblogic/bea/weblogic92/integration
H3C交换机简单配置命令 1、配置主机名 [H3C]systemname H3C 2、配置console口密码 # 进入系统视图。
# 设置通过VTY0口登录交换机的用户进行Password认证。 [H3C-ui-vty0] authentication-mode password # 设置用户的认证口令为密码方式,口令为123456。 [H3C-ui-vty0] set authentication password cipher 123456 # 设置从VTY0用户界面登录后可以访问的命令级别为2级。 [H3C-ui-vty0] user privilege level 2 # 设置VTY0用户界面支持Telnet协议。 [H3C-ui-vty0] protocol inbound telnet 4、配置交换机VLAN 1 管理地址
Shell命令行操作 Linux shell 简介 Linux shell指的是一种程序,有了它,用户就能通过键盘输入指令来操作计算机了。Shell会执行用户输入的命令,并且在显示器上显示执行结果。这种交互的全过程都是基于文本的,与其他各章介绍的图形化操作不同。这种面向命令行的用户界面被称为CLI(Command Line interface)。在图形化用户界面(GUI)出现之前,人们一直是通过命令行界面来操作计算机的。 现在,基于图形界面的工具越来越多,许多工作都不必使用Shell就可以完成了。然而,专业的Linux用户认为Shell是一个非常有用的工具,学习Linux时一定要学习Shell,至少要掌握一些基础知识和基本的命令 启动shell 在启动Linux桌面系统后,Shell已经在后台运行起来了,但并没有显示出来。如果想让它显示出来, 按如下的组合键就可以:
是等效的。“系统终端”启动后是一个命令行操作窗口,可以随时放大缩小,随时关闭,比较方便,推荐使用。启动“系统终端”的方法是: 【开始】→【应用程序】→【附件】→【系统终端】 该软件允许建立多个Shell客户端,它们相互独立,可以通过标签 在彼此之间进行切换。 Shell命令基本规则 一般格式 Shell命令的一般格式如下: 命令名【选项】【参数1】【参数2】... 【选项】是对命令的特别定义,以减号(-)开始,多个选项可以用一个减号(-)连起来,如ls -l -a与 ls -la 相同。 【参数】提供命令运行的信息,或者是命令执行过程中所使用的文件名。 使用分号(可以将两个命令隔开,这样可以实现一行中输入多个命令。命令的执行顺序和输入的顺序 相同。 命令补全 在送入命令的任何时刻,可以按
进入系统视图 system-view 配置设备名 sysname RouterA 查看FLASH目录下内容 dir 指定下次启动配置文件 startup saved-configuration main.cfg 保存配置 save 重启 reboot #置CONSOLE用户登陆的口令认证
用户的命令控制级别设置 [H3C-ui-aux0]user privilege level 0 [H3C]super password level 1 simple 123456 [H3C]super password level 2 simple 123456 [H3C]super password level 3 simple 123456 # 设置super(明文)密码当低权限向高权限切换时使用![RouterA]super password simple quidway # 设置super(密文)密码 [RouterA]super password cipher quidway # 启用telnet 管理功能 [RouterA]user-interface vty 0 4 [RouterA-ui-vty0-4]authentication-mode password [RouterA-ui-vty0-4]set authentication password simple quidway [RouterA-ui-vty0-4]user privilege level 3 [RouterA-ui-vty0-4]quit [RouterA]telnet server enable
linux shell脚本语言基础知识 一.shell简介 Linux系统的shell作为操作系统的外壳,为用户提供使用操作系统的界面,更确切的说,shell是用户与Linux操作系统沟通的桥梁。用户既可以输入命令执行,又可以利用Shell脚本编程,完成更加复杂的操作。 shell是一个命令解释器,它从输入设备读取命令,再将其转为计算机可以了解的指令,然后执行它。在linux中,shell又不仅是简单的命令解释器,而且是一个全功能的编程环境。 Linux的Shell种类众多,常见的有:Bourne Shell(/usr/bin/sh或/bin/sh)、Bourne Again Shell(/bin/bash)、C Shell(/usr/bin/csh)、K Shell (/usr/bin/ksh)、Shell for Root(/sbin/sh),等等。不同的Shell语言的语法有所不同,所以不能交换使用。每种Shell都有其特色之处,基本上,掌握其中任何一种就足够了。通常用Bash,也就是Bourne Again Shell进行编程。 二.shell使用 1.建立和运行shell程序 shell脚本程序:按照一定的语法结构把若干linux命令组织在一起,是这些命令按照我们的要求完成一定的功能。它可以进行类似程序的编写,并且不需要编译就能执行。(只需修改其权限) 像编写高级语言的程序一样,编写shell程序需要一个文本编辑器,如VI和VIM,通常使用VIM文本编辑器,支持更便利的插入模式。 首先使用VIM编辑器编辑一个hello.sh文件: #!/bin/bash #hello world example
H3C交换机常用步骤和命令 1.进入命令行sys 2.给交换机命名: sysname fuwuqi2 3.创建所属vlan: vlan 114 4.描述vlan 114 及分配情况: description fuwuqi2 5.把24个口划分到vlan114中: port e 1/0/1 to e 1/0/24 6.退出: quit 7.进入vlan 114: vlan 114 8.查看千兆口信息: dis int g 9.把25,26两个千兆口加到vlan 114中: port g 1/0/25 to g 1/0/26 10.退出: quit 11.进入vlan114 : int vlan 114 12.查看本接口信息dis this 13.退出quit 14.进入vlan 114虚接口下(可以配置管理地址):interface vlan-interface 114 15.配置管理地址ip address 111.115.76.98 27 16.查看信息dis this 17.退出quit 18.配置默认路由ip route-static 0.0.0.0 0.0.0.0 111.115.76.97(分别是目 的地址子网掩码网关) 19.建立一个登陆交换机的用户名local-user fuwuqi2 20.设置登陆密码password cipher fuwuqi2_2918 21.设置用户管理等级0-3,3是超级管理员authorization-attribute level 3 22.设置用“telnet”方式登陆service-type telnet 23.退出quit 24.打开telnet服务telnet server enable 25.设置0-5共6个用户可同时远程登陆user-interface vty 0 5 26.设置用户登陆方式,scheme是用户名+密码authentication-mode scheme 27.查看当前配置信息dis this 28.查看当前所有配置dis cur 29.保存配置信息save 30.查看交换机上有哪些VLAN dis vlan 31.查看各交换机端口状态及vlan情况: dis brief int 32.将某个端口加入到某个vlan中:sys Vlan 111 Port eth 1/0/1 33.查看当前各端口流量情况: dis int 34.查看交换机上mac地址:dis mac-address 物理地址 35.查看CPU占用:dis cup 36.静态IP与MAC地址绑定(不与端口绑定): sys arp static 192.168.11.204 0005-5d02-f2b3 查询:dis arp 192.168.11.204 取消:undo arp 192.168.11.204
Shell本身是一个用C语言编写的程序,它是用户使用Linux的桥梁。Shell既是一种命令语言,又是一种程序设计语言。作为命令语言,它交互式地解释和执行用户输入的命令;作为程序设计语言,它定义了各种变量和参数,并提供了许多在高级语言中才具有的控制结构,包括循环和分支。它虽然不是Linux系统核心的一部分,但它调用了系统核心的大部分功能来执行程序、建立文件并以并行的方式协调各个程序的运行。因此,对于用户来说,shell 是最重要的实用程序,深入了解和熟练掌握shell的特性极其使用方法,是用好Linux系统的关键。可以说,shell使用的熟练程度反映了用户对Linux使用的熟练程度。 一、什么是shell 当一个用户登录Linux系统之后,系统初始化程序init就为每一个用户运行一个称为shel l(外壳)的程序。那么,shell是什么呢?确切一点说,shell就是一个命令行解释器,它为用户提供了一个向Linux内核发送请求以便运行程序的界面系统级程序,用户可以用shell 来启动、挂起、停止甚至是编写一些程序。 当用户使用Linux时是通过命令来完成所需工作的。一个命令就是用户和shell之间对话的一个基本单位,它是由多个字符组成并以换行结束的字符串。shell解释用户输入的命令,就象DOS里的https://www.doczj.com/doc/325033126.html,所做的一样,所不同的是,在DOS中,https://www.doczj.com/doc/325033126.html,只有一个,而在Linux下比较流行的shell有好几个,每个shell都各有千秋。一般的Linux系统都将bash作为默认的shell。 二、几种流行的shell 目前流行的shell有ash、bash、ksh、csh、zsh等,你可以用下面的命令来查看你自己的shell类型: #echo $SHELL $SHELL是一个环境变量,它记录用户所使用的shell类型。你可以用命令: #shell-name 来转换到别的shell,这里shell-name是你想要尝试使用的shell的名称,如ash等。这个命令为用户又启动了一个shell,这个shell在最初登录的那个shell之后,称为下级的shell或子shell。使用命令: $exit 可以退出这个子shell。 使用不同的shell的原因在于它们各自都有自己的特点,下面作一个简单的介绍: 1.ash ash shell是由Kenneth Almquist编写的,Linux中占用系统资源最少的一个小shell,它只包含24个内部命令,因而使用起来很不方便。 2.bash bash是Linux系统默认使用的shell,它由Brian Fox和Chet Ramey共同完成,是Bourne Again Shell的缩写,内部命令一共有40个。Linux使用它作为默认的shell是因为它有诸如以下的特色: (1)可以使用类似DOS下面的doskey的功能,用方向键查阅和快速输入并修改命令。 (2)自动通过查找匹配的方式给出以某字符串开头的命令。 (3)包含了自身的帮助功能,你只要在提示符下面键入help就可以得到相关的帮助。 3.ksh ksh是Korn shell的缩写,由Eric Gisin编写,共有42条内部命令。该shell最大的优点是几乎和商业发行版的ksh完全兼容,这样就可以在不用花钱购买商业版本的情况下尝试商业版本的性能了。 4.csh
H3C交换机常用配置命令 一、用户配置
H3C交换机配置命令大全 1、system-view 进入系统视图模式 2、sysname 为设备命名 3、display current-configuration 当前配置情况 4、 language-mode Chinese|English 中英文切换 5、interface Ethernet 1/0/1 进入以太网端口视图 6、 port link-type Access|Trunk|Hybrid 设置端口访问模式 7、 undo shutdown 打开以太网端口 8、 shutdown 关闭以太网端口 9、 quit 退出当前视图模式 10、 vlan 10 创建VLAN 10并进入VLAN 10的视图模式 11、 port access vlan 10 在端口模式下将当前端口加入到vlan 10中 12、port E1/0/2 to E1/0/5 在VLAN模式下将指定端口加入到当前vlan中 13、port trunk permit vlan all 允许所有的vlan通过 H3C路由器 1、system-view 进入系统视图模式 2、sysname R1 为设备命名为R1 3、display ip routing-table 显示当前路由表
4、 language-mode Chinese|English 中英文切换 5、interface Ethernet 0/0 进入以太网端口视图 6、 ip address 192.168.1.1 255.255.255.0 配置IP地址和子网掩码 7、 undo shutdown 打开以太网端口 8、 shutdown 关闭以太网端口 9、 quit 退出当前视图模式 10、 ip route-static 192.168.2.0 255.255.255.0 192.168.12.2 description To.R2 配置静态路由 11、 ip route-static 0.0.0.0 0.0.0.0 192.168.12.2 description To.R2 配 置默认的路由 H3C S3100 Switch H3C S3600 Switch H3C MSR 20-20 Router 1、调整超级终端的显示字号; 2、捕获超级终端操作命令行,以备日后查对; 3、 language-mode Chinese|English 中英文切换; 4、复制命令到超级终端命令行,粘贴到主机; 5、交换机清除配置 :
目录 (2)配置静态路由.............................................................. H3C交换机配置命令手册: 交换机端口链路类型介绍: 1. Access类型的端口只能属于1个VLAN, —般用于连接计算机的端口; 2. Trunk类型的端口可以属于多个VLAN,可以接收和发送多个VLAN的报文,一般用于交换机之间连接的端口; 3. Hybrid类型的端口可以属于多个VLAN,可以接收和发送多个VLAN的报文,可以用于交换机 之间连接,也可以用于连接用户的计算机。 认证方式为Scheme时Telnet登录方式的配置 telnet server enable
# local-user guest service-type telnet level 3 password simple 123456 # Vlan 的创建及描述 #
一.用户配置:
如何用脚本实现分割文件 #!/bin/bash if [ $# -ne 2 ]; then echo 'Usage: split file size(in bytes)' exit fi file=$1 size=$2 if [ ! -f $file ]; then echo "$file doesn't exist" exit fi #TODO: test if $size is a valid integer filesize=`/bin/ls -l $file | awk '{print $5}'` echo filesize: $filesize let pieces=$filesize/$size let remain=$filesize-$pieces*$size if [ $remain -gt 0 ]; then let pieces=$pieces+1 fi echo pieces: $pieces i=0 while [ $i -lt $pieces ]; do echo split: $file.$i: dd if=$file of=$file.$i bs=$size count=1 skip=$i let i=$i+1 done echo "#!/bin/bash" >; merge echo "i=0" >;>; merge echo "while [ $i -lt $pieces ];" >;>; merge echo "do" >;>; merge echo " echo merge: $file.$i" >;>; merge echo " if [ ! -f $file.$i ]; then" >;>; merge echo " echo merge: $file.$i missed" >;>; merge
.用户配置:
第12章 Shell 脚本编程 ● Shell 命令行的运行 ● 编写、修改权限和执行Shell 程序的步骤 ● 在Shell 程序中使用参数和变量 ● 表达式比较、循环结构语句和条件结构语句 ● 在Shell 程序中使用函数和调用其他Shell 程序 12-1 Shell 命令行书写规则 ◆ Shell 命令行的书写规则 对Shell 命令行基本功能的理解有助于编写更好的Shell 程序,在执行Shell 命令时多个命令可以在一个命令行上运行,但此时要使用分号(;)分隔命令,例如: [root@localhost root]# ls a* -l;free;df 长Shell 命令行可以使用反斜线字符(\)在命令行上扩充,例如: [root@localhost root]# echo “ this is \ >long command ” This is long command 注意: “>”符号是自动产生的,而不是输入的。 12-2 编写/修改权限及执行Shell 程序的步骤 ◆ 编写Shell 程序 ◆ 执行Shell 程序 Shell 程序有很多类似C 语言和其他程序设计语言的特征,但是又没有程序语言那样复杂。Shell 程序是指放在一个文件中的一系列Linux 命令和实用程序。在执行的时候,通过Linux 操作系统一个接一个地解释和执行每条命令。首先,来编写第一个Shell 程序,从中学习Shell 程序的编写、修改权限、执行过程。
12-2-1 编辑Shell程序 编辑一个内容如下的源程序,保存文件名为date,可将其存放在目录/bin下。 [root@localhost bin]#vi date #! /bin/sh echo “Mr.$USER,Today is:” echo &date “+%B%d%A” echo “Wish you a lucky day !” 注意: #! /bin/sh通知采用Bash解释。如果在echo语句中执行Shell命令date,则需要在date 命令前加符号“&”,其中%B%d%A为输入格式控制符。 12-2-2 建立可执行程序 编辑完该文件之后不能立即执行该文件,需给文件设置可执行程序权限。使用如下命令。[root@localhost bin]#chmod +x date 12-2-3 执行Shell程序 执行Shell程序有下面三种方法: 方法一: [root@localhost bin]#./ date Mr.root,Today is: 二月 06 星期二 Wish you a lucky day ! 方法二: 另一种执行date的方法就是把它作为一个参数传递给Shell命令: [root@localhost bin]# Bash date Mr.root,Today is: 二月 06 星期二 Wish you a lucky day ! 方法三: 为了在任何目录都可以编译和执行Shell所编写的程序,即把/bin的这个目录添加到整个环境变量中。 具体操作如下: [root@localhost root]#export PATH=/bin:$PATH [root@localhost bin]# date Mr.root,Today is: 二月 06 星期二 Wish you a lucky day !
H3C交换机配置命令大全 ##################################################################### H3C交换机 ##################################################################### 1、system-view 进入系统视图模式 2、sysname 为设备命名 3、display current-configuration 当前配置情况 4、language-mode Chinese|English 中英文切换 5、interface Ethernet 1/0/1 进入以太网端口视图 6、port link-type Access|Trunk|Hybrid 设置端口访问模式 7、undo shutdown 打开以太网端口 8、shutdown 关闭以太网端口 9、quit 退出当前视图模式 10、vlan 10 创建VLAN 10并进入VLAN 10的视图模式 11、port access vlan 10 在端口模式下将当前端口加入到vlan 10中 12、port E1/0/2 to E1/0/5 在VLAN模式下将指定端口加入到当前vlan中 13、port trunk permit vlan all 允许所有的vlan通过 ##################################################################### H3C路由器 ##################################################################### 1、system-view 进入系统视图模式 2、sysname R1 为设备命名为R1 3、display ip routing-table 显示当前路由表 4、language-mode Chinese|English 中英文切换 5、interface Ethernet 0/0 进入以太网端口视图 6、ip address 192.168.1.1 255.255.255.0 配置IP地址和子网掩码 7、undo shutdown 打开以太网端口