{"id":13581742,"url":"https://github.com/mhausenblas/cinf","last_synced_at":"2025-04-06T07:13:51.140Z","repository":{"id":57494166,"uuid":"70931005","full_name":"mhausenblas/cinf","owner":"mhausenblas","description":"Command line tool to view namespaces and cgroups, useful for low-level container prodding","archived":false,"fork":false,"pushed_at":"2020-05-11T11:51:21.000Z","size":1336,"stargazers_count":478,"open_issues_count":0,"forks_count":36,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-30T06:07:34.542Z","etag":null,"topics":["cgroups","cli","containers","debugging","linux","namespace"],"latest_commit_sha":null,"homepage":"http://containerz.info","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mhausenblas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-14T17:10:57.000Z","updated_at":"2025-03-14T04:47:33.000Z","dependencies_parsed_at":"2022-09-06T06:13:07.166Z","dependency_job_id":null,"html_url":"https://github.com/mhausenblas/cinf","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhausenblas%2Fcinf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhausenblas%2Fcinf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhausenblas%2Fcinf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhausenblas%2Fcinf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhausenblas","download_url":"https://codeload.github.com/mhausenblas/cinf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445671,"owners_count":20939958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cgroups","cli","containers","debugging","linux","namespace"],"created_at":"2024-08-01T15:02:13.105Z","updated_at":"2025-04-06T07:13:51.123Z","avatar_url":"https://github.com/mhausenblas.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# cinf\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/mhausenblas/cinf)](https://goreportcard.com/report/github.com/mhausenblas/cinf)\n\nThis is `cinf`, short for container info, a command line tool to view namespaces and cgroups, the stuff that makes up Linux containers such as Docker, rkt/appc, or OCI/runc. It might be useful for low-level container prodding, when you need to understand what's going on under the hood. Read more here: [Containers are a lie](https://medium.com/@mhausenblas/containers-are-a-lie-2521afda1f81) …\n\nContents:\n\n- [Install](#install) `cinf`\n- [Use](#use) `cinf` to\n  - [see all namespaces](#to-see-all-namespaces)\n  - dig into a [namespace](#to-dig-into-a-namespace)\n  - dig into a [cgroup](#to-dig-into-a-cgroup)\n  - dig into a [process](#to-dig-into-a-process) \n  - [monitor a process](#to-monitor-a-process)\n- [CLI reference](#cli-reference)\n- [Background](#background) on namespaces and cgroups\n\n## Install\n\nSimply download the Linux binary:\n\n```sh\ncurl -s -L https://github.com/mhausenblas/cinf/releases/latest/download/cinf_linux_amd64.tar.gz \\\n     -o cinf.tar.gz \u0026\u0026 \\\n     tar xvzf cinf.tar.gz cinf \u0026\u0026 \\\n     mv cinf /usr/local/bin \u0026\u0026 \\\n     rm cinf*\n```\n\nOr build from source (note that you'll get the latest, experimental version via this method):\n\n```sh\ngo get github.com/mhausenblas/cinf\n\nGOOS=linux go build\n```\n\nThe `cinf` package docs are available [online](https://godoc.org/github.com/mhausenblas/cinf/namespaces).\n\n\n## Use\n\nThe following sections show basic usage. For a complete end-to-end usage, see the [walkthrough](walkthrough.md).\n\nNote that if you want to see detailed debug messages, you can do that via a `DEBUG` environment variable, like so: `sudo DEBUG=true cinf`.\n\n### To see all namespaces\n\nTo list all available namespaces and a summary of how many processes are in them along with the user IDs and the top-level command line executed, simply do the following:\n\n    $ sudo cinf\n    \n    NAMESPACE   TYPE  NPROCS  USERS                     CMD\n    \n    4026532396  pid   1       1000                      sleep10000\n    4026532398  net   1       1000                      sleep10000\n    4026531837  user  109     0,1,101,102,104,106,1000  /sbin/init\n    4026532196  pid   2       0,104                     nginx: master proces\n    4026532293  mnt   1       0                         md5sum/dev/urandom\n    4026532298  net   1       0                         md5sum/dev/urandom\n    4026532393  mnt   1       1000                      sleep10000\n    4026532296  pid   1       0                         md5sum/dev/urandom\n    4026531840  mnt   104     0,1,101,102,106,1000      /sbin/init\n    4026531839  ipc   105     0,1,101,102,106,1000      /sbin/init\n    4026531836  pid   105     0,1,101,102,106,1000      /sbin/init\n    4026532193  mnt   2       0,104                     nginx: master proces\n    4026532198  net   2       0,104                     nginx: master proces\n    4026531838  uts   105     0,1,101,102,106,1000      /sbin/init\n    4026532194  uts   2       0,104                     nginx: master proces\n    4026532294  uts   1       0                         md5sum/dev/urandom\n    4026532394  uts   1       1000                      sleep10000\n    4026532395  ipc   1       1000                      sleep10000\n    4026531956  net   105     0,1,101,102,106,1000      /sbin/init\n    4026531856  mnt   1       0\n    4026532195  ipc   2       0,104                     nginx: master proces\n    4026532295  ipc   1       0                         md5sum/dev/urandom\n\n### To dig into a namespace\n\nAssuming we're interested in more information on namespace `4026532398`, we would do the following:\n\n    $ sudo cinf --namespace 4026532193\n\n### To dig into a cgroup\n\nLet's dig into a specific cgroup (with hierarchy ID `3`) of a process (with PID `27681`):\n\n    $ sudo cinf --cgroup 27681:3\n\n### To dig into a process\n\nIt is also possible to list the namespaces a specific process is in:\n\n    $ sudo cinf --pid 27681\n\n### To monitor a process\n\nThe interactive, `top` like mode of `cinf` is as follows. Let's say we want to monitor the control files `memory.usage_in_bytes`, `cpuacct.usage`, and `blkio.throttle.io_service_bytes` for process with PID `27681`: \n\n    $ sudo cinf --mon 27681:memory.usage_in_bytes,cpuacct.usage,blkio.throttle.io_service_bytes\n\nNote that a more detailed usage description is available via the [walkthrough](walkthrough.md).\n\n## CLI reference\n\nThere are three arguments you can provide to `cinf`, to dig into specific aspects of a namespace, cgroup, or process:\n\n- `--namespace $NAMESPACE_ID` … List details about namespace with provided ID.\n- `--cgroup $PID:$CGROUP_HIERARCHY_ID` … List details of a cgroup a process belongs to.\n- `--pid $PID` … List namespaces the process with provided process ID is in.\n- `--mon $PID:$CF1,$CF2,…` … Monitor process with provided process ID and the control files specified.\n\nThe meaning of the output columns is as follows:\n\n- Overview (without arguments):\n  - `NAMESPACE` … the namespace ID\n  - `TYPE` … the type of namespace, see also [explanation of the namespaces](#overview-on-linux-namespaces-and-cgroups) below\n  - `NPROCS` … number of processes in the namespace\n  - `USERS` … user IDs in the namespace\n  - `CMD` … command line of the root process\n- Detailed namespace view (`--namespace`):\n  - `PID` … process ID\n  - `PPID` … process ID of parent\n  - `NAME` … process name\n  - `CMD` … process command line\n  - `NTHREADS`… number of threads\n  - `CGROUPS` … summary of the attached cgroups\n  - `STATE` … process state\n- Detailed cgroups view (`--cgroup`):\n  - `CONTROLFILE` … the name of the control file, see also [cgroup man pages](#reading-material) below\n  - `VALUE` … the content of the control file\n- Detailed process view (`--pid`):\n  - `NAMESPACE` … the namespace ID\n  - `TYPE` … the type of namespace\n- Monitor process view (`--mon`):\n  - `PID` … process ID\n  - `PPID` … process ID of parent\n  - `UIDS` … real, effective, saved set, filesystem user ID\n  - `STATE` … process state\n  - `NAMESPACE` … the IDs of the namespaces the process is in  \n  - `CONTROLFILE` … the name of the control file, see also [cgroup man pages](#reading-material) below\n  - `VALUE` … the content of the control file\n\n## Background\n\nI developed `cinf` because existing tools like `systemd-cgtop` or `lsns` didn't do what I wanted. \nAlso, I needed it for educational purposes (like training sessions, etc.). Note that the output format `cinf` uses is modelled after [lsns](http://karelzak.blogspot.ie/2015/12/lsns8-new-command-to-list-linux.html), so kudos to Karel for the inspiration.\n\nIf you want to learn more about container building blocks such as namespaces and cgroups, check out [containerz.info](http://containerz.info/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhausenblas%2Fcinf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhausenblas%2Fcinf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhausenblas%2Fcinf/lists"}