Get specific container using lxc/lxd-list command

399 Views Asked by At

When I run the following command: enter image description here

I get the following output: enter image description here

But I only want to get the container specified in the command not all of them.

How can I do that?

1

There are 1 best solutions below

0
On BEST ANSWER

You can use POSIX Extended Regular Expressions:

lxc list -c n '^ubuntu$'

+--------+
|  NAME  |
+--------+
| ubuntu |
+--------+

If you don't want the formatting just use the --format csv switch, which will output just ubuntu