A GNU-style ps command for Windows that brings Linux process management familiarity to Windows environments.
- Overview
- Installation
- Quick Start
- Command Reference
- Usage Examples
- Encoding Behavior
- Integration Examples
- Advanced Usage
- Compatibility
- Troubleshooting
- Contributing
win_ps provides a familiar Linux-style process listing experience on Windows without requiring administrator privileges. It automatically handles encoding for seamless integration with Java, Python, and other tools.
- GNU-compatible: Supports standard options like
-ef,-fl,-l - Smart Encoding: Auto-detects console vs pipe for optimal output
- Flexible Output: Custom columns, multi-key sorting, filtering
- No Admin Required: Works with standard user privileges
- Windows 2008+: Compatible with legacy and modern Windows versions
Download the latest win_ps.exe from Releases and add it to your PATH.
Requirements: Visual Studio 2022 or MSBuild tools
git clone https://github.com/ice3x2/win_ps.git
cd win_ps
msbuild win_ps.sln /p:Configuration=Release /p:Platform=x64Binary will be generated at x64\Release\win_ps.exe.
# List all processes (default output)
win_ps
# Full format with command line
win_ps -ef
# Long format with CPU and priority
win_ps -l# Default: win_ps
PID TIME NAME
2312 28:57 explorer.exe
1234 00:15 chrome.exe
5678 00:05 notepad.exe
# Full format: win_ps -ef
PID TIME PPID STIME NAME CMD
2312 28:57 3536 07:58 explorer.exe C:\WINDOWS\Explorer.EXE
1234 00:15 4567 09:30 chrome.exe "C:\Program Files\Google\Chrome\..."
5678 00:05 1234 09:45 notepad.exe "C:\WINDOWS\system32\notepad.exe"
| Option | Description | Example |
|---|---|---|
-A, -e |
Show all processes (default) | ps -e |
-f |
Full format (adds PPID, STIME, CMD) | ps -f |
-l |
Long format (adds PPID, C, PRI) | ps -l |
-u USER |
Filter by username | ps -u Administrator |
-p PID |
Filter by process ID | ps -p 1234 |
-C NAME |
Filter by executable name | ps -C chrome.exe |
-o FIELDS |
Select output columns | ps -o pid,name,time |
--sort FIELDS |
Sort by fields (prefix - for reverse) |
ps --sort -c,pid |
--utf8 |
Force UTF-8 encoding | ps --utf8 -f |
--utf16 |
Force UTF-16 encoding | ps --utf16 -f |
-v, --version |
Show version | ps -v |
-h, --help |
Show help message | ps --help |
| Field | Description | Example |
|---|---|---|
pid |
Process ID | 1234 |
ppid |
Parent Process ID | 5678 |
user |
Username running the process | Administrator |
name |
Executable name | chrome.exe |
cmd |
Full command line | "C:\Program Files\..." |
time |
Cumulative CPU time (MM:SS) | 02:30 |
c |
CPU usage percentage | 5.2 |
pri |
Process priority | 8 |
stime |
Start time (HH:MM) | 09:30 |
# Find all Chrome processes
win_ps -C chrome.exe
# Show processes for specific user
win_ps -u Administrator
# Display specific process
win_ps -p 1234# Show only PID, CPU, and name
win_ps -o pid,c,name
# Custom columns with sorting
win_ps -o pid,ppid,time,c,cmd --sort -c# Sort by CPU usage (descending)
win_ps --sort -c
# Multi-key sort: CPU descending, then PID ascending
win_ps --sort -c,pid
# Sort by CPU time
win_ps --sort -time# Full format, filter by user, sort by CPU
win_ps -f -u beom --sort -c
# Long format, specific executable, custom columns
win_ps -l -C java.exe -o pid,c,pri,time,cmdwin_ps automatically detects the output destination and selects the optimal encoding:
| Destination | Encoding | Purpose |
|---|---|---|
| Console | UTF-16 | Native Windows console support for Korean/CJK characters |
| Pipe | UTF-8 | Standard compatibility with Java, Python, Node.js, etc. |
| File | UTF-8 | Universal text file format |
Problem: Windows consoles use UTF-16, but most programming languages expect UTF-8 from pipes.
Solution: win_ps detects the output type using GetFileType() and adjusts encoding automatically.
Force a specific encoding when auto-detection doesn't work (rare cases like Git Bash):
# Force UTF-8 (for Java, Python, scripting)
win_ps --utf8 -f
# Force UTF-16 (for console compatibility)
win_ps --utf16 -f > output.txtimport java.io.*;
import java.nio.charset.StandardCharsets;
public class ProcessMonitor {
public static void main(String[] args) throws Exception {
ProcessBuilder pb = new ProcessBuilder("win_ps.exe", "-f");
Process p = pb.start();
// Auto-detects pipe β outputs UTF-8
BufferedReader reader = new BufferedReader(
new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8)
);
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line); // Korean characters work perfectly
}
p.waitFor();
}
}import subprocess
# Run win_ps and capture UTF-8 output
result = subprocess.run(
['win_ps.exe', '-f'],
capture_output=True,
text=True,
encoding='utf-8' # Auto-detects pipe β UTF-8
)
for line in result.stdout.splitlines():
print(line)# Pipe to other commands
win_ps -f | Where-Object { $_ -match 'chrome' }
# Export to CSV (UTF-8)
win_ps -o pid,name,time,c | Out-File -Encoding UTF8 processes.txt
# Filter and sort
win_ps -f | Select-String 'java' | Sort-Objectconst { spawn } = require('child_process');
const ps = spawn('win_ps.exe', ['-f']);
ps.stdout.setEncoding('utf8'); // Auto-detects pipe β UTF-8
ps.stdout.on('data', (data) => {
console.log(data);
});# Top 10 CPU consumers
win_ps -o pid,c,name --sort -c | head -n 11
# Processes using >5% CPU
win_ps -o pid,c,name | findstr /R "[5-9]\.[0-9]"# Show process hierarchy
win_ps -o pid,ppid,name --sort ppid
# Find all children of PID 1234
win_ps -o pid,ppid,name | findstr "1234"# Kill all Chrome processes
win_ps -C chrome.exe -o pid | ForEach-Object {
if ($_ -match '^\s*(\d+)') {
Stop-Process -Id $matches[1] -Force
}
}
# Monitor specific process
while ($true) {
Clear-Host
win_ps -p 1234 -o pid,c,time,name
Start-Sleep -Seconds 2
}- β Windows Server 2008 R2
- β Windows 7
- β Windows 8/8.1
- β Windows 10
- β Windows 11
- β Windows Server 2012/2016/2019/2022
- No elevated privileges needed, but some process details may be restricted for protected processes
- CPU percentage is calculated over 1-second interval (not real-time)
- Command line may be truncated for very long arguments (system limitation)
Problem: Characters appear garbled in Java/Python
Solution: Ensure you're reading UTF-8 from the pipe:
new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8)Problem: Console output shows weird spacing
Solution: This is normal for UTF-16 detection. Redirect to file for UTF-8:
win_ps -f > output.txt # Auto-detects file β UTF-8Problem: Slow on first run
Solution: Windows caches process information after first query. Subsequent runs are faster.
Problem: Some processes don't appear
Solution: Protected system processes require SYSTEM privileges. win_ps shows all user-accessible processes.
MIT License - see LICENSE.txt for details.
- Developer: @ice3x2
- Initial Design Support: ChatGPT (OpenAI)
- Encoding Implementation: Claude Sonnet 4.5 (Anthropic)
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
If this tool helps you, please consider giving it a star on GitHub!
Why win_ps?
- GNU-compatible syntax (unlike
tasklist) - No admin required (unlike
pslist) - Smart encoding for modern development workflows
- Lightweight and portable (single executable)