1.4 Aliases Flashcards
What is the purpose of an alias?
Aliases are shortcuts to a different commands on your linux system; they point to a real command.
How do you list all aliases currently assigned?
Display a list of currently defined aliases on the system using the alias command with no arguments.
What happens if you create a new alias with an alias name that already exists?
If you create a new alias with an alias name that already exists, the new alias will overwrite the old one.
Are aliases persistent by default?
No
When would it be important to make an alias persistent?
Add aliases to shell configuration file(s), such as /etc/profile or ~/.profile.
What does the command alias with no arguments do?
Displays the currently defined aliases on the system.
What does the command alias name do?
Creates a custom command that:
- Adds additional functionality to an existing command.
- Performs multiple functions - you can include multiple commands separated by semicolons.
- *Note**: When creating the alias, encapsulate the command(s) with quotation marks or apostrophes.
Create a shortcut that prevents the ls command from displaying .elf files even if ls -a is used.
alias ls=’ls –ignore=*.elf’
Create a shortcut that creates a compressed tar archive of a given file or directory and then securely deletes the original file or directory. (hint: use the command shred -fuvz to securely delete)
alias securearchive=’/bin/tar -czf $1 $2; shred -fuvz $2’
Create a shortcut that kills all java processes.
alias killjavas=’killall java’
What does the command unalias name do?
Remove the alias associated with name.
Remove all aliases specified for the ls command.
unalias ls
Remove the alias named forcelogout.
unalias forcelogout