Krysztal Huang e039c3e451 ps: Add command ps (#133)
* ps: Add command `ps`

* pidof: Add some basic arguments and flags

* ps: Introduce new dependencies.

Introduce `uu_pgrep` for processing processes, and introduce `prettytable-rs` for output.

* ps: Finish command infrastructure.

* pgrep: Implemented `Hash` trait for `ProcessInformation`.

* misc: Introduce `nix` crate

* pgrep: Rename `TerminalType` to `Teletype`

* ps: Use `Vec<Rc<RefCell<_>>>` for mutable data.

* misc: Fix conflict

* misc: Fix fmt

* pgrep: Revert refactoring.

* ps: Add `basic_collector`

* ps: Introduce `picker` mod to do data picking.

* ps: Implemented user defined data picking

* ps: Collect and apply header mapping and use `Vec` instead of `LinkedList`

* ps: Add license header

* ps: Apply suggestions

* ps: Implemented logic of `-o`

* ps: Implement basic function.

* ps: Remove empty line of output

* ps: Implemented nullable format parser.

And also introduce `thiserror` crate.

* ps: Implemented `-o` (`--format`)

* ps: Add license header for `parser.rs`

* misc: Apply modifications from upstream

* ps: Implemented code of `time`

* ps: Fix check failure

* ps: Fix build failure on Windows

* ps: Enable tests for another *NIX system.

* ps: Revert tests support for *NIX platform.

It looks like it's very difficult to implement the ps command on *NIX platforms as portable, as it's only portable if you have a proc pseudo-fs. In other words, the current design only even supports Linux.

- FreeBSD's proc pseudo-fs is not automounted.
- macOS does not have a proc fs, it use sysctl instead.

* ps: Refactor mappings to `mapping.rs`

* ps: Clean code

* misc: Bump version of `nix` crate.

* ps: Rewrite document and optimize code.

* ps: Clean TODO and add TODO

Remove TODO in `mapping.rs` and add TODO in `collector.rs`

* ps: Allow multiple occurrences of the same code.

* ps: Fix default codes' display

* ps: Use `Result` instead of `Option` in `parser.rs`

* ps: Remove duplicate elements of `proc_infos`

* ps: Implemented sorting

But only implemented the basic usage: sorting by pid.

* ps: Rename functions in `sorting.rs`

- Rename `sorting` to `sort`
- Rename `default_sort` to `sort_by_pid`

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2024-08-07 10:04:00 +02:00
2024-08-07 10:04:00 +02:00
2024-08-07 10:04:00 +02:00
2024-02-17 17:47:45 +01:00
2024-02-17 14:54:03 +01:00
2024-08-07 10:04:00 +02:00
2024-08-07 10:04:00 +02:00
2024-01-15 23:26:56 +01:00
2024-07-15 01:38:07 +08: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:

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

TODO:

  • ps: Displays information about active processes.
  • pidwait: Waits for a specific process to terminate.
  • skill: Sends a signal to processes based on criteria like user, terminal, etc.
  • tload: Prints a graphical representation of system load average to the terminal.
  • top: Displays real-time information about system processes.
  • vmstat: Reports information about processes, memory, paging, block IO, traps, and CPU activity.
  • pkill: Kills processes based on name and other attributes.
  • snice: Changes the scheduling priority of a running process.

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%