fi

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 19 Imported by: 0

README

fi - File Information CLI Tool

A powerful, colorful CLI tool for displaying comprehensive file information with advanced analysis capabilities.

Features

  • Colorized Output - Beautiful, readable terminal output with distinct colors per section
  • Smart Size Formatting - Intelligent display of file sizes in relevant units
  • File Type Detection - MIME type, format detection (ELF, Mach-O, scripts), encoding
  • Binary Analysis - Linked libraries, stripped status, code signatures (macOS)
  • Hash Calculation - MD5, SHA256, SHA512 checksums
  • File Comparison - Git-like diff output comparing two files
  • Symlink Resolution - Complete symlink chain visualization
  • Command Resolution - Automatic PATH lookup for commands
  • Library Search - Find and analyze .so, .a, .dylib files
  • Cross-Platform - Works on macOS and Linux

Installation

macOS
Homebrew
brew tap oh-tarnished/tap
brew install fi
Manual Install
# Download latest release
curl -LO https://github.com/oh-tarnished/fi/releases/latest/download/fi-darwin-arm64

# Make executable and move to PATH
chmod +x fi-darwin-arm64
sudo mv fi-darwin-arm64 /usr/local/bin/fi
Linux
Debian/Ubuntu (deb)
curl -LO https://github.com/oh-tarnished/fi/releases/latest/download/fi_<version>_linux_amd64.deb
sudo dpkg -i fi_<version>_linux_amd64.deb
RHEL/Fedora (rpm)
curl -LO https://github.com/oh-tarnished/fi/releases/latest/download/fi_<version>_linux_amd64.rpm
sudo dnf install fi_<version>_linux_amd64.rpm
Arch Linux
curl -LO https://github.com/oh-tarnished/fi/releases/latest/download/fi_<version>_linux_amd64.pkg.tar.zst
sudo pacman -U fi_<version>_linux_amd64.pkg.tar.zst
From Source

Requires Go 1.21 or later:

go install github.com/oh-tarnished/fi@latest

Or build manually:

git clone https://github.com/oh-tarnished/fi.git
cd fi
go build -o fi
sudo mv fi /usr/local/bin/

Usage

Basic Usage
# Show info for a specific file
fi /usr/bin/python3

# Search for command in PATH
fi python3

# Multiple files
fi file1 file2 file3

# Use glob patterns
fi *.so
Advanced Features
# Show file with checksums
fi --hash file.zip

# Compare two files (git-like diff)
fi file1.txt file2.txt --diff

# Search for library files
fi --lib ssl

# Disable colors
fi --no-color /usr/bin/gcc

Output Example

Path        : /usr/bin/python3
Size        : 31 KB
              ╰─ 31744 bytes
Arch        : arm64
OS          : Darwin
Permissions : -rwxr-xr-x
  ├─ Owner  : rwx (read, write, execute)
  ├─ Group  : rx (read, execute)
  ╰─ Others : rx (read, execute)
File Type   : Mach-O executable
MIME Type   : application/x-mach-binary
Binary Type : Executable
Linked Libraries:
  ├── /usr/lib/libSystem.B.dylib
  ├── /usr/lib/libc++.1.dylib
  ╰── /usr/lib/libz.1.dylib
Privileges:
  ├─ Owner        : root
  ├─ Writable by  : root only
  ╰─ Requires sudo: yes
Checksums: 
  ├─ MD5    : fe7a92c873699de5873ece5963176689
  ├─ SHA256 : 4970a8c688841ce9726a217c549b29e5f34bfdb53abfe221a06d78c903a05368
  ╰─ SHA512 : d14570aeaef900d09bf40d472c0d11813237863b8b98e863647fdd6eb35d7c9c...

Flags

Flag Description
--no-color Disable colored output
--lib Search for library files (.so, .a, .dylib)
--hash Calculate and show file checksums (MD5, SHA256, SHA512)
--diff Compare two files and show differences

File Comparison

The --diff flag provides a git-like comparison of two files:

fi file1 file2 --diff

Output includes:

  • Size comparison - Byte-level difference
  • Permissions - Mode comparison
  • Modification time - Timestamp comparison
  • Checksums - MD5, SHA256, SHA512 comparison
  • Final verdict - IDENTICAL or DIFFERENT

Color Scheme

  • Labels: Cyan (bold)
  • Values: White
  • Tree symbols: Blue
  • Paths: Green
  • Sizes: Magenta
  • Permissions: Yellow
  • Warnings: Red
  • Executable type: Green
  • Matches (✓): Green
  • Differences (✗): Red

Development

Building
# Build for current platform
just build

# Build for all platforms
just build-all

# Run tests
just test

# Install locally
just install
Project Structure
fi/
├── main.go              # Entry point
├── fileinfo.go          # Core file info gathering
├── fileinfo_darwin.go   # macOS-specific info
├── fileinfo_linux.go    # Linux-specific info
├── formatter.go         # Output formatting
├── filetype.go          # File type detection
├── binary.go            # Binary analysis
├── hash.go              # Hash calculation & comparison
├── resolver.go          # Command & library resolution
└── cmd/
    └── root.go          # CLI command definitions

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details

Author

Created by @oh-tarnished

Acknowledgments

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL