ヘルプ機能とコマンド補完機能
このページで解説している内容は、以下のYoutube動画の解説で見ることができます。
ヘルプ機能
IOSコマンドを全て覚えるのは大変です。
各コマンドでは、さまざまなオプションが指定可能です。コマンドのオプションまで覚えようと思うと気の遠い話になってしまいます。しかし、Cisco IOSでは、ヘルプ機能が充実しています。コマンド入力を支援する機能が以下のように用意されています。
- コマンドの一覧
- オプションの確認
- 補完機能
このヘルプ機能を使うには、分からないところで、「?」を入力します。
まず、ユーザEXECモードでどんなコマンドが入力できるのか確認してみます。
●ユーザEXECモードで入力できるコマンドの確認
Router>?
Exec commands:
<1-99> Session number to resume
connect Open a terminal connection
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
exit Exit from the EXEC
logout Exit from the EXEC
ping Send echo messages
resume Resume an active network connection
show Show running system information
ssh Open a secure shell client connection
telnet Open a telnet connection
terminal Set terminal line parameters
traceroute Trace route to destination
次に、特権モードでどんなコマンドが入力できるのか確認します。
●特権EXECモードで入力できるコマンドの確認
Router#?
Exec commands:
<1-99> Session number to resume
auto Exec level Automation
clear Reset functions
clock Manage the system clock
configure Enter configuration mode
connect Open a terminal connection
copy Copy from one file to another
debug Debugging functions (see also 'undebug')
delete Delete a file
dir List files on a filesystem
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
erase Erase a filesystem
exit Exit from the EXEC
logout Exit from the EXEC
mkdir Create new directory
more Display the contents of a file
no Disable debugging informations
ping Send echo messages
reload Halt and perform a cold restart
resume Resume an active network connection
rmdir Remove existing directory
send Send a message to other tty lines
setup Run the SETUP command facility
show Show running system information
ssh Open a secure shell client connection
telnet Open a telnet connection
terminal Set terminal line parameters
traceroute Trace route to destination
undebug Disable debugging functions (see also 'debug')
vlan Configure VLAN parameters
write Write running configuration to memory, network, or terminal
特権モードで入力できるコマンドが確認できます。
例えば、コマンドをうろ覚えしていて、「s」で始まるコマンドであるとしか思い出せなかったとします。
そこで、
Router#s?
●「s」で始まるコマンドを表示
Router#s?
send setup show ssh
「s」で始まるコマンドが表示できます。この中から、探せばいいのです。大抵は、ここまで表示されれば思い出せるはずです。
次に、オプションを思い出せなかったとします。
Router#show ?
「 ?」(スペース+?)とコマンドの続きに入力することで、次のオプション
●オプションの確認
Router#show ?
aaa Show AAA values
access-lists List access lists
arp Arp table
cdp CDP information
class-map Show QoS Class Map
clock Display the system clock
controllers Interface controllers status
crypto Encryption module
debugging State of each debugging option
dhcp Dynamic Host Configuration Protocol status
dot11 IEEE 802.11 show information
file Show filesystem information
flash: display information about flash: file system
flow Flow information
frame-relay Frame-Relay information
history Display the session command history
hosts IP domain-name, lookup style, nameservers, and host table
interfaces Interface status and configuration
ip IP information
ipv6 IPv6 information
license Show license information
line TTY line information
lldp LLDP information
logging Show the contents of logging buffers
login Display Secure Login Configurations and State
mac-address-table MAC forwarding table
ntp Network time protocol
parser Show parser commands
policy-map Show QoS Policy Map
pppoe PPPoE information
privilege Show current privilege level
processes Active process statistics
protocols Active network routing protocols
queue Show queue contents
queueing Show queueing configuration
running-config Current operating configuration
secure Show secure image and configuration archive
sessions Information about Telnet connections
snmp snmp statistics
spanning-tree Spanning tree topology
ssh Status of SSH server connections
standby standby configuration
startup-config Contents of startup configuration
storm-control Show storm control configuration
tcp Status of TCP connections
tech-support Show system information for Tech-Support
terminal Display terminal configuration parameters
users Display information about terminal lines
version System hardware and software status
vlan-switch VTP VLAN status
vtp Configure VLAN database
zone Zone Information
zone-pair Zone pair information
これだと、候補が多すぎて迷うかもしれません。覚えているところまで、入力すれば、候補を絞ることができます。
例えば、
Router#show c?
と入力すると、「show」コマンドで「c」で始まるオプションを表示してくれます。
●「show」コマンドで「c」で始まるオプション
Router#show c?
cdp class-map clock controllers crypto
補完機能
コマンドの入力に慣れてくるとコマンドを最後まで入力するのが面倒になってきます。IOSコマンドでは、コマンドやオプションが、入力場所で一意になる長さまで入力すればコマンドが補完されるようになっています。省略コマンドを入力しても、「show running-config」で確認するとちゃんとコマンドがフルスペルで設定されていることが確認できます。
また、入力時に「TAB」キーを押すことでも入力最中にコマンドやオプションの補完ができます。これは、スペルミス防止にとても役立ちます。
例えば、
show controllersと入力する時に、
Router#show co[TAB]と押せば
Router#show co[TAB]
Router#show controllers
show controllersと補完されます。
show c[TAB]と入力してみてください。
Router#show c[TAB]
Router#show c
show c のままだと思います。
それは、「show」コマンドのオプションで指定できるコマンドには、「c」で始まるオプションが5つあるからです。候補が2つ以上ある場合は、「TAB」で補完できません。一意(唯一)になるまでの長さを入力しなければなりません。
context
cdp
class-map
clock
controllers
crypto
ヘルプ機能を利用すれば、どんなにオプション指定が多くて長いコマンドでも最後まで入力できるかと思います。