An open API service indexing awesome lists of open source software.

https://github.com/gigachad80/gilchrist

Unix-like utilities for Windows - wc, find, and rm utilities in one powerful executable
https://github.com/gigachad80/gilchrist

cli find go golang linux powershell rm terminal unix unix-utilities unix-utility utilities utils wc windows windows-11

Last synced: 3 months ago
JSON representation

Unix-like utilities for Windows - wc, find, and rm utilities in one powerful executable

Awesome Lists containing this project

README

          

# πŸš€ Project Name : gilchrist


Maintenance

Contributions Welcome



Description

### πŸ“Œ Overview

**gilchrist** is your essential multi-command utility suite that brings the power of Unix/Linux command-line tools directly to Windows environments. While Windows users struggle with limited native text processing and file management capabilities, gilchrist provides familiar `wc`, `find`, and `rm` commands with full feature parity to their Unix counterparts.

Whether you're counting lines in log files, searching through directory hierarchies, or safely removing files and directories, gilchrist delivers consistent Unix-like behavior optimized for Windows workflows. No more wrestling with PowerShell's verbose syntax or missing your favorite Linux tools - get the familiar command experience you know and love.

---

### πŸ“š Requirements & Dependencies

- **Windows 7.0 or later**
- No additional dependencies required
- Single portable executable
- Golang ( if you want to build from source )

---

## ⚑ Installation

### If you have Git installed :
1. Git clone this repo

```
git clone https://github.com/gigachad80/Gilchrist
cd Gilchrist
```
2. Now build Go executable :

```
go build -o gilchrist.exe
```
3. Run Powershell ISE as administrator and Go to the direcctory where you have cloned the repo then run this command :

```
.\install-gilchrist.ps1
```

### If you haven't Git installed .

1. Go to releases section and download the exe file as per your architecture.

2. Now , Run Powershell ISE as administrator and Go to the direcctory where you have cloned the repo then run this command .

```
.\install-gilchrist.ps1
```

### πŸ”§ Features & Command Suite

### Core Commands

- βœ… **`wc`** - Word, line, character, and byte counting (GNU wc compatible)
- βœ… **`find`** - File and directory search with powerful filtering
- βœ… **`rm`** - Safe file and directory removal with confirmation options

### Universal Features

- βœ… **Windows native** - Works in Command Prompt and PowerShell
- βœ… **Unix compatibility** - Familiar syntax and behavior
- βœ… **Stdin support** - Seamless pipe integration
- βœ… **Error handling** - Robust error reporting and recovery
- βœ… **Help system** - Built-in help for all commands

---

### πŸ“– Command Reference

### πŸ”’ WC Command - Word Count Utility

Count lines, words, characters, and bytes in files or stdin input.

#### Syntax
```cmd
gilchrist wc [OPTIONS] [FILE...]
```

#### Options
| Option | Description |
|--------|-------------|
| `-l` | Print newline counts |
| `-w` | Print word counts |
| `-c` | Print byte counts |
| `-m` | Print character counts |
| `-L` | Print maximum line length (character count) |
| `-h` | Display help |

#### Default Behavior
When no options are specified, `wc` shows lines, words, and bytes (equivalent to `-l -w -c`).

#### Examples
```cmd
# Count lines, words, and bytes (default)
gilchrist wc file.txt
150 842 5234 file.txt

# Count only lines
gilchrist wc -l *.txt
150 file1.txt
200 file2.txt
350 total

# Count characters (Unicode-aware)
gilchrist wc -m unicode.txt
1250 unicode.txt

# Find longest line
gilchrist wc -L code.js
89 code.js

# Process from stdin
type largefile.txt | gilchrist wc -l
5000

# Multiple files with totals
gilchrist wc -lwc *.log
100 500 2500 app.log
250 1200 6000 error.log
350 1700 8500 total

# Combined flags
gilchrist wc -lwcmL report.txt
42 156 892 856 78 report.txt
```

### πŸ” FIND Command - File Search Utility

Search for files and directories with powerful filtering and action capabilities.

#### Syntax
```cmd
gilchrist find [PATH...] [EXPRESSION...]
```

#### Options
| Option | Description |
|--------|-------------|
| `-name ` | File name pattern (glob, case-sensitive) |
| `-iname ` | File name pattern (glob, case-insensitive) |
| `-type ` | File type: 'f' for files, 'd' for directories |
| `-delete` | Delete found files/directories (USE WITH CAUTION!) |
| `-maxdepth ` | Maximum directory descent level |
| `-mindepth ` | Minimum directory descent level |
| `-h` | Display help |

#### Pattern Matching
- `*` - Matches any sequence of characters
- `?` - Matches any single character
- `[abc]` - Matches any character in brackets
- Case sensitivity controlled by `-name` vs `-iname`

#### Examples
```cmd
# Find all .txt files in current directory and subdirectories
gilchrist find . -name "*.txt"
./documents/readme.txt
./logs/debug.txt
./temp/backup.txt

# Find directories case-insensitively
gilchrist find C:\Users -iname "*temp*" -type d
C:\Users\Admin\AppData\Local\Temp
C:\Users\Admin\Documents\Templates

# Limit search depth
gilchrist find . -maxdepth 2 -name "*.log"
./app.log
./logs/error.log

# Find and delete (DANGEROUS - use with care!)
gilchrist find ./temp -name "*.tmp" -delete
gilchrist find: deleted ./temp/cache.tmp
gilchrist find: deleted ./temp/session.tmp

# Find files not in immediate directory
gilchrist find . -mindepth 2 -name "*.js"
./src/components/app.js
./src/utils/helper.js

# Complex search: JavaScript files in src, max 3 levels deep
gilchrist find ./src -maxdepth 3 -iname "*.js" -type f
./src/index.js
./src/components/Header.js
./src/utils/api.js

# Find empty directories (no pattern matches everything)
gilchrist find . -type d -maxdepth 1
./
./empty_folder
./src
```

### πŸ—‘οΈ RM Command - File Removal Utility

Remove files and directories with safety features and confirmation options.

#### Syntax
```cmd
gilchrist rm [OPTIONS] FILE...
```

#### Options
| Option | Description |
|--------|-------------|
| `-r`, `-R` | Remove directories recursively |
| `-f` | Force removal, ignore nonexistent files |
| `-i` | Interactive mode - prompt before removal |
| `-v` | Verbose mode - explain what's being done |
| `-h` | Display help |

#### Safety Features
- **Directory protection**: Won't remove directories without `-r`
- **Interactive confirmation**: `-i` flag prompts for each removal
- **Non-destructive by default**: Fails safely on errors
- **Force override**: `-f` suppresses most errors and prompts

#### Examples
```cmd
# Remove a single file
gilchrist rm oldfile.txt
# (silently removes if successful)

# Remove with confirmation
gilchrist rm -i important.txt
gilchrist rm: remove 'important.txt'? y
removed 'important.txt'

# Remove directory recursively
gilchrist rm -r old_project/
# (removes entire directory tree)

# Verbose removal
gilchrist rm -v *.tmp
removed 'cache.tmp'
removed 'session.tmp'
removed 'backup.tmp'

# Force removal (ignore errors)
gilchrist rm -f nonexistent.txt
# (no error message, continues)

# Interactive recursive removal
gilchrist rm -ri temp_folder/
gilchrist rm: remove directory 'temp_folder/'? y
# (removes after confirmation)

# Combined flags - force recursive verbose
gilchrist rm -rfv old_logs/
removed 'old_logs/app.log'
removed 'old_logs/error.log'
removed 'old_logs/'

# Remove multiple files interactively
gilchrist rm -i *.backup
gilchrist rm: remove 'file1.backup'? y
gilchrist rm: remove 'file2.backup'? n
not removing 'file2.backup'
removed 'file1.backup'
```

---

## πŸ”₯ Real-World Use Cases

### Log Analysis Workflow
```cmd
# Count total log entries
gilchrist wc -l *.log
1500 app.log
2300 error.log
3800 total

# Find all log files in subdirectories
gilchrist find . -name "*.log" -type f
./logs/app.log
./logs/error.log
./archive/old.log

# Clean up old temporary logs
gilchrist find ./temp -name "*.log" -delete
gilchrist find: deleted ./temp/debug.log
gilchrist find: deleted ./temp/trace.log

# Remove log files older than certain pattern
gilchrist rm -v ./archive/*.log
removed './archive/2023-01.log'
removed './archive/2023-02.log'
```

### Development Workflow
```cmd
# Count lines of code in project
gilchrist wc -l *.go *.js *.py
450 main.go
320 utils.go
680 app.js
200 helper.py
1650 total

# Find all source files
gilchrist find . -name "*.go" -o -name "*.js"
./main.go
./utils.go
./frontend/app.js

# Clean build artifacts
gilchrist find . -name "*.exe" -o -name "*.tmp" -delete

# Remove node_modules safely
gilchrist rm -rf node_modules/
```

### System Maintenance
```cmd
# Find large directories
gilchrist find C:\Users -type d -maxdepth 2
C:\Users\AppData
C:\Users\Documents
C:\Users\Downloads

# Count files in Downloads
gilchrist find C:\Users\%USERNAME%\Downloads -type f | gilchrist wc -l
156

# Clean temporary files
gilchrist find %TEMP% -name "*.tmp" -delete
gilchrist rm -f %TEMP%\*.log

# Find configuration files
gilchrist find . -iname "*.config" -o -iname "*.ini"
./app.config
./settings.ini
```

---

## πŸ† gilchrist vs Windows Native Commands

### 🀑 Windows Native vs πŸ—Ώ gilchrist: The Epic Battle

| **Task** | **Windows Native 🀑** | **gilchrist πŸ—Ώ** | **Winner** |
|----------|----------------------|----------------|------------|
| **Count Lines** | `Get-Content file.txt \| Measure-Object -Line` | `gilchrist wc -l file.txt` | πŸ—Ώ **Familiar Unix syntax** |
| **Count Words** | `(Get-Content file.txt \| Out-String \| Measure-Object -Word).Words` | `gilchrist wc -w file.txt` | πŸ—Ώ **Single command** |
| **Find Files** | `Get-ChildItem -Recurse -Filter "*.txt"` | `gilchrist find . -name "*.txt"` | πŸ—Ώ **Shorter, clearer** |
| **Remove Directory** | `Remove-Item -Recurse -Force folder\` | `gilchrist rm -rf folder/` | πŸ—Ώ **Unix familiarity** |
| **Interactive Delete** | `Remove-Item -Confirm folder\` | `gilchrist rm -i folder` | πŸ—Ώ **Simpler flag** |
| **Case-insensitive Search** | `Get-ChildItem -Recurse \| Where-Object {$_.Name -like "*PATTERN*"}` | `gilchrist find . -iname "*pattern*"` | πŸ—Ώ **Built-in flag** |

### πŸ“Š Complex Operations Comparison

| **Operation** | **Windows PowerShell 🀑** | **gilchrist πŸ—Ώ** | **Complexity** |
|---------------|---------------------------|----------------|----------------|
| **Count + Find Pattern Files** | `Get-ChildItem -Recurse -Filter "*.log" \| ForEach-Object { Get-Content $_ \| Measure-Object -Line }` | `gilchrist find . -name "*.log" \| xargs gilchrist wc -l` | **PS: Pipeline hell** vs **WG: Simple pipe** |
| **Find + Delete with Confirmation** | `Get-ChildItem -Recurse -Filter "*.tmp" \| Remove-Item -Confirm` | `gilchrist find . -name "*.tmp" -delete` | **PS: Two commands** vs **WG: One action** |
| **Recursive Verbose Removal** | `Remove-Item -Recurse -Verbose -Force folder\` | `gilchrist rm -rfv folder/` | **PS: Long flags** vs **WG: Compact flags** |
| **Multi-level Directory Search** | `Get-ChildItem -Recurse -Depth 2 -Directory \| Where-Object {$_.Name -like "*cache*"}` | `gilchrist find . -maxdepth 2 -type d -iname "*cache*"` | **PS: Complex pipeline** vs **WG: Clear flags** |

### πŸ”₯ Real-World Scenarios

#### Scenario 1: Project Statistics
**Task:** Count lines of code in all JavaScript files

| **PowerShell 🀑** | **gilchrist πŸ—Ώ** |
|-------------------|----------------|
| ```Get-ChildItem -Recurse -Filter "*.js" \|
ForEach-Object {
$lines = (Get-Content $_.FullName \| Measure-Object -Line).Lines
Write-Output "$($_.Name): $lines lines"
}``` | ```bash
gilchrist find . -name "*.js" -exec gilchrist wc -l {} +
# or simply:
gilchrist wc -l $(gilchrist find . -name "*.js")
``` |
| **Complex looping logic** | **Simple command composition** |

#### Scenario 2: Cleanup Old Files
**Task:** Find and interactively delete .tmp files in subdirectories

| **PowerShell 🀑** | **gilchrist πŸ—Ώ** |
|-------------------|----------------|
| ```Get-ChildItem -Recurse -Filter "*.tmp" \|
ForEach-Object {
$response = Read-Host "Delete $($_.Name)? (y/n)"
if ($response -eq 'y') {
Remove-Item $_.FullName
Write-Host "Deleted $($_.Name)"
}
}``` | ```bash
gilchrist find . -name "*.tmp" -delete
# or for manual confirmation:
gilchrist rm -i $(gilchrist find . -name "*.tmp")
``` |
| **Custom interactive loop** | **Built-in interactive mode** |

#### Scenario 3: Analysis Pipeline
**Task:** Find log files, count total lines, show file with most lines

| **PowerShell 🀑** | **gilchrist πŸ—Ώ** |
|-------------------|----------------|
| ```$logs = Get-ChildItem -Recurse -Filter "*.log"
$totalLines = 0
$maxLines = 0
$maxFile = ""
foreach ($log in $logs) {
$lines = (Get-Content $log \| Measure-Object -Line).Lines
$totalLines += $lines
if ($lines -gt $maxLines) {
$maxLines = $lines
$maxFile = $log.Name
}
}
Write-Host "Total: $totalLines lines"
Write-Host "Largest: $maxFile ($maxLines lines)"``` | ```bash
gilchrist find . -name "*.log" \| xargs gilchrist wc -l
# Output shows individual counts AND total
# Largest file is easily visible in output
``` |
| **20+ lines of scripting** | **1 line with automatic totals** |

### πŸš€ Performance & Usability Comparison

| **Aspect** | **Windows Native 🀑** | **gilchrist πŸ—Ώ** |
|------------|----------------------|----------------|
| **Startup Time** | ~2-3 seconds (PowerShell load) | ~10ms (native binary) |
| **Memory Usage** | ~50-100MB (PowerShell session) | ~2-5MB (Go runtime) |
| **Learning Curve** | PowerShell object model + cmdlet syntax | Familiar Unix command syntax |
| **Cross-Platform Knowledge** | Windows-specific | Transferable to Linux/macOS |
| **Pipeline Efficiency** | Object-heavy processing | Text-based streaming |
| **Error Handling** | Complex try-catch blocks | Built-in Unix-style error codes |

### πŸ’€ Windows Pain Points vs gilchrist Solutions

| **Windows Problems 🀑** | **gilchrist Solutions πŸ—Ώ** |
|-------------------------|-------------------------|
| Verbose cmdlets: `Get-ChildItem -Recurse -Filter` | Concise: `find . -name` |
| Object pipeline complexity | Simple text-based pipes |
| No interactive delete by default | Built-in `-i` flag |
| Complex filtering with `Where-Object` | Direct pattern matching |
| Inconsistent parameter naming | Standard Unix flag conventions |
| Heavy memory usage for simple tasks | Lightweight native binaries |
| Platform-specific knowledge | Universal Unix command knowledge |
| Complex error handling required | Automatic error reporting |

### πŸ† Why gilchrist Wins

#### βœ… **Familiarity**
- **Windows:** Learn PowerShell's unique object model and verbose syntax
- **gilchrist:** Use the same commands you know from Linux/macOS/Unix

#### βœ… **Efficiency**
- **Windows:** `Get-ChildItem -Recurse -Filter "*.txt" | ForEach-Object { (Get-Content $_ | Measure-Object -Line).Lines }`
- **gilchrist:** `find . -name "*.txt" | xargs wc -l`

#### βœ… **Performance**
- Native Go binaries vs PowerShell's .NET overhead
- Text streaming vs object processing
- Instant startup vs PowerShell initialization

#### βœ… **Consistency**
- Standard Unix behavior across all commands
- Consistent flag naming (`-r`, `-i`, `-v`)
- Predictable exit codes and error handling

### 🎯 Bottom Line

**Windows Native 🀑:** "Let me write a 15-line PowerShell script with object manipulation, error handling, and hope it doesn't consume all my RAM..."

**gilchrist πŸ—Ώ:** "Three commands, five flags, job done. Next!"

**gilchrist gives you the Unix command-line power you're used to, while Windows native tools make you feel like you're learning a new programming language just to count files πŸ“**

---

### πŸ› οΈ Advanced Usage Patterns

### Command Chaining
```cmd
# Find large log files and count their lines
gilchrist find . -name "*.log" -type f | xargs gilchrist wc -l

# Count total source code files
gilchrist find . -name "*.go" -o -name "*.js" | gilchrist wc -l

# Clean and verify cleanup
gilchrist find . -name "*.tmp" -delete && echo "Cleanup complete"
```

### Batch Operations
```cmd
# Process multiple directories
for /d %i in (*) do gilchrist wc -l "%i\*.txt"

# Conditional removal
gilchrist find . -name "*.backup" -type f -exec gilchrist rm -i {} +

# Statistics gathering
gilchrist find . -type f | gilchrist wc -l > file_count.txt
```

### Integration with Windows Commands
```cmd
# Combine with DIR
dir /b *.txt | xargs gilchrist wc -l

# Process command output
tasklist | gilchrist find - -name "*chrome*"

# Log analysis
type server.log | gilchrist wc -l
```

---

### πŸ§ͺ Sample Data & Testing

### Test Files Setup

**Create test environment:**
```cmd
mkdir test_env
cd test_env
echo Line 1 > file1.txt
echo Line 2 >> file1.txt
echo Single line > file2.txt
mkdir subdir
echo Nested content > subdir\nested.txt
```

### Verification Commands
```cmd
# Test wc functionality
gilchrist wc -l *.txt
2 file1.txt
1 file2.txt
3 total

# Test find functionality
gilchrist find . -name "*.txt"
.\file1.txt
.\file2.txt
.\subdir\nested.txt

# Test rm functionality (be careful!)
gilchrist rm -v file2.txt
removed 'file2.txt'
```

---

### πŸ“‹ Tips and Best Practices

### General Usage
1. **Always test with `-v` (verbose)** when using `rm` command
2. **Use `-i` (interactive)** for important file removals
3. **Combine commands with pipes** for powerful workflows
4. **Use `-h` flag** to get command-specific help
5. **Test find patterns** before adding `-delete`

### Performance Tips
1. **Use `-maxdepth`** to limit find searches in large directories
2. **Process large files with `wc`** instead of loading into memory
3. **Batch operations** are more efficient than individual commands
4. **Use specific patterns** rather than wildcards when possible

### Safety Practices
1. **Never use `rm -rf` without verification**
2. **Test find commands without `-delete` first**
3. **Use `-f` flag sparingly** - it suppresses important warnings
4. **Keep backups** before bulk operations
5. **Use `-mindepth 1`** to avoid operating on current directory

---

### πŸ™ƒ Why I Created This

As a developer who switches between Windows and Linux environments, I was tired of the cognitive overhead of remembering PowerShell's verbose cmdlet syntax for simple file operations. When I need to count lines in a file, I want to type `wc -l file.txt`, not `Get-Content file.txt | Measure-Object -Line`.

gilchrist brings the familiar Unix command experience to Windows without requiring WSL, Git Bash, or other emulation layers. It's a single executable that provides the essential file utilities with the exact syntax and behavior you expect from Unix systems.

Instead of learning PowerShell's object-oriented approach for basic file operations, you can use the same muscle memory and command patterns that work across Linux, macOS, and now Windows.

---

### ⌚ Development Stats

Approx 30 min

**Features Implemented:**
- βœ… Complete argument parsing with flag package
- βœ… Error handling and exit codes
- βœ… Stdin/stdout pipe support
- βœ… Unicode-aware character counting
- βœ… Glob to regex pattern conversion
- βœ… Safe recursive directory operations
- βœ… Interactive confirmation prompts
- βœ… Comprehensive help system

---

### πŸ“ž Contact

πŸ“§ Email: pookielinuxuser@tutamail.com

---

### πŸ€” Why This Name?

Initially, I thought of naming it Goutils, but it felt a bit boring β€” I wanted something with a cooler vibe. That’s when the name Adam Gilchrist popped into my mind. So, I decided to rename Goutils into gilchrist β€” and that's how the I came up with this .

## πŸ“„ License

Licensed under **GNU Affero General Public License**

---


Need help? Run gilchrist help or gilchrist <command> -h for quick reference!


πŸ•’ Last Updated: June 19, 2025