GETI Explainer
  • Welcome to the GETI explainer series
  • Create Cardano Wallet
  • Simple Transactions
  • Enable SFTP on LINUX server
  • Linux commands
  • Node Setup
Powered by GitBook
On this page

Linux commands

Here I want to summarize the most powerful and useful linux commands that I get to know during my ADA journey.

Tested on the following system. System: Ubuntu 20.04.03 LTS Shell: bash

# Compress/uncompress folder
tar -zcvf archive.tar.gz foldertozip/ 
# 	uncompress
tar -zxvf archive.tar.gz

# Change Default Shell for user
cat /etc/shells # show all available shells
sudo vim /etc/passwd # go to user and set the desired shell

# Check available disk space
df -h

# Fancy way to show CPU/RAM usage as well as running processes
htop

# Show folder size
du -shc folder/

# Best way to find out where programms are located
which cardano-cli
    # Output
    /usr/local/bin/cardano-cli

# find only the sudo or super users

grep '^sudo:.*$' /etc/group | cut -d: -f4
# or
getent group sudo | cut -d: -f4

# seatch and replace text in file
sed -i "s+SARCHPATTERN+NEWPATTERN+g" file.txt
# Watch node service output
journalctl -u cardano-node.service -f -o cat 

# Show current number of connections form different IP adresses. 
                         # PORT —> change if you want to see a different one
sudo netstat -enp | grep ":6000" | awk {'print $5'} | cut -d ':' -f 1 | sort | uniq -c | sort
      #Output from Core node with two relay nodes which is correctly set up 
      #number #IP_adress

      2       147.85.148.240 # --> 2 connections from 147.85.148.240
      2       134.143.118.260 # --> 2 connections from 134.143.118.260
      
# Check balance on fully syncronized cardano node server
cardano-cli query utxo --address $(cat payment.addr) --mainnet

# Generate HASH from metadata URL
cardano-cli stake-pool metadata-hash --pool-metadata-file <(curl -s -L https://www.yourwebside.com/your-metadata.json)

# Keyfiles to start block producer node need the following permissions:
-rw-------  1 cardano cardano     230 Jan 31 21:15 vrf.skey
# -rw------- can be reached with 
	
chmod 600 vrf.skey

# show firewall status
sudo ufw status

# Using TELNET to check if server is reachable on a specific port
telnet 192.133.143.240 2222 # is 192.133.143.240 reachable on port 2222
      # Quit telnet on MAC:
      # ctrl + ü then type quit and enter

# copy file from server to local maschine
scp -P 22 user@23.131.141.00:/home/user/<file> /home/user/ 

# copy files from local mashine to server
scp -P 22 /home/user/<file> user@23.131.141.00:/home/user/

# Upgrade and update your ubuntu system
sudo apt-get update && sudo apt-get upgrade && sudo apt-get autoremove && sudo apt-get autoclean

# show current number of connections form different IP adresses. Output: #number #IP_adress
                                              
#                         :PORT —> change if you want to see a different one

sudo netstat -enp | grep ":6000" | awk {'print $5'} | cut -d ':' -f 1 | sort | uniq -c | sort

sudo netstat -enp | grep ":2017" | awk {'print $5'} | cut -d ':' -f 1 | sort | uniq -c | sort
PreviousEnable SFTP on LINUX serverNextNode Setup

Last updated 3 years ago