filebyte 3.5.0

A CLI tool for analyzing files and directories with detailed metadata, permissions, and size information
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# filebyte

A CLI tool to list files and directories with intelligent size formatting, advanced filtering and file analysis. Made in Rust

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)


--- 

If you found this project interesting and want to help me out, buy me a coffee :)

[![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-%23FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://buymeacoffee.com/execrooted)


---

## Aliases

You can invoke the tool as any of the following:

- `filebyte` — full name
- `fbt` — short alias

The commands below work identically with any of these names. For example:

```bash
fbt file
filebyte file 
```

## Installation

### Cargo (Recommended)

```bash
cargo install filebyte
```

### Automated Installation

1. Clone the repository:
```bash
git clone https://github.com/execRooted/filebyte.git
cd filebyte
```

2. Run the installer:
```bash
sudo ./install.sh
```

The installer will automatically:
- Install Rust if not present
- Build filebyte with optimizations
- Install it system-wide to `/usr/local/bin/filebyte`

### Arch Linux (AUR)

```bash
paru -S filebyte
# Or any other AUR helper
```
**!!! Note: I don't use Arch Linux anymore. I will keep publishing to the AUR but I won't test the packages. If you find a problem, please don't hesitate to contact me**

### Windows

1. Install Rust from https://www.rust-lang.org/tools/install
2. Clone the repository and run `install.bat`:

```powershell
git clone https://github.com/execRooted/filebyte.git
cd filebyte
.\install.bat
```

### Manual Build

```bash
git clone https://github.com/execRooted/filebyte.git
cd filebyte
cargo build --release
# Binary will be available at target/release/filebyte
```

## Uninstallation

```bash
cd filebyte
```
```
sudo ./uninstall.sh
```

### Arch Linux

```
paru -R filebyte
# Or any AUR helper
```

### Windows

```powershell
cd filebyte
.\uninstall.bat
```

## Usage

### Basic Usage

```bash
# List files in current directory
filebyte

# List files in specific directory
filebyte /home/user/Documents

# Show directory tree
filebyte --tree

# Analyze a specific file
filebyte -w /path/to/file.txt

# Analyze a directory as a whole
filebyte -w /path/to/directory
```

### Size Formatting

```bash
# Show permissions and modification dates (default)
filebyte

# Show file sizes in auto-detected units
filebyte -s

# Show file sizes in specific units
filebyte -s mb          # Megabytes
filebyte -s gb          # Gigabytes
filebyte -s b           # Bytes
```

### Advanced Filtering

```bash
# Search for specific files
filebyte --search "\.rs$"           # Find Rust files
filebyte --search "config"          # Find files containing "config"

# Exclude files
filebyte --excluding "^\."          # Hide hidden files
filebyte --excluding "temp"         # Exclude temp files

# Combine search and exclusion
filebyte --search "\.txt$" --excluding "old"

# Filter by file size
filebyte --larger-than 10MB         # Files larger than 10MB
filebyte --larger-than 1GB          # Files larger than 1GB
filebyte --larger-than 8 GB         # Space-separated also works
filebyte --larger-than bigfile.bin  # Use another file's size as threshold
filebyte --larger-than 2MiB         # Binary prefix also works
filebyte --larger-than 1GiB         # Binary prefix also works
filebyte --smaller-than 500MB       # Files smaller than 500MB
filebyte --equal-to 10MB            # Files exactly 10MB
filebyte --equal-to 0               # Empty files only

# Filter by file age
filebyte --older-than 30d           # Files older than 30 days
filebyte --older-than 2w            # Files older than 2 weeks
filebyte --older-than 1y            # Files older than 1 year
filebyte --older-than 2024-01-01    # Files older than Jan 1, 2024
filebyte --newer-than 7d            # Files newer than 7 days

# Show only empty files and directories
filebyte --empty
filebyte --empty -r                 # Recursively find empty files/dirs

# Search inside file contents
filebyte --content "hello"          # Show files containing "hello"
filebyte --content "TODO" --r       # Recursively find files with TODO

# Delete or merge duplicate files
filebyte --duplicates --delete-duplicates --force
filebyte --duplicates --merge-duplicates --force
```

### File Analysis

```bash
# Show comprehensive analysis for current directory
filebyte -p

# Analyze a specific file in detail
filebyte -f src/main.rs

# Analyze a directory's metadata
filebyte -d /home/user

# Find duplicate files
filebyte --duplicates

# Find true duplicates by content hash (SHA-256, slower but accurate)
filebyte --duplicates --content-dups

# Find true duplicates using MD5 for faster hashing
filebyte --duplicates --content-dups --hash md5
```

### Disk Operations

```bash
# List all disks
filebyte --disk list

# Analyze specific disk
filebyte --disk /dev/sda1

# Disk info with custom size units
filebyte --disk list --size gb
```

### Sorting & Export

```bash
# Sort by different criteria
filebyte --sort-by size     # Largest files first
filebyte --sort-by date     # Newest files first
filebyte --sort-by name     # Alphabetical

# Export results
filebyte --export results.json
filebyte --export analysis.csv
```

### Interactive Menu

```bash
# Launch interactive menu
filebyte -i
filebyte --interactive
```

The interactive menu provides a user-friendly interface with the following options:

| Option | Description |
|--------|-------------|
| 1 | List files in current directory |
| 2 | Analyze a specific file |
| 3 | Analyze a directory |
| 4 | Find duplicate files |
| 5 | Show directory tree |
| 6 | List all disks |
| 7 | Search for files (regex) |
| 8 | Show file type statistics |
| 9 | Bit converter (bits, kbits, mbits, gbits, tbits) |
| 0 | Exit |

Directory-based prompts in the interactive menu display the current working directory and default to it when pressing Enter.

**Bit Converter** - Option 9 allows you to convert between bits and bytes:
- Input formats: `1000 bits`, `500 kbits`, `1.5 mbits`, `2 gbits`
- Shows conversions in both bits and bytes formats

The menu automatically clears the screen between operations for a clean interface.

## Command Line Options

| Option | Short | Description |
|--------|-------|-------------|
| `--version` | `-v` | Show version information |
| `--help` | `-h` | Show help information |
| `--size <UNIT>` | `-s` | Show file sizes with specified unit (auto, b/bytes, kb/kilobytes, mb/megabytes, gb/gigabytes, tb/terabytes) |
| `--tree` | `-t` | Show directory tree |
| `--properties` | `-p` | Show comprehensive file/directory analysis |
| `--no-color` | | Disable colored output |
| `--disk <DISK>` | `-m` | Disk operations ('list' or specific disk name) |
| `--search <PATTERN>` | `-e` | Search files using regex pattern |
| `--excluding <PATTERN>` | `-x` | Exclude files matching regex pattern |
| `--extension <EXT>` | `-E` | Only list files with the specified extension (e.g. `rs`, `txt`, `pdf`) |
| `--sort-by <CRITERIA>` | | Sort by: name, size, date |
| `--duplicates` | | Find duplicate files |
| `--content-dups` | | Verify duplicates by content hash instead of size only (true duplicates) |
| `--hash <ALGORITHM>` | | Hash algorithm for content-based deduplication (`sha256` or `md5`) |
| `--export <FILE>` | | Export results to JSON/CSV |
| `--file <FILE>` | `-f` | Analyze a specific file |
| `--directory <DIR>` | `-d` | Analyze a directory as a whole |
| `--recursive` | `-r` | Enable recursive searching and analysis |
| `--whole` | `-w` | Analyze the path as a whole (auto-detects if file or directory) |
| `--interactive` | `-i` | Enable interactive menu mode |
| `--lines` | `-l` | Count lines in files |
| `--preview [MODE]` | `-P` | Preview file contents (`N`, `f/N`, or `l/N` for first/last N lines) |
| `--exclude-dirs` | `-X` | Exclude all directories from results |
| `--top <N>` | | Show the N largest files in a directory |
| `--ignore-hidden` | | Skip hidden files and directories (dotfiles) |
| `--stat` | | Show a summary of directory statistics (file count, total size, etc.) |
| `--larger-than <SIZE>` | | Filter files larger than threshold (`10MB`, `1GB`, `8 GB`, `2MiB`, `1GiB`, or path to file) |
| `--smaller-than <SIZE>` | | Filter files smaller than threshold (`1KB`, `500MB`, `500 MB`, `2MiB`, `1GiB`, or path to file) |
| `--equal-to <SIZE>` | | Filter files equal to threshold (`10MB`, `1GB`, `8 GB`, `2MiB`, `1GiB`, or path to file) |
| `--older-than <DURATION>` | | Filter files older than duration (`30d`, `2w`, `1y`, `yyyy-mm-dd`, `30 d`) |
| `--newer-than <DURATION>` | | Filter files newer than duration (`7d`, `1w`, `7 d`) |
| `--empty` | | Show only empty files and directories |
| `--content <PATTERN>` | | Search for pattern inside file contents |
| `--delete-duplicates` | | Delete duplicate files, keeping the first occurrence |
| `--merge-duplicates` | | Merge duplicate files by hard linking |
| `--force` | | Skip confirmation prompts for destructive actions |

## Examples

### Everyday Usage
```bash
# Quick directory overview (shows permissions & dates)
filebyte

# Find large files with sizes
filebyte -s --sort-by size

# Analyze disk usage
filebyte --disk list -s gb

# Find all PDFs
filebyte --search "\.pdf$"

# List only files with a specific extension
filebyte --extension rs
filebyte -E txt

# Recursively list only files with a specific extension
filebyte --extension rs --recursive
filebyte -E txt -r

# Check a specific file's details
filebyte -f important.txt

# Get directory metadata
filebyte -d /home/user/projects

# Search recursively through directories
filebyte -r --search "\.rs$"

# Recursively exclude hidden files and sort by size
filebyte -r --excluding "^\." --sort-by size

# Count lines in all files in current directory
filebyte -l

# Count lines recursively, excluding target directories
filebyte -lr -x target

# Exclude all directories from output
filebyte -X

# Find files larger than 100MB
filebyte --larger-than 100MB

# Find files smaller than 1KB
filebyte --smaller-than 1KB

# Find files exactly matching a size
filebyte --equal-to 50MB
filebyte --equal-to 2MiB

# Find files older than 30 days
filebyte --older-than 30d

# Find files newer than 1 week
filebyte --newer-than 1w

# Show only empty files and directories
filebyte --empty

# Search for text inside files
filebyte --content "TODO"

# Recursively search for text inside files
filebyte --content "FIXME" -r

# Recursively search for text inside files
filebyte --content "FIXME" -r

# Delete duplicate files (keeps first occurrence)
filebyte --duplicates --delete-duplicates --force

# Merge duplicates by hard linking
filebyte --duplicates --merge-duplicates --force

# Recursively search for a file by name
filebyte -r -f filename

# Gets the file info for foo and counts the lines of the bar file
filebyte -f foo -l bar

# Gets the info for foo and bar
filebyte foo bar

# Gets the info for foo and bar directory
filebyte foo bar/

```

### Advanced Analysis
```bash
# Comprehensive file analysis
filebyte -p --export analysis.json

# Find and sort duplicates by size
filebyte --duplicates -s --sort-by size

# Exclude system files and sort by date
filebyte --excluding "^\." --sort-by date

# Recursively analyze entire project structure
filebyte -r -p /home/user/projects

# Find all config files recursively
filebyte -r --search "config" --sort-by date

# Analyze path as whole (auto-detects file or directory)
filebyte -w /path/to/something

# Search with full paths shown
filebyte -r -e kilo

# Preview file contents (first/last N lines)
filebyte --preview 20 important.txt
filebyte -P 5 src/main.rs
filebyte -Pf notes.txt
filebyte -Pl notes.txt
filebyte -Pf 20 notes.txt
filebyte -Pl 20 notes.txt
filebyte -Pf20 notes.txt
filebyte -Pl20 notes.txt
filebyte -P f:5 notes.txt
filebyte -P l:5 notes.txt
```

### Power User Tips
```bash
# Monitor large directories
filebyte /var/log -s mb --sort-by size

# Find recently modified config files
filebyte --search "config" --sort-by date -p

# Disk space analysis
filebyte --disk list -s gb | head -10

# Deep analysis of entire filesystem
filebyte -r / -s gb --sort-by size | head -20

# Find all executables recursively
filebyte -r --search "\.(exe|bin|sh)$" --sort-by size

# Quick file analysis - no flags needed!
filebyte important.txt

```


---

***Made by execRooted***