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.
Command | Description |
---|---|
sudo | Used to sync the package index files from their sources via the internet and download any updated ones |
sudo | The upgrade command is used to install the newest versions of all packages currently installed |
sudo apt-get dist-upgrade | A safe way to update all dependent packages for other software, will check and update if other dependencies exist |
sudo uname –sr | Check 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!
Command | Description |
---|---|
sudo | Used to execute a command under the privilege of the root user or superuser |
su | This 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 -i | Provides 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.
Command | Description |
---|---|
ifconfig | Provides all network interface configuration details |
ip addr show dev eth0 | Provides eth0 details and IP address |
netstat -nutlp | Displays listening TCP/UDP ports on the host and their corresponding programme |
hostname -i | Displays the network address of the hostname |
sudo ufw status | Check the status of the firewall, this should return the status of the firewall either active or inactive |
sudo ufw enable | This command will enable the firewall on the Linux host and will provide your a response such as ‘Firewall is active’ |
sudo ufw disable | If 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.
Command | Description |
---|---|
vim 'file_name' | Launches vi editor with the specified file |
:q! | Quit editor without saving changes |
:wq | Quit editor and save changes |
:w | Save the file currently being edited |
i | Put the editor into edit/insert mode ‘Esc’ key will take you back out of editing mode and into normal mode |
Reboot / Power Down
Command | Description |
---|---|
reboot | Will reboot the server (ubuntu) |
sudo reboot | Will reboot the server (ubuntu) and ignore any errors/messages it might throw |
shutdown | Will 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.
Command | Description |
---|---|
masternode status | This 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 |
getinfo | This 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 |
getblockcount | Provides the block to confirm if the node has the latest block and therefore up-to-date |