Chapter 4: Integrating Linux Commands with Click

Alfredo Deza

Python comes with lots of different utilities to interact with a system. Listing directories, getting file information, and even lower-level operations like socket communications. There are situations where these are not sufficient or just not solving the right problem for us. I remember this time I worked with Ceph (a distributed file storage system) and had to interact with different disk utilities. There are quite a few tools to retrieve device information like blkid, lsblk, and parted. They all have some overlap and some distinct features. I had to retrieve some specific information from a device that one tool wouldn’t have and then go to a different tool to retrieve the rest. ...

Get Python Command Line Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.