Linux Node – Command Cheat Sheet

This is a collection of common commands often used when working with Linux Operating Systems (OS)

Linux Ubuntu is often the chosen OS when installing nodes for various reasons highlighted in some of our node basics documentation.

The purpose of this cheat sheet is to act as a go-to during the creation, installation and maintenance of nodes in general, it does not serve to be specific to any particular node. Please refer to specific node guides and supporting documents for specific commands per node operating.

Installation & Updating

Updating and installing new software on Linux is fairly straightforward. Most Linux operating systems will inform you if a Kernal update is available however you may need to keep to a specific version or be in complete control of all updates.

CommandDescription
sudo apt-get update Used to sync the package index files from
their sources via the internet and download any updated ones
sudo apt-get upgrade The upgrade command is used to install the newest versions
of all packages currently installed
sudo apt-get dist-upgradeA safe way to update all dependent packages for other software, will check and update if other dependencies exist
sudo uname –srCheck the current Kernal version of Linux

Permissions

Root in Linux is much like the administrator on Windows, certain commands you will need to execute under sudo – you can also work within the root and all commands executed under root although you should only use and execute commands under root as required. You should not be logging in using root user!

CommandDescription
sudoUsed to execute a command under the privilege of the root user or superuser
suThis will switch you to the superuser/root account you can also switch to a different user account by giving the username after the su command such as su joe
sudo -iProvides you root shell and puts you into the home directory /root/

Networking

Most hosting solutions will make standing up a VPS straightforward and provide you with the IP etc. The following commands can be used for diagnostics and fault finding such as checking if the host is listening on the specific port required by the node/adding a firewall rule.

CommandDescription
ifconfigProvides all network interface configuration details
ip addr show dev eth0Provides eth0 details and IP address
netstat -nutlpDisplays listening TCP/UDP ports on the host and their corresponding programme
hostname -iDisplays the network address of the hostname
sudo ufw statusCheck the status of the firewall, this should return the status of the firewall either active or inactive
sudo ufw enableThis command will enable the firewall on the Linux host and will provide your a response such as ‘Firewall is active’
sudo ufw disableIf you need to disable the firewall, be aware with using this command will completely disable the firewall service running on the host
sudo ufw allow 30303/tcp
sudo ufw allow 30303/udp
Allow a specific port to listen for incoming connections, you also need to specify the protocol such as TCP or UDP

VI Editing

vim is a text editor on almost all Linux operating systems, it can be used when you need to edit a config file for example. Caution – VI editor can be quite daunting to new users, if you need to make a change to a file consider if you can edit this in word through SSH instead which would b a much easier option.

CommandDescription
vim 'file_name'Launches vi editor with the specified file
:q!Quit editor without saving changes
:wqQuit editor and save changes
:wSave the file currently being edited
iPut the editor into edit/insert mode ‘Esc’ key will take you back out of editing mode and into normal mode

Reboot / Power Down

CommandDescription
rebootWill reboot the server (ubuntu)
sudo rebootWill reboot the server (ubuntu) and ignore any errors/messages it might throw
shutdownWill shut down the server (ubuntu)

Master Nodes (MN)

Here are just a short collection of commands which are associated with general Master Nodes, specific commands will be added to setup guides as this will just remain as what is seen as common.

CommandDescription
masternode statusThis command needs to run with the specific MN in front of it which will then provide its status for example for a Deviant MN you would use:
deviant-cli masternode status
getinfoThis command needs to run with the specific MN in front of it which will then provide the info regarding blocks etc for example for a Deviant MN you would use:
deviant-cli getinfo
getblockcountProvides the block to confirm if the node has the latest block and therefore up-to-date