Awesome
PCtrl - Linux Process/Task Manager based on Rust
Pctrl is a robust, featureful, easy-to-use and powerful process manager based on the Rust programming language. It provides an overview of the system, as in what processes are currently running and the system, and gives administrators control to manipulate these processes. Pctrl is designed to compete with all currently available Linux process managers by providing powerful controls as well as a friendly interface choice of running in either a Terminal User Interface (TUI), Graphical User Interface (GUI) or both.
We have built this project as part of the Operating Systems (CSCE 3401) course at the American University in Cairo with the aim to experiment and learn the rust programming language.
Demo
TUI
GUI
Features
- Run as a TUI or GUI or both
- List all processes in a tabular format
- List all processes in a tree format
- Sort processes by any column
- Search for a process by name or pid
- Filter processes by various categories
- View process details
- View graphs demonstrating both overall system and individual process usage of memory and cpu
- Kill a process
- Change process priority
- Pause/Unpause a process
- Change process niceness
- Change process owner
- Export processes list to a csv file
- Monitor a process and restart it if it crashes
- Track and save a process's resource usage over time in a file
Installation
Deb Package
- Download the deb package from the releases page
- Install the package using
sudo apt install ./pctrl_1.0.0_amd64.deb
AppImage
- Download the AppImage from the releases page
- Make the AppImage executable
chmod +x pctrl_1.0.0_amd64.AppImage
- Run the AppImage
./pctrl_1.0.0_amd64.AppImage
Building from source
- Clone the repository
git clone https://github.com/MohamedSherifNoureldin/PCtrl
- Install system dependencies
sudo apt update sudo apt install libwebkit2gtk-4.0-dev \ build-essential \ curl \ wget \ libssl-dev \ libgtk-3-dev \ libayatana-appindicator3-dev \ librsvg2-dev \ libncursesw5-dev
- Install Rust
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
- Install the latest LTS version of Node & NPM
- Install Tauri-CLI
cargo install tauri-cli
- Install Node packages
npm install
- Build the project
cargo tauri build
- Build results will be located in the
src-tauri/target/release
directory
Usage
- Run the TUI only (default mode)
pctrl
- Run the GUI only
pctrl gui_only
- Run both the TUI and GUI concurrently
pctrl gui
- To view list of command line arguments that Pctrl accepts along with commands that Pctrl accepts
pctrl --help
- To record information about a certain process and save it in a file
Output file: {HOME}/.local/share/pctrl/pctrl_{PID}.plogpctrl --record <pid>
- To monitor a process and restart it whenever it crashes
pctrl keepalive <PID>
- To filter the processes to be displayed in the TUI processes table
Example of filtering for processes with pid greater than 2 and priority 20 and CPU less than 5:pctrl filter --columns <COLUMNS_TO_FILTER_ON> --type <TYPE OF FILTER> --value <VALUE TO FILTER ON>
pctrl filter --columns PID,PRI,CPU --type greater,eq,less --value 2,20,5
- To search for a certain process using PID or Name (CMD)
Example of searching for a process with pid 2:pctrl search --type <TYPE OF SEARCH> --value <VALUE TO SEARCH FOR>
pctrl search --type PID --value 2
- As for the usage of the TUI itself, the TUI contains a Control box that shows what keyboard buttons to click on in order to achieve certain functionality. Most actions described in this box are invoked on the selected item in the processes table. To sort in the TUI, you only need to click on the header of the column you want to sort on and clicking on it toggles the sorting order.
- Similarly, the GUI is self-explanatory and hence doesn't have to be specially explained. However, it is worth noting that some features appear only when you have a process selected from the processes table (such as buttons to manipulate the process) and the tab to show the selected process's graphs.
Directory Structure
src
contains the source code for the react frontend of the GUIApp.css
a custom stylesheet for the GUIApp.jsx
the main component of the GUI responsible for rendering the different tabs and processing the data received from the backendmain.jsx
the entry point of the GUIProcessTable.jsx
the component responsible for rendering the processes tableProcessTree.jsx
the component responsible for rendering the processes treeProcessInfo.jsx
the component responsible for rendering the selected process's informationSystemInfo.jsx
the component responsible for rendering the system information tab along with its graphsTheme.jsx
custom theme for the GUI
src-tauri
contains the source code for the backend and the TUIsrc
actual rust source codemain.rs
the entry point of the backend. It is responsible for handling the command line arguments, starting the TUI or GUI or both accordingly and reading the configuration fileour_mods.rs
just a file to hold all the modules we createdour_modes
contains the code for our modulesgui.rs
contains the code for the tauri methods that are called from the GUItui.rs
contains the code for the cursive TUIproc_functions.rs
contains the code for the functions that read and parse the process information from the system as well as the functions that manipulate processes.structures.rs
contains the code for the structures needed across the project
Authors
- Mohamed Sherif - https://github.com/MohamedSherifNoureldin
- Ali Eissa - https://github.com/Spospider
- Youssef Magdy - https://github.com/youssefmagdy99