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.
git clone https://github.com/Open-Technology-Foundation/ls.types.git
cd ls.types
sudo make installmake install lays down:
| Artefact | Destination |
|---|---|
ls.types binary + 7 dispatch symlinks |
/usr/local/bin/ |
types.conf (preserved if already present) |
/etc/ls.types/ |
Manpage ls.types.1 + per-symlink aliases |
/usr/local/share/man/man1/ |
| Bash completion | /etc/bash_completion.d/ls.types |
Paths are overridable via PREFIX, CONFDIR, MANDIR, COMPDIR. DESTDIR is honoured for staged/packaged installs.
sudo make uninstall # Remove installed files
make check # Verify ls.types is in PATHManual 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 |
-- |
End of options |
-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- Substring fragment inserted into regex^#!.*{pattern}(not a full regex — do not include anchors)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)
The following symlinks are created by make install and listed in the shipped types.conf:
| Symlink | Type | Shebang pattern | Extensions |
|---|---|---|---|
ls.bash |
Bash | bash |
sh, bash |
ls.python |
Python | python |
py, python |
ls.php |
PHP | php |
php |
ls.js |
JavaScript | node |
js, mjs, cjs |
ls.perl |
Perl | perl |
pl, pm |
ls.ruby |
Ruby | ruby |
rb |
ls.sh |
Shell | /bin/sh |
sh |
ls.bash -E # Launch interactive config editor (honours $EDITOR, defaults to nano)Add entry:
ls.js:JavaScript:node:js,mjs,cjs
After saving, the editor prompts to create symlinks for the updated config. Or run manually:
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 | Runtime failure (config not found, unknown symlink, invalid directory, symlink creation failed, unwritable config) |
| 22 | Invalid option or argument (unknown option, missing or non-numeric -d value) |
- Bash 5.2+
- GNU coreutils (find, realpath)
- file (MIME encoding detection)
GPL-3.0