Skip to content

Commit 41da06a

Browse files
committed
Initial release: WinUnix v1.0
8 Linux/Unix tools natively compiled for Windows 11: ps, pstree, top, htop, df, du, free, uname All tools support the same flags as their Linux counterparts. Statically compiled with MSVC - no runtime dependencies.
0 parents  commit 41da06a

File tree

13 files changed

+2541
-0
lines changed

13 files changed

+2541
-0
lines changed

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Compiled binaries
2+
bin/
3+
*.exe
4+
*.obj
5+
*.pdb
6+
*.ilk
7+
*.exp
8+
*.lib
9+
10+
# Build logs
11+
*_build.log
12+
13+
# Old / temporary build scripts
14+
build2.bat
15+
16+
# Root-level cpp files (sources are in src/)
17+
/*.cpp
18+
19+
# OS
20+
Thumbs.db
21+
desktop.ini
22+
.DS_Store
23+
24+
# Editor
25+
.vscode/
26+
*.suo
27+
*.user

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 WinUnix Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# WinUnix
2+
3+
**Linux/Unix command-line tools natively compiled for Windows 11**
4+
5+
WinUnix brings the most-used Linux process and system tools to Windows — built from scratch in C++ using the native Windows API. No WSL, no Cygwin, no dependencies. Just drop the `.exe` files in your PATH and go.
6+
7+
```
8+
> uname -a
9+
Windows DESKTOP 10.0.26100 #1 SMP (Windows Build 26100) x86_64 x86_64 x86_64 Windows_NT
10+
11+
> free -h
12+
total used free shared buff/cache available
13+
Mem: 15.7Gi 8.4Gi 7.3Gi 0B 0B 7.3Gi
14+
Swap: 8.5Gi 3.4Gi 5.1Gi
15+
16+
> pstree -p
17+
explorer(8432)
18+
├─Copilot(7812)
19+
├─ms-teams(14200)
20+
│ └─msedgewebview2(14380)
21+
│ └─4*[msedgewebview2]
22+
└─WindowsTerminal(14472)
23+
└─powershell(13472)
24+
```
25+
26+
---
27+
28+
## Tools
29+
30+
| Tool | Description | Key flags |
31+
|------|-------------|-----------|
32+
| `ps` | Snapshot of running processes | `-e` `-f` `-ef` `aux` `-l` `-C` `-p` `--sort` |
33+
| `pstree` | Process tree with Unicode/ASCII drawing | `-p` `-n` `-u` `-A` `-c` `-h` `-H` |
34+
| `top` | Live process monitor (batch & interactive) | `-b` `-n` `-d` `-o` `-p` `-u` `-i` |
35+
| `htop` | Color interactive process viewer | `-d` `-u` `-p` `-s` `-t` `--sort-key` |
36+
| `df` | Disk space usage by drive | `-h` `-H` `-T` `-t` `-x` `-l` `-k` `-P` |
37+
| `du` | Directory/file size on disk | `-sh` `-a` `-c` `-d` `-h` `-b` `-k` `-m` `--exclude` |
38+
| `free` | RAM and swap usage | `-h` `-b` `-k` `-m` `-g` `-t` `-w` `-s` `-c` |
39+
| `uname` | OS and hardware information | `-a` `-s` `-n` `-r` `-v` `-m` `-p` `-i` `-o` |
40+
41+
All tools accept the same flags as their Linux counterparts.
42+
43+
---
44+
45+
## Installation (from release)
46+
47+
**1. Download** `WinUnix-v1.0.zip` from the [Releases](../../releases/latest) page.
48+
49+
**2. Create a tools folder and extract:**
50+
```cmd
51+
mkdir C:\tools
52+
```
53+
Extract all `.exe` files from the zip into `C:\tools`.
54+
55+
**3. Add to PATH permanently** (run as Administrator):
56+
```cmd
57+
setx /M PATH "%PATH%;C:\tools"
58+
```
59+
60+
**4. Restart your terminal**, then verify:
61+
```cmd
62+
uname -a
63+
free -h
64+
ps aux
65+
```
66+
67+
> The `/M` flag sets the PATH system-wide. Omit `/M` to set it for the current user only.
68+
69+
---
70+
71+
## Building from Source
72+
73+
Requires **Visual Studio 2019 or 2022** with the *"Desktop development with C++"* workload.
74+
75+
```cmd
76+
git clone https://github.com/NoCoderRandom/WinUnix.git
77+
cd WinUnix
78+
build.bat
79+
```
80+
81+
Compiled binaries are placed in `bin\`. The build script auto-detects your VS installation and compiles with `/MT` (statically linked CRT — no runtime DLL dependencies).
82+
83+
---
84+
85+
## Usage Examples
86+
87+
```cmd
88+
# System info
89+
uname -a
90+
uname -r
91+
92+
# Memory
93+
free -h
94+
free -h -t
95+
free -s 2 # refresh every 2 seconds
96+
97+
# Disk
98+
df -h
99+
df -h -T # include filesystem type
100+
du -sh C:\Windows
101+
du -h --max-depth=1 .
102+
103+
# Processes
104+
ps aux
105+
ps -ef
106+
ps aux --sort -%cpu
107+
ps -C explorer # find by name
108+
109+
# Process tree
110+
pstree
111+
pstree -p # with PIDs
112+
pstree -A # ASCII drawing characters
113+
pstree -n # sorted by PID
114+
115+
# Live monitor (batch)
116+
top -b -n 1
117+
top -b -n 5 -d 2 -o mem
118+
119+
# Interactive
120+
top # press q to quit, P/M/T/N to sort
121+
htop # press q to quit, F6 to sort
122+
htop -t # start in tree view
123+
htop --sort-key=CPU
124+
```
125+
126+
---
127+
128+
## Notes
129+
130+
- **No dependencies** — statically compiled, works on any Windows 10/11 machine.
131+
- **TTY column** shows `?` — Windows has no TTY/pts concept.
132+
- **buff/cache and shared** show `0` in `free` — Windows does not expose these kernel buffers separately.
133+
- **df** shows drive letters (`C:`, `D:`) instead of `/dev/sda1` — this is the Windows equivalent.
134+
- Run your terminal **as Administrator** to see all system processes in `ps`, `top`, and `htop`.
135+
136+
---
137+
138+
## License
139+
140+
MIT License — see [LICENSE](LICENSE) for details.

build.bat

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
@echo off
2+
setlocal
3+
4+
:: WinUnix - Build Script
5+
:: Requires Visual Studio 2019 or 2022 with C++ workload
6+
7+
set "SCRIPT_DIR=%~dp0"
8+
set "SRC_DIR=%SCRIPT_DIR%src"
9+
set "OUT_DIR=%SCRIPT_DIR%bin"
10+
11+
:: Detect Visual Studio (2022 or 2019)
12+
set "VCVARS="
13+
if exist "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" (
14+
set "VCVARS=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat"
15+
) else if exist "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" (
16+
set "VCVARS=C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat"
17+
) else if exist "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
18+
set "VCVARS=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
19+
) else if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" (
20+
set "VCVARS=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat"
21+
) else if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" (
22+
set "VCVARS=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat"
23+
)
24+
25+
if not defined VCVARS (
26+
echo [ERROR] Visual Studio 2019 or 2022 not found.
27+
echo Please install "Desktop development with C++" workload.
28+
exit /b 1
29+
)
30+
31+
call "%VCVARS%" x64 >nul 2>&1
32+
if errorlevel 1 (
33+
echo [ERROR] Failed to initialize Visual Studio environment.
34+
exit /b 1
35+
)
36+
37+
if not exist "%OUT_DIR%" mkdir "%OUT_DIR%"
38+
39+
set CFLAGS=/nologo /O2 /W3 /EHsc /std:c++17 /MT
40+
set LIBS_PROC=psapi.lib advapi32.lib
41+
set LIBS_PDH=psapi.lib advapi32.lib pdh.lib
42+
set LIBS_SHWAPI=shlwapi.lib
43+
44+
echo Building WinUnix tools...
45+
echo.
46+
47+
set ERRORS=0
48+
49+
call :build uname ""
50+
call :build free "%LIBS_PROC%"
51+
call :build df ""
52+
call :build du "%LIBS_SHWAPI%"
53+
call :build ps "%LIBS_PROC%"
54+
call :build pstree "%LIBS_PROC%"
55+
call :build top "%LIBS_PDH%"
56+
call :build htop "%LIBS_PDH%"
57+
58+
echo.
59+
if %ERRORS%==0 (
60+
echo [OK] All tools built successfully in: %OUT_DIR%
61+
) else (
62+
echo [WARN] %ERRORS% tool(s) failed to build.
63+
exit /b 1
64+
)
65+
exit /b 0
66+
67+
:build
68+
set TOOL=%~1
69+
set TOOL_LIBS=%~2
70+
echo Building %TOOL%...
71+
cl %CFLAGS% "%SRC_DIR%\%TOOL%.cpp" /Fe:"%OUT_DIR%\%TOOL%.exe" %TOOL_LIBS% >"%OUT_DIR%\%TOOL%_build.log" 2>&1
72+
if errorlevel 1 (
73+
echo [FAIL] %TOOL% - see %OUT_DIR%\%TOOL%_build.log
74+
set /a ERRORS+=1
75+
) else (
76+
del "%OUT_DIR%\%TOOL%_build.log" 2>nul
77+
del "%OUT_DIR%\%TOOL%.obj" 2>nul
78+
echo [OK] %TOOL%.exe
79+
)
80+
exit /b 0

releases/WinUnix-v1.0.zip

740 KB
Binary file not shown.

0 commit comments

Comments
 (0)