Unix Utilities
The gist: clone simple, tried and true Unix commands.
When working with the command line, it's likely you have used of the core Unix programs like grep
, cat
, less
, tail
, or sort
.
A great learning exercise is to rewrite those existing tools. Who knows, you might end up making a faster or better version.
One of the main concepts in Unix is being able to pipe data and chain together the commands. cat foo.txt | grep bar
, that sort of thing. As part of rewriting these commands, you'll need to learn about stdin
, stdout
, and more.
Here are some simpler utilities that would be good candidates for building:
cat
— output the contents of a file, line by line, to stdoutls
— list the files of the current or passed in directorygrep
— search through the contents of target files for a matchless
— read-only file viewer, particularly useful for longer filessort
— order lines alphanumericallytail
— print last n lines of a file, can follow output with-f
, useful for logswc
— displays the number of lines, words, and bytes in a file
Resources
Examples
- brettchalupa/werds — a (poor) clone of
wc
I made to help learn Rust - demfabris/rmx — Multi-platform GNU rm
- uutils/coreutils — Cross-platform Rust rewrite of the GNU coreutils