Join GitHub today
An implementation of the unix commands yes, cat, and echo in as few bytes of executable as possible
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
These are minimal implementations of the unix utilities `yes`, `cat`, `echo`, `true` and `false`, written in x86-64 assembly for linux. The goal was to create an implementation which would consume the smallest number of bytes possible as a complete ELF executable. The micro program is a sloppily created program which will remove the section headers from the program in order to save on the space which they would have consumed, and allows for the programs to be as small as possible, containing only the machine code, the ELF header, and a single program segment header. It's also super hacky, and will probably not work well for you. To build, run `make`. All of the utilities which you should need are probably already installed on your machine. The following are the current sizes of the programs as provided by the systems and as implemented here, in bytes. +-------+-----+-------+ | prog | sys | micro | +-------+-----+-------+ | cat | 51K | 167 | | echo | 31K | 167 | | false | 27K | 127 | | true | 27K | 125 | | yes | 27K | 158 | +-------+-----+-------+ NOTE: These programs are not identical to the programs provided by the system, especially in their error handling/reporting capabilities. However, they do perform the primary purpose of the program correctly.