117-101 · Question #204
Which shell built-in command can be used to create a shortcut or pseudonym for a longer command? Assume a modern bourne-like shell, such as bash.
The correct answer is E. alias. See the full explanation below for the reasoning.
Question
Options
- Ashortcut
- Bln
- Csudo
- Dlink
- Ealias
How the community answered
(26 responses)- A4% (1)
- B4% (1)
- C12% (3)
- D8% (2)
- E73% (19)
Community Discussion
5The answer is E, alias. In bash and other Bourne-like shells, the alias built-in lets you define a shortcut name that expands to a longer command, so something like alias ll='ls -la' means you just type ll and the shell substitutes the full command before executing it. The other options are not shell built-ins for this purpose: ln and link operate on filesystem hard links, sudo elevates privileges, and shortcut is not a real shell command at all. If anyone in the group is fuzzy on the difference between an alias and a shell function, that might be worth a separate thread since they overlap a bit but have key differences worth knowing for the exam.
The word "pseudonym" is the key here, it is pointing you directly at E, alias. The command alias lets you define a shorter name that the shell replaces with the longer command at parse time, for example alias ll='ls -la' so that typing ll runs the full command. Options B, D, and link all relate to filesystem links, not shell behavior, and sudo is for privilege escalation. Option A, shortcut, is simply not a real built-in in bash or any Bourne-like shell.
I'll be honest, my eye went straight to D because "link" sounds like exactly what you'd call a thing that points to another thing, but then I remembered that ln and link are filesystem tools for making hard and symbolic links to files, not shortcuts for commands you type at a prompt. The word "alias" is the one bash actually uses, and if you type "alias ll='ls -la'" in your terminal you'll see it is a shell built-in that creates that pseudonym the question describes.
I almost clicked D thinking "link" had some shell shortcut magic I was blanking on, but then I remembered ln and link are filesystem tools, not shell built-ins, and the word "pseudonym" in the stem is basically spelling out alias for you. Fastest E of your life, do not spend more than 10 seconds here, bank that time for the process management questions later.
Honest moment, I glanced at D thinking "link" sounded vaguely right because I spent years in networking where shortcuts and links meant the same thing, but then I remembered ln and link are filesystem commands, not shell built-ins, and alias is literally what the bash man page calls a "command shortcut mechanism." E is the only one that actually lives inside the shell itself, which is what the question is asking about.