I was trying to find the naming convention for Linux commands.
For commands like cp
, rm
, mv
, etc it seems to be based on first and second last character like
- move is
mv
- list is
ls
- copy is
cp
- change directory is
cd
, the first character of two words, which makes sense
while sometimes ignoring vowels in some commands, which makes sense.
On the other hand, the command mkdir
is not based on the previous perception: "make directory" is mkdir
which should be more like md
.
As we have naming convention for a variable in a bash script and another guide line (for example 1, 2), I am wondering whether any similar convention exists for these commands.
Best Answer
Historically, UNIX commands are short because, at the time the OS was created, memory was scarce, networks were slow, keyboard were hard to use, and terminals (when available -- most of the times you got the output as a paper print) had small resolution. So it made sense to try to economise as much as possible.
Clearly one couldn't shorten at maximum any arbitrary command and yours is a good example:
md
could better be attributed to a command to generate a MD hash, and a shorthand for "directory" is "dir", so choosingmkdir
for a command that creates a directory makes perfect sense.See also my answer here: Why are UNIX/POSIX system call namings so illegible?
To sum up, there is no convention - as far as I know - for UNIX command names, apart from the guidelines above mentioned which come from historical technical limitations.