Improvements to the Linux shell utilities

Last updated: 19 May 2018

The utilities provided by the GNU Project are old-fashioned and confusing to novices as they were developed over years under limited coordination. Although they have served the community well for decades, I decided to come up with conceptual alternatives to some of the most commonly used utilities. When the utilities were developed, the times were different and every character was a burden on the storage system and processing unit.

Utilities

File system utilities

New (short) Old
Change-Access (CA) chmod
CA [-I] DirectoryOrFile -P 777
chmod 777 DirectoryOrFile
-I stands for item(s). -P stands for permission.
Change-Owner (CO) chgrp, chown
CO [-I] DirectoryOrFile -U User -G Group
chown User:Group DirectoryOrFile
-I stands for item(s). -U stands for user. -G stands for group.
CO [-I] DirectoryOrFile -U User
chown User DirectoryOrFile
-I stands for item(s). -U stands for user.
CO [-I] DirectoryOrFile -G Group
chown :Group DirectoryOrFile
chgrp Group DirectoryOrFile
-I stands for item(s). -G stands for group.
Create-Item (CI) ln, mkdir, touch
CI [-I] Directory/
mkdir Directory
-I stands for item(s). The slash indicates that the item should be a directory.
CI [-I] File.txt
touch File.txt
-I stands for item(s). The lack of the slash indicates that the item should be a file.
CI -T Target -L Link
ln Target Link
-T stands for targret. -L stands for link. Without the options, the utility would create two files, one called Target and another called Link.
Delete-Item (DI) rm, rmdir
DI [-I] Directory/ [-R]
rm [-d] Directory
rm [-r] Directory
rmdir Directory
-I stands for item(s). -R stands for recursive.
DI [-I] File.txt
rm File.txt
-I stands for item(s). -R stands for recursive.
List-Item (LI) ls
LI
ls
Move-Item (PI) cp, mv
MI -S Source -D Destination -C
cp Source Destination
-S stands for source. -D stands for destination. -C stands for copy.
MI -S Source -D Destination
mv Source Destination
-S stands for source. -D stands for destination.

Text utilities

New (short) Old
Get-Content (GC) cat, head, tail
GC [-I] File.txt
cat File.txt
-I stands for item(s).
GC [-I] File.txt -F 50
head -n 50 File.txt
-I stands for item(s). -F stands for first.
GC [-I] File.txt -L 50
tail -n 50 File.txt
-I stands for item(s). -L stands for last.
Set-Content (SC) cat
SC [-I] File.txt -O "Text to insert (overwrite)."
cat <<EOT > File.txt
Text to insert (overwrite).
EOT
-I stands for item(s). -O stands for overwrite.
SC [-I] File.txt -P "Text to prepend."
Requires a more complicated solution.
-I stands for item(s). -P stands for prepend.
SC [-I] File.txt -A "Text to append."
cat <<EOT >> File.txt
Text to append.
EOT
-I stands for item(s). -A stands for append.

Shell utilities

New (short) Old
Get-Directory (GD) pwd
GD
pwd
Set-Directory (SD) cd
SD /
cd /
Strip-Path (SP) basename, dirname
SP -B /root/File.txt
basename /root/File.txt
SP -D /root/File.txt
dirname /root/File.txt

Arguments and options

This proposal relies heavily on command-line options rather than an inflexible hard-to-remember argument order. The arguments are read from left to right and belong to the option preceeding them. A program can accept unqualified arguments (arguments without a preceeding option) but they should be accepted sparingly and only when their meaning is obvious. An options can be long (e.g. --option) or short (e.g. -opt). Idealy, all options have a long and a short version.

utility
The program utility is executed without arguments nor options.
utility value
The program utility is executed with one unqualified argument (value).
utility value1 value2 value3
The program utility is executed with three unqualified arguments (value1, value2, value3).
utility --option
The program utility is executed with one valueless option (--option).
utility --option1 --option2 --option3
The program utility is executed with 3 valueless options (--option1, --option2, --option3).
utility value --option
The program utility is executed with one unqualified argument (value) and one valueless option (--option).
utility value1 value2 value3 --option1 --option2 --option3
The program utility is executed with three unqualified arguments (value1, value2, value3) and three valueless options (--option1, --option2, --option3).
utility value1 value2 --option1 --option2 value3 --option3 value4 value5
The program utility is executed with two unqualified arguments (value1, value2), one valueless option (--option1), one option (--option2) which takes one value (value3) and one option (--option3) which takes two values (value4, value5).