OS commands you should know


Ubuntu Firewall

Ubuntu Firewall

sudo ufw status

UFW STATUS
--------------

Shows you the status of your firewall and what ports are being allow from where.  Below you see the L0 and L1 ports are opened and SSH.  Please remember that you have Ubuntu OS firewall rules and then you have cloud based rules you should look into.

 

#sudo ufw status

Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
9000/tcp                   ALLOW       Anywhere
9001/tcp                   ALLOW       Anywhere
9010/tcp                   ALLOW       Anywhere
9011/tcp                   ALLOW       Anywhere

df - disk space monitoring

Very simple command of df -h (h means human readable...aka GB sizes). 

df -h

Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.6G  1.8M  1.6G   1% /run
/dev/sda3       450G  220G  208G  52% /
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
/dev/sda1       3.9G  6.1M  3.9G   1% /boot/efi
tmpfs           1.0M     0  1.0M   0% /mnt/nodectlsecure
tmpfs           1.6G  104K  1.6G   1% /run/user/1002

You are interested in the / (ROOT) volume.  You can see I have 208GB available which should handle my node for quite some time.  If you have disk space issues please see Stararchiver KB under the Node Operator shelf.

 

watch - continuously run a command and watches for changes.

This command does not run for every application so if you notice issues then its not compatible.  So a good example of how watch works is to use it with df command.  

watch -d df -h

So below I'm watching my filesystem and the watch command highlights in white what has changed.   So if you are in DIP status then you should see disk space decreasing.   It updates every 2 seconds (which is changeable)

 

image.png

CTRL-C to exit out of watch.

 

htop - Advanced version of top

HTOP
------

All Linux OS's come with top (shows top processes and CPU/Memory details.  It still does the job but its suggested you install and use HTOP.  Do the following....

  1. Login to your node
  2. run "apt-get install htop
  3. HTOP is now installed.  Just run it and it will look like this..

image.png

If you press F4 (to filter) and type java and press enter it will filter the DAG related processes.

image.png

Screen - Run an terminal in the background and if you lose connectivity it still runs

Screen is a utility that lets you run an application/script/terminal and then place it in the background so you can come back to it later.  If you were to lose your network connection to your SSH terminal then you can go back to where you were.

  1. run "screen"
  2. You are now in the first screen.  Run whatever you need to run and press CTRL-A then D to detach.
  3. You have now dethatched from your terminal.  If you want to return to that terminal all you do is type screen -r (return

If you have multiple screens launched you just return to the proper screen.  It will list them for you automatically like so...

nodeadmin@Constellation-Node:/scripts$ screen -r
There are screens on:
        832022.pts-0.meeseeks   (05/27/2025 03:45:36 AM)        (Attached)
        831693.pts-0.meeseeks   (05/27/2025 03:42:36 AM)        (Attached)

 screen -r 831693.pts-0.meeseeks

Now you can launch your process in screen, detach, put your computer to sleep/power off and come back later. 

crontab - Scheduler

 

Crontab - Crontab is scheduler so you can launch scripts hourly/daily/weekly/monthly.

  1. type "sudo crontab -e" (Edit the crontab)
  2. Pick 1. nano unless you like other editors.

image.png

Add the following to the bottom of the crontab to run the script at 10AM Sunday

0 10  0 /scripts/<starchiver script> -options

image.png

It should look like this...