Tuomas Tynkkynen 43f7412e74 process_matcher: Fix accidentally matching against pid
Currently pgrep/pkill without -x/-f flags is matching based on the first
15 characters of /proc/<pid>/stat, which actually contains something like
"1116878 (cat) R" thus matching the process id when it should just match
on the name.

This has probably come from misunderstanding the comment from manpage:

> The process name used for matching is limited to the 15 characters
> present in the output of /proc/pid/stat.

... which doesn't mean pgrep/pkill is literally matching on 15
characters of /proc/<pid>/stat but that the process name in that file is
truncated to 15 characters.

Fixes #307
2025-02-19 01:48:41 +02:00
2024-02-17 17:47:45 +01:00
2025-01-29 09:09:29 +01:00
2024-01-15 23:26:56 +01:00
2024-01-26 19:19:00 +00:00

Crates.io Discord License dependency status

CodeCov

procps

Rust reimplementation of the procps project

Provides command line and full screen utilities for browsing procfs, a "pseudo" file system dynamically generated by the kernel to provide information about the status of entries in its process table (such as whether the process is running, stopped, or a "zombie").

Ongoing:

  • free: Shows the amount of free and used memory in the system.
  • pgrep: Searches for processes based on name and other attributes.
  • pidof: Find the process ID of a running program.
  • pidwait: Waits for a specific process to terminate.
  • pmap: Displays the memory map of a process.
  • ps: Displays information about active processes.
  • pwdx: Shows the current working directory of a process.
  • slabtop: Displays detailed kernel slab cache information in real time.
  • snice: Changes the scheduling priority of a running process.
  • top: Displays real-time information about system processes.
  • w: Shows who is logged on and what they are doing.
  • watch: Executes a program periodically, showing output fullscreen.

TODO:

  • hugetop: Report hugepage usage of processes and the system as a whole.
  • pkill: Kills processes based on name and other attributes.
  • skill: Sends a signal to processes based on criteria like user, terminal, etc.
  • sysctl: Read or write kernel parameters at run-time.
  • tload: Prints a graphical representation of system load average to the terminal.
  • vmstat: Reports information about processes, memory, paging, block IO, traps, and CPU activity.

Elsewhere:

Installation

Ensure you have Rust installed on your system. You can install Rust through rustup.

Clone the repository and build the project using Cargo:

git clone https://github.com/uutils/procps.git
cd procps
cargo build --release
cargo run --release

License

procps is licensed under the MIT License - see the LICENSE file for details

S
Description
No description provided
Readme MIT 3.8 MiB
Languages
Rust 99.7%
Shell 0.3%