Tutorial

Using the CLI on Ubuntu and Debian

A practical guide to the Ubuntu and Debian command line: apt, systemd, permissions and the everyday tools that make these distributions popular for development.

Terminal entry points

On Ubuntu and Debian, you typically open a terminal through GNOME Terminal, Konsole, or a third-party emulator like Alacritty or Ghostty. Servers often start directly via SSH with no graphical interface at all.

# Check current shell
$ echo $SHELL
/bin/bash

# Check distribution information
$ cat /etc/os-release

# Check kernel version
$ uname -a

apt basics

apt is the package manager for Debian-based systems. It handles installation, updates, and removal of software from configured repositories.

# Refresh package metadata
$ sudo apt update

# Install common tools
$ sudo apt install git curl build-essential tmux

# Search for a package
$ apt search tmux

# Upgrade installed packages
$ sudo apt upgrade

# Remove a package
$ sudo apt remove tmux
  • System packages Use apt for shell tools, compilers, and base dependencies.

  • Language-specific packages Use npm, pip, cargo, or uv on top of the system layer when working inside a specific language ecosystem.

Filesystem and permissions

Linux follows a Unix-style filesystem rooted at /. Understanding home directories, hidden files, executable bits, and ownership is essential.

CommandPurposeExample
pwdShow current directory$ pwd
ls -laList files, including hidden ones$ ls -la ~/.config
chmodChange permissions$ chmod +x script.sh
chownChange owner/group$ sudo chown user:user file.txt
sudoRun with elevated privileges$ sudo systemctl restart nginx
# View file permissions
$ ls -l deploy.sh
-rwxr-xr-x 1 stone stone 914 Mar 20 09:14 deploy.sh

# Add execute permission
$ chmod +x deploy.sh

Services and logs

Modern Ubuntu and Debian use systemd as the service manager. systemctl and journalctl become everyday tools.

# Inspect running processes
$ ps aux | head

# Check service state
$ systemctl status ssh

# View recent logs
$ journalctl -u ssh --since today

# Enable a service at boot
$ sudo systemctl enable nginx

SSH and remote work

Even on a local desktop, many real workflows eventually move to remote servers or cloud instances.

# Connect to a remote server
$ ssh user@example.com

# Copy files to a server
$ scp app.tar.gz user@example.com:/srv/app/

# Generate an SSH key
$ ssh-keygen -t ed25519 -C "you@example.com"

Developer toolchain

Once apt and permissions are familiar, install the common development stack.

# Common utilities
$ sudo apt install git curl tmux jq ripgrep fd-find

# Git identity
$ git config --global user.name "Your Name"
$ git config --global user.email "you@example.com"

# Check language runtimes
$ python3 --version
$ node --version

Next steps

  1. Build confidence with apt, chmod, and chown.
  2. Practice SSH on a local VM or cloud test box.
  3. Learn systemctl, logs, and process inspection.
  4. Add one repeatable workflow using Git, Docker, or shell scripts.