1.4 Aliases Flashcards

2
Q

What is the purpose of an alias?

A

Aliases are shortcuts to a different commands on your linux system; they point to a real command.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you list all aliases currently assigned?

A

Display a list of currently defined aliases on the system using the alias command with no arguments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What happens if you create a new alias with an alias name that already exists?

A

If you create a new alias with an alias name that already exists, the new alias will overwrite the old one.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Are aliases persistent by default?

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When would it be important to make an alias persistent?

A

Add aliases to shell configuration file(s), such as /etc/profile or ~/.profile.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the command alias with no arguments do?

A

Displays the currently defined aliases on the system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the command alias name do?

A

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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Create a shortcut that prevents the ls command from displaying .elf files even if ls -a is used.

A

alias ls=’ls –ignore=*.elf’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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)

A

alias securearchive=’/bin/tar -czf $1 $2; shred -fuvz $2’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Create a shortcut that kills all java processes.

A

alias killjavas=’killall java’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does the command unalias name do?

A

Remove the alias associated with name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Remove all aliases specified for the ls command.

A

unalias ls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Remove the alias named forcelogout.

A

unalias forcelogout

How well did you know this?
1
Not at all
2
3
4
5
Perfectly