- [Instructor] Visiting Aliases.
In the previous video,
we have learned about arrays and associative arrays.
An alias is basically a shortcut
that takes the place of typing a long command sequence.
In this video, we'll see how to create aliases
using the alias command.
There are various operations you can perform on aliases.
These are as.
An alias can be created as.
Giving a shortcut to the install command
apt-get install can be done as.
Therefore, we can use install pigeon
instead of pseudo apt-get install pigeon.
The alias command is temporary.
Aliasing exists until we close the current terminal only.
To keep these shortcuts permanent,
add this statement to the tilde slash .bashrc file.
Commands in tilde slash .bashrc are always executed
when a new shell process is spawned.
To remove an alias, remove it's entry
from tilde slash .bashrc, if any
or use the unalias command.
Alternatively, alias example = should unset
the alias name example.
As an example, we can create an alias for rm
so that it will delete the original
and keep a copy in backup directory.
When you create an alias,
if the item being aliased already exists,
it will be replaced by this newly aliased command
for that user.
There are situations when aliasing
can also be a security breach.
We'll see how to identify them.
Escaping aliases.
The alias command can be used to alias any important command
and you may not always want to run the commands
using the alias.
We can ignore any aliases currently defined
by escaping the command we want to run.
For example, the slash character escapes the command,
running it without any alias changes.
While running privileged commands
on an untrusted environment,
it is always good security practice
to ignore aliases by prefixing the command with slash.
The attacker might have aliased a privileged command
with his slash her own custom command
to steal the critical information
that's provided by the user to the command.
Great!
We've successfully learned about visiting aliases.
In the next video,
we'll learn how to grab the information about the terminal.