Essential Ubuntu/Debian Linux CLI Commands for Daily Use, Development, and Homelab Setup

Linux is a powerhouse for developers, system admins, and homelab enthusiasts. While the GUI is handy, the command line (CLI) is where true efficiency lives. Whether you’re debugging code, managing servers, or automating tasks, knowing the right CLI commands can save you hours. In this post, we’ll walk through the most useful Ubuntu/Debian commands for daily use, development workflows, and homelab setups. Let’s dive in!

1. File & Directory Management: The Basics

These are the bread and butter of Linux workflows.

  • ls – List files and folders. Use ls -l for details or ls -a to see hidden files.
  • cp [file] [destination] – Copy files. Example: cp file.txt /backup/.
  • mv [file] [new-name] – Rename or move files.
  • rm [file] – Delete files. Pro tip: Use rm -r for folders, but be very careful!
  • mkdir [folder-name] – Create a new folder.
  • touch [file] – Create an empty file or update a file’s timestamp.

2. Package Management: Keep Your System Up-to-Date

Ubuntu and Debian rely on apt for package handling.

  • sudo apt update – Refresh your package list.
  • sudo apt install [package] – Install apps or tools.
  • sudo apt remove [package] – Uninstall software.
  • sudo apt autoremove – Clean up unused dependencies.
  • sudo apt search [keyword] – Find packages by name or description.

3. System Monitoring & Troubleshooting: Keep an Eye on Your System

Know what’s running and how your system is performing.

  • top / htop – See CPU, memory, and process usage in real time.
  • df -h – Check disk space (like a “Where’s my storage?” cheat sheet).
  • free -h – View memory (RAM) usage.
  • netstat -tuln / ss -tuln – List active network connections.
  • journalctl -u [service] – Dig into logs for systemd services (e.g., journalctl -u nginx).

4. Process Management: Control What’s Running

Need to kill a stuck process or run something in the background?

  • ps aux – List all running processes.
  • kill [PID] – Terminate a process by its ID.
  • pkill [process-name] – Kill processes by name (e.g., pkill firefox).
  • nohup [command] & – Run a task in the background, even if you log out.

5. Networking & Connectivity: Stay Connected

Troubleshoot or manage your network like a pro.

  • ping [host] – Test if a server or website is alive.
  • curl [URL] / wget [URL] – Download files or test APIs.
  • ifconfig / ip a – Check your network interface details.
  • nslookup [domain] / dig [domain] – Dig into DNS records.

6. Searching & Text Processing: Find What You Need

Need to find a file, edit a script, or analyze logs?

  • grep [pattern] [file] – Search for text in files.
  • find [path] [pattern] – Locate files by name, size, or modification date.
  • sed – Edit text in files (e.g., sed 's/old/new/' file.txt).
  • awk – Process and analyze text data (perfect for logs).

7. User & Permissions: Secure Your System

Manage users, files, and access with confidence.

  • sudo – Run commands as the admin.
  • chmod [permissions] [file] – Adjust file permissions (e.g., chmod 755 script.sh).
  • chown [user:group] [file] – Change ownership of files.
  • useradd [username] – Create new users for your homelab or server.

8. Scripting & Automation: Save Time, Repeat Tasks

Automate repetitive tasks with bash scripts.

  • bash script.sh – Run a bash script.
  • cron – Schedule recurring tasks (edit with crontab -e).
  • tee – Redirect output to a file and the terminal (e.g., command | tee output.txt).

9. Homelab & Development Tips: Power Up Your Setup

  • systemctl status [service] – Check if a service (like nginx) is running.
  • rsync – Back up files securely.
  • docker / podman – Containerize apps for consistency.
  • tmux / screen – Manage multiple terminal sessions (perfect for homelab setups).

Conclusion

These commands are your secret weapon for Linux development, system management, and homelab setups. By mastering them, you’ll streamline workflows, reduce errors, and unlock the full potential of Ubuntu/Debian. Whether you’re debugging code, securing servers, or automating tasks, the CLI is your greatest ally.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.