Skip to content
Ask AI

Diagnostic-information Configuration

[Command]

show diagnostic-information [since|count]

[Purpose]

Used to collect device diagnostic information.

[View]

System view

[Parameter]

ParameterDescription
sinceCollect logs and core files since the specified date
countThe 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

[Command] show system reboot-cause

[Purpose] Used to view system restart reason information.

[View] System View

[Use Cases]

Terminal window
sonic# show system reboot-cause
+------------------------------+--------------------+------------------------------+---------------+----------------+
| Reboot-time | Reboot-timestamp | Reboot-reason | Reboot-user | Reboot-ip |
+==============================+====================+==============================+===============+================+
| Fri Mar 6 02:45:54 UTC 2026 | 1772765154 | User issued 'reboot' command | admin | 192.168.18.238 |
+------------------------------+--------------------+------------------------------+---------------+----------------+

[Command] show system cfgdb-event

[Purpose] Used to view the change status of system configuration files, supporting modify/delete status.

[View] System View

[Use Cases]

Terminal window
sonic# show system cfgdb-event
+------------------------------+-------------+-------------+--------+----------------+
| Time | Timestamp | Operation | User | IP |
+==============================+=============+=============+========+================+
| Fri Mar 06 03:40:28 UTC 2026 | 1772768428 | modify | admin | 192.168.18.238 |
+------------------------------+-------------+-------------+--------+----------------+
sonic# show system cfgdb-event
+------------------------------+-------------+-------------+--------+----------------+
| Time | Timestamp | Operation | User | IP |
+==============================+=============+=============+========+================+
| Fri Mar 06 03:51:04 UTC 2026 | 1772769064 | delete | admin | 192.168.18.238 |
+------------------------------+-------------+-------------+--------+----------------+

[Command] show system fs-status

[Purpose] Used to view the system disk read/write status, with rw/ro states available.

[View] System View

[Use Cases]

Terminal window
sonic# show system fs-status
+----------+------------------------------+--------------------+
| Status | Detect-time | Detect-timestamp |
+==========+==============================+====================+
| rw | Thu Mar 05 07:02:14 UTC 2026 | 1772694134 |
+----------+------------------------------+--------------------+
sonic# show system fs-status
+----------+------------------------------+--------------------+
| Status | Detect-time | Detect-timestamp |
+==========+==============================+====================+
| ro | Thu Mar 05 06:59:14 UTC 2026 | 1772693954 |
+----------+------------------------------+--------------------+

[Command] show system users

[Purpose] View users currently logged into the switch

[View] System View

[Use Cases]

Terminal window
sonic# show system users
admin pts/0 2026-03-10 07:39 (192.168.18.238)
admin pts/1 2026-03-10 07:26 (192.168.18.238)

[Command] ping* target_address* [source* source_address***|vrf*** vrf_name***]] [size*** size***] [interval*** interval***] [repeat*** count***]**

[Purpose] Used to execute the ping diagnostic command.

[View] Linux View

[Parameter]

ParameterDescription
target_addressSpecifies the destination address for the ping
source_addressSpecifies the source address for the ping request
source_interfaceSpecifies the source interface for the ping request
vrf_nameSpecifies the VRF for the ping request
sizeSpecifies the packet length of the ping request
intervalSpecifies the interval between ping requests
countSpecifies the number of ping request packets

[Use Cases]

sonic# ping 1.1.1.1 interval 0.5

[Command]

ping <target_address> [source [ip <ip_address> |] [vrf <vrf_name>]

[Purpose]

Used to execute the traceroute diagnostic command.

[View]

Linux View

[Parameter]

ParameterDescription
target_addressSpecifies the destination address for the ping
ip_addressSpecifies the source address for the tracerouterequest
interfaceSpecifies the source interface for the tracerouterequest
vrf_nameSpecifies the VRF for the ping request

[Use Cases]

sonic# traceroute 192.168.0.78
traceroute to 192.168.0.78 (192.168.0.78), 30 hops max, 60 byte packets
1 192.168.0.1 2.347 ms 2.373 ms 2.486 ms
2 172.16.1.1 1.954 ms 1.916 ms 2.057 ms
3 172.16.1.11 3.159 ms 3.446 ms 3.587 ms
4 192.168.0.78 1.739 ms 1.705 ms 1.669 ms

[Purpose]

System configuration file.

[View]

Linux View

[Comment]

System configuration file directory: /etc/sonic/config-db.json stores the currently saved configuration of the system. The system loads this configuration file during startup to restore the configuration. It is not recommended to directly modify the content of this file.

[Purpose]

System log file.

[View]

Linux View

[Comment]

System log file directory: /var/log/syslog stores the runtime logs of the current system. You can open this file to view system operation logs. System logs are periodically compressed. To view older logs, you can check the compressed files at /var/log/syslog..gz. The system can store a maximum of 1,000 compressed syslog files. The /var/log directory also stores runtime logs for other modules, such as auth.log, ptp.log, ztp.log, etc. The method for viewing these logs is the same as for syslog. It is not recommended to directly edit the contents in this directory.

[Command]

tcpdump -i* interface_name***[-Qin] [-Qout] [-w xxx.pcap]**

[Purpose]

Capture packets on a specified interface.

[View]

Linux View

[Parameter]

ParameterDescription
*interface_name *Specifies the interface for packet capture. Supported interfaces include physical interfaces, LAG interfaces, and VLAN interfaces
Qin/QoutSpecifies Specifies the packet capture direction as inbound or outbound; by default, both directions are captured.
-wSpecifies that captured packets should be saved locally.

[Use Cases]

admin@sonic:~$ tcpdump -i Vlan100 -w Vlan100.pcap

[Command]

ftp* x.x.x.x*

[Purpose]

Transfer files using the FTP method

[View]

Linux View

[Parameter]

ParameterDescription
x.x.x.xThe Ftp server address

[Use Cases]

admin@sonic:~$ ftp
ftp> admin@sonic:~$ ftp 192.168.0.78
Connected to 192.168.0.78.
220 (vsFTPd 3.0.3)
Name (192.168.0.78:admin): teraspek
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> put 14.pcap
local: 14.pcap remote: 14.pcap
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
29424 bytes sent in 0.00 secs (64.6565 MB/s)
ftp>

[Command]

tftp* x.x.x.x*

[Purpose]

Transfer files using the Ttfp method

[View]

Linux View

[Parameter]

ParameterDescription
x.x.x.xThe tftp server address

[Use Cases]

admin@sonic:~$ tftp 192.168.0.7
tftp> put 14.pcap
Sent 29461 bytes in 0.0 seconds
tftp>

[Command]

screen-paging disable no screen-paging disable

[Purpose]

Disable pagination for screen display

[View]

System Configuration View

[Comment]

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

[Command] watch [interval* interval***] [diff] [err-quit]*** commands*

[Purpose] Periodically Execute Display Commands

[Parameter]

ParameterDescription
intervalInterval for executing the command. Default: 5 seconds. Range: 1 – 254 seconds
diffHighlights differences when the current command output differs from the previous one
err-quitAutomatically exits when an error occurs during command execution
commandsThe specific command to execute. Only a single show command is supported

[View] System View

[Comment] When users need to repeatedly execute the same command on the device, this command can be used for automatic execution. The command output is displayed on the screen in real time at regular intervals for easy observation. Press the q or Q key to exit.

[Use Cases]

Terminal window
sonic# watch interval 2 diff err-quit show counters interface