Proxmox

Top 10 Proxmox CLI Commands for Ultimate Control in 2024

Master Proxmox CLI commands and take full control of your Proxmox VE Server in 2024. Learn how to manage VMs, containers, storage, backups, and more.

Highlights

  • We start the list of the best Proxmox CLI commands with a simple command that enables you to see the specific version of Proxmox VE running on your systems.
  • The pct command is actually the modern tool used for managing LXC containers in Proxmox VE environments, as opposed to the tool to manage OpenVZ containers in legacy versions.
  • It is a great command to verify specific system updates, seeking support, or ensuring that your Proxmox environment is up to date with the latest features and security patches.

One of the great things about Proxmox VE Server is that it contains very powerful command line utilities for controlling, configuring, and managing your Proxmox server. There are many Proxmox CLI utilities you need to know for ultimate control over your Proxmox environment. Let’s look at the top Proxmo CLI commands to know.

The Core of Proxmox VE: A CLI Overview

By using Proxmox VE commands, you can control virtual machine (VM) orchestration, container management, storage, backups, and other aspects of your Proxmox environment. The command line interface (CLI) is a tool for administrators who are serious about low-level configuration and automation.

Let’s consider the following Proxmox CLI commands for controlling and automating your Proxmox environment

1. PVEVersion

We start the list of the best Proxmox CLI commands with a simple command that enables you to see the specific version of Proxmox VE running on your systems. The pveversion command provides a way to see your PVE version information.

Checking Proxmox Version

You can print version information of the Proxmox VE hardware node with the command:

pveversion

This command outputs the current version of Proxmox VE installed. It includes the version number and any patch level installed. It is a great command to verify specific system updates, seeking support, or ensuring that your Proxmox environment is up to date with the latest features and security patches.

Running the pve version command
Running the pve version command

2. QM

The qm command stands as a cornerstone for managing QEMU/KVM virtual machines, offering a comprehensive suite of functionalities. With commands like qm list, which displays all available VMs, to more intricate commands for VM creation and management, mastering qm equips you with the control to optimize your virtual machine performance. This tool ensures your VMs are finely tuned, reflecting on how much memory or CPU resources are allocated, essential for maintaining an efficient virtual environment.

Here are a few examples in the following commands:

Listing All Virtual Machines

qm list

This command displays a list of all configured VMs on your Proxmox host. It provides the basic details about yorur virtual machines such as VM ID, status, and memory allocation.

Qm list command in proxmox
Qm list command in proxmox

Creating a New Virtual Machine

qm create 100 --name myVM --memory 2048 --net0 virtio,bridge=vmbr0

This example creates a new VM with ID 100, named myVM, with 2048 MB of memory and a VirtIO network device attached to vmbr0.

3. PCT

The pct command is actually the modern tool used for managing LXC containers in Proxmox VE environments, as opposed to the tool to manage OpenVZ containers in legacy versions. It allows administrators to perform a wide range of operations related to LXC containers, including creation, deletion, starting, stopping, and configuring these container instances.

Here are a few examples of how you can use the pct command:

List all LXC containers:

pct list
Pct proxmox command for containers
Pct proxmox command for containers

Create a new LXC container:

pct create <VMID> local:vztmpl/<template>.tar.gz --hostname <hostname> --memory <memory> --cores <cores>

This command creates a new LXC container from a template. The <VMID> is the unique ID you assign to the container. The <template> is the name of the template you wish to use. The <hostname> is the desired hostname of the container. <memory> is the amount of RAM in megabytes, and <cores> is the number of CPU cores.

Start an LXC container:

pct start <VMID>

This command starts the container with the specified VMID.

Stop an LXC container:

pct stop <VMID>

This command stops the specified container.

pct provides a powerful, flexible interface for managing LXC containers directly from the command line, making it an essential tool for administrators working within the Proxmox VE environment.

4. PVESH

The pvesh command opens the door to interacting directly with the Proxmox API, offering an alternative to the GUI for managing resources and configurations. This command-line tool allows for a wide range of actions, from querying the system for version information to adjusting configurations, showcasing the versatility of CLI commands in managing a Proxmox VE environment.

pvesh allows direct interaction with the Proxmox API:

Getting Node Information

pvesh get /nodes

The following command retrieves information about all nodes in the Proxmox cluster, including the following sections:

  • node
  • status
  • CPU
  • level
  • maxCPU
  • maxmem
  • mem
  • SSL_fingerprint
Pvesh command for proxmox cli
Pvesh command for proxmox cli

5. PVEUM

Managing user permissions and accounts is streamlined with the pveum command, a dedicated tool for user administration within Proxmox. This command simplifies the complexity surrounding user management, ensuring that access control and permissions align with your security standards.

For user management, pveum is indispensable:

Adding a New User

pveum useradd jdoe@pve --password myPassword --firstname John --lastname Doe

This creates a new user jdoe in the pve realm with the specified password and name.

Pveum proxmox command line cli
Pveum proxmox command line cli

6. PVECM

pvecm, the Proxmox Cluster Manager, is crucial for those operating in a clustered environment. This command facilitates the creation and management of clusters, enhancing the resilience and scalability of your infrastructure. Through commands like man pvecm, administrators can access detailed documentation to adeptly manage their cluster settings.

pvecm is used for cluster management tasks:

Adding a Node to the Cluster

pvecm add <node-IP>

This command adds a new node to the Proxmox cluster using the node’s IP address.

Pvecm proxmox cli command
Pvecm proxmox cli command

7. VZDump and qmrestore

vzdump is a backup tool for Proxmox that saves your virtual machines and containers to backup files. You can set it to automatically back up your data, save it in different places, and use it to quickly get your system back up if something goes wrong.

vzdump 101 --storage local --mode snapshot

This command creates a backup of the container with ID 101, storing it on local storage using snapshot mode.

Restoring a Backup

While you can’t restore OpenVZ VZdump backups for VMs or Openvz container backups using qmrestore:

qmrestore /var/lib/vz/dump/vzdump-qemu-100-*.vma.lzo 100

This restores a backup for VM 100 from a specified VMA.LZO file. You can use the man qmrestore command to view more details of the qmrestore command as well.

8. PVE-Firewall

The pve-firewall tool empowers administrators to directly manage the integrated Proxmox firewall with the CLI. You can enable and disable the firewall, and create and configure rules.

Enabling the Firewall

pve-firewall enable

Activates the firewall across your Proxmox environment, safeguarding your virtual machines and containers.

Adding a Firewall Rule

pve-firewall add rule --action accept --source 192.168.1.0/24 --dest any --proto tcp --dport 22

This command adds a rule allowing SSH access from the specified source network.

Pve firewall command in proxmox
Pve firewall command in proxmox

9. PVESM (Proxmox Storage Manager)

pvesm is a command in Proxmox that helps you manage where your data is stored. You can use it to add, remove, or change storage settings for your virtual machines and containers. It’s useful for organizing storage in a way that makes sense for your setup, or home lab. With pvesm, keeping track of and adjusting your storage space becomes simpler.

Adding a Storage Pool

pvesm add dir --storage local-backup --path /var/lib/vz/backup

Creates a new directory-based storage pool named local-backup for backups.

Listing Storage

pvesm status

With this command you can list your configured storage resources. It allows admins to manage and configure storage efficiently.

Pvesm command for managing proxmox storage
Pvesm command for managing proxmox storage

10. Proxmox Backup Client

As part of the Proxmox Backup Suite, the proxmox-backup-client enhances backup management of the backup utility:

Creating a Backup to Proxmox Backup Server

proxmox-backup-client backup vm/100.pxar:/var/lib/vz/images/100 --repository root@pam@backup-server:backup-vm100
Proxmox backup client in proxmox
Proxmox backup client in proxmox

General management

The command line offers a direct path to managing Proxmox VE packages. You can easily perform system upgrades, and query installed versions. You can use general commands like apt-get update and apt-get upgrade to update your Proxmox host(s).

You can also use general Linux commands like top to see the top CPU processes running on your Proxmox host.

Wrapping up the top Proxmox PVE command line commands

Proxmox VE is a really powerful virtualization platform that is free and open-source and is gaining tons of traction. It is great that it contains so many great commands you can use to configure, manage, and automate your Proxmox environment. The 10 commands we have listed are certainly not the only ones available in Proxmox. However, these commands are some of the most powerful for managing your Proxmox host, virtual machines, and containers. Let me know in the comments if you are using other commands in your Proxmox environment.

Subscribe to VirtualizationHowto via Email 🔔

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com and has over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

2 Comments

  1. Hi

    Nice presentation as always. I d like to mention about the paragraph where you re saying the typical commands like apt-get update and apt-get upgrade.
    First thing is that get is to be deprecated and it is a long time now that you dont need to type extra words. The outcome would be the same just by typing apt.
    Last but not least, there are many posts about if you have to use apt upgrade or apt dist-upgrade in the official forum. I believe the strong opinions were to use the dist-upgrade and since many people tent to forget that, that’s why they guide them to use the gui environment instead.

    1. Jim,

      Thank you for the comment! Yes great points on apt vs apt-get. I am old school and used these for years, so old habits die hard. Thanks for the shout out on this though.

      Brandon

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.