Finding your way: files and directories
pwdcopy
Shows which directory you are in.
ls -lahcopy
Lists files with permissions, owner, size and hidden files.
cd /var/logcopy
Changes directory. cd - goes back to the previous one, cd alone goes home.
cat filecopy
Prints the whole file. For long files use less file (q to quit, / to search).
tail -n 50 filecopy
Last 50 lines of a file. tail -f file follows it live, handy for logs.
grep -n "error" filecopy
Finds lines containing text. -i ignores case, -r searches a whole directory.
find / -name "*.log" -size +100Mcopy
Finds files by name and size — for example, logs that grew too large.
cp -r src dstcopy
Copies a file or a directory (-r includes contents).
mv old newcopy
Moves or renames a file or a directory.
rm -rf foldercopy
careful Deletes a directory and everything in it, no questions asked. Unrecoverable; a typo in the path is expensive.
mkdir -p a/b/ccopy
Creates a directory together with its parents.
nano filecopy
A simple editor: Ctrl+O saves, Ctrl+X exits.
chmod +x script.shcopy
Makes a file executable.
chown user:user filecopy
Changes the owner of a file or a directory (-R recursively).
ln -s /data/models ~/modelscopy
A symbolic link: a directory or file becomes reachable by a second path, for example from a large drive.
history | grep nvidiacopy
Finds a command you typed before. Ctrl+R searches history interactively.
sudo !!copy
Repeats the last command with sudo when you forgot to add it.
Server health: load, memory, processes
htopcopy
A live view of processes, cores and memory. Install with sudo apt install htop; q to quit.
topcopy
The same, available on any system. %CPU is the process load, RES its memory.
uptimecopy
How long the server has been up and the load average over 1, 5 and 15 minutes. Numbers above the core count mean processes are queuing.
free -hcopy
Memory and swap in readable units. Look at the available column, not free.
nproccopy
Number of CPU cores available to the system.
lscpucopy
CPU model, cores, threads, clocks, virtualization.
ps aux | grep pythoncopy
Finds a process by name. First column is the user, second is the PID.
kill PIDcopy
Terminates a process gracefully. kill -9 PID forces it when it does not respond.
pkill -f namecopy
Kills every process whose command line contains the word.
sudo dmesg -T | tail -n 50copy
Kernel messages with timestamps: GPU, disk, memory and network errors show up here.
sudo dmesg -T | grep -i -E "xid|nvrm"copy
Only NVIDIA driver errors. The first thing to check when a card drops or the self-test fails.
sensorscopy
CPU and motherboard temperatures. Install with sudo apt install lm-sensors, then run sudo sensors-detect.
hostnamectlcopy
Hostname, Ubuntu release and kernel version in one command.
uname -rcopy
Kernel version. Needed to check which kernel the driver was built for after an update.
timedatectlcopy
Time, timezone and sync status. A clock that drifts breaks TLS connections and confuses logs.
GPUs: NVIDIA
nvidia-smicopy
The host's main command: cards, driver version, temperature, power draw, utilization, memory in use and processes on each GPU.
watch -n 2 nvidia-smicopy
The same table refreshed every 2 seconds. Ctrl+C to quit.
nvidia-smi -Lcopy
Lists GPUs with model and UUID. A quick check that the system sees every card.
nvidia-smi --query-gpu=index,name,temperature.gpu,power.draw,utilization.gpu,memory.used --format=csvcopy
Only the columns you need, as CSV — convenient for logging or sending to a Telegram bot.
nvidia-smi -q -d TEMPERATURE,POWER,CLOCKcopy
A detailed report: throttle thresholds, power limits, current clocks.
nvidia-smi -q -d PERFORMANCEcopy
Why a card drops its clocks: overheating, power cap, idle.
nvidia-smi -q -d ECCcopy
ECC memory error counters on cards that have ECC. Non-zero values are a reason to pull the card from rental.
sudo nvidia-smi -pl 300copy
Caps the card's power draw in watts. Lowers heat and the electricity bill at the cost of some performance.
sudo nvidia-smi -pm 1copy
Enables persistence mode: the driver stays loaded and the cards respond faster.
sudo nvidia-smi -r -i 0copy
careful Resets GPU 0 without rebooting the server. Only when it has no processes and no rentals.
nvidia-smi topo -mcopy
How the cards connect to each other and to the CPU: PCIe, NVLink. Matters for multi-GPU rentals.
lspci | grep -i nvidiacopy
GPUs on the PCIe bus regardless of the driver. If a card is missing here, the problem is hardware or the riser.
sudo lspci -vv -s 01:00.0 | grep -i lnkstacopy
PCIe link speed and width for a card (for example, 16GT/s, x16). Take the address from lspci.
dpkg -l | grep nvidia-drivercopy
Which driver package is installed and its version.
sudo apt-mark hold nvidia-driver-570copy
Freezes the driver package (use your version). An automatic driver update under a running Vast daemon breaks rentals.
nvidia-smi --query-gpu=index,fan.speed --format=csvcopy
Fan speed in percent for each card.
The Vast.ai host
sudo systemctl status vastaicopy
Is the Vast daemon alive: active (running) and the last lines of its log.
sudo systemctl restart vastaicopy
Restarts the daemon when it hangs or stops reporting to the panel. Running rentals are not stopped.
sudo journalctl -u vastai -fcopy
The daemon log, live.
sudo tail -f /var/lib/vastai_kaalia/kaalia.logcopy
The detailed agent log: checks, self-test, panel connectivity, container start errors.
cat /var/lib/vastai_kaalia/host_port_rangecopy
The port range the daemon assigns to rentals. The same range must be open in the firewall and on the router.
cat /var/lib/vastai_kaalia/host_ipaddrcopy
The IP address the agent treats as the machine's public address.
docker pscopy
Client rentals currently running on the machine: the Vast daemon runs them as containers.
vastai show machinescopy
Your machines via the CLI: id, status, reliability, prices. Requires pip install vastai and vastai set api-key <key>.
vastai self-test machine <id>copy
Self-test before listing: GPUs, network, Docker. Run it with no active clients; takes about 6 minutes.
vastai list machine <id> --price_gpu 0.25 --price_disk 0.003 --price_inetu 0.004 --price_inetd 0.004copy
Lists the machine for rent: price per GPU-hour, per GB of disk per month and per GB of traffic (the CLI uses gigabytes, the panel uses terabytes). The panel is simpler; the CLI suits scripts.
vastai unlist machine <id>copy
Takes the machine off the market: no new orders, current ones finish. Do this before maintenance.
vastai set min-bid <id> --price 0.10copy
The minimum price for interruptible rentals.
vastai show usercopy
Balance, accumulated earnings and account details.
vastai --helpcopy
The full list of CLI commands; each has its own --help.
Docker
docker ps -acopy
All containers, including stopped ones. Without -a — only running.
docker stats --no-streamcopy
How much CPU, memory and network each container is using right now.
docker logs --tail 100 <container>copy
The last 100 lines of a container's output. -f follows it live.
docker imagescopy
Downloaded images and their sizes.
docker system dfcopy
Disk space used by images, containers and volumes. The first check when the disk is full.
docker system prunecopy
careful Removes stopped containers, unused networks and dangling images. On a Vast host, only with no active rentals: the daemon keeps images for fast starts.
sudo systemctl status dockercopy
Is the Docker service running. Without it the Vast daemon cannot start a single rental.
docker info | grep -i -E "storage driver|root dir"copy
Where Docker keeps its data and which storage driver is in use.
docker exec -it <container> bashcopy
Opens a shell inside a container. Only for your own containers — never enter clients' rentals.
Disks and space
df -hcopy
Free space per partition. A full root or Docker partition is the most common cause of failed rentals.
sudo du -xh / --max-depth=2 2>/dev/null | sort -h | tail -n 20copy
The twenty largest directories on the system — quickly see what took the space.
du -sh /var/lib/docker /var/logcopy
Size of specific directories; on a host these two grow fastest.
lsblk -fcopy
Disks, partitions, filesystems and mount points.
sudo fdisk -lcopy
Disks and partitions with sizes. Useful when a new SSD does not show up.
sudo nvme listcopy
NVMe drive models and capacities (sudo apt install nvme-cli).
sudo smartctl -a /dev/nvme0n1copy
Drive health: wear percentage, errors, temperature (sudo apt install smartmontools).
sudo fstrim -avcopy
Tells SSDs which blocks are free. Usually runs on a weekly timer.
mount | grep ^/devcopy
What is mounted where and with which options.
sudo dmesg -T | grep -i -E "i/o error|nvme"copy
Disk errors at the kernel level. If they appear, plan a replacement.
Network and bandwidth
ip acopy
IP addresses and interface state (state UP).
ip rcopy
The routing table: which gateway the server uses to reach the internet.
curl -4 ifconfig.mecopy
The public IPv4 address as seen by the internet and the Vast panel.
ping -c 4 8.8.8.8copy
Is there connectivity and what is the latency. ping -c 4 vast.ai also checks DNS.
ss -tulpencopy
What is listening on which port: program, PID and address. Replaces the old netstat.
sudo ss -tnp | grep :22copy
Who is connected to the server over SSH right now.
nc -zv host 22copy
Checks whether a port is open on another machine — for example, your Vast port from outside, from a VPS.
mtr -rw 8.8.8.8copy
A traceroute with loss per hop: shows where the provider has a problem (sudo apt install mtr).
speedtest-cli --simplecopy
Bandwidth to the nearest test server (sudo apt install speedtest-cli). For Vast, upload matters more.
iperf3 -c <ip_vps>copy
Real upload throughput to your VPS in Europe or Asia; -R measures the other direction. The VPS must run iperf3 -s.
wget -O /dev/null http://speedtest.tele2.net/100MB.zipcopy
A quick download speed check without installing anything.
sudo ethtool enp5s0 | grep -i speedcopy
The negotiated link speed: 1000Mb/s or 100Mb/s. A common surprise with a bad cable. Take the interface name from ip a.
dig +short vast.aicopy
Checks that DNS resolves.
sudo ufw status numberedcopy
Firewall rules with numbers (remove one with sudo ufw delete <number>).
sudo ufw allow 40000:40100/tcpcopy
Opens the port range for Vast rentals. Use your own range from host_port_range.
Services and logs
sudo systemctl status <service>copy
Service status and the last lines of its log.
sudo systemctl restart <service>copy
Restarts a service. start and stop start and stop it.
sudo systemctl enable --now <service>copy
Enables start at boot and starts the service right now.
systemctl list-units --type=service --state=runningcopy
What is running right now.
systemctl --failedcopy
Services that failed at boot or later.
sudo journalctl -u <service> -fcopy
A service log, live.
sudo journalctl -u <service> --since "1 hour ago"copy
The log for the last hour. Also understands today, yesterday, and a date with time.
sudo journalctl -b -1 -ecopy
The previous boot's log from the end: what happened before a reboot or a hang.
sudo journalctl -p err -bcopy
Only errors since boot.
sudo journalctl --vacuum-size=500Mcopy
Shrinks the system journal to 500 MB when it fills the disk.
last -n 20copy
Who logged in and when, plus reboots.
whocopy
Who is logged in right now.
sudo tail -f /var/log/auth.logcopy
Login attempts, including SSH password brute force.
sudo fail2ban-client status sshdcopy
How many addresses are banned for password guessing.
Packages and updates
sudo apt updatecopy
Refreshes the package lists. Installs nothing.
apt list --upgradablecopy
What can be upgraded. If nvidia-driver is in the list, run apt-mark hold first.
sudo apt upgradecopy
careful Installs upgrades. On a host with rentals, update the driver and kernel only in a maintenance window with the machine unlisted.
sudo apt install <package>copy
Installs a package. sudo apt remove <package> removes it.
apt search <word>copy
Finds a package by name or description.
dpkg -l | grep <word>copy
Is a package installed and which version.
sudo apt-mark hold <package>copy
Freezes a package so upgrades leave it alone. unhold unfreezes it. Mandatory for the NVIDIA driver.
sudo apt autoremovecopy
Removes unneeded dependencies and old kernels that take space in /boot.
cat /etc/apt/apt.conf.d/20auto-upgradescopy
Are automatic updates enabled (Unattended-Upgrade "1"). On a host, disable them or keep the driver on hold.
sudo rebootcopy
careful Reboots. Every rental on the machine is interrupted: unlist it first and wait for the orders to finish.
sudo shutdown -h nowcopy
careful Shuts the server down. sudo shutdown -r +10 reboots in 10 minutes.
Access: SSH, files, sessions
ssh user@host -p 2222copy
Connects to the server; -p is needed when the port is not 22.
ssh-keygen -t ed25519copy
Creates a key pair on your own computer.
ssh-copy-id user@hostcopy
Installs your public key on the server so you can log in without a password.
scp file user@host:/path/copy
Copies a file to the server. Swap the arguments to download.
rsync -avP src/ user@host:/dst/copy
Syncs a directory with resume and progress. Better than scp for large transfers.
tmuxcopy
A session that survives an SSH disconnect: start, disconnect, come back with tmux attach. Detach with Ctrl+B, then D.
screen -S namecopy
Like tmux, but simpler. Return with screen -r name, detach with Ctrl+A, then D.
nohup command ©
Runs a command in the background so it survives logout. Output goes to nohup.out.
sudo -icopy
Become root until you type exit.
passwdcopy
Changes your password.
exitcopy
Ends the session (or Ctrl+D).
Combinations that save time
Ctrl+Ccopy
Interrupts the current command.
Ctrl+Rcopy
Searches command history: start typing and the last match appears.
Tabcopy
Autocompletes paths and commands. Press twice to list every option.
command | lesscopy
Pages through long output: q to quit, / to search.
command | grep wordcopy
Keeps only the output lines that contain the word.
command > out.txt 2>&1copy
Saves all output, errors included, to a file.
command1 && command2copy
The second command runs only if the first succeeded.
watch -n 5 'df -h; nvidia-smi -L'copy
Repeats a command every 5 seconds and shows the result on one screen.
alias gpu='nvidia-smi --query-gpu=index,temperature.gpu,power.draw,utilization.gpu --format=csv'copy
A short name for a long command. Add the line to ~/.bashrc to keep it.
man commandcopy
The manual for a command; shorter — command --help.
Nothing found. Try another word: “disk”, “gpu”, “port”.