Commandes procs
procs est un remplacement moderne de la commande ps, écrit en Rust. Il fournit une sortie colorée, la recherche de processus, une vue arborescente, la surveillance des ressources et le support multiplateforme.
Installation
# Using cargo (Rust)
cargo install procs
# macOS
brew install procs
# Arch Linux
sudo pacman -S procs
# Ubuntu/Debian (via snap)
sudo snap install procs
# Nix
nix-env -i procs
# Download prebuilt binary
curl -sSfL https://github.com/dalance/procs/releases/latest/download/procs-x86_64-linux.zip \
-o procs.zip && unzip procs.zip && mv procs /usr/local/bin/
# Verify installation
procs --version
Utilisation de base
# List all processes (like ps aux but prettier)
procs
# Show specific PID
procs 1234
# Show processes by name
procs nginx
# Show processes by multiple keywords
procs "nginx|postgres|redis"
Filtrage
# Filter by process name
procs ssh
# Filter by exact PID
procs 1
# Filter by username
procs --or user=root
# Filter by CPU usage (processes using CPU)
procs --sortd cpu
# Case-insensitive search (default)
procs Python
# Show only non-kernel processes
procs --nonnumeric
Vue arborescente
# Show process tree
procs --tree
# Tree view with filtering (shows matching processes and their parents)
procs --tree nginx
# Abbreviated tree (collapse branches)
procs --tree --thread
# Tree rooted at specific PID
procs --tree 1
Mode de surveillance
# Watch processes in real-time (refreshes periodically)
procs --watch
# Watch with specific interval (seconds)
procs --watch-interval 2
# Watch filtered processes
procs --watch nginx
Colonnes personnalisées
# Show only specific columns
procs --insert pid,user,cpu,mem,command
# Available built-in columns:
# pid - Process ID
# ppid - Parent process ID
# user - Username
# group - Group name
# state - Process state
# cpu - CPU usage percentage
# mem - Memory usage percentage
# rss - Resident set size
# vsz - Virtual memory size
# read - Disk read bytes
# write - Disk write bytes
# start - Start time
# time - CPU time
# command - Command name
# cmd - Full command line
# threads - Thread count
# tcp - TCP connections
# udp - UDP connections
Tri
# Sort by CPU usage (descending)
procs --sortd cpu
# Sort by memory usage (descending)
procs --sortd mem
# Sort by PID (ascending)
procs --sorta pid
# Sort by start time
procs --sortd start
# Sort by resident memory
procs --sortd rss
Configuration des couleurs
# procs uses colors by default based on resource usage
# High CPU/memory = red/yellow
# Normal = green/default
# Disable color output
procs --color=never
# Force color output (for piping)
procs --color=always
# Theme options
procs --theme=dark # Dark terminal theme
procs --theme=light # Light terminal theme
procs --theme=auto # Auto-detect (default)
Support du pager
# procs automatically uses a pager for long output
# Default pager: less
# Disable pager
procs --pager=disable
# Use specific pager
PAGER=less procs
Intégration Docker
# Show Docker container information alongside processes
procs --docker
# This adds a Docker column showing:
# - Container name
# - Container ID
# - Container status
# Filter by Docker container
procs --docker my-container-name
# Show only Docker-related processes
procs --docker | head -50
Fichier de configuration
# procs reads configuration from ~/.config/procs/config.toml
# Create the config directory
mkdir -p ~/.config/procs
# ~/.config/procs/config.toml
# Default columns to display
[[columns]]
kind = "Pid"
[[columns]]
kind = "User"
[[columns]]
kind = "CpuUsage"
[[columns]]
kind = "MemUsage"
[[columns]]
kind = "RssSize"
[[columns]]
kind = "TcpPort"
[[columns]]
kind = "Command"
# Sort configuration
[sort]
column = 2 # Sort by column index (0-based)
order = "Descending"
# Docker integration
[docker]
path = "unix:///var/run/docker.sock"
# Display configuration
[display]
show_self = false # Don't show procs itself
cut_to_terminal = true # Truncate to terminal width
cut_to_pager = false
color_rss = "ByPercentage"
# Pager
[pager]
mode = "Auto" # Auto, Always, Disable
command = "less"
Utilisation avancée
# Find processes listening on a specific port
procs --tcp 8080
# Find processes with UDP connections
procs --udp 53
# Show thread count
procs --insert pid,user,threads,cpu,mem,command
# Show processes using most memory (top 10)
procs --sortd mem | head -15
# Show processes using most CPU (top 10)
procs --sortd cpu | head -15
# Show processes owned by a specific user
procs root
# Show zombie processes
procs --or state=Z
# Pipe to other tools (force color for grep)
procs --color=always | grep -i python
Comparaison avec ps
# Traditional ps equivalents:
# ps aux -> procs
# ps aux --sort=-rss -> procs --sortd rss
# ps axjf -> procs --tree
# ps -eo pid,user,%cpu,%mem,cmd -> procs --insert pid,user,cpu,mem,cmd
# ps -p 1234 -> procs 1234
# procs advantages over ps:
# - Color-coded output by default
# - Built-in search/filtering
# - Tree view with filtering
# - Docker container awareness
# - TCP/UDP port display
# - Real-time watch mode
# - Configurable via TOML
Intégration shell
# Add alias for common usage patterns
alias ptop='procs --sortd cpu --watch'
alias pmem='procs --sortd mem'
alias ptree='procs --tree'
# Kill process by search (use with caution)
kill $(procs --color=never ssh-agent | awk 'NR>1{print $1}')