" to our own values, remove triangular brackets"> " to our own values, remove triangular brackets"> " to our own values, remove triangular brackets">

Change everything in "< >" to our own values, remove triangular brackets

Commands after the start of the new server

sudo apt-get update && sudo apt-get upgrade -y # update packages

Working with the file system

cd <path> # change working directory
cd # go to home directory

ls # list directory contents
ls -a # list directory contents + hidden files 

touch <filename> # create an empty file
cat <filename> # print the content of a file

nano <filename> # open file in nano text editor
# save changes: Ctrl+O, then Enter
# exit nano: Ctrl+X

rm <name> # remove files or directories
rm -rf <name> # remove files or directories recursively and ignore nonexistent files

cp <filename> <destination-path> # copy files and directories

mkdir <foldername> # make directories
rmdir <foldername> # remove empty directories

find / -name <filename> # find the file location

View server IP

curl ifconfig.co

curl ifconfig.me

Working with variables

env # print a list of the current environment variables

VARIABLE_NAME=<value> # set a variable

echo 'export VARIABLE_NAME='${VARIABLE_NAME} >> $HOME/.bash_profile # variable export
source $HOME/.bash_profile # reload .bash_profile

Monitoring

df -h # report file system disk space usage
du -sh <name> # estimate file/dir space usage
du -d1 -h $HOME | sort -h # sort directories by size

htop # interactive process viewer

Service files

# service file using the Archway node as an example

[Unit]
Description=Archway Node
After=network.target
[Service]
Type=simple
User=$USER
ExecStart=$(which archwayd) start
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target

# full example of creating a service file using an Archway node as an example

sudo tee /etc/systemd/system/archwayd.service > /dev/null <<EOF
[Unit]
Description=Archway Node
After=network.target
[Service]
Type=simple
User=$USER
ExecStart=$(which archwayd) start
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

Commands after creating a service file

# in this case service-file-name = archwayd

sudo systemctl daemon-reload
sudo systemctl enable <service-file-name>
sudo systemctl restart <service-file-name>

Check logs

journalctl -u <service-file-name> -f -o cat