https://github.com/michaeladler/shell-snoop
figure out the exact command which was used to run a child process in a shell
https://github.com/michaeladler/shell-snoop
tmux-plugins
Last synced: about 1 year ago
JSON representation
figure out the exact command which was used to run a child process in a shell
- Host: GitHub
- URL: https://github.com/michaeladler/shell-snoop
- Owner: michaeladler
- License: apache-2.0
- Archived: true
- Created: 2021-05-18T08:38:37.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T05:51:04.000Z (about 2 years ago)
- Last Synced: 2025-02-20T02:26:49.053Z (over 1 year ago)
- Topics: tmux-plugins
- Language: Rust
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/michaeladler/shell-snoop/actions/workflows/build.yml)
[](https://github.com/michaeladler/shell-snoop/actions/workflows/ci.yml)
# shell-snoop
**shell-snoop** figures out the **exact command** which was used to run a child process in a shell.
This works great in combination with a session persistence plugin such as [tmux-resurrect](https://github.com/tmux-plugins/tmux-resurrect).
Currently, there is support for **bash** and **zsh**.
## Demo
```bash
# get pid of zsh
$ echo $$
14316
# start some arbitrary child process:
$ env foo=bar sleep 300
```
In another shell:
```bash
$ shell-snoop 14316
env foo=bar sleep 300
```
As you can see, `shell-snoop` was able to figure the exact command which was used to start the child process.
## Build & Install
```
$ cargo install
# setcap cap_sys_ptrace+eip ~/.cargo/bin/shell-snoop
```
**Hint**: A statically linked binary is provided as an artifact in [Github Actions](https://github.com/michaeladler/shell-snoop/actions/workflows/build.yml).
You must be logged in to download it though (this is a restriction imposed by Github for 'security reasons').
## Credits
This is based on [save_command_strategies/gdb.sh](https://github.com/tmux-plugins/tmux-resurrect/blob/8ebda79f6881d84a0cdc144ad5f20395eb0dd846/save_command_strategies/gdb.sh) by Bruno Sutic.