Skip to content

An implementation of the unix commands yes, cat, and echo in as few bytes of executable as possible

Notifications You must be signed in to change notification settings

mystor/micro-coreutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

An implementation of the unix commands yes, cat, and echo in as few bytes of executable as possible

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published