TL;DR — The Commands You Actually Use Every Day
| What you want to do | Command |
|---|---|
| See all containers and their status | pct list |
| Get a root shell inside a container | pct enter <ctid> — exit with exit or Ctrl+D |
| Open a console with login prompt | pct console <ctid> — exit with Ctrl+A then q |
| Start a stopped container | pct start <ctid> |
| Cleanly shut down a container | pct shutdown <ctid> |
| Kill a container that won't respond | pct stop <ctid> |
| Reboot a container | pct reboot <ctid> |
| See a container's config | pct config <ctid> |
| Change a setting | pct set <ctid> --memory 2048 |
| Run a command without entering | pct exec <ctid> -- uptime |
| Take a snapshot before changes | pct snapshot <ctid> pre-upgrade |
| Roll back a snapshot | pct rollback <ctid> pre-upgrade |
That covers 90% of day-to-day use. The sections below go deeper on each topic. Advanced Operations covers disk management, migration, diagnostics, restore, and the full command reference.
Contents
Containers vs. VMs
LXC Container (pct)
- Shares the host Linux kernel
- Near-native performance
- Starts in under a second
- Smaller footprint — no guest kernel overhead
- Linux only
- No GPU passthrough
QEMU/KVM VM (qm)
- Full hardware emulation, own kernel
- Runs any OS (Linux, Windows, BSD)
- Stronger isolation
- GPU passthrough supported
- Slower to start, more RAM overhead
- Guest agent needed for host integration
Containers are the right choice for Linux services, network utilities, and anything where you want density and speed. VMs are the right choice when you need a different OS, a full kernel, hardware passthrough, or the strongest isolation.
Listing Containers
pct list
Sample output:
VMID Status Lock Name
201 running zebra
305 stopped meerkat
901 running warthog
911 running lemur
The VMID column is used in all pct commands, same numbering space as VMs.
Entering a Container
The primary way to get a shell inside a running container:
pct enter <ctid>
This drops you directly into the container's root namespace — no password, no SSH required. You get a root shell immediately.
pct enter 201
root@zebra:~#
Console access (with login prompt)
For a proper console session that presents a getty login:
pct console <ctid>
| Command | What you get | Use when |
|---|---|---|
pct enter | Direct root shell, no login prompt | Quick admin access, scripting |
pct console | Console with getty login | Testing boot behavior, login troubleshooting |
Starting, Stopping, and Restarting
# Start a stopped container
pct start <ctid>
# Graceful shutdown
pct shutdown <ctid>
# Force stop immediately
pct stop <ctid>
# Reboot
pct reboot <ctid>
# Suspend to disk
pct suspend <ctid>
# Resume from suspend
pct resume <ctid>
Checking Status
# Single container
pct status <ctid>
# All containers
pct list
pct status 201
status: running
Viewing and Modifying Config
pct config <ctid>
Sample output:
arch: amd64
cores: 2
hostname: zebra
memory: 2048
nameserver: 8.8.8.8
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=BC:24:11:AA:BB:CC,ip=dhcp,type=veth
onboot: 1
ostype: ubuntu
rootfs: local-lvm:vm-201-disk-0,size=16G
swap: 512
Modifying with pct set
# Change memory
pct set <ctid> --memory 4096
# Change core count
pct set <ctid> --cores 4
# Set hostname
pct set <ctid> --hostname new-name
# Add a bind mount from host into container
pct set <ctid> --mp0 /host/path,mp=/container/path
# Enable autostart on host boot
pct set <ctid> --onboot 1
Creating a Container
pct create <ctid> <template> \
--hostname <name> \
--memory <mb> \
--cores <n> \
--rootfs <storage>:<size-gb> \
--net0 name=eth0,bridge=vmbr0,ip=dhcp \
--ostype ubuntu \
--unprivileged 1
pct start <ctid>
Example — a 2-core, 2GB Ubuntu container:
pct create 202 local:vztmpl/ubuntu-24.04-standard_24.04-2_amd64.tar.zst \
--hostname pangolin \
--memory 2048 \
--cores 2 \
--rootfs local-lvm:16 \
--net0 name=eth0,bridge=vmbr0,ip=dhcp \
--ostype ubuntu \
--unprivileged 1
pct start 202
Snapshots
# Create a snapshot
pct snapshot <ctid> <name> --description "before upgrade"
# List snapshots
pct listsnapshot <ctid>
# Roll back
pct rollback <ctid> <name>
# Delete a snapshot
pct delsnapshot <ctid> <name>
Cloning
# Full clone — independent copy
pct clone <ctid> <new-ctid> --hostname <new-name> --full
# Linked clone — shares base storage (storage must support it)
pct clone <ctid> <new-ctid> --hostname <new-name>
Running Commands
Run a command inside a container without entering an interactive shell:
pct exec <ctid> -- <command>
# Examples
pct exec 201 -- uptime
pct exec 201 -- bash -c "df -h /"
pct exec 201 -- systemctl status nginx
File Transfer
# Push a file from the host into a container
pct push <ctid> <host-path> <container-path>
# Pull a file from a container to the host
pct pull <ctid> <container-path> <host-path>
# Examples
pct push 201 /tmp/config.yaml /etc/app/config.yaml
pct pull 201 /var/log/app.log /tmp/app.log
Mounting the Filesystem
Access a stopped container's filesystem directly from the Proxmox host — useful for recovering files or editing configs when the container won't start:
# Container must be stopped first
pct mount <ctid>
# Filesystem is now at /var/lib/lxc/<ctid>/rootfs/
# Unmount when done
pct unmount <ctid>
Templates
# List downloaded templates
pveam list local
# Browse available templates
pveam available --section system
# Download a template
pveam download local ubuntu-24.04-standard_24.04-2_amd64.tar.zst
Advanced Operations
Less common commands for disk management, container lifecycle, migration, diagnostics, and restore. If you found what you needed above, you can stop here.
Disk Operations
Resize a disk
# Grow the root filesystem by 10GB
pct resize <ctid> rootfs +10G
# Set absolute size on an additional mount point
pct resize <ctid> mp0 20G
Move a volume to different storage
# Move rootfs to a different storage pool
pct move-volume <ctid> rootfs ceph-pool
# Move to a different container entirely
pct move-volume <ctid> mp0 local-lvm --target-vmid <new-ctid> --target-volume mp0
Force storage rescan
pct rescan
Container Lifecycle
Restore a container from a backup
# Restore a container from a vzdump backup archive
pct restore <ctid> /var/lib/vz/dump/lxc-<ctid>-*.tar.zst --storage local-lvm
Convert to a template
# Convert a stopped container to a template (irreversible — clone first if unsure)
pct template <ctid>
Destroy a container
# Delete a container and all its storage volumes (must be stopped)
pct destroy <ctid>
View pending config changes
# Show config changes that require a restart to take effect
pct pending <ctid>
Suspend and resume
pct suspend <ctid>
pct resume <ctid>
Migration
Migrate to another node (same cluster)
# Migrate a container to another Proxmox node in the same cluster
pct migrate <ctid> <target-node>
# Migrate with storage mapping
pct migrate <ctid> <target-node> --target-storage local-lvm
Remote migrate (different cluster)
pct remote-migrate <ctid> [<target-ctid>] <target-endpoint> \
--target-bridge vmbr0 \
--target-storage local-lvm
Diagnostics & Recovery
Disk usage inside the container
# Show disk usage from the container's perspective
pct df <ctid>
Filesystem check
# Run fsck on a stopped container's rootfs
pct fsck <ctid>
Trim free space (reclaim disk)
# Issue TRIM/discard to reclaim unused blocks (thin-provisioned storage)
pct fstrim <ctid>
Show CPU set assignments
# Show which host CPU cores each container is pinned to
pct cpusets
Unlock a stuck container
# Remove a stuck lock after a failed migration, snapshot, or backup
pct unlock <ctid>
Full Command Reference
Every pct subcommand, in one place.
| Command | What it does | |
|---|---|---|
pct list | List all containers and status | |
pct status <ctid> | Show status of a single container | |
pct start <ctid> | Start a stopped container | |
pct shutdown <ctid> | Graceful shutdown | |
pct stop <ctid> | Force stop | |
pct reboot <ctid> | Reboot | |
pct suspend <ctid> | Suspend to disk | |
pct resume <ctid> | Resume from suspend | |
pct enter <ctid> | Root shell (no login prompt) — exit: Ctrl+D | |
pct console <ctid> | Console with getty — exit: Ctrl+A then q | |
pct exec <ctid> -- <cmd> | Run a command non-interactively | |
pct config <ctid> | Show container configuration | |
pct set <ctid> [OPTIONS] | Modify container configuration | |
pct pending <ctid> | Show config changes pending a restart | |
pct snapshot <ctid> <name> | Create a snapshot | |
pct listsnapshot <ctid> | List all snapshots | |
pct rollback <ctid> <name> | Roll back to a snapshot | |
pct delsnapshot <ctid> <name> | Delete a snapshot | |
pct clone <ctid> <newid> | Clone a container | |
pct create <ctid> <template> | Create a new container | |
pct restore <ctid> <archive> | Restore from vzdump backup | |
pct template <ctid> | Convert to template (irreversible) | ⚠ |
pct destroy <ctid> | Delete container and all disks | ⚠ |
pct migrate <ctid> <node> | Migrate to another cluster node | |
pct remote-migrate <ctid> ... | Migrate to a different cluster | |
pct resize <ctid> <disk> <size> | Resize a disk | |
pct move-volume <ctid> <vol> ... | Move volume to different storage | |
pct rescan | Force storage rescan | |
pct push <ctid> <file> <dest> | Push file from host to container | |
pct pull <ctid> <path> <dest> | Pull file from container to host | |
pct mount <ctid> | Mount stopped container's filesystem | |
pct unmount <ctid> | Unmount container filesystem | |
pct df <ctid> | Show container disk usage | |
pct fsck <ctid> | Filesystem check (container must be stopped) | ⚠ |
pct fstrim <ctid> | Trim free space on thin storage | |
pct cpusets | Show CPU set assignments for all containers | |
pct unlock <ctid> | Remove stuck lock | ⚠ |
pct help | Show help |
⚠ = destructive or requires care — read the relevant section before running.
Quick Reference
| Task | Command |
|---|---|
| List all containers | pct list |
| Enter container (root shell) | pct enter <ctid> |
| Exit pct enter | exit or Ctrl+D |
| Open console (login prompt) | pct console <ctid> |
| Exit pct console | Ctrl+A then q |
| Start container | pct start <ctid> |
| Graceful shutdown | pct shutdown <ctid> |
| Force stop | pct stop <ctid> |
| Reboot | pct reboot <ctid> |
| View config | pct config <ctid> |
| Modify config | pct set <ctid> --<option> <value> |
| Create container | pct create <ctid> <template> ... |
| Create snapshot | pct snapshot <ctid> <name> |
| List snapshots | pct listsnapshot <ctid> |
| Roll back snapshot | pct rollback <ctid> <name> |
| Clone container | pct clone <ctid> <new-ctid> --hostname <name> --full |
| Run command in container | pct exec <ctid> -- <command> |
| Push file to container | pct push <ctid> <host-path> <ctid-path> |
| Pull file from container | pct pull <ctid> <ctid-path> <host-path> |
| Mount stopped container | pct mount <ctid> |
| Unmount container | pct unmount <ctid> |
| Destroy container | pct destroy <ctid> |
| List templates | pveam list local |