Linux for Networking Quick Start Cheat Sheet
Using Linux for networking completely unifies the network stack. The switch from traditional networking operating systems is easy and can be done with existing skill sets.This handy cheat sheet is a quick reference as you learn and use NVIDIA® Cumulus® Linux. It features the most common native Linux, as well as Cumulus NVUE, commands with explanations on how to use them.
Common Linux Commands
sudo
command Run a command in root | man
program Display help menu for program | kill
PID Halt process by process-id | killall
proccess_name Halt any processes based on a name |
historyDisplay recently entered commands | sudo rebootReboot the switch immediately | command
-hDisplay commands help menu | command
&Send command execution to the background(use “fg” to send command to the foreground) |
Linux User Administration Commands
sudo adduser
username Add a user | sudo userdel -r
username Delete a user | sudo passwd
username Change a user password | sudo passwd -l
username Disable a user | id
username Display user information |
whoDisplay all logged-in users and their activity | whoamiDisplay the current logged-in user | su
username Switch user | lastDisplay last login of a user(s) | exitLogout of the current session |
Linux Monitoring and Troubleshooting Commands
topView real-time CPU/memory info | free -mShow free memory in MB | ps auxShow all running processes |
uptimeDisplay uptime info | nslookup
hostname Perform DNS lookup | ntpq -pnPerform ntp query |
datePrint the current date and time | tcpdump -i
interface Collect control plane traffic from an interface | clearClear a command-line screen |
smonctl -vShow PSU/FAN/Temp information | ping
ip_address Check connectivity status to remote IP | sudo cl-supportCreate an archive file for troubleshooting.A tar file will be created in the /var/support/ directory. |
Working with Files and Folders
nano
file_name Edit a text file | treeShow filesystem hierarchy | pwdPrint current folder name | head -n 5
file_name Display top 5 lines of a file |
tail -n 5
file_name Display last 5 lines of a file | tail -f
file_name Follow file and disaplay new lines | mkdir
folder Make new folder | cd
folder Change into different folder |
ls -lhaList the files in the current folder | find / -name
file_name Find file named file_name | find / -name
"string" Find file_name containing string | chmod 777
file_name Change file permissions to all |
mv
old_file
new_file Move/rename a file | cp
old_file
new_file Copy a file | rm
file_name Delete a file | chown
username
file_name Change file ownership |
grep
"string"
file_name Search file for a text string | touch
file_name Create a new file | cat
file_name Display a text file | command
>
new_file Redirect stadndard command output to a file.e.g. ip link show > ip_addr_output |
cat
/path/file_name
| grep
"string"
>
new_file Filter one program’s/files output to a file.e.g. cat /var/log/syslog | grep kernel > syslog_kernel_output | command
& >
new_file Redirect stadndard command output and Standard error to a file.e.g. ifreload -a & > ifreload_output |
NVUE (NVIDIA User Experience) General Commands
nv list-commandsList all NVUE commands | nv show
[options] attribute Show system configuration | nv set
attribute Modify system configurations |
nv unset
attribute Remove system configurations attribute | nv config
command Manage/Apply system configurations | nv
command
-hShow command usage with all its options and attributes |
System Software and Hardware Commands
sudo -E apt list
package_name Show the list of packages based on package name(all if package_name not specified) | sudo -E apt-get install
package_name Install a package from the repository | sudo -E apt-get updateUpdate software packages to latest versions |
sudo apt-cache search
string Look for packages containing string | sudo systemctl
[start|stop|restart|reload] program .serviceControl current execution of a service | sudo systemctl
[enable|disable] program .serviceSet/unset a service to start on system boot |
cat /etc/image-releaseShow precise software version | nv show system globalShow switch global configuration | nv show platform software installed
package_name Show a specific installed software package on the switch(all if package_name not specified) |
nv show platform capabilitiesShow switch hardware information | nv show platform hardware
component_device Show switch hardware information | nv show platform hardware component device fanShow switch PSU/FAN/Temp information |
Working with Interfaces
Using Linux Commands
ip addr show
interface Layer 2 and 3 interface status | cl-netstatDisplay interfaces counters | ifup
interface Set port admin UP | ifdown
interface Set port admin DOWN |
ifreload -aApply interface configuration changes | ip addr set
ip_address/mask
dev
interface Set IP address and mask to an interface | ifquery -sShow ALL interface keywords | ifquery -aShow interfaces config (to be applied) |
ethtool
interface Show transceiver information | ethtool -S
interface Show port statistics | ethtool -s
interface
speed
speed Set physical interface's speed | ip monitor linkMonitor changes to link state in real time |
Using NVUE Commands
nv show interfaceHigh-level interfaces status | nv show interface
interface Detailed interface status and counters | nv set interface
interface
link state downAdministratively disable physical port |
nv set interface
interface
link state upAdministratively enable physical port(by default all ethernet ports are disabled) | nv set interface
interface
ip address
ip_address/mask Set IP address to physical layer 3 port or loopback | nv set
interface
bridge domain br_defaultCreates a default bridge and sets physical port/s as its member |
nv unset interface
interface
ip addressUnset IP address from an inteface (SVI/layer 3/Lo) | nv set interface vlan
vlan_id
ip address
ip_address/mask Create and set IP address to logical layer 3 port (SVI) | nv set interface
bond0
bond member
interface(s) Create bond(LAG) interface and set physical member(s) into it |
nv set interface
interface
link speed
speed Set physical interface's speed | nv show interface
interface
[attribute] Show interface's configuration | nv set interface
interface
link breakout
breakout_options Breakout physical interfaces according to the supported options |
Important Log Files
cat /var/log/aptLogs for apt utility | cat /var/log/audit/*Logs for auditd service | cat /var/log/syslogThe main system log | cat /var/log/clagdLogs status of the clagd service |
cat /var/log/frr/frr.logLocation of the FRRouting log (if enabled) | cat /var/log/rdnbrd.logLogs for redistribute neighbor | cat /var/log/netd.logLog file for NVUE | cat /var/log/ptmdLogs file for ptmd service |
cat /var/log/switchd.logThe HAL log for NVIDIA Cumulus Linux | cat /var/log/autoprovisionLogs output generated by running the ZTP script | cat /var/log/dpkg.logLog file for packages added or removed using dpkg command |
cat /var/log/installer/*Directory containing files related to the NVIDIA Cumulus Linux installation | dmesg(driver message) is a command that prints the message buff of the kernel |
Configuration Management with NVUE Commands
nv config applyApplies the pending configuration | nv config detachDetaches the configuration from the current pending |
nv config saveOverwrites startup configuration with the applied configuration (writes to /etc/nvue.d/startup.yaml ). This configuration persists after reboot. |
nv config diff
revision_1
revision_2 Compares between two configuration types (e.g. pending vs. applied ) | nv config history
nvue-file Shows applied configuration history for the revision |
nv config patch
nvue-file Updates pending configuration with a YAML file | nv config replace
nvue-file Replaces pending configuration with a YAML file |