Command Line Reference
Device Management
47 min
device status device status show version show version \[command] show version \[purpose] show system version \[view] system view \[notes] this command displays version information including software, description, kernel, create, and image \[use cases] admin\@sonic $ show version sonic software version sonic asternos v6 1r001t001 dirty 20220807 083641 distribution debian 9 13 kernel 5 10 34 asternos build commit f1376ee06 build date sun aug 7 12 45 57 utc 2022 built by aster\@arm64 compile server platform arm64 asterfusion gesp1u 4y48x 1 s r0 hwsku x204y 48s m asic marvell serial number f020015a003 uptime 06 47 53 up 41 min, 7 users, load average 0 24, 0 37, 0 35 docker images show platform fan show platform fan \[command] show platform fan \[purpose] view fan information \[view] system view \[use cases] sonic# show platform fan fan speed direction presence status timestamp \ fan1 8625rpm exhaust present ok 2022 08 18 08 59 45 fan2 8715rpm exhaust present ok 2022 08 18 08 59 45 fan3 8580rpm exhaust present ok 2022 08 18 08 59 45 fan4 8715rpm exhaust present ok 2022 08 18 08 59 45 description of the show platform fan command output item description speed fan speed direction fan wind direction exhaust:blowing wind outward inhaust:inward air suction presence is the fan in place status fan status timestamp get the time of the current state show platform psu status show platform psu status \[command] show platform psu status \[purpose] view power status \[view] system view item description ok in place and properly powered not ok in place but no power supply not present not in position \[use cases] sonic# show platform psu status psu status \ psu 1 ok psu 2 not ok show platform summary show platform summary \[command] show platform summary \[purpose] view hardware platform information \[view] system view \[use cases] sonic# show platform summary platform arm64 asterfusion x206y 48t ma r0 hwsku cx206y 48gt hpw4 m asic marvell show platform temperature show platform temperature \[command] show platform temperature \[purpose] view hardware platform information \[view] system view \[use cases] sonic# show platform temperature show image show image \[command] show image \[purpose] display the system's installed firmware \[view] system view \[use cases] sonic# show image current sonic os head 0 51e434286 next sonic os head 0 51e434286 available sonic os head 0 51e434286 sonic os head 0 7ecdef796 show feature state show feature state \[command] show feature state \[purpose] check if the feature is enabled \[view] system view \[notes] the processes related to all features on the current system are running in the corresponding containers, and the corresponding containers will be started after the feature is enabled the containers in the always enabled state are not allowed to be closed \[use cases] sonic# show feature state feature state \ lldp enabled pmon always enabled snooping always enabled dhcp relay always enabled database always enabled snmp disabled dot1x disabled bgp always enabled radv always enabled proxy always enabled mstpd disabled web server disabled teamd always enabled syncd always enabled ucentral client disabled swss always enabled slad always enabled show ztp show ztp \[command] show ztp \[purpose] display ztp execution results \[view] system view \[use cases] sonic# show ztp ztp admin mode true ztp service inactive ztp status failed ztp source dhcp opt67 (ethernet10) runtime 23m 16s timestamp 2024 06 20 09 03 04 utc ztp service is not running configdb json success upload log failed show ztp verbose show ztp verbose \[command] show ztp verbose \[purpose] display detailed ztp execution results \[view] system view \[use cases] sonic# show ztp verbose command ztp status verbose \======================================== ztp \======================================== ztp admin mode true ztp service inactive ztp status failed error upload log failed ztp source dhcp opt67 (ethernet10) runtime 23m 16s timestamp 2024 06 20 09 03 04 utc ztp json version 1 0 ztp service is not running \ configdb json \ filename ftp\ //teraspek\ teraspek\@150 1 0 1/poam cfg/aster666 json status success runtime 17s timestamp 2024 06 20 08 59 19 utc exit code 0 ignore result false \ upload log \ status failed runtime 03m 45s timestamp 2024 06 20 09 03 04 utc exit code 20 error plugin failed ignore result false show environment powers show environment powers \[command] show environment powers \[purpose] display power supply details \[view] system view \[use cases] sonic# show environment powers psu status psu1 model g1251 055 input voltage +233 00 v output voltage +12 07 v fan speed 4136 rpm temperature +35 3 c input power 38 06 w output power 30 44 w input current +0 21 a output current +2 52 a (max = +45 00 a) psu2 model g1251 055 input voltage +0 00 v output voltage +0 00 v fan speed 0 rpm temperature +29 9 c input power 0 00 w output power 0 00 w input current +0 00 a output current +0 00 a (max = +45 00 a) show system memory usage show system memory usage \[command] show system memory usage \[purpose] display the current memory usage of the device \[view] system view \[notes] when the device's memory usage exceeds 80%, executing this command will display the top 10 processes by memory usage \[use cases] sonic# show system memory usage + + \| memory usage % | \| | \| 53 1 | + + + + + + + + + \| total | used | free | shared | buff/cache | available | \| + + + + + | \| 4186353664(b) | 2125402112(b) | 1292824576(b) | 19099648(b) | 768126976(b) | 1962168320(b) | \| 3 90(gb) | 1 98(gb) | 1 20(gb) | 18 21(mb) | 732 54(mb) | 1 83(gb) | + + + + + + + show system cpu usage show system cpu usage \[command] show system cpu usage \[purpose] display the current cpu usage of the device \[view] system view \[notes] when the device's cpu usage exceeds 80%, executing this command will display the top 10 processes by cpu usage \[use cases] sonic# show system cpu usage + + \| cpu usage % | \| | \| 18 3 | + + show system disk usage show system disk usage \[command] show system disk usage \[purpose] display the current disk utilization of the device \[view] system view \[notes] when the device's disk utilization exceeds 80%, executing this command will display the major files occupying disk space \[use cases] sonic# show system disk usage + + \| disk usage % | \| | \| 27 4 | + + + + + + \| total | used | free | \| + + | \| 29357916160(b) | 8025161728(b) | 21315977216(b) | \| 27 34(gb) | 7 47(gb) | 19 85(gb) | device configuration device configuration hostname hostname \[command] hostname hostname \[purpose] modify the device host name \[parameter] parameter description hostname host name \[view] system view \[notes] the hostname can be named with a maximum of 64 characters and can only contain " " , " ", "a z", "a z" and "0 9" it cannot start and end with " ", " ", and " " cannot appear after modification, you need to save the configuration manually and log out to take effect again \[use cases] sonic# hostname sonic 226 screen paging disable screen paging disable \[command] screen paging disable no screen paging disable \[purpose] disable pagination for screen display \[view] system configuration view \[notes] users can change the terminal screen display pagination settings for easier viewing of configurations when executing commands multiple times with extensive output lines on the device \[use cases] sonic# screen paging disable ntp configuration ntp configuration show ntp show ntp \[command] show ntp \[purpose] show ntp information \[view] system view \[use cases] sonic# show ntp remote refid st t when poll reach delay offset jitter \============================================================================== 10 250 0 240 203 107 6 88 3 u 46 64 377 0 165 10 575 3 198 ntp server ntp server \[command] ntp server ip address \[prefer] no ntp server \[purpose] configure ntp server \[parameter] parameter description ip address ntp server ip address \[view] system configuration view \[use cases] sonic(config)# ntp server 10 250 0 242 ntp source interface ntp source interface \[command] ntp source interface {ethernet interface num |vlan vlan id |loopback loopback id |mgmt} \[vrf {default|mgmt}] no ntp source interface \[purpose] specify the ntp source interface \[view] system configuration view \[notes] configuring the local source interface for sending/receiving ntp packets can help avoid using ip addresses from other interfaces on this device as the destination address for response packets \[use cases] sonic(config)# ntp source interface loopback0 vrf default system time configuration system time configuration show clock show clock \[command] show clock \[purpose] display time zone and time \[view] system view \[use cases] sonic# show clock show supported timezones show supported timezones \[command] show supported timezones \[purpose] display the time zones supported by the system configuration \[view] system view \[use cases] sonic# show supported timezones clock datetime clock datetime \[command] clock datetime date string time string \[purpose] configure system time \[parameter] parameter description date string date value, yy mm dd format time string time value, hh\ mm\ ss format \[view] system configuration view \[usage scenario] when preparing to deploy a device, it's essential to configure the system time of the device to the current actual time this ensures that the device's logs and alarm messages accurately reflect the timestamp of events the device often comes with an arbitrary system time when it leaves the factory, which doesn't represent the actual time \[use cases] sonic# configure sonic(config)# clock datetime 2022 02 22 20 30 30 clock timezone clock timezone \[command] clock timezone zone no clock timezone \[purpose] configure the system time zone, the default time zone is utc \[parameter] parameter description zone timezone \[view] system view \[use cases] sonic# configure sonic(config)# clock timezone asia/shang poe configuration poe configuration show interface poe show interface poe \[command] show interface poe \[purpose] display interface poe information \[view] system view \[use cases] sonic# show interface poe show interface poe diagnose show interface poe diagnose \[command] show interface poe diagnose \[purpose] display interface poe initialization information \[view] system view \[usage scenario] this command displays information including poe hardware version, poe status, current poe temperature, alarm temperature, and the number of internal poe resets \[notes] if the command results in a "device busy" message, it is normal this indicates that the system is currently retrieving poe power information simply reissue the command to get the results \[use cases] sonic# show interface poe diagnose pse device information field value \ version 0x4a02 status ok expected poe device found (zone1) event temperature 48 c temperature alarm 110 c reset count 0 initialized true pse wrong port map interface current id expect id \ poe enable poe enable \[command] poe enable no poe enable \[purpose] enable poe power supply function of the interface \[view] interface view \[use cases] sonic(config)# interface ethernet 1 sonic(config if 1)# poe enable poe delay poe delay \[command] poe delay time no poe delay \[purpose] configure the delayed start time of the interface poe function \[parameter] parameter description time range of values 0 3600 \[view] interface view \[usage scenario] this command is used to delay the activation of power over ethernet (poe) power supply on an interface based on actual usage requirements when the uplink link state stabilizes, and the protocols are running correctly, poe power is supplied to the connected poe devices this delay mechanism is useful for ensuring that poe devices receive power only when the network is stable and ready to support them \[use cases] sonic(config)# interface ethernet 1 sonic(config if 1)# poe delay 300 time range time time range time \[command] time range name from date stop to date start no time range \[purpose] configure poe power off time range \[parameter] parameter description name specifies the name of a time range date stop specify the stop time of a time range, the format is hh\ mm yy mm dd date start specify the start time of a time range, the format is hh\ mm yy mm dd \[view] system configuration view \[use cases] sonic(config)# time range test from 12 00 2022 01 01 to 16 00 2023 01 01 time range date time range date \[command] time range name time stop to time start no time range \[purpose] configure poe power off date range \[parameter] parameter description name specifies the name of a time range time stop specify the stop time of a time range, the format is hh\ mm time start specify the start time of a time range, the format is hh\ mm \[view] system configuration view \[use cases] sonic(config)# time range test 00 00 to 23 59 off day poe power off time range poe power off time range \[command] poe power off time range name no poe power off time range \[purpose] configure poe power off time range effective on an interface \[view] interface view \[use cases] sonic(config)# interface ethernet 48 sonic(config if 48)# poe power off time range test warning this operation may power off some pd continue? \\\[y/n] y log threshold configuration log threshold configuration show interface log threshold \[command] show interface log threshold \[purpose] display interface bandwidth utilization alarms \[view] system view \[notes] if no specific alarm configuration is applied to a particular interface, this command will only display the default values and will not provide information for each individual interface \[use cases] sonic# show interface log threshold interface default bandwidth utilization rx/tx alert threshold 80%, resume threshold 75% customer defined interface rx alert threshold rx resume threshold tx alert threshold tx resume threshold \ ethernet2 70 60 70 60 log threshold {tx|rx|both} log threshold {tx|rx|both} \[command] log threshold {tx|rx|both} alert threshold resume threshold \[purpose] configure the bandwidth utilization log threshold value for the interface \[view] system view \[parameter] parameter description tx interface outgoing direction rx interface incoming direction both configure both rx and tx simultaneously alert threshold alarm threshold, range 50 100, default value 80 resume threshold recovery threshold, range 50 100, default value 75 \[view] interface view \[usage scenario] users can use this command to customize the alarm thresholds and recovery thresholds for the outgoing and incoming directions of a specific interface when the alarm threshold is exceeded, syslog begins to generate alarm logs; when it falls below the recovery threshold, the alarm is canceled \[use cases] sonic(config)# interface ethernet 2 sonic(config if 2)# log threshold both 70 60 diagnostic information configuration diagnostic information configuration show diagnostic information \[since|count] show diagnostic information \[since|count] \[command] show diagnostic information \[since|count] \[purpose] used to collect device diagnostic information \[view] system view \[parameter] parameter description since collect logs and core files since the specified date count the number of logs to be collected \[usage scenario] currently, on site troubleshooting often requires multiple communications to check the configuration status of the on site switches to facilitate the collection of more information in one go, a quick maintenance command has been added to collect switch information after executing the command, the output will be saved as a compressed file to a fixed directory /var/dump/ \[use cases] sonic# show diagnostic information count 2
