How to create a symbolic link to a command with certain argument?
When I man hexdump, it is said in the man page that "-C Canonical hex+ASCII display...Calling the command hd implies this option". Actually it is. hd equals to hexdump -C.
And then I examined the ln command but find it is a symbolic link to hexdump, just like this: /usr/bin/hd -> hexdump.
But I failed to make such a symbolic link like this. I tried: ln -s "/bin/ls -al" myls. But it didn't work.
I wonder how to make a symbolic link to a command with certain argument.
Long answer: A symbolic link is just a reference to a different file. Basically it tells the OS "You were looking for file x, but to use it please load file y". However, since every program is told it's execution name as the very first parameter (even before those you specify on the command line), it can use different behaviour based on that name. But the program itself has to support that, and short of modifying the source you can't change the behaviour.
No, the ln command has nothing to do with it. The only thing it really does is call the symlink or link function, plus some validation. After all, a program is just a file, like a text file or image.
It does, and it doesn't. Busybox can detect what name it's called with and act accordingly; a trick its developers exploited to squeeze dozens of utilities into one medium executable. What you don't see happening is any arguments in those links. As described previously, that has to be done in the shell.