RAD GNU/Linux Shell Reference Guide


Table of Contents

RAD GNU/Linux Shell Reference Guide
License
Thanks
Shell basics
Command prompt
Output modifiers
Keyboard shortcuts
Alt-B
Alt-D
Alt-F
Ctrl-A
Ctrl-C
Ctrl-D
Ctrl-E
Ctrl-U
Ctrl-K
Ctrl-W
Command list
backup delete
backup recover
backup restore
backup write
cancel poweroff
cancel reload
clear arp cache
clear ip table
clear ppp line
configure commit
configure download
configure editor
configure ppp chap
configure ppp limits
configure ppp pap
configure reload
disk editor
disk quota
disk register
disk unregister
exec kill
exec lvm
exit
install system
install virtual
ip ping
ip traceroute
monitor interfaces
monitor log
monitor system
poweroff
reload
set ambiguous
set autocommit
set autoreload
set date
set rootpw
show arp cache
show backup
show bridge info
show bridge macs
show bridge stp
show date
show dhcp leases
show disk quota
show hostname
show interfaces address
show interfaces statistics
show interfaces status
show ip accounting
show ip cache flow
show ip egress
show ip route
show ip table
show log
show memory
show ntp iostat
show ntp monlist
show ntp peers
show ntp reslist
show ntp sysinfo
show ppp chap
show ppp limits
show ppp pap
show ppp users
show run
show variables
show xid attributes
show xid limits
show xid processes
show xid running
virtual

RAD GNU/Linux Shell Reference Guide

License

Copyright (c) 2005 RAD GNU/Linux project, Peter V. Saveliev.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license can be found on the project homepage[1] and on the GNU site[2].

Thanks

Author acknowledges these people:

  • Lidia V. Starostina - documentation proofreading

And all the people from the RAD GNU/Linux maillists for their significant help in testing. Thank you.

Shell basics

Shell is a primary administration tool for RAD GNU/Linux. To log on to the system, one can use a local console, serial line or telnet to the router. To use a local console, connect your monitor and keyboard to the router, then press Alt-F2. You will be prompted for a login and password.

Note

Some Intel chipsets require machine to boot with a keyboard connected. Otherwise a keyboard will not be available until next reboot.

To use a serial console, connect rs232 to the first or second serial port on the RAD GNU/Linux box. Then you can use minicom, cu or something like this to login. After a successful login you will get a command prompt.

Command prompt

In the command prompt one can use TAB or ? to get command completions. Each completion is followed by a short command description. Note, that RAD GNU/Linux' shell uses compound commands like Cisco (tm) or Juniper (tm) does. It means that each command consists of one or more words and all commands are grouped by these words in a tree-like structure. So, after the first word of a command is typed, one can use autocompletion again to see if there are subsequent commands.

Output modifiers

There is the ability to filter or modify output of some shell commands. To apply an output modifier, use «|» (vertical line) and modifier name:

Example 1. An output modifier usage

rush 1# show ip accounting | include 192.168.101.87
 192.168.111.1    192.168.101.87         90        12564
 192.168.101.87   192.168.111.1         132         5396
			

Also, you can use several modifiers consecutively and their names can be abbreviated:

Example 2. The consecutive usage of several modifiers

rush 5# show ip accounting | i 192.168.101.87 | f 4 | s
2189894
			

List of modifiers (in brackets – abbreviated names):

(i) include re

include strings matches regular expression

(e) exclude re

exclude strings matches regular expression from output

(n) netcat host port

send data to host:port with a TCP connection (using netcat)

(f) field N

print only N-th column

(s) sum

try to sum output strings

(c) count

count strings

Keyboard shortcuts

Some useful keyboard shortcuts that can help to save time.

Alt-B

Move cursor backward to the start of a current word.

Alt-D

Kill a word after cursor.

Alt-F

Move cursor forward to the end of a current word.

Ctrl-A

Move cursor backward to the start of a current line.

Ctrl-C

Interrupt running program.

Ctrl-D

Exit session, must be typed in a clear line.

Ctrl-E

Move cursor forward to the end of a current line.

Ctrl-U

Kill a line before the cursor.

Ctrl-K

Kill a line after the cursor.

Ctrl-W

Kill a word before the cursor.

Command list

Each command description in the list consists of a command name, a parameter list and a short description. Parameters in [square brackets] are optional, otherwise, parameters are mandatory. Each parameter is designated with a name ("from", "virtual", etc.) or position ($1 for the first position etc.). Named parameters should be given in the command line in the form name value, positional parameters mean only value in a fixed position.

backup delete

Parameters:

  • [$1] -- name of the snapshot to be removed

Delete the saved configuration from the backup. If no snapshot name is supplied, remove the oldest snapshot.

backup recover

No parameters required

Try to load a config from a harddisk. Applicable only for normal (not-lvm etc.) partitions.

backup restore

Parameters:

  • [$1] -- name of the snapshot to load

Restore the configuration from the backup. If no snapshot name is supplied, restore the newest snapshot.

backup write

No parameters required

Write the running configuration to the backup. The system must be installed onto a harddisk before backup.

cancel poweroff

No parameters required

Cancel the system shutdown

cancel reload

No parameters required

Cancel the system reboot

clear arp cache

Parameters:

  • [$1] -- filter

Clear ARP cache entries either whole or by a filter (FIXME)

clear ip table

Parameters:

  • [$1] -- table name, may be one of filter, nat or mangle

Clear access-list counters. If no table name is given, clear counters for the filter table.

clear ppp line

Parameters:

  • [$1] -- PPP interface name

Cancel an established PPP session

configure commit

No parameters required

Commit changes, if applicable.

configure download

Parameters:

  • from -- url to download the config from

Download the config from a web or ftp source.

configure editor

No parameters required

Start the configuration editor (vi)

configure ppp chap

No parameters required

Edit PPP chap-secrets.

configure ppp limits

No parameters required

Edit PPP shaper limits.

configure ppp pap

No parameters required

Edit PPP pap-secrets.

configure reload

Parameters:

  • [$1] -- section prefix

Reload defined by a prefix config section, or, if no prefix is given, reload the whole config.

disk editor

Parameters:

  • $1 -- disk to edit (sda, hda etc.)

Launch fdisk to edit the partition table. Disk parameter is mandatory. Disks are named by the standard GNU/Linux scheme: hda stands for the first and hdb -- the second disks on the IDE bus; sda etc. -- on the SCSI bus or SCSI-emulated devices (USB flash and so on)

disk quota

Parameters:

  • [user] -- UID or name of a user
  • [group] -- GID or name of a group
  • virtual -- virtual to be affected

Edit disk quota limits for a user or a group. Either user or group option has to be given, not both at one time.

disk register

Parameters:

  • [bus] -- bus to scan: ide or scsi

Register a new storage unit on a desired bus or scan both scsi and ide buses for devices.

disk unregister

No parameters required

Unregister a storage unit. Uniplemented function

exec kill

Parameters:

  • pid -- PID (process id) to send a signal (see show xid processes)
  • [signal] -- signal name or number to send, by default -- 15, SIGTERM

Send a signal to a selected process (dangerous). Signal names and numbers can be displayed by kill -l or trap -l in bash shell on any GNU/Linux system. Please, do not use exec kill unless you fully understand what you're doing.

exec lvm

No parameters required

Execute LVM shell. RAD GNU/Linux uses LVM2 to maintain the disk storage, so, this command gives manual acess to Logical Volume Manager for debug or maintenance. Do not use it unless you're familiar with LVM: RAD GNU/Linux authomatically does all the necessary disk-related procedures (such as disk repartitioning, formatting etc.) by disk register

exit

No parameters required

Exit the session. One can use also Ctrl-D sequence to leave the shell.

install system

Parameters:

  • [from] -- url to download a system image from

Install the system onto a hard disk. If no url is given, install an image from operating memory.

install virtual

Parameters:

  • name -- name of the virtual to be installed
  • from -- url to download virtual's rootfs tarball from

Install a virtual server from the url. All parameters are mandatory. Please, note that virtual must be defined in the committed configuration before install ...

ip ping

Parameters:

  • $1 -- host to ping

Ping a host with ICMP echoes

ip traceroute

Parameters:

  • $1 -- a host to trace the route to

Trace a route with UDP, ICMP or TCP packets. Currently only UDP trace is implemented

monitor interfaces

Parameters:

  • [$1] -- an interface to monitor

Monitor interface activity, either for selected one or for all interfaces. One can interrupt monitoring with Ctrl-C.

monitor log

No parameters required

Monitor the system log -- the analogue for tail -f /var/log/messages

monitor system

No parameters required

Trace the system activity

poweroff

Parameters:

  • $1 -- interval to apply the command in seconds or now for immediate poweroff

Shutdown the system

reload

Parameters:

  • $1 -- the same as for shutdown

Reboot the system.

Important

Syntax of this command will be changed in future releases

set ambiguous

Parameters:

  • $1 -- on|off

Set the ambiguous variable. If set, shell will try to understand incomplete commands like sho int sta and so on, as it is frequently used in Cisco TM environments.

Important

Syntax of this command will be changed in future releases

set autocommit

Parameters:

  • $1 -- on|off

Set the autocommit variable. If set, the configuration will be committed right after configure editor exit. This can be dangerous in some cases.

Important

Syntax of this command will be changed in future releases

set autoreload

Parameters:

  • $1 -- on|off

Set the autoreload variable. If it is set, the system will authomatically reboot in 5 minutes after configure commit. It can be useful when a wrong configuration has been committed.

Important

Syntax of this command will be changed in future releases

set date

Parameters:

  • $1 -- date in mmddHHMM format

Set the system date. See man date on your GNU/Linux system for details.

set rootpw

No parameters required

Set the root password. This password is stored in the local password database and is used for administrative access via telnet, ssh (in the TODO) and local console. In the case of weak password, you'll be warned. To save the password, do not forget to use backup write, otherwise the change will be lost after system restart.

show arp cache

No parameters required

Show the ARP cache. ARP (Address Resolution Protocol) cache is a database where macaddr - ipaddr correspondence is stored. Note, that it implies both MAC and IP functionality on the interface: it is meaningless for PPP interfaces and so on.

show backup

No parameters required

Show saved config versions. Snapshot names are in format of YYYYmmddHHMM, in other words, the least interval between backups is one minute. Oldest backups go first, newest ones -- the last.

show bridge info

No parameters required

Show a list of bridges.

show bridge macs

Parameters:

  • [$1] -- bridge name

Show a macaddr table either for a selected bridge or for all bridges.

show bridge stp

Parameters:

  • [$1] -- bridge name

Show STP info either for a selected bridge or for all bridges.

show date

No parameters required

Show the system date (the same as date command on other GNU/Linux systems)

show dhcp leases

Parameters:

  • [$1] -- DHCP pool name

Show offered leased lines for a selected DHCP pool or for all pools in the case when no pool selected. Obviously, you must have at least one DHCP pool defined in the configuration.

show disk quota

Parameters:

  • [for] -- mode, may be "users" or "groups"
  • [virtual] -- virtual server's name

Show installed disk quotas either for users or for groups. If no virtual name is given, show quotas for all virtual servers, otherwise show quotas only for selected virtual

show hostname

No parameters required

Show the hostname (the same as hostname command on other GNU/Linux systems)

show interfaces address

No parameters required (FIXME)

Show IP and MAC (if applicable) addresses for all existent netowrk interfaces and some other parameters such as ppp peer address, interface state and so on.

show interfaces statistics

No parameters required (FIXME)

Show interfaces statistics -- received and transmitted packets, bytes, errors and so on.

show interfaces status

No parameters required (FIXME)

Show status for all defined in the config interfaces. For interfaces, defined in the config but not existent in the system, there will be "n/a" in a status field. Dynamic interfaces like PPP are not present in the show interfaces status output.

show ip accounting

No parameters required

Show IP accounting info. One have to enable service netflow in the config first.

Important

Applicable for IPv4 only

Important

On the gateways with high traffic, IP accounting table can be very large. In this case command output can block terminal for a long time, especially on a slow terminal line. Beside of this, the service netflow loads system by itself. So, if you expect very high traffic or you have old hardware and there is no need to account IP flow, it is better to disable this service.

show ip cache flow

No parameters required

Show IP cache flow. This can be useful for network debugging. As for show ip accounting, service netflow has to be enabled.

Important

Applicable for IPv4 only

show ip egress

No parameters required (FIXME)

Show installed egress shapers for each real or virtual network interface in the system. RAD GNU/Linux uses single mechanism for any traffic shaping -- in-kernel classful queueing with HTB (Hierarhical Token Bucket) and CBQ (Class Based Queueing).

show ip route

Parameters:

  • [$1] -- ipaddr of destination
  • [table] -- name of the routing table to display

Show routing info. This command operates in two distinct modes. If the first parameter is an IP address, show ip route will show entry which is to be used to route packets to the selected address. If no IP address given, but there is table option, the command will display the named routing table. For now, only three tables are supported: main, local and default. The main routing table is maintained with ip route section of the configuration. The local routing table is maintained by kernel and is used to store authomatically calculated routes. The default table is empty. In future releases, there will be ability to define multiple routing table in configuration.

show ip table

Parameters:

  • [$1] -- iptable name

Show IP access lists. There are three tables: filter, nat and mangle. If no table name is given, the filter table will be implied.

show log

No parameters required

Show the system log. To scroll pages, use SPACE, to exit the log viewer immediately, use Q.

show memory

No parameters required

Show system memory information. Note, that the swap space is available only after install system and only if harddisk space is larger than 1.2Gb, cause the default swap space size is 1Gb.

show ntp iostat

No parameters required

Show NTP I/O statistics. Note, that the service ntp has to be enabled in the configuration.

show ntp monlist

No parameters required

Show NTP server's monitor routines -- it is a way to see, who uses this server.

show ntp peers

No parameters required

Show NTP peers -- status, offset, drift etc. for each peer. The peer, currently used for clock synchronisation, is marked with asterisk.

show ntp reslist

No parameters required

Show the NTP restrictions list.

show ntp sysinfo

No parameters required

Show the NTP subsystem status.

show ppp chap

No parameters required

Show PPP chap-secrets.

show ppp limits

No parameters required

Show PPP shaper limits.

show ppp pap

No parameters required

Show PPP pap-secrets.

show ppp users

No parameters required

Show online PPP-users.

show run

No parameters required

Show the configuration. Note, that it is not an actual configuration, but the config file last edition. In case of uncommitted configuration, an actual system state can differ.

show variables

No parameters required

Show system variables -- "ambiguous", "autocommit" etc.

show xid attributes

Parameters:

  • [$1] -- xid, context identifier

Show security context attributes either for a selected context or for all contexts.

show xid limits

Parameters:

  • [$1] -- xid

Show limits for a context or all contexts if xid is omitted.

show xid processes

Parameters:

  • [$1] -- xid

Show running processes for a selected context or for all contexts.

show xid running

No parameters required

Show running contexts. This command shows xids, context names and short system statistics for each context.

virtual

Parameters:

  • $1 -- virtual prefix

Enter a virtual server. Such virtual has to be defined in the config, at least. Abbreviation is allowed, so, one can use virtual te for virtual "test.spb.ru".