List script files by language type using shebang detection or file extension.
A single script that serves as multiple commands via symlink dispatch. Call it as ls.bash for Bash files, ls.python for Python, ls.php for PHP, etc.
# Clone repository
git clone https://github.com/Open-Technology-Foundation/ls.types.git
cd ls.types
# System-wide install (root)
sudo make install
# User install (no root)
make install
# Uninstall
[sudo] make uninstall| Context | Script | Config |
|---|---|---|
sudo make install |
/usr/local/bin/ |
/etc/ls.types/ |
make install |
~/.local/bin/ |
~/.local/share/ls.types/ |
Manual setup (without make):
./ls.types -S create # Create symlinks in script directoryls.bash # Bash files in current dir
ls.bash /ai/scripts # Bash files in specified dir
ls.bash /dir1 /dir2 # Search multiple directories
ls.bash -d 2 . # Depth 2 (recursive)
ls.bash -rl /ai/scripts # Realpath + ls listing (clustered options)
ls.bash -L /scripts # Include symlinked files
ls.python . # Python files
ls.php /var/www # PHP files| Option | Description |
|---|---|
-d, --maxdepth N |
Max find depth (default: 1) |
-r, --realpath |
Output absolute paths |
-l, --ls |
Format as ls -lhA --color=always listing |
-L, --follow |
Follow symbolic links |
-E, --edit |
Interactive config editor |
-S, --symlinks [ACTION] [DIR] |
Manage symlinks (list|create) |
-V, --version |
Show version |
-h, --help |
Show help |
Short options can be clustered: -Lrl is equivalent to -L -r -l.
Config file format (types.conf):
symlink:filetype:shebang_pattern:extensions
ls.bash:Bash:bash:sh,bash
ls.python:Python:python:py,python
ls.php:PHP:php:php
Fields:
symlink- Command name (dispatch key)filetype- Human-readable labelshebang_pattern- Regex matched against^#!.*{pattern}extensions- Comma-separated file extensions (no dots)
/etc/ls.types/types.conf/usr/local/share/ls.types/types.conf/usr/share/ls.types/types.conf- Script directory (development/fallback)
ls.bash -E # Launch interactive config editorAdd entry:
ls.js:JavaScript:node:js,mjs,cjs
Create symlinks:
ls.bash -S createUse:
ls.js .Files are matched using priority-based logic:
- Shebang match (primary) - First line matches
^#!.*{pattern} - Extension fallback - Checked only if shebang doesn't match
- Binary exclusion - Files detected as binary via
file --mime-encodingare skipped - Readability - Unreadable files are silently skipped
Plain (default):
ls.bash /scripts
# /scripts/deploy.sh
# /scripts/backup.shRealpath (-r):
ls.bash -r /scripts
# /home/user/scripts/deploy.sh
# /home/user/scripts/backup.shListing (-l):
ls.bash -l /scripts
# -rwxr-xr-x 1 user group 1.2K 2026-01-13 09:15 /scripts/deploy.shCombined (-rl):
ls.bash -rl /scripts
# Absolute paths with ls -lhA formattingList symlinks:
ls.bash -S # Or: ls.bash -S list
# Symlinks defined in /path/to/types.conf:
# ls.bash [exists] -> /path/to/ls.types
# ls.python [missing]Create symlinks:
ls.bash -S create # In script directory
ls.bash -S create /target # In specified directory| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Config not found, invalid directory, or symlink creation failed |
| 22 | Unknown option |
- Bash 5.2+
- GNU coreutils (find, realpath)
- file (MIME encoding detection)
GPL-3.0