-
-
Notifications
You must be signed in to change notification settings - Fork 163
The Biggest Shell Programs in the World
Koichi Murase edited this page Dec 12, 2024
·
61 revisions
Help me fill out this page! It's freely editable.
What programs should be listed? I'm using "biggest" in the sense of substantial, not necessarily the raw number of lines.
- Hand-written shell scripts. There are many big autoconf-generated scripts, like the 70K-line coreutils script, but I don't consider them substantial in this sense.
- Shell programs that use data structures and algorithms.
- As a counterexample, bash-completion is pretty sophisticated, but it's also repetitive because it has a relatively simple function for every command on a Unix machine.
- Shell programs that are over 5K lines (though there may be exceptions). The biggest shell programs that aren't repetitive tend to be in the 10K+ line range. I haven't seen any programs over 100K lines.
-
akinomyoga/ble.sh -- 87K lines (63K LoC w/o comments) in total. Bash Line Editor---fish-like interactive line editor in pure bash! The main file
out/ble.sh
has 39K lines (29K LoC), but there are 80K+ lines including module files in total. There are many comments (in Japanese).-
How Interactive Shells Work has a nice overview of how ble.sh works. It's very sophisticated, using
bind -x
to read raw bytes from the terminal, decoding those itself in multiple explicit state machines, maintaining a drawing buffer, updating the buffer, etc. It has timing and "fibers", etc. - This comment on issue 663 has details on the shell parser! I think this is one of the most sophisticated uses of data structures in shell I've seen.
- We are trying to run ble.sh under OSH. It mostly parses.
- First commit in 2015 with 8K lines / 6K loc. The actual development has started in 2013.
-
How Interactive Shells Work has a nice overview of how ble.sh works. It's very sophisticated, using
- kalua - OpenWRT addon ~56K SLoC/lines of POSIX shell
- bashdb, the bash debugger. ~14K lines of bash. Interesting history: Implementing Debuggers
- drwetter/testssl.sh -- 21K lines of bash in a single file! Appears to be hand-written. History: Back in 2006 it started with a few openssl commands.... (Hit issue #606 parsing it.)
-
Simplenetes: Kubernetes in 17K lines of Shell. Amazing! But seems dormant. Hacker News Thread.
- Related to my bold claim here
- rkhunter (official site) -- 21K lines of Bourne shell written from 2003-2018!
-
romkatv/powerlevel10k -- 12K lines of zsh scripts in the directory
internal/
. There are other 8K lines of configs and helper scripts. First commit in 2014. -
dylanaraps/neofetch -- 10K lines of bash 3.2. Displays system information. May also do something interesting with images (?)
- first commit 2015
-
xwmx/nb -- 26K lines (22K LoC) of bash in nb itself. An additional 91K lines (61K LoC) if we count bats tests as bash.
- First commit in 2014, but active commit history starts in early 2016.
- distrobox -- over 7k lines of bash script. Use any linux distribution inside your terminal.
- acme.sh -- 8K lines of shell script. Issues and renews certificates.
-
inxi 2.3.56 [obsolete] -- 16K lines of bash. A fork of
infobash
in 2008 (889 lines then).infobash
has started in 2005. From v2.9,inxi
is replaced by the Perl implementation. - bashforth -- At ~3800 lines this isn't huge, but it apparently implements a real programming language. It has a lot of whitespace and comments.
- yoda -- While only about half the size of the above bashforth, this again is an implementation of a whole interpreter and compiler, while being considerably more feature-packed. Same author, but a 20 years younger implementation. Comment: "What learned you have, unlearn you must!"
- vegardit/bash-funk -- 27K lines (24K LoC) in total. A Bash library. The first commit in May, 2017 (with 10K lines / 8K LoC).
- Relax-and-Recover -- 35K lines (24K LoC). Backup and restoration tool. First git commit March, 2009 (with 4K lines / 3K LoC)
- abcde / A Better CD Encoder, used for ripping CDs, weighs in at around 5.5k LoC.
- thc-segfault -- 3.3K LoC. A pubnix server built mostly using Bash
- ffmpeg/configure - 8.4K LoC. FFmpeg's configure script is hand-written
- ffhevc -- 4k LoC. Fully hand-written Bash wrapper script for encoding to HEVC video using FFmpeg and libx265.
- ffx264 -- 3.9k LoC. Fully hand-written Bash wrapper script for encoding to H.264/AVC video using FFmpeg and libx264.
- h264enc -- 9.2k LoC. Fully hand-written Bash wrapper script for MEncoder for encoding to H.264/AVC video.
- bashtop -- 5.3k LoC. A resource monitor
- halcyon -- 6.6k LoC. A system for installing Haskell apps; hand-written with careful attention to bash semantics and error-checking, in a peculiar style inspired by functional programming.
- winetricks -- 22K lines of shell script. Installs various Windows programs under Wine
- wordshell -- ~7k lines of code. Manages multiple WordPress sites from the command-line.
- BaCon -- ~10k lines of code. Converts programs written in BASIC to C. There are two implementations - one written in BASIC and one as a shell script.
- FireHOL -- 9k lines of code for the main script, another 3k for the FireQOS tool. FireHOL is a language (and a program to run it) which builds secure, stateful firewalls from easy to understand, human-readable configurations.
- gxadmin -- 11kLOC is a collection of templated SQL queries and data processing utilities for managing a scientific workflow engine (Galaxy).
- x11docker -- 11.6k lines of code. Run GUI applications in docker or podman containers.
- modernish is a portable shell dialect written in shell
- bats is a DSL for writing tests. Generates bash code.
- bashible is an Ansible-like DSL in bash. comments
- clash is an object oriented framework compatible with any modern POSIX shell.
- bash Infinity is a standard library and a boilerplate framework for bash.
- Alpine, Aboriginal, Debian scripts -- see blog post
- Completion scripts are big, but often repetitive.
- _git Zsh completion -- 8.3k lines of code
- git-completion.bash
- Docker completion
- dyne/Tomb is a ~3500 line zsh script.
-
Basalt -- a full-featured package manager in pure Bash (est. ~2021). Although it's only a few thousand lines, there's already a rich ecosystem (15+ apps/libs) that includes many thousand more lines. Some Bash libraries include (at various stages of development):
-
bash-core, a library for enhancing the
trap
andshopt
builtins, adding stacktraces, and many essential amenities - bash-object, a library for constructing arbitrarily nested data structures in pure Bash (nearly 200 tests)
- bash-json, a library for parsing and printing JSON in pure Bash
-
bash-core, a library for enhancing the
- tablespoon/fun/cli-clock - a clock with multiline characters written in bash.
- json.bash / jb — a command-line tool and bash library that creates JSON (~1700 lines, plus ~3000 lines of tests).
-
OSH "Wild" Tests parse over a million lines of shell. However most of these are small programs and distro package definitions like Alpine PKGBUILD and Gentoo ebuilds, which are repetitive.
-
shell script are dangerous The shell is a program to handle your system internally via an interactive console(or not)... It's feature full and extremely dangerous. it's not done to produce applications.