STACKLOGIC LABS

Certification

STOPPED

Shell Environment Configuration and History Management

Scenario

Configure a user shell environment for optimal administration. This involves managing the command history buffer, creating persistent aliases for complex commands, and utilizing shell expansion features to navigate the filesystem efficiently.

Objectives

  • Analyze Shell History Behavior
  • Execute Commands via History Expansion
  • Configure Persistent Aliases
  • Utilize Shell Path Expansion
  • Manage Environment Variables

Instructions

1. Step 1

SETUP: Populate the history buffer with sample commands.

for i in {1..5}; do echo "Command $i"; done

2. Step 2

List the last 10 commands from the history buffer.

history 10

3. Step 3

Re-execute the command at offset 3 using history expansion.

!3

4. Step 4

Retrieve the last executed command using the '!!' operator.

!!

5. Step 5

Create a temporary alias 'll' for detailed file listing.

alias ll='ls -alF --color=auto'

6. Step 6

Verify the alias functionality.

ll /etc/skel

7. Step 7

Persist the alias by appending it to the user's .bashrc file.

echo "alias ll='ls -alF --color=auto'" >> ~/.bashrc

8. Step 8

Reload the shell configuration to apply changes immediately.

source ~/.bashrc

9. Step 9

Locate the absolute path of the 'ls' binary using 'which'.

which ls

10. Step 10

VALIDATION: Confirm the alias persists in a new subshell.

bash -c "alias ll"
Terminal Session