Almost everything you do on a homelab server happens in a terminal. You connect over SSH, see a blinking cursor, and have to know what to type. That is the point where many beginners freeze, because Linux has thousands of commands and most cheat sheets list sixty of them with no sense of which ones matter.
This guide covers about 40 Linux commands that a mini PC homelab owner will actually use, grouped by the job you’re trying to do: moving around, handling files, checking health, managing services, reading logs, fixing network problems, and looking after Docker. It assumes you have a server running Ubuntu Server or a similar system. If you don’t have one yet, start with our guide to installing Ubuntu Server on a mini PC.
Three safety rules before you type anything
- Read a command before you run it. This is especially true for anything you copy from a website, including this one. If you don’t know what a part does, look it up first.
- Use sudo only when needed. The word
sudoruns a command as the administrator, so a mistake can damage the whole system. If a command works without it, leave it off. - There is no recycle bin. The
rmcommand deletes for good. A typo in a command likerm -rfcan wipe out folders you meant to keep.
Moving around
| Command | What it does |
|---|---|
pwd | Shows which folder you’re in |
ls -la | Lists files, including hidden ones, with sizes and owners |
cd /srv/docker | Moves into a folder |
cd .. | Moves up one folder |
cd ~ | Goes back to your home folder |
man ls | Opens the manual for a command (press q to leave) |
ls --help | Shows a short summary of a command’s options |
Two keyboard tricks will save you more time than any command. Press Tab to finish a file or folder name for you, and press the up arrow to bring back the previous command.
Working with files and folders
| Command | What it does |
|---|---|
mkdir -p /srv/docker/app | Creates a folder, plus any missing parent folders |
cp file.txt backup.txt | Copies a file |
cp -r folder folder-backup | Copies a whole folder |
mv old.txt new.txt | Moves or renames a file |
rm file.txt | Deletes a file permanently |
nano compose.yaml | Opens a simple text editor (Ctrl+O saves, Ctrl+X exits) |
cat file.txt | Prints a small file on screen |
less file.txt | Lets you scroll through a long file (press q to leave) |
tail -f file.log | Shows the end of a file and keeps updating as it grows |
Be careful with rm -r and rm -rf, which delete entire folders. Before you run one, use ls on the same path to confirm you’re about to delete what you think you are.
Finding things
grep -i "error" file.log
grep -r "8096" /srv/docker
find /srv -name "compose.yaml"The first command searches one file for a word. The second searches every file inside a folder, which is handy when you can’t remember which Compose file uses a certain port. The third looks for files by name.
Permissions and ownership
Many “permission denied” errors come from files owned by the wrong user. Start by looking at who owns what:
ls -l
idThe first column of ls -l shows the permissions, and the next two columns show the owner and group. The id command shows your own user and group numbers, which Docker apps often ask for.
| Command | What it does |
|---|---|
chmod +x script.sh | Makes a script runnable |
sudo chown -R $USER:$USER /srv/docker | Makes your account the owner of a folder and everything in it |
Avoid the popular “fix” of chmod 777, which lets everyone read, change, and run the file. It hides the real problem and weakens your security.
Checking system health
| Command | What it tells you |
|---|---|
uptime | How long the server has been running and how busy it is |
free -h | How much memory is used and available |
df -h | How full each disk is |
sudo du -sh * | sort -rh | head | Which folders in the current location use the most space |
lsblk | Which drives and partitions the system can see |
top or htop | Live view of processes using CPU and memory (press q to leave) |
A full disk is one of the most common reasons a homelab service suddenly breaks, so df -h is worth running first when something misbehaves. The htop tool is nicer than top but may need installing with sudo apt install htop.
Managing services and reading logs
On Ubuntu, background programs are managed by systemd. These two tools cover most of what you’ll need:
systemctl status docker
sudo systemctl restart docker
sudo systemctl enable docker
journalctl -u docker -f
journalctl -xesystemctl statusshows whether a service is running and its last few log lines.restartstops and starts it again, andenablemakes it start at every boot.journalctl -u docker -ffollows the logs for one service live, and press Ctrl+C to stop.journalctl -xejumps to the latest entries, which is the first place to look after a failure.
For hardware and driver problems, sudo dmesg --level=err shows kernel error messages, such as a drive that dropped off.
Installing and updating software
sudo apt update
sudo apt upgrade
sudo apt install htop
sudo apt autoremoveupdate refreshes the list of available software, upgrade installs newer versions, install adds a program, and autoremove clears out leftovers. Run the first two regularly, and reboot with sudo reboot if a kernel update was installed.
Network commands
| Command | What it does |
|---|---|
ip addr | Shows your IP address |
ip route | Shows your default gateway (your router) |
ping 1.1.1.1 | Tests whether you can reach the internet |
ping example.com | Tests whether DNS works (Ctrl+C to stop) |
sudo ss -tulpn | Lists which programs are listening on which ports |
curl -I http://192.168.1.50:8096 | Checks whether a web service answers |
ssh user@192.168.1.50 | Logs in to another machine |
The ss command is the one to remember when you see “port already in use.” It tells you exactly which program holds the port. Our home network basics guide explains IP addresses, gateways, and DNS, and gives a step-by-step checklist that uses several of these commands.
Copying files between machines
scp file.txt user@192.168.1.50:/home/user/
rsync -av /srv/docker/ user@192.168.1.60:/backup/docker/scp copies a single file over SSH. rsync copies whole folders and only sends what changed, which makes it a good starting point for backups. Pay attention to the trailing slashes, because they change what gets copied. Our homelab backup strategy for beginners shows where this fits in a real plan.
Docker commands
If you run apps in containers, these cover most daily needs:
| Command | What it does |
|---|---|
docker ps | Lists running containers |
docker ps -a | Lists all containers, including stopped ones |
docker logs -f container-name | Follows one container’s logs |
docker compose up -d | Starts the apps in a Compose file |
docker compose pull | Downloads newer images |
docker compose down | Stops and removes the containers |
docker system df | Shows how much disk space Docker uses |
Run the docker compose commands from the folder that holds your compose.yaml. Our Docker Compose tutorial for beginners explains each one. Be careful with commands that start with docker system prune, which delete unused data. Read what they will remove before you agree.
A simple routine when something breaks
- Is the machine reachable? Try
pingandsshfrom your computer. - Is the disk full? Run
df -h. - Is it out of memory? Run
free -horhtop. - Is the service running? Use
systemctl statusordocker ps. - What do the logs say? Use
journalctl -u name -fordocker logs -f name. - Is the port open? Use
sudo ss -tulpnandcurl.
To stop guessing in the first place, set up alerts with a monitoring tool, as described in our Uptime Kuma monitoring guide.
Shortcuts worth learning
- Tab completes names, so you type less and make fewer typos.
- Ctrl+C stops whatever is running.
- Ctrl+R searches your command history.
- Up arrow brings back the previous command.
sudo !!repeats the last command with sudo, which helps after a “permission denied.”historylists your recent commands.
Frequently asked questions
How many Linux commands do I need to learn?
A few dozen cover almost everything you’ll do on a homelab. Learn them as you need them rather than memorizing a long list.
What does sudo mean?
It runs a command with administrator rights. Use it only when a task needs it, and understand the command first.
Which text editor should a beginner use?
Nano. It shows its shortcuts at the bottom of the screen, which makes it much easier than editors like vim.
How do I undo a mistake?
For most commands you can’t, which is why backups matter. Back up important folders before large changes.
Wrapping up
You don’t need to master Linux to run a homelab. Learn how to move around, read files, check disk and memory, manage services, read logs, and test the network, then add Docker commands as you start running containers. Follow the three safety rules, and use the troubleshooting routine whenever something breaks. The rest you’ll pick up one problem at a time.