https://github.com/hurricane1988/cli-tools
cli-tools - Use rust program language to get host information. ⎈ 🖥 ☁️😊🥑
https://github.com/hurricane1988/cli-tools
cli linux markdown rust
Last synced: 2 months ago
JSON representation
cli-tools - Use rust program language to get host information. ⎈ 🖥 ☁️😊🥑
- Host: GitHub
- URL: https://github.com/hurricane1988/cli-tools
- Owner: hurricane1988
- Created: 2024-04-08T14:22:45.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-07T14:10:28.000Z (almost 2 years ago)
- Last Synced: 2025-07-01T05:44:09.911Z (12 months ago)
- Topics: cli, linux, markdown, rust
- Language: Rust
- Homepage:
- Size: 62.5 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## A command tool get system information
- [ ] [Help]
```shell
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**]
```shell
./cli-tools user -u 1
```
```shell
+-------+--------------+-----+-----+-------+
| INDEX | USER | UID | GID | LOGIN |
+-------+--------------+-----+-----+-------+
| 0 | root | 0 | 0 | |
+-------+--------------+-----+-----+-------+
| 1 | _mbsetupuser | 248 | 248 | |
+-------+--------------+-----+-----+-------+
```
- [ ] [**Process information**]
```shell
./cli-tools process -p 1
```
```shell
+------+----------+----------------------------------------------------------+------------+--------------+-----+
| 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**]
```shell
./cli-tools host -h 1
```
```shell
+---------------+-------------+-------------+--------------+---------+
| host-name | system-name | kernel | architecture | up-time |
+---------------+-------------+-------------+--------------+---------+
| MacBook.local | Darwin | MacOS 14.5 | arm64 | 18900 |
+---------------+-------------+-------------+--------------+---------+
```
- [ ] [**Disk information**]
```shell
./cli-tools disk -d 1
```
```shell
+-------+--------------+------+------------+----------------------+----------------+-----------+
| 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**]
```shell
./cli-tools memory -m 1
```
```shell
+------------------+----------------------+-----------------+-----------------+----------------+---------------+---------------+
| 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**]
```shell
./cli-tools network -n 1
```
```shell
+----------+-------------------+--------------+--------------+------------+------------+------------+-----------+
| 接口名称 | 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**]
```shell
+-------+------+-------------+---------------+------------+-----------------+-------------+
| 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 |
+-------+------+-------------+---------------+------------+-----------------+-------------+
```