{"id":37133666,"url":"https://github.com/hemzaz/pfinder","last_synced_at":"2026-01-14T15:36:13.542Z","repository":{"id":241027797,"uuid":"804089795","full_name":"hemzaz/pfinder","owner":"hemzaz","description":"pfinder is a cross-platform Go tool for finding processes by file usage, PID, command strings, regex patterns, and ports on macOS and Linux.","archived":false,"fork":false,"pushed_at":"2024-05-22T01:35:56.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-19T05:34:05.710Z","etag":null,"topics":["cmd","go","golang","shell"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hemzaz.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-21T23:54:08.000Z","updated_at":"2024-05-22T01:35:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"6991c2a1-aa3b-4469-8812-4d780ed51871","html_url":"https://github.com/hemzaz/pfinder","commit_stats":null,"previous_names":["hemzaz/pfinder"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hemzaz/pfinder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemzaz%2Fpfinder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemzaz%2Fpfinder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemzaz%2Fpfinder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemzaz%2Fpfinder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hemzaz","download_url":"https://codeload.github.com/hemzaz/pfinder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemzaz%2Fpfinder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28424374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cmd","go","golang","shell"],"created_at":"2026-01-14T15:36:12.891Z","updated_at":"2026-01-14T15:36:13.528Z","avatar_url":"https://github.com/hemzaz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pfinder: Cross-Platform Process Finder\n\n`pfinder` is a cross-platform tool written in Go that helps you find processes based on various criteria, such as file usage, PID, command strings, regex patterns, and network ports.  \nDesigned to be efficient and robust,  \n`pfinder` works seamlessly on both macOS and Linux without relying on external system commands.\n\n## Features\n\n- **Cross-Platform Compatibility**: Supports macOS and Linux with platform-specific optimizations.\n- **Find Processes by File Usage**: Identify which process is using a specific file or directory.\n- **Find Processes by PID**: Retrieve detailed information about a process by its PID.\n- **Find Processes by Command String or Regex**: Filter running processes based on command strings or regex patterns.\n- **Find Processes by Port**: Identify processes listening on a specific network port.\n- **Efficient and Concurrent**: Utilizes Go's concurrency features to handle large numbers of processes efficiently.\n- **Pure Go Implementation**: No external dependencies or system commands required.\n\n## Installation\n\nTo build `pfinder` from source, follow these steps:\n\n### Prerequisites\n\n1. **Install Go**: Ensure you have Go installed. You can download and install Go from [golang.org](https://golang.org/dl/).\n\n2. **Set Up Go Environment**: Configure your Go environment variables, especially `GOPATH`, which is the directory where your Go workspace is located.\n\n### Steps to Build\n\n1. **Clone the Repository**: Clone the `pfinder` repository from GitHub to your local machine.\n\n    ```bash\n    git clone https://github.com/hemzaz/pfinder.git\n    cd pfinder\n    ```\n\n2. **Install Dependencies**: Install the required Go packages.\n\n    ```bash\n    go get github.com/mitchellh/go-ps\n    go get github.com/shirou/gopsutil/net\n    ```\n\n3. **Build the Executable**: Use the `go build` command to compile the source code into an executable.\n\n    ```bash\n    go build -o pfinder\n    ```\n\n4. **Verify the Executable**: Ensure the `pfinder` executable is created in the current directory.\n\n    ```bash\n    ls -l pfinder\n    ```\n\n## Usage\n\n`pfinder` can be used with multiple arguments to find processes based on various criteria. The results will be aggregated and displayed.\n\n```bash\n./pfinder \u003carguments\u003e...\n```\n\n### Arguments\n\n- **Path**: If the argument is a path to an existing file or folder, `pfinder` reports the PID locking the resource (if any).\n- **PID**: If the argument is a PID, `pfinder` provides detailed information about the process.\n- **String**: If the argument is a string, `pfinder` filters running processes case-insensitively based on the string in their command line.\n- **Regex**: If the argument is a regex, `pfinder` filters running processes using the regex pattern.\n- **Port**: If the argument is a port (prefixed with ':'), `pfinder` reports the processes listening on that port.\n\n### Examples\n\n1. **Find the process using a specific file**:\n\n    ```bash\n    ./pfinder /path/to/file\n    ```\n\n2. **Get details of a process by PID**:\n\n    ```bash\n    ./pfinder 1234\n    ```\n\n3. **Find processes by a command string**:\n\n    ```bash\n    ./pfinder \"go run\"\n    ```\n\n4. **Find processes by a regex pattern**:\n\n    ```bash\n    ./pfinder \".*go.*\"\n    ```\n\n5. **Find processes by a port**:\n\n    ```bash\n    ./pfinder :8080\n    ```\n\n6. **Aggregate multiple arguments**:\n\n    ```bash\n    ./pfinder \"go run\" :8080 /path/to/file\n    ```\n\n## How It Works\n\n### Path Handling\n\n- **macOS**: Uses native Go libraries to check file usage by iterating over processes and their file descriptors.\n- **Linux**: Reads the `/proc` filesystem to check which process is using the specified file or directory.\n\n### PID Handling\n\n- Retrieves detailed information about the process including PID, PPID, user, and command.\n\n### String and Regex Handling\n\n- Filters running processes based on command strings or regex patterns in a case-insensitive manner.\n\n### Port Handling\n\n- Uses the `gopsutil` library to identify processes listening on specified network ports.\n\n## Contributing\n\nWe welcome contributions! Here are a few ways you can help:\n\n1. **Report Bugs**: Use the issue tracker to report bugs.\n2. **Fix Bugs**: If you find a bug and know how to fix it, please do so! Pull requests are welcome.\n3. **Request Features**: If you have ideas for new features, we'd love to hear them.\n\n### How to Contribute\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/fooBar`)\n3. Commit your changes (`git commit -am 'Add some fooBar'`)\n4. Push to the branch (`git push origin feature/fooBar`)\n5. Create a new Pull Request\n\n## Acknowledgements\n\n- [mitchellh/go-ps](https://github.com/mitchellh/go-ps): A library for listing processes on a system.\n- [shirou/gopsutil](https://github.com/shirou/gopsutil): A library for retrieving system and process information.\n\n---\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n---\nAuthored by: **hemzaz the frogodile** 🐸🐊","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhemzaz%2Fpfinder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhemzaz%2Fpfinder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhemzaz%2Fpfinder/lists"}