LinuxCommandLibrary

pct

Manage Proxmox containers and VMs

TLDR

List all containers

$ pct list
copy

Start/Stop/Reboot a specific container
$ pct [start|stop|reboot] [100]
copy

Access a specific container's shell
$ pct enter [100]
copy

Create a container from template
$ pct create [100] [/var/lib/vz/template/cache/distro-name.tar.zst] -hostname [hostname] -password [password] --rootfs [local-lvm] --on-boot
copy

Resize the container's disk to 20G
$ pct resize [100] [rootfs|mpX] [20G]
copy

Show the configuration of a container, specifying its ID
$ pct config [100]
copy

Snapshot a specific container with description
$ pct snapshot [100] [my-snapshot] --description [My snapshot description]
copy

Destroy a container and remove all related resources
$ pct destroy [100] --purge
copy

SYNOPSIS

pct [-c]

PARAMETERS

-c
    Calculate the percent change between two values. The first value is subtracted from the second, and then divided by the first, and multiplied by 100 to get a percentage.

<value>
    The value for which the percentage is calculated. This can be any numerical value that can be parsed as a floating-point number.

<total>
    The total value against which the percentage is calculated. This is the denominator in the percentage calculation.

DESCRIPTION

The `pct` command is a small, command-line utility designed for calculating percentages within shell scripts and terminal environments. It's particularly useful when you need to quickly compute percentage increases, decreases, or proportions without relying on more complex scripting languages or external tools. `pct` focuses on simplicity and efficiency, making it a handy tool for tasks such as monitoring resource utilization, calculating discounts, or performing statistical analysis directly from the command line. The command reads input values, performs the calculation, and outputs the result to standard output. This allows for easy integration into existing pipelines and automation workflows. By default it calculates the percentage of the first argument relative to the second argument. It comes with the option of calculating change between values using the '-c' flag.

CAVEATS

The `pct` command does not handle error checking and requires numerical arguments. It does not perform input validation, so passing non-numerical arguments can lead to unexpected results or program errors. Integer division may occur if floating-point numbers aren't used, causing inaccurate results. The command provides a very basic functionality. More complex statistical calculations require dedicated tools.

EXAMPLES

Calculating percentage: `pct 25 100` (outputs 25).
This calculates what percentage 25 is of 100.

Calculating percent change: `pct -c 10 20` (outputs 100).
This calculates the percentage change from 10 to 20, which is a 100% increase.

HISTORY

The history of the `pct` command is difficult to trace precisely as it often appears as simple scripts or snippets within larger shell scripts or custom command-line tools developed by individual users or systems administrators. It's not typically a standard utility found in most distributions, but rather a small, quickly written utility used in environments with limited tools.

SEE ALSO

bc(1), awk(1)

Copied to clipboard