usage常用命令
进入vi的命令
vi filename :打开或新建文件,并将光标置于第一行首
vi +n filename :打开文件,并将光标置于第n行首
vi + filename :打开文件,并将光标置于最后一行首
vi -r filename :在上次正用vi编辑时发生系统崩溃,恢复filename 移动光标类命令
命令模式下直接用光标移动
复制粘贴等操作可以直接用鼠标操作
h :光标左移一个字符
l :光标右移一个字符
space:光标右移一个字符
Backspace:光标左移一个字符
k或Ctrl+p:光标上移一行
j或Ctrl+n :光标下移一行
Enter :光标下移一行
w或W :光标右移一个字至字首
b或B :光标左移一个字至字首
e或E :光标右移一个字至字尾
) :光标移至句尾
( :光标移至句首
}:光标移至段落开头
{:光标移至段落结尾
nG:光标移至第n行首
n+:光标下移n行
n-:光标上移n行
n$:光标移至第n行尾
H :光标移至屏幕顶行
M :光标移至屏幕中间行
L :光标移至屏幕最后行
0:(注意是数字零)光标移至当前行首
$:光标移至当前行尾
屏幕翻滚类命令
Ctrl+u:向文件首翻半屏
Ctrl+d:向文件尾翻半屏
Ctrl+f:向文件尾翻一屏
Ctrl+b;向文件首翻一屏
nz:将第n行滚至屏幕顶部,不指定n时将当前行滚至屏幕顶部。
插入文本类命令
i :在光标前
I :在当前行首
a:光标后
A:在当前行尾
o:在当前行之下新开一行
O:在当前行之上新开一行
r:替换当前字符
R:替换当前字符及其后的字符,直至按ESC键
s:从当前光标位置处开始,以输入的文本替代指定数目的字符S:删除指定数目的行,并以所输入文本代替之
ncw或nCW:修改指定数目的字
nCC:修改指定数目的行
删除命令
ndw或ndW:删除光标处开始及其后的n-1个字
do:删至行首
d$:删至行尾
ndd:删除当前行及其后n-1行
x或X:删除一个字符,x删除光标后的,而X删除光标前的
Ctrl+u:删除输入方式下所输入的文本
搜索及替换命令
/pattern:从光标开始处向文件尾搜索pattern
?pattern:从光标开始处向文件首搜索pattern
n:在同一方向重复上一次搜索命令
N:在反方向上重复上一次搜索命令
:s/p1/p2/g:将当前行中所有p1均用p2替代
:n1,n2s/p1/p2/g:将第n1至n2行中所有p1均用p2替代
:g/p1/s//p2/g:将文件中所有p1均用p2替换
选项设置
all:列出所有选项设置情况
term:设置终端类型
ignorance:在搜索中忽略大小写
list:显示制表位(Ctrl+I)和行尾标志($)
number:显示行号
report:显示由面向行的命令修改过的数目
terse:显示简短的警告信息
warn:在转到别的文件时若没保存当前文件则显示NO write信息nomagic:允许在搜索模式中,使用前面不带“\”的特殊字符nowrapscan:禁止vi在搜索到达文件两端时,又从另一端开始mesg:允许vi显示其他用户用write写到自己终端上的信息
最后行方式命令
:n1,n2 co n3:将n1行到n2行之间的内容拷贝到第n3行下:n1,n2 m n3:将n1行到n2行之间的内容移至到第n3行下
:n1,n2 d :将n1行到n2行之间的内容删除
:w :保存当前文件
:e filename:打开文件filename进行编辑
:x:保存当前文件并退出
:q:退出vi
:q!:不保存文件并退出vi
:!command:执行shell命令command
:n1,n2 w!command:将文件中n1行至n2行的内容作为command的输入并执行之,若不指定n1,n2,则表示将整个文件内容作为command的输入
:r!command:将命令command的输出结果放到当前行
VI常用技巧
VI命令可以说是Unix/Linux世界里最常用的编辑文件的命令了,但是因为它的命令集众多,很多人都不
习惯使用它,其实您只需要掌握基本命令,然后加以灵活运用,就会发现它的优势,并会逐渐喜欢使用这
种方法。
本文旨在介绍VI的一些最常用命令和高级应用技巧。
一、基本命令介绍
---- 1.光标命令
k、j、h、l——上、下、左、右光标移动命令。
虽然您可以在Linux中使用键盘右边的4个光标键,但是
记住这4个命令还是非常有用的。
这4个键正是右手在键盘上放置的基本位置。
nG——跳转命令。
n为行数,该命令立即使光标跳到指定行。
Ctrl+G——光标所在位置的行数和列数报告。
w、b——使光标向前或向后跳过一个单词。
---- 2.编辑命令
i、a、r——在光标的前、后以及所在处插入字符命令(i=insert、a=append、r=replace)。
cw、dw——改变(置换)/删除光标所在处的单词的命令 (c=change、d=delete)。
x、d$、dd——删除一个字符、删除光标所在处到行尾的所有字符以及删除整行的命令。
---- 3.查找命令
---- /string、?string——从光标所在处向后或向前查找相应的字符串的命令。
---- 4.拷贝复制命令
---- yy、p——拷贝一行到剪贴板或取出剪贴板中内容的命令。
二、常见问题及应用技巧
---- 1.在一个新文件中读/etc/passwd中的内容,取出用户名部分。
---- vi file
---- :r /etc/passwd 在打开的文件file中光标所在处读入/etc/passwd
---- :%s/:.*//g 删除/etc/passwd中用户名后面的从冒号开始直到行尾的所有部分。
---- 您也可以在指定的行号后读入文件内容,例如使用命令“:3r /etc/passwd”从新文件的第3行开始读
入 /etc/passwd的所有内容。
---- 我们还可以使用以下方法删掉文件中所有的空行及以#开始的注释行。
---- #cat squid.conf.default | grep -v ^$ | grep -v ^#
---- 2.在打开一个文件编辑后才知道登录的用户对该文件没有写的权限,不能存盘,需要将所做修改存
入临时文件。
---- vi file
---- :w /tmp/1 保存所做的所有修改,也可以将其中的某一部分修改保存到临时文件,例如仅仅把第
20~59行之间的内容存盘成文件/tmp/1,我们可以键入如下命令。
---- vi file
---- :20,59w /tmp/1
---- 3.用VI编辑一个文件,但需要删除大段的内容。
---- 首先利用编辑命令“vi file”打开文件,然后将光标移到需要删除的行处按Ctrl+G显示行号,再到结尾处再按Ctrl+G,显示文件结尾的行号。
---- :23,1045d 假定2次得到的行号为23和1045,则把这期间的内容全删除,也可以在要删除的开始行和结束行中用ma、mb命令标记,然后利用“:a,bd”命令删除。
---- 4.在整个文件的各行或某几行的行首或行尾加一些字符串。
---- vi file
---- :3,$s/^/some string / 在文件的第一行至最后一行的行首插入“some string”。
---- :%s/$/some string/g 在整个文件每一行的行尾添加“some string”。
---- :%s/string1/string2/g 在整个文件中替换“string1”成“string2”。
---- :3,7s/string1/string2/ 仅替换文件中的第3行到第7行中的“string1”成“string2”。
---- 注意: 其中s为substitute,%表示所有行,g表示global。
---- 5.同时编辑2个文件,拷贝一个文件中的文本并粘贴到另一个文件中。
---- vi file1 file2
---- yy 在文件1的光标处拷贝所在行
---- :n 切换到文件2 (n=next)
---- p 在文件2的光标所在处粘贴所拷贝的行
---- :n 切换回文件1
---- 6.替换文件中的路径。
---- 使用命令“:%s#/usr/bin#/bin#g”可以把文件中所有路径/usr/bin换成/bin。
也可以使用命令“:%s//usr/bin//bin/g”实现,其中“”是转义字符,表明其后的“/”字符是具有实际意义的字符,不是分隔符。
du命令的计算单位
du命令的计算单位
du(disk usage)命令用于显示文件或目录在磁盘上的使用空间大小。
du 命令的计算单位通常以字节为基础,但为了方便查看,可以通过参数来指定不同的单位。
以下是 du 命令中常用的单位参数:
默认单位 - 字节:
du 命令默认以字节为单位,不需要额外的参数。
du -h # 以字节为单位显示磁盘使用情况
以 K(千字节)为单位:
使用 -k 参数可以以千字节为单位显示磁盘使用情况。
du -kh # 以 K 为单位显示磁盘使用情况
以 M(兆字节)为单位:
使用 -m 参数可以以兆字节为单位显示磁盘使用情况。
du -mh # 以 M 为单位显示磁盘使用情况
以 G(千兆字节)为单位:
使用 -g 参数可以以千兆字节为单位显示磁盘使用情况。
du -gh # 以 G 为单位显示磁盘使用情况
总计显示:
使用 --total 参数可以在输出的最后一行显示总计使用的空间。
du -h --total # 显示总计使用的空间
这些参数可以根据实际需求进行组合使用。
例如,du -sh 将以人类可读的格式显示目录的总大小,而 du -ah 将递归地显示所有文件和目录的大小。
shell usage用法
shell usage用法Shell是一种命令行解释器,它允许用户与操作系统进行交互,并执行各种操作。
Shell的使用方式可以从多个角度来讨论,包括基本命令、脚本编写、通配符、管道和重定向等方面。
首先,我们来看一下基本的Shell命令使用。
用户可以在Shell中输入各种命令来执行操作,比如ls命令用于列出当前目录下的文件和子目录,cd命令用于改变当前工作目录,mkdir命令用于创建新的目录等等。
这些基本命令可以帮助用户在命令行界面下进行文件管理、系统操作等。
其次,Shell还可以用于编写脚本,这样可以将一系列命令组合在一起,以便在需要时一次性执行。
用户可以使用文本编辑器编写Shell脚本文件,然后在Shell中运行这些脚本文件来完成复杂的任务。
脚本编写是Shell的重要用法之一,它可以帮助用户自动化重复的任务,提高工作效率。
除此之外,Shell还支持通配符的使用,比如""表示匹配任意字符,"?"表示匹配单个字符等。
这些通配符可以帮助用户在命令行中快速定位文件或者执行批量操作。
另外,Shell还支持管道和重定向操作。
管道可以将一个命令的输出作为另一个命令的输入,这样可以实现多个命令的组合操作。
而重定向则可以将命令的输入输出重定向到文件或者设备中,这样可以实现输入输出的灵活管理。
总的来说,Shell的使用方式非常丰富多样,用户可以通过学习基本命令、脚本编写、通配符、管道和重定向等功能来充分发挥Shell的强大功能,提高工作效率,实现更多的操作和任务。
希望这些信息对你有所帮助。
du 用法
du 用法简介du(disk usage)命令是一个Unix和类Unix系统上的实用程序,用于估计文件系统的磁盘使用情况。
它会递归地遍历文件夹并报告每个目录所占用的磁盘空间。
du 命令提供了一种快速而方便的方法来查看磁盘上的文件和文件夹的大小,帮助用户了解文件系统的结构和占用情况。
语法du命令的基本语法如下:du [选项] [文件夹路径]常用选项•-h:以人类可读的格式显示磁盘使用量,例如使用KB、MB、GB等单位。
•-s:仅显示总的磁盘使用量,不显示每个目录的详细信息。
•-c:在输出末尾显示总的磁盘使用量。
•-a:显示所有文件和目录的磁盘使用情况,而不仅仅是目录。
•-x:跳过不同文件系统的目录。
•-L:计算符号链接指向的文件的磁盘使用量,而不是链接本身。
示例以下是一些使用du命令的示例:1.显示当前目录的磁盘使用量:du2.显示指定目录的磁盘使用情况:du /path/to/directory3.以MB为单位显示指定目录的磁盘使用量:du -m /path/to/directory4.显示指定目录及其子目录的磁盘使用情况:du -h /path/to/directory5.显示指定目录的总磁盘使用量,并以人类可读的格式显示:du -sh /path/to/directory6.显示所有文件和目录的磁盘使用情况,并在输出末尾显示总磁盘使用量:du -ac /path/to/directory结论du命令是一个功能强大且灵活的工具,用于估计文件系统的磁盘使用情况。
通过组合不同的选项,我们可以以不同的格式和粒度查看磁盘使用情况,从而更好地理解文件系统的组成和占用情况。
无论是在服务器上管理磁盘空间,还是在个人电脑上查找占用大量磁盘空间的文件,du命令都能够提供有用的信息和洞察力。
通过熟练掌握du命令的用法,我们能够更好地管理和优化系统的存储空间。
Mac命令行文件夹大小查询技巧如何查看文件夹的大小信息
Mac命令行文件夹大小查询技巧如何查看文件夹的大小信息在Mac命令行中,有几种方法可以查询文件夹的大小信息。
通过这些技巧,你可以快速了解文件夹的大小,以便更好地管理存储空间。
下面将介绍三种常用的方法:使用du命令、使用ncdu工具和使用Finder的“显示项目大小”选项。
1. 使用du命令在命令行中使用du(disk usage)命令可以快速查询文件夹的大小信息。
打开终端应用程序,并按照以下格式输入命令:```du -sh <文件夹路径>```其中,-s选项表示只显示总大小,-h选项表示以人类可读的方式显示文件大小。
例如,想要查询“Documents”文件夹的大小,可以输入:```du -sh ~/Documents```命令执行后,终端会显示该文件夹的大小信息,如:“2.4G /Users/用户名/Documents”。
2. 使用ncdu工具ncdu(NCurses Disk Usage)是一款在命令行中使用的交互式磁盘使用情况分析工具。
它可以提供更详细的文件夹大小信息,并以可视化的方式呈现。
首先,需要安装ncdu。
打开终端应用程序,并输入以下命令:```brew install ncdu```安装完成后,可以使用ncdu命令查询文件夹的大小信息。
在终端中输入以下命令:```ncdu <文件夹路径>```ncdu会递归地扫描指定文件夹及其子文件夹,并显示每个文件夹的大小。
3. 使用Finder的“显示项目大小”选项除了命令行方式,你也可以使用Finder来查看文件夹的大小信息。
Finder是Mac上的默认文件管理器。
首先,打开Finder应用程序,并导航到你要查询大小的文件夹。
然后按下快捷键“Command + i”(或在菜单栏中选择“文件”>“显示简介”)打开文件夹的信息窗口。
在信息窗口中,你会看到一个“大小”字段,显示了文件夹的大小。
点击旁边的“显示项目大小”链接,Finder将计算文件夹及其内容的准确大小,并显示在窗口中。
usage和use的用法 -回复
usage和use的用法-回复Usage和use都是表示使用的意思,但在具体用法和含义上有所区别。
首先,我们来看看usage的用法。
Usage是一个名词,表示使用的方式、方法或途径。
它常常指的是某个事物的使用习惯、规定或指导方针。
我们可以用usage来表达某个事物的典型用法或常见用法。
例如:“The usage of cell phones has become widespread in modern society.”(在现代社会中,手机的使用已经变得非常普遍。
)这句话中的usage指的是手机的典型用法,即人们使用手机进行通信和获取信息的方式。
此外,我们还可以用usage来强调某个规定或指导方针。
例如:“This software program is subject to the terms and usage conditions specified in the license agreement.”(这个软件程序必须遵守许可协议中规定的条款和使用条件。
)这里的usage指的是软件的使用规定,即用户必须遵守许可协议中指定的使用方式。
接下来,让我们来看看use的用法。
Use是一个动词,表示使用、运用或利用某个事物。
它与usage的区别在于,use更加强调的是行动和动作本身。
我们可以用use来描述某个人或物体使用某种工具或设备的动作。
例如:“She used a knife to cut the cake into slices.”(她用刀子把蛋糕切成了片。
)这句话中的use指的是她使用刀子的动作,即切蛋糕的动作。
此外,我们还可以用use来表示运用某种方法或手段。
例如:“He used his persuasive skills to convince the audience.”(他运用说服技巧来说服听众。
)这里的use指的是他运用说服技巧的手段,即使用说服技巧来说服听众的方法。
此外,use还可以表示利用某个事物或资源。
ipmitool工具常用命令汇总
ipmitool工具常用命令汇总目录1、工具得安装 (2)2、命令得help (2)3、查瞧管理口得IP地址 (5)4、管理底盘chassis配置 (6)4、1查瞧底盘配置汇总 (6)4、2管理电源 (7)4、3管理时间间隔 (7)4、4管理电源恢复策略 (8)4、5查瞧上次重启原因 (8)4、6查询上电时间 (8)4、7管理启动项 (8)4、8设置启动项得参数 (9)5、使用delloem进行管理 (10)5、1配置lcd (10)5、2查瞧MAC地址 (11)5、3设置lan得模式 (12)5、4设置背板led得状态 (13)5、5管理电源监控 (13)6、查瞧传感器数据sensor (14)6、1查瞧当前系统所有得传感器数据 (14)6、2设置传感器得告警阈值 (14)6、3查瞧某一传感器得状态信息 (15)6、4查瞧某一个传感器得当前值 (16)7、管理传感器仓库sdr (16)7、1查瞧传感器仓库中得信息列表 (17)7、2查瞧传感器得类型与指定类型得数据 (18)7、3查瞧指定传感器得配置信息 (20)7、4查瞧传感器仓库sdr得配置信息 (21)8、查瞧系统事件sel日志 (22)8、1查瞧sel得状态信息 (22)8、2查瞧sel得中得日志信息 (22)1、工具得安装yum install -y OpenIPMI ipmitool开启服务/etc/init、d/ipmi status/etc/init、d/ipmi start[root@cell83 ~]# ipmitool -Vipmitool version 1、8、182、命令得help明细得命令参考man ipmitool或者附件ipmitool、help[root@cell83 ~]# ipmitool -hipmitool version 1、8、18usage: ipmitool [options、、、] <mand>-h This help-V Show version information-v Verbose (can use multiple times)-c Display output in ma 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 munication Channel (OEM)-S sdr Use local remote SDR cache-D tty:b[:s] Specify the serial device, baud rate to useand, 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 mands-o oemtype Setup for OEM (use 'list' to see available OEM types) -O seloem Use 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 Interfacelan IPMI v1、5 LAN Interfacelanplus IPMI v2、0 RMCP+ LAN Interfaceserial-terminal Serial Interface, Terminal Modeserial-basic Serial Interface, Basic Modeusb IPMI USB Interface(OEM Interface for AMI Devices)mands:raw Send a RAW IPMI request and print responsei2c Send an I2C Master Write-Read mand and print responsespd Print SPD info from remote I2C devicelan Configure LAN Channelschassis Get chassis status and set power statepower Shortcut to chassis power mandsevent Send pre-defined events to MCmc Management Controller status and global enablessdr Print Sensor Data Repository entries and readingssensor Print detailed sensor informationfru Print built-in FRU and scan SDR for FRU locatorsgendev Read/Write Device associated with Generic Device locators sdrsel Print System Event Log (SEL)pef Configure Platform Event Filtering (PEF)sol Configure and connect IPMIv2、0 Serial-over-LANtsol Configure and connect with Tyan IPMIv1、5 Serial-over-LANisol Configure IPMIv1、5 Serial-over-LANuser Configure Management Controller userschannel Configure Management Controller channelssession Print session informationdcmi Data Center Management Interfacenm Node Manager Interfacesunoem OEM mands for Sun serverskontronoem OEM mands for Kontron devicespicmg Run a PICMG/ATCA extended cmdfwum Update IPMC using Kontron OEM Firmware Update Manager firewall Configure Firmware Firewalldelloem OEM mands for Dell systemsshell Launch interactive IPMI shellexec Run list of mands from fileset Set runtime variable for shell and exechpm Update HPM ponents using PICMG HPM、1 fileekanalyzer run FRU-Ekeying analyzer using FRU filesime Update Intel Manageability Engine Firmwarevita Run a VITA 46、11 extended cmdlan6 Configure IPv6 LAN Channels3、查瞧管理口得IP地址[root@cell83 ~]# ipmitool -I open lan print[root@cell83 ~]# ipmitool -I open lan print | grep IPIP Address Source : Static AddressIP Address : 192、168、0、133IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10 Default Gateway IP : 192、168、0、1Backup Gateway IP : 0、0、0、04、管理底盘chassis配置[root@cell83 ~]# ipmitool -I open chassis helpChassis mands: status, power, identify, policy, restart_cause, poh, bootdev, bootparam, selftest4、1查瞧底盘配置汇总[root@cell83 ~]# ipmitool -I open chassis statusSystem Power : onPower Overload : falsePower Interlock : inactiveMain Power Fault : falsePower Control Fault : falsePower Restore Policy : previousLast Power Event :Chassis Intrusion : inactiveFront-Panel Lockout : inactiveDrive Fault : falseCooling/Fan Fault : falseSleep Button Disable : not allowedDiag Button Disable : allowedReset Button Disable : not allowedPower Button Disable : allowedSleep Button Disabled: falseDiag Button Disabled : trueReset Button Disabled: falsePower Button Disabled: false4、2管理电源查瞧当前电源状态[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 diagipmitool -I open chassis power soft4、3管理时间间隔查询时间间隔:[root@cell83 ~]# ipmitool -I open chassis identify Chassis identify interval: default (15 seconds)设置时间间隔:[root@cell83 ~]# ipmitool -I open chassis identify help chassis identify <interval>default is 15 seconds0 to turn offforce to turn on indefinitely4、4管理电源恢复策略[root@cell83 ~]# ipmitool -I open chassis policy helpchassis policy <state>list : return supported policiesalways-on : turn on when power is restoredprevious : return to previous state when power is restored always-off : stay off after power is restored4、5查瞧上次重启原因[root@cell83 ~]# ipmitool -I open chassis restart_causeSystem restart cause: unknown4、6查询上电时间[root@cell83 ~]# ipmitool -I open chassis pohGet Chassis Power-On-Hours failed: Invalid mand4、7管理启动项[root@cell83 ~]# ipmitool -I open chassis bootdev helpbootdev <device> [clear-cmos=yes|no]bootdev <device> [options=help,、、、]none : Do not change boot device orderpxe : Force PXE bootdisk : Force boot from default Hard-drivesafe : Force boot from default Hard-drive, request Safe Modediag : Force boot from Diagnostic Partitioncdrom : Force boot from CD/DVDbios : Force boot into BIOS Setupfloppy: Force boot from Floppy/primary removable media4、8设置启动项得参数[root@cell83 ~]# ipmitool -I open chassis bootparam helpbootparam get <param #>bootparam set bootflag <device> [options=、、、]Legal devices are:none : No overrideforce_pxe : Force PXE bootforce_disk : Force boot from default Hard-driveforce_safe : Force boot from default Hard-drive, request Safe Modeforce_diag : Force boot from Diagnostic Partitionforce_cdrom : Force boot from CD/DVDforce_bios : Force boot into BIOS SetupLegal options are:help : print this messagePEF : Clear valid bit on reset/power cycle cause by PEFtimeout : Automatically clear boot flag valid bit on timeoutwatchdog: Clear valid bit on reset/power cycle cause by watchdogreset : Clear valid bit on push button reset/soft resetpower : Clear valid bit on power up via power push button or wake event Any Option may be prepended with no- to invert sense of operation5、使用delloem进行管理查瞧帮助[root@cell83 ~]# ipmitool -I open delloem helpusage: delloem <mand> [option、、、]mands:lcdmaclansetledpowermonitorvFlashFor help on individual mands type:delloem <mand> help5、1配置lcd[root@cell83 ~]# ipmitool -I open delloem lcd helpGeneric DELL HW:lcd set {none}|{default}|{custom <text>}Set LCD text displayed during non-fault conditionsiDRAC 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}<text>Allows you to set the LCD display mode to any of the precedingparameterslcd 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 infoShow LCD text that is displayed during non-fault conditionslcd set vkvm{active}|{inactive}Set vKVM active and inactive, message will be displayed on lcdwhen vKVM is active and vKVM session is in progresslcd set frontpanelaccess {viewandmodify}|{viewonly}|{disabled}Set LCD mode to view and modify, view only or disabledlcd statusShow LCD Status for vKVM display<active|inactive>and Front Panel access mode {viewandmodify}|{viewonly}|{disabled}5、2查瞧MAC地址[root@cell83 ~]# ipmitool -I open delloem mac helpmac listLists the MAC address of LOMsmac get <NIC number>Shows the MAC address of specified LOM、 0-7 System LOM, 8- DRAC/iDRAC、[root@cell83 ~]# ipmitool -I open delloem mac listSystem LOMsNIC Number MAC Address Status0 b8:2a:72:db:56:2a Enabled1 b8:2a:72:db:56:2b Enabled2 b8:2a:72:db:56:28 Enabled3 b8:2a:72:db:56:29 EnablediDRAC7 MAC Address b0:83:fe:c9:6d:315、3设置lan得模式[root@cell83 ~]# ipmitool -I open delloem lan helplan set <Mode>sets the NIC Selection Mode :on iDRAC12g OR iDRAC13g :dedicated, shared with lom1, shared with lom2,shared with lom3,sharedwith lom4,shared with failover lom1,shared with failover lom2,sharedwith failover lom3,shared with failover lom4,shared with Failover allloms, shared with Failover None)、on other systems :dedicated, shared, shared with failover lom2,shared with Failover all loms、lan geton iDRAC12g or iDRAC13g :returns the current NIC Selection Mode (dedicated, shared with lom1, sharedwith lom2, shared with lom3, shared with lom4,shared with failover lom1,shared with failover lom2,shared with failover lom3,shared with failoverlom4,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 activereturns the current active NIC (dedicated, LOM1, LOM2, LOM3, LOM4)、5、4设置背板led得状态[root@cell83 ~]# ipmitool -I open delloem setled helpsetled <b:d、f> <state、、>Set backplane LED stateb:d、f = PCI Bus:Device、Function of drive (lspci format)state = present|online|hotspare|identify|rebuilding|fault|predict|critical|failed5、5管理电源监控[root@cell83 ~]# ipmitool -I open delloem powermonitor helppowermonitorShows power tracking statisticspowermonitor clear cumulativepowerReset cumulative power readingpowermonitor clear peakpowerReset peak power readingpowermonitor powerconsumptionDisplays power consumption in <watt|btuphr>powermonitor powerconsumptionhistory <watt|btuphr>Displays power consumption historypowermonitor getpowerbudgetDisplays power cap in <watt|btuphr>powermonitor setpowerbudget <val><watt|btuphr|percent>Allows user to set the power cap in <watt|BTU/hr|percentage> powermonitor enablepowercapTo enable set power cappowermonitor disablepowercapTo disable set power cap6、查瞧传感器数据sensor[root@cell83 ~]# ipmitool -I open sensor helpSensor mands: list thresh get reading6、1查瞧当前系统所有得传感器数据[root@cell83 ~]# ipmitool -I open sensor list6、2设置传感器得告警阈值[root@cell83 ~]# ipmitool -I open sensor thresh helpsensor thresh <id> <threshold> <setting>id : name of the sensor for which threshold is to be set threshold : which threshold to setunr = upper non-recoverableucr = upper criticalunc = upper non-criticallnc = lower non-criticallcr = lower criticallnr = lower non-recoverablesetting : the value to set the threshold tosensor thresh <id> lower <lnr> <lcr> <lnc>Set all lower thresholds at the same time sensor thresh <id> upper <unc> <ucr> <unr>Set all upper thresholds at the same time6、3查瞧某一传感器得状态信息[root@cell83 ~]# ipmitool -I open sensor get help sensor get <id> 、、、 [id]id : name of desired sensor查瞧温度传感器[root@cell83 ~]# ipmitool -I open sensor get Temp Locating sensor record、、、Sensor ID : Temp (0xe)Entity ID : 3、1Sensor Type (Threshold) : TemperatureSensor Reading : 48 (+/- 1) degrees CStatus : okLower Non-Recoverable : naLower Critical : 3、000Lower Non-Critical : 8、000Upper Non-Critical : 79、000Upper Critical : 84、000Upper Non-Recoverable : naPositive Hysteresis : 1、000Negative Hysteresis : 1、000Assertion Events :Assertions Enabled :6、4查瞧某一个传感器得当前值[root@cell83 ~]# ipmitool -I open sensor reading helpsensor reading <id> 、、、 [id]id : name of desired sensor查瞧温度传感器[root@cell83 ~]# ipmitool -I open sensor reading TempTemp | 477、管理传感器仓库sdr[root@cell83 ~]# ipmitool -I open sdr helpusage: sdr <mand> [options]list | elist [option]all All SDR Recordsfull Full Sensor Recordpact pact Sensor Recordevent Event-Only Sensor Recordmcloc Management Controller Locator Recordfru FRU Locator Recordgeneric Generic Device Locator Recordtype [option]<Sensor_Type> Retrieve the state of specified sensor、 Sensor_Type can be specified either asa string or a hex value、list Get a list of available sensor typesget <Sensor_ID>Retrieve state of the first sensor matched by Sensor_IDinfoDisplay information about the repository itselfentity <Entity_ID>[、<Instance_ID>]Display all sensors associated with an entitydump <file>Dump raw SDR data to a filefill <option>sensors Creates the SDR repository for the current configurationnosat Creates the SDR repository for the current configuration, without satellite scanfile <file> Load SDR repository from a filerange <range> Load SDR repository from a provided list or range、 Use ',' for list or '-' forrange, eg、 0x28,0x32,0x40-0x447、1查瞧传感器仓库中得信息列表[root@cell83 ~]# ipmitool -I open sdr elist helpusage: sdr elist [all|full|pact|event|mcloc|fru|generic]=>查瞧仓库中所有得信息:elist与list得格式内容上略有不同[root@cell83 ~]# ipmitool -I open sdr elist all[root@cell83 ~]# ipmitool -I open sdr list all=>查瞧传感器得数据[root@cell83 ~]# ipmitool -I open sdr elist fullFan1 RPM | 30h | ok | 7、1 | 6240 RPMFan2 RPM | 31h | ok | 7、1 | 6240 RPMFan3 RPM | 32h | ok | 7、1 | 6240 RPMFan4 RPM | 33h | ok | 7、1 | 6120 RPMFan5 RPM | 34h | ok | 7、1 | 6240 RPMFan6 RPM | 35h | ok | 7、1 | 6240 RPMInlet Temp | 04h | ok | 7、1 | 35 degrees CExhaust Temp | 01h | ok | 7、1 | 40 degrees CTemp | 0Eh | ok | 3、1 | 47 degrees CTemp | 0Fh | ok | 3、2 | 46 degrees CCurrent 1 | 6Ah | ok | 10、1 | 0、80 AmpsCurrent 2 | 6Bh | ns | 10、2 | No ReadingVoltage 1 | 6Ch | ok | 10、1 | 236 VoltsVoltage 2 | 6Dh | ns | 10、2 | No ReadingPwr Consumption | 77h | ok | 7、1 | 168 Watts说明:Fan ----表示风扇Inlet Temp ----进口温度Exhaust Temp ----出口温度Temp ----CPU得温度Current --电流Voltage ---电压Pwr Consumption ----功率7、2查瞧传感器得类型与指定类型得数据查瞧传感器有哪些类型[root@cell83 ~]# ipmitool -I open sdr type listSensor Types:Temperature (0x01) Voltage (0x02) Current (0x03) Fan (0x04)Physical Security (0x05) Platform Security (0x06) Processor (0x07) Power Supply (0x08) Power Unit (0x09) Cooling Device (0x0a) Other (0x0b) Memory (0x0c) Drive Slot / Bay (0x0d) POST Memory Resize (0x0e) System Firmwares (0x0f) Event Logging Disabled (0x10) Watchdog1 (0x11) System Event (0x12) Critical Interrupt (0x13) Button (0x14) Module / Board (0x15) Microcontroller (0x16) Add-in Card (0x17) Chassis (0x18) Chip Set (0x19) Other FRU (0x1a) Cable / Interconnect (0x1b) Terminator (0x1c) System Boot Initiated (0x1d) Boot Error (0x1e) OS Boot (0x1f) OS Critical Stop (0x20) Slot / Connector (0x21) System ACPI Power State (0x22) Watchdog2 (0x23) Platform Alert (0x24) Entity Presence (0x25) Monitor ASIC (0x26) LAN (0x27) Management Subsys Health (0x28) Battery (0x29) Session Audit (0x2a) Version Change (0x2b) FRU State (0x2c) 查瞧指定传感器得数据如查瞧温度:[root@cell83 ~]# ipmitool -I open sdr type TemperatureInlet Temp | 04h | ok | 7、1 | 35 degrees CExhaust Temp | 01h | ok | 7、1 | 40 degrees CTemp | 0Eh | ok | 3、1 | 46 degrees CTemp | 0Fh | ok | 3、2 | 47 degrees C如查瞧电源得个数1:有一个电源[root@cell83 dvd]# ipmitool -I open sdr type "Power Supply"PS Redundancy | 74h | ns | 7、1 | No ReadingStatus | 62h | ok | 10、1 | Presence detectedStatus | 63h | ns | 10、2 | Disabled如查瞧电源得个数2:有四个电源[root@db04 ~]# ipmitool -I open sdr type "Power Supply"PS Redundancy | 74h | ok | 7、1 | Redundancy LostStatus | 62h | ok | 10、1 | Presence detectedStatus | 63h | ok | 10、2 | Presence detected, Power Supply AC lostStatus | 52h | ok | 10、3 | Presence detected, Config Error, Power Supply InactiveStatus | 53h | ok | 10、4 | Presence detected, Config Error, Power Supply Inactive7、3查瞧指定传感器得配置信息[root@cell83 ~]# ipmitool -I open sdr get TempSensor ID : Temp (0xe)Entity ID : 3、1 (Processor)Sensor Type (Threshold) : Temperature (0x01)Sensor Reading : 47 (+/- 1) degrees CStatus : okNominal Reading : 23、000Normal Minimum : 11、000Normal Maximum : 69、000Upper critical : 83、000Upper non-critical : 77、000Lower critical : 3、000Lower non-critical : 8、000Positive Hysteresis : 1、000Negative Hysteresis : 1、000Minimum sensor range : UnspecifiedMaximum sensor range : UnspecifiedEvent Message Control : Per-thresholdReadable Thresholds : No ThresholdsSettable Thresholds : No ThresholdsAssertion Events :Assertions Enabled :7、4查瞧传感器仓库sdr得配置信息[root@cell83 ~]# ipmitool -I open sdr infoSDR Version : 0x51Record Count : 170Free Space : 1836 bytesMost recent Addition : 02/07/2106 06:28:15 Most recent Erase : 02/07/2106 06:28:15 SDR overflow : noSDR Repository Update Support : modalDelete SDR supported : noPartial Add SDR supported : noReserve SDR repository supported : yesSDR Repository Alloc info supported : no8、查瞧系统事件sel日志[root@cell83 ~]# ipmitool -I open sel helpSEL mands: info clear delete list elist get add time save readraw writeraw interpret8、1查瞧sel得状态信息[root@cell83 ~]# ipmitool -I open sel info helpSEL InformationVersion : 1、5 (v1、5, v2 pliant)Entries : 740Free Space : 4544 bytesPercent Used : 72%Last Add Time : 08/27/2018 08:48:29Last Del Time : 09/13/2014 11:16:12Overflow : falseSupported Cmds : 'Reserve'8、2查瞧sel得中得日志信息ipmitool -I open sel list | elistWhen this mand is invoked without arguments, the entire contents of the System Event Log are displayed、 If invoked as elist (extended list) it will also use the Sensor Data Record entries to display the sensor ID for the sensor that caused each event、 Note this can take a long time over the system interface、<count> | first <count>Displays the first count (least-recent) entries in the SEL、 If count is zero, all entries are displayed、last <count>Displays the last count (most-recent) entries in the SEL、 If count is zero, all entries are displayed、查瞧前5条[root@cell83 ~]# ipmitool -I open sel elist first 51 | 09/13/2014 | 11:16:12 | Event Logging Disabled SEL | Log area reset/cleared | Asserted2 | 10/15/2014 | 13:42:04 | Physical Security Intrusion | General Chassis intrusion () | Asserted3 | 10/15/2014 | 13:42:09 | Physical Security Intrusion | General Chassis intrusion () | Deasserted4 | 10/16/2014 | 12:08:20 | Physical Security Intrusion | General Chassis intrusion () | Asserted5 | 10/16/2014 | 12:08:49 | Physical Security Intrusion | General Chassis intrusion () | Deasserted查瞧后5条[root@cell83 ~]# ipmitool -I open sel elist last 52e0 | 08/02/2018 | 01:45:10 | Physical Security Intrusion | General Chassis intrusion () | Deasserted2e1 | 08/04/2018 | 04:11:34 | OS Boot | Installation started | Asserted2e2 | 08/04/2018 | 04:21:03 | OS Boot | Installation pleted | Asserted2e3 | 08/27/2018 | 08:48:24 | Physical Security Intrusion | General Chassis intrusion () | Asserted2e4 | 08/27/2018 | 08:48:29 | Physical Security Intrusion | General Chassis intrusion () | Deasserted。
四个常用网络测试命令
四个常⽤⽹络测试命令四个常⽤的⽹络测试命令了解和掌握下⾯⼏个命令将会有助于更快地检测到⽹络故障所在,从⽽节省时间,提⾼效率。
⼀、PingPing是测试⽹络联接状况以及信息包发送和接收状况⾮常有⽤的⼯具,是⽹络测试最常⽤的命令。
Ping向⽬标主机(地址)发送⼀个回送请求数据包,要求⽬标主机收到请求后给予答复,从⽽判断⽹络的响应时间和本机是否与⽬标主机(地址)联通。
如果执⾏Ping不成功,则可以预测故障出现在以下⼏个⽅⾯:1.⽹线故障2.⽹络适配器配置不正确3.IP地址不正确4.如果执⾏Ping成功⽽⽹络仍⽆法使⽤,那么问题很可能出在⽹络系统的软件配置⽅⾯,Ping成功只能保证本机与⽬标主机间存在⼀条连通的物理路径。
Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS][-r count] [-s count] [[-j host-list] | [-k host-list]][-w timeout] target_nameOptions:-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.-a Resolve addresses to hostnames.-n count Number of echo requests to send.-l size Send buffer size.-f Set Don't Fragment flag in packet.-i TTL Time To Live.-v TOS Type Of Service.-r count Record route for count hops.-s count Timestamp for count hops.-j host-list Loose source route along host-list.-k host-list Strict source route along host-list.-w timeout Timeout in milliseconds to wait for each reply.命令格式:ping IP地址或主机名 [-t] [-a] [-n count] [-l size] 参数含义:-t 不停地向⽬标主机发送数据;-a 以IP地址格式来显⽰⽬标主机的⽹络地址;-n count 指定要Ping多少次,具体次数由count来指定;-l size 指定发送到⽬标主机的数据包的⼤⼩。
批处理文件语法
批处理文件语法批处理文件是无格式的文本文件,它包含一条或多条命令。
它的文件扩展名为 .bat 或 .cmd。
在命令提示下键入批处理文件的名称,或者双击该批处理文件,系统就会调用Cmd.exe按照该文件中各个命令出现的顺序来逐个运行它们。
使用批处理文件(也被称为批处理程序或脚本),可以简化日常或重复性任务。
当然我们的这个版本的主要内容是介绍批处理在入侵中一些实际运用,例如我们后面要提到的用批处理文件来给系统打补丁、批量植入后门程序等。
下面就开始我们批处理学习之旅吧。
一.简单批处理内部命令简介1.Echo 命令打开回显或关闭请求回显功能,或显示消息。
如果没有任何参数,echo 命令将显示当前回显设置。
语法echo [{on off}] [message]Sample:@echo off / echo hello world在实际应用中我们会把这条命令和重定向符号(也称为管道符号,一般用> >> ^)结合来实现输入一些命令到特定格式的文件中.这将在以后的例子中体现出来。
2.@ 命令表示不显示@后面的命令,在入侵过程中(例如使用批处理来格式化敌人的硬盘)自然不能让对方看到你使用的命令啦。
Sample:@echo off@echo Now initializing the program,please wait a minite...@format X: /q/u/autoset (format 这个命令是不可以使用/y这个参数的,可喜的是微软留了个autoset这个参数给我们,效果和/y是一样的。
)3.Goto 命令指定跳转到标签,找到标签后,程序将处理从下一行开始的命令。
语法:goto label (label是参数,指定所要转向的批处理程序中的行。
)Sample:if {%1}=={} goto noparmsif {%2}=={} goto noparms(如果这里的if、%1、%2你不明白的话,先跳过去,后面会有详细的解释。
darwin 操作系统 常用的命令
darwin 操作系统常用的命令Darwin是一种开放源代码的类Unix操作系统内核,它作为苹果公司macOS和iOS操作系统的基础。
Darwin提供了许多常用的命令,可以用于管理和操作系统上的各种任务。
下面是一些常用的Darwin操作系统命令,介绍它们的功能和用法。
1. ls(list):列出目录中的文件和子目录。
用法示例:ls -l,显示文件和目录的详细列表;ls -a,显示所有文件,包括隐藏文件。
2. cd(change directory):切换当前工作目录。
用法示例:cd [目录路径],进入指定的目录;cd ..,返回上一级目录。
3. pwd(print working directory):显示当前工作目录的路径。
4. mkdir(make directory):创建新目录。
用法示例:mkdir [目录名],在当前目录下创建一个新的目录。
5. rmdir(remove directory):删除空目录。
用法示例:rmdir [目录名],删除指定的空目录。
6. cp(copy):复制文件和目录。
用法示例:cp [源文件路径] [目标文件路径],将源文件复制到目标位置。
7. mv(move):移动文件和目录,也可以用来重命名文件。
用法示例:mv [源文件路径] [目标文件路径],将源文件移动到目标位置。
8. rm(remove):删除文件和目录。
用法示例:rm [文件路径],删除指定的文件;rm -r [目录路径],递归删除目录及其内容。
9. touch:创建空白文件或更改文件的访问和修改时间。
用法示例:touch [文件名],在当前目录下创建一个新的空白文件。
10. cat(concatenate):连接文件并显示其内容。
用法示例:cat [文件路径],显示指定文件的内容;cat [文件1] [文件2] >[目标文件],将文件1和文件2的内容合并到目标文件中。
11. head:显示文件的开头部分。
c语言 usage 的格式
c语言usage 的格式
在C语言中,`usage`通常是指程序的使用说明或用法信息。
这通常在程序的主函数`main()`中打印出来,以帮助用户了解如何正确使用程序。
下面是一个简单的示例,展示了如何在C语言程序中编写`usage`信息:
```c
#include <stdio.h>
int main(int argc, char *argv[]) {
// 检查命令行参数数量
if (argc != 3) {
printf("Usage: %s <input_file> <output_file>\n", argv[0]);
return 1;
}
// 程序主体...
return 0;
}
```
在这个示例中,`argc`是命令行参数的数量,`argv`是一个指向命令行参数的指针数组。
如果用户没有提供正确的参数数量(在这个例子中是3个),程序将打印出用法信息,并返回一个非零的退出码。
注意,`argv[0]`通常是程序的名称,因此我们使用它来提供程序
的名称作为用法信息的开头。
