Home / Server / Proxmox / Proxmox Cheat Sheet: CLI Commands for VMs, LXC and Storage

Proxmox Cheat Sheet: CLI Commands for VMs, LXC and Storage

Proxmox Cheat Sheet: CLI Commands for VMs, LXC and Storage

Proxmox VE (Virtual Environment) is an open-source hypervisor platform built on Debian Linux, combining KVM virtualisation for full virtual machines and LXC for lightweight containers on a single host. All commands below are run over SSH directly on the Proxmox node as root (or with sudo where configured). The three primary CLI namespaces are: qm for KVM virtual machine management, pct for LXC container management, and pvesm for storage management. VMID and CTID refer to the numeric identifiers assigned to each VM or container.

VM Management (qm)

List and Status

Command Description
qm list List all VMs with their ID, name, status, memory, and CPU
qm status VMID Show current running status of a specific VM
qm config VMID Display the full configuration of a VM (hardware, disks, network)
qm showcmd VMID Show the exact QEMU command that Proxmox uses to start the VM

Start, Stop, Reset

Command Description
qm start VMID Start a VM
qm stop VMID Immediately stop a VM (hard power-off, no graceful shutdown)
qm shutdown VMID Send ACPI shutdown signal (graceful guest shutdown)
qm reboot VMID Send ACPI reboot signal to the guest
qm reset VMID Hard reset the VM (equivalent to pressing the reset button)
qm suspend VMID Suspend VM to RAM (pause execution)
qm resume VMID Resume a suspended VM

Create and Delete

Command Description
qm create VMID --name myvm --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0 Create a new VM with the specified ID, name, RAM (MB), CPU cores, and network interface
qm destroy VMID Permanently delete a VM and all associated disk images
qm clone VMID NEWID --name newname Clone an existing VM to a new VM ID with a new name
qm template VMID Convert a VM into a template (read-only base for cloning)

Snapshots

Command Description
qm snapshot VMID snapname Create a snapshot of the VM with the given name
qm listsnapshot VMID List all snapshots for the VM
qm rollback VMID snapname Roll back the VM to the named snapshot
qm delsnapshot VMID snapname Delete a specific snapshot

Disk Operations

Command Description
qm disk import VMID /path/to/disk.img local-lvm Import a raw or QCOW2 disk image into a VM on the specified storage
qm resize VMID scsi0 +20G Increase the size of the scsi0 disk by 20 GB (use scsi0, virtio0, etc. to match your config)
qm move-disk VMID scsi0 target-storage Move a VM disk from its current storage to a different storage pool

Console and Execution

Command Description
qm terminal VMID Attach to the VM’s serial console (requires a serial port configured in the VM)
qm guest exec VMID -- command Run a command inside the guest OS (requires QEMU Guest Agent to be installed and running)
qm agent VMID ping Test whether the QEMU Guest Agent is responding inside the VM
qm monitor VMID Open the QEMU monitor prompt for low-level VM control

LXC Container Management (pct)

List and Status

Command Description
pct list List all LXC containers with their ID, status, and name
pct status CTID Show the running status of a specific container
pct config CTID Display the full configuration of a container

Start, Stop, Enter

Command Description
pct start CTID Start a container
pct stop CTID Immediately stop a container (hard stop)
pct shutdown CTID Gracefully shut down a container
pct reboot CTID Reboot a container gracefully
pct enter CTID Attach an interactive shell session to the container console
pct exec CTID -- command Execute a single command inside the container without an interactive shell

Create and Delete

Command Description
pct create CTID local:vztmpl/ubuntu-22.04-standard_22.04-1_amd64.tar.zst --hostname myct --memory 512 --cores 1 --rootfs local-lvm:8 --net0 name=eth0,bridge=vmbr0,ip=dhcp --password Create a container from a template; sets hostname, memory (MB), CPU cores, root filesystem size (GB), network interface with DHCP, and prompts for root password
pct destroy CTID Permanently delete a container and its storage
pct clone CTID NEWID --hostname newname Clone an existing container to a new ID with a new hostname

Snapshots

Command Description
pct snapshot CTID snapname Create a snapshot of the container (requires LVM-thin or ZFS storage)
pct listsnapshot CTID List all snapshots for the container
pct rollback CTID snapname Roll back the container to the named snapshot
pct delsnapshot CTID snapname Delete a specific container snapshot

Mount and File Access

Command Description
pct mount CTID Mount the container’s root filesystem on the host at /var/lib/lxc/CTID/rootfs (container must be stopped)
pct unmount CTID Unmount the container’s root filesystem from the host
pct push CTID /local/file /container/path Copy a file from the Proxmox host into the container
pct pull CTID /container/file /local/path Copy a file from the container to the Proxmox host

Storage Management (pvesm)

Command Description
pvesm status Show all configured storage pools with their type, status, total size, and free space
pvesm list STORAGE List all volumes (disk images, templates, backups) in a specific storage pool
pvesm scan STORAGE Rescan a storage backend and refresh the volume list
pvesm add TYPE NAME options Add a new storage definition (e.g. pvesm add nfs nfs-share --server 192.168.1.5 --export /data)
pvesm remove NAME Remove a storage definition from Proxmox (does not delete the underlying data)

Common storage types: dir (directory), lvm (LVM volume group), lvmthin (LVM thin pool), nfs, cifs, zfspool, rbd (Ceph RADOS Block Device).

LVM Thin Pool Commands

Command Description
lvs List all logical volumes with size, pool, and data usage
vgs List all volume groups with total and free space
pvs List all physical volumes and which volume group they belong to
lvcreate -L 20G -n myvolume vg0 Create a new 20 GB logical volume named myvolume in volume group vg0
lvextend -L +10G /dev/vg0/myvolume Extend an existing logical volume by 10 GB
lvremove /dev/vg0/myvolume Remove a logical volume (irreversible — confirm with -f to skip prompt)

Node and Cluster Management

Command Description
pvesh get /nodes List all nodes in the cluster via the Proxmox REST API shell
pvesh get /nodes/NODE/status Show CPU, memory, and disk usage for a specific node
pvesh get /cluster/status Show cluster-wide status including quorum and member state
pvecm status Show Corosync cluster membership and quorum status
pvecm nodes List all cluster nodes with their node ID and name
ha-manager status Show the High Availability manager status for all HA-managed resources
pveversion Display the installed Proxmox VE version
pveupdate Check for available Proxmox VE package updates (does not apply them)
apt update && apt dist-upgrade Apply all available updates including kernel and Proxmox packages

Network Configuration

Command Description
cat /etc/network/interfaces View the current network interface configuration file
ip a Show all network interfaces with their IP addresses and state
brctl show List all Linux bridges and their attached interfaces
pvesh get /nodes/NODE/network List network interfaces via the Proxmox API (shows pending changes before apply)
ifup vmbr0 Bring up a network bridge or interface
ifdown vmbr0 Bring down a network bridge or interface

A typical /etc/network/interfaces configuration with a Linux bridge on a single NIC:

auto lo
iface lo inet loopback

auto enp3s0
iface enp3s0 inet manual

auto vmbr0
iface vmbr0 inet static
    address 192.168.1.10/24
    gateway 192.168.1.1
    bridge-ports enp3s0
    bridge-stp off
    bridge-fd 0

After editing /etc/network/interfaces, apply changes with ifreload -a (from the ifupdown2 package, which Proxmox installs by default) to avoid losing network connectivity mid-session.

Backup and Restore

Command Description
vzdump VMID --storage local --mode snapshot Back up a VM to the local storage using snapshot mode (online, minimal downtime)
vzdump VMID --dumpdir /mnt/backup --compress zstd Back up a VM to a specific directory path with Zstandard compression
qmrestore /var/lib/vz/dump/vzdump-qemu-VMID-*.vma NEWVMID Restore a VM backup archive to a new VM ID
pct restore NEWCTID /var/lib/vz/dump/vzdump-lxc-CTID-*.tar.zst Restore an LXC container backup to a new container ID

Backup Modes

Mode Flag Behaviour
stop --mode stop Shuts the VM/container down before backup and restarts afterwards. Safest, ensures consistency. Results in downtime.
suspend --mode suspend Briefly pauses the VM, takes a copy of the disk, then resumes. Short downtime window.
snapshot --mode snapshot Online backup with no downtime. Requires QEMU Guest Agent, or LVM-thin/ZFS storage for data consistency.

To schedule automated backups, use the Proxmox web UI under Datacenter → Backup, or add a cron entry to /etc/cron.d/vzdump directly.

ZFS Commands (if using ZFS storage)

Command Description
zpool status Show health status of all ZFS pools including device errors
zpool list List all pools with size, allocated space, and free space
zfs list List all ZFS datasets and volumes with usage and mount points
zfs list -t snapshot List all ZFS snapshots across all datasets
zfs snapshot pool/dataset@snapname Create a named snapshot of a dataset
zfs rollback pool/dataset@snapname Roll back a dataset to the named snapshot (destroys later snapshots by default)
zfs destroy pool/dataset@snapname Delete a specific ZFS snapshot
zfs get all pool/dataset Display all ZFS properties for a dataset (compression, quota, record size, etc.)
zpool scrub poolname Initiate a data integrity scrub on a pool (reads all data and verifies checksums)
zpool iostat -v Show per-device I/O statistics for all pools

Logs and Diagnostics

Command Description
journalctl -u pve-cluster View logs for the Proxmox cluster service (pve-cluster)
journalctl -u pvedaemon View logs for the Proxmox API daemon
journalctl -u qemu-server@VMID View logs for a specific VM’s QEMU process
cat /var/log/pve/tasks/active View the active task log (backups, migrations, snapshots in progress)
pvesubscription get Check the current Proxmox subscription status and expiry
pveceph status Show Ceph cluster health status (only applicable if Ceph is configured)

Useful One-Liners

# List all VMs and containers with status
qm list && pct list
# Show resource usage for all VMs on a node (replace NODE with hostname)
pvesh get /nodes/NODE/qemu --output-format json | python3 -m json.tool
# Force-stop a frozen VM (bypasses lock checks)
qm stop VMID --skiplock 1
# Find which storage a VM's disks are on
qm config VMID | grep -E "scsi|virtio|ide|sata"
# Bulk snapshot all currently running VMs
for vmid in $(qm list | awk 'NR>1 && $3=="running" {print $1}'); do
    qm snapshot $vmid auto-$(date +%Y%m%d)
done
# Check the full Proxmox version string including package versions
pveversion -v
# Watch the cluster task log live
tail -f /var/log/pve/tasks/active
# List available LXC templates in local storage
pveam list local
# Download an LXC template from the Proxmox template repository
pveam update && pveam download local ubuntu-22.04-standard_22.04-1_amd64.tar.zst
# Check disk usage on the Proxmox host itself
df -h && lvs

Related articles: n8n Expressions Cheat Sheet: Variables, Functions and Syntax, Git Cheat Sheet: Every Command You Need, Linux Commands Cheat Sheet: Home Lab and Server Reference, Proxmox — Complete Guide and How-To Index