0% found this document useful (0 votes)
16 views

Learn The Command Line - Configuring The Environment - Configuring The Environment Cheatsheet - Codecademy

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Learn The Command Line - Configuring The Environment - Configuring The Environment Cheatsheet - Codecademy

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Cheatsheets / Learn the Command Line: Configuring the Environment

Configuring the Environment

Command line environment


The environment of the command line refers to the
settings and preferences of the current user. It enables
users to set greetings, alias commands, variables, and
much more.

Shell Command env


For Unix-based systems like Mac OS and Linux (not
Windows), the shell command env returns a list of
environment variables for the current user.

Alias
The shell command alias is used to assign commonly # The following command creates an alias
used commands to shortcuts (or aliases). The assigned
`pd` for the command `pwd`
commonly used command should be wrapped in double
quotes.
alias pd="pwd"

Environment Variables
Variables that can be used across terminal commands are
called environment variables. They also hold information
about the shell’s environment.

Source Bash Profile


All the commands in ~/.bash_profile are executed with
the shell command source ~/.bash_profile . So when
changes are made to ~/.bash_profile, run this command
to activate the changes in the current session.
history Command
The history shell command is used to get a history of
commands (also known as “events”) that were executed in
the current session. The command also allows us to
perform operations on this list of commands that have
been executed, such as selecting or manipulating a
command in the history.

Export command
The export command makes a given variable available to # This command will make the environment
all child sessions initiated from the current session.
variable USER available
# to all child sessions with the value
"Jane Doe".
export USER="Jane Doe"

HOME Environment Variable in Unix Systems


HOME is an environment variable present in command # To show the path of the home directory
line environments. It is used to get the path to the current
use the following command:
user’s home directory. This makes it easy for programs to
access the home directory when needed.
echo $HOME

Print Share

You might also like