.org - The Personal Website of Brian Millar
Twitter Profile Link Github Profile Link LinkedIn Profile Link

Rethinking Coreutils in Project Sandford - Post 1: cat

<-- Back to Blog Posts  |  05/08/2017  |  Brian Millar  |  23 👁  | 

I have been thinking about the original purpose of the core Unix utilties and how they fit into the world of computing today. In many cases the usage of these tools differs greatly from their original intended purpose, in other cases their original purpose would be useful today but the tools have not been updated to suit a modern environment. In this new series of blog posts I will look at the coreutils in a new light and attempt to think of how to create versions of them for Sandford that more suit the needs of computer users today.

I will begin this series with the humble cat utility. Everyone knows cat but most people seem to use it as the "print the contents of a file" utility. People know it is for concatinating files but that is often not how it is used. The tool can be used to concatinate text or binary files, however running cat on a binary is usually useless since the resulting file will not be a valid file for whatever filetype it is. This is because cat has no knowledge of the file structure, it just sticks the binaries to each other and what is headers and what is data is irrelevant. I believe if cat had such knowledge it would become far more useful to people today. Imagine concatinating 20 mp3 song files into a single mp3 album file. The cat utility is designed for concatination and it should be what people go to to concatinate anything. Be it images, songs, videos, webpages, literally anything should be able to be concatinated together easily into a single, valid file for that filetype. Of course cat should still work in its original way, my proposal is to add an option, -k to enable cat to have "knowledge" of the filetype, of course this will only work for concatinating files of the same type. This feature should be totally modular with the user able to add understanding of how to concatinate more filetypes as they please. This is the approach that will be taken with future releases of the cat utility for Sandford Project.