Shell Environment

The Environment is a set of information that your shell maintains during a session. It defines how your shell looks and behaves, and how it finds programs.

1. Environment Variables

Variables are key-value pairs that store information. Common environment variables include:

Viewing Variables

Use the echo command with a $ sign to view the value of a variable.

Bash

echo $PATH

Creating Variables (export)

You can create your own variables using the export command.

Bash

export MY_PROJECT="/home/ashish/code/project1"

2. Aliases

An alias is a custom shortcut for a long or complex command.

Bash

# Create an alias for a detailed list
alias ll="ls -la"

# Create an alias to quickly go to a project folder
alias goproj="cd /home/ashish/work/my_big_project"

Note: Variables and aliases created in the terminal are temporary. They will disappear when you close the terminal. To make them permanent, you need to add them to your .bashrc or .zshrc file.