Request / Idea: lxc list $search to list as "including" instead of as "starting with"

I’ve managed to name containers in a way that is easy to search the list, but I still feel like:

It would be far more intuitive if the search function of the lxc list command could default or at least have an option for “like” or “including” besides the current “starts with”.

I think “use regex” is not a proper answer for such a simple yet powerful functionality. However, a few basic regex examples could go a long way if that is the only solution available.

Note: In the man pages and docs, it does not specify which “flavor” of regex is expected, hence adding a lot of confusion.

FYI: The Java/JavaScript flavor is used, for example:
lxc list ^.*something.*$
will give you the list of all containers having “something” anywhere in the container name. I think the UX can be improved a lot with a small change.

It’s not as small a change as it sounds as filtering is performed server side with the filter sent over the REST API. So this would need an extension to the filtering syntax which doesn’t break backward compatibility.

One suggestion to ease with searching for instances is to add additional label/tags to them, in the form of user.XYZ config keys. You can then do lxc list user.XYZ=foo or similar to get all instances with that particular thing set.

1 Like

Right, all changes seem small to the person not having to implement them, hehehe.

Thanks @stgraber for taking the time to respond and thank you for the labels/tags tip, the more I learn about LXC/LXD the more there is to discover…