Skip to content

Latest commit

 

History

History
167 lines (163 loc) · 11.8 KB

README.md

File metadata and controls

167 lines (163 loc) · 11.8 KB

A command tool get system information

  • [Help]
A terminal cli tool to get system information base on selected option

Usage: cli-tools [COMMAND]

Commands:
  cpu      Print the cpu usage information.
  user     Print the user information.
  process  Print the cpu usage information.
  disk     Print the disk information.
  host     Print the host information.
  network  Print the network information.
  memory   Print the memory information.
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version
  • [User information]
./cli-tools user -u 1
+-------+--------------+-----+-----+-------+
| INDEX |     USER     | UID | GID | LOGIN |
+-------+--------------+-----+-----+-------+
| 0     | root         | 0   | 0   |       |
+-------+--------------+-----+-----+-------+
| 1     | _mbsetupuser | 248 | 248 |       |
+-------+--------------+-----+-----+-------+
  • [Process information]
./cli-tools process -p 1
+------+----------+----------------------------------------------------------+------------+--------------+-----+
| PID  |  STATUS  |                           NAME                           | DISK-USAGE | MEMORY-USAGE | CMD |
+------+----------+----------------------------------------------------------+------------+--------------+-----+
| 1304 | Unknown  | dprivacyd                                                | 0          | 0            |     |
+------+----------+----------------------------------------------------------+------------+--------------+-----+
| 4759 | Sleeping | DiskUnmountWatcher                                       | 24576      | 3391488      |     |
+------+----------+----------------------------------------------------------+------------+--------------+-----+
| 1095 | Sleeping | fudHelperAgent                                           | 122880     | 5783552      |     |
+------+----------+----------------------------------------------------------+------------+--------------+-----+
| 949  | Unknown  | UARPUpdaterServiceAFU                                    | 0          | 0            |     |
+------+----------+----------------------------------------------------------+------------+--------------+-----+
| 730  | Runnable | askpermissiond                                           | 19275776   | 19382272     |     |
+------+----------+----------------------------------------------------------+------------+--------------+-----+
| 773  | Runnable | networkserviceproxy                                      | 2576384    | 32964608     |     |
+------+----------+----------------------------------------------------------+------------+--------------+-----+
  • [Host information]
./cli-tools host -h 1
+---------------+-------------+-------------+--------------+---------+
|   host-name   | system-name |   kernel    | architecture | up-time |
+---------------+-------------+-------------+--------------+---------+
| MacBook.local | Darwin      | MacOS 14.5  | arm64        | 18900   |
+---------------+-------------+-------------+--------------+---------+
  • [Disk information]
./cli-tools disk -d 1
+-------+--------------+------+------------+----------------------+----------------+-----------+
| Index |     Disk     | Type | FileSystem |       Mounted        | Capability/GiB | Removable |
+-------+--------------+------+------------+----------------------+----------------+-----------+
| 0     | Macintosh HD | SSD  | apfs       | /                    | 429.45         | false     |
+-------+--------------+------+------------+----------------------+----------------+-----------+
| 1     | Macintosh HD | SSD  | apfs       | /System/Volumes/Data | 429.45         | false     |
+-------+--------------+------+------------+----------------------+----------------+-----------+
  • [Memory information]
./cli-tools memory -m 1
+------------------+----------------------+-----------------+-----------------+----------------+---------------+---------------+
| Total-Memory/GiB | Available-Memory/GiB | Used-Memory/GiB | Free-Memory/GiB | Total-Swap/GiB | Used-Swap/GiB | Free-Swap/GiB |
| 32.00            | 18.48                | 17.12           | 6.43            | 0.00           | 0.00          | 0.00          |
+------------------+----------------------+-----------------+-----------------+----------------+---------------+---------------+
  • [Network information]
./cli-tools network -n 1
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| 接口名称 |      MAC地址      | 已接收数据包 | 已发送数据包 | 接收时错误 | 发送时错误 |  总接收量  | 总发送量  |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| utun2    | 00:00:00:00:00:00 | 0            | 0            | 0          | 0          | 0          | 3072      |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| utun5    | 00:00:00:00:00:00 | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| en6      | 02:a1:2f:69:1b:5f | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| gif0     | 00:00:00:00:00:00 | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| en7      | 02:a1:2f:69:1b:60 | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| en1      | 36:24:1e:80:dc:c0 | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| en2      | 36:24:1e:80:dc:c4 | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| en3      | 36:24:1e:80:dc:c8 | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| bridge0  | 00:00:00:00:00:00 | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| stf0     | 00:00:00:00:00:00 | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| en0      | bc:d0:74:02:29:c9 | 0            | 0            | 0          | 0          | 1694902272 | 175192064 |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| utun4    | 00:00:00:00:00:00 | 0            | 0            | 0          | 0          | 0          | 1024      |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| llw0     | 16:0b:4a:a7:a0:18 | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| utun0    | 00:00:00:00:00:00 | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| utun1    | 00:00:00:00:00:00 | 0            | 0            | 0          | 0          | 0          | 3072      |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| utun3    | 00:00:00:00:00:00 | 0            | 0            | 0          | 0          | 0          | 3072      |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| anpi1    | 02:a1:2f:69:1b:7f | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| anpi0    | 02:a1:2f:69:1b:7e | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| lo0      | 00:00:00:00:00:00 | 0            | 0            | 0          | 0          | 298668032  | 298668032 |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| ap1      | be:d0:74:02:29:c9 | 0            | 0            | 0          | 0          | 0          | 149504    |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| anpi2    | 02:a1:2f:69:1b:80 | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| awdl0    | 16:0b:4a:a7:a0:18 | 0            | 0            | 0          | 0          | 154624     | 114688    |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| en5      | 02:a1:2f:69:1b:5e | 0            | 0            | 0          | 0          | 0          | 0         |
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
  • [TCP Socket Information]
+-------+------+-------------+---------------+------------+-----------------+-------------+
| Index | PID  |    State    |  Local-Addr   | Local-Port |   Remote-Addr   | Remote-Port |
+-------+------+-------------+---------------+------------+-----------------+-------------+
| 0     | 3899 | Established | 192.168.3.207 | 54095      | 116.132.235.206 | 443         |
+-------+------+-------------+---------------+------------+-----------------+-------------+
| 1     | 1997 | Established | 192.168.3.207 | 53695      | 39.107.253.151  | 443         |
+-------+------+-------------+---------------+------------+-----------------+-------------+
| 2     | 1997 | Established | 127.0.0.1     | 36510      | 127.0.0.1       | 54068       |
+-------+------+-------------+---------------+------------+-----------------+-------------+
| 5     | 1932 | Established | 127.0.0.1     | 53990      | 127.0.0.1       | 63342       |
+-------+------+-------------+---------------+------------+-----------------+-------------+
| 6     | 1932 | Established | 127.0.0.1     | 54054      | 127.0.0.1       | 63342       |
+-------+------+-------------+---------------+------------+-----------------+-------------+
| 7     | 1932 | Established | 127.0.0.1     | 54056      | 127.0.0.1       | 63342       |
+-------+------+-------------+---------------+------------+-----------------+-------------+
| 8     | 1932 | Established | 127.0.0.1     | 54057      | 127.0.0.1       | 63342       |
+-------+------+-------------+---------------+------------+-----------------+-------------+
| 9     | 1932 | Established | 127.0.0.1     | 54059      | 127.0.0.1       | 63342       |
+-------+------+-------------+---------------+------------+-----------------+-------------+