Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Understanding the Command Line Environment: Aliases, Environment Variables, and History, Cheat Sheet of Applications of Computer Sciences

The concept of the command line environment, focusing on aliases, environment variables, and the history command. It provides instructions on how to create aliases, set environment variables, and use the history command in unix-based systems like mac os and linux. It also discusses the export command and the home environment variable.

What you will learn

  • What is the purpose of environment variables in the command line?
  • How do you create an alias in the command line?
  • How do you make an environment variable available to all child sessions?

Typology: Cheat Sheet

2019/2020

Uploaded on 11/07/2020

kdiwakar-reddy-1
kdiwakar-reddy-1 🇮🇳

1 document

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
/
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.
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.
The shell command alias is used to assign
commonly used commands to shortcuts (or aliases).
The assigned commonly used command should be
wrapped in double quotes.
Variables that can be used across terminal commands
are called environment variables. They also hold
information about the shell’s environment.
All the commands in ~/.bash_prole are executed with
the shell command source ~/.bash_profile .
So when changes are made to ~/.bash_prole, run this
command to activate the changes in the current
session.
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.
Cheatsheets / Learn the Command Line
Configuring the Environment
Command line environment
Shell Command env
Alias
Environment Variables
Source Bash Prole
history command in Unix Systems
# The following command creates an alias
`pd` for the command `pwd`
alias pd="pwd"
pf2

Partial preview of the text

Download Understanding the Command Line Environment: Aliases, Environment Variables, and History and more Cheat Sheet Applications of Computer Sciences in PDF only on Docsity!

/ 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. 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.

The shell command alias is used to assign

commonly used commands to shortcuts (or aliases). The assigned commonly used command should be wrapped in double quotes. Variables that can be used across terminal commands are called environment variables. They also hold information about the shell’s environment. All the commands in ~/.bash_prole are executed with

the shell command source ~/.bash_profile.

So when changes are made to ~/.bash_prole , run this command to activate the changes in the current session.

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.

Cheatsheets / Learn the Command Line

Configuring the Environment

Command line environment Shell Command env Alias Environment Variables Source Bash Prole history command in Unix Systems

# The following command creates an alias

pd for the command pwd

alias pd="pwd"

/

The export command makes a given variable

available to all child sessions initiated from the current session.

HOME is an environment variable present in

command line environments. It is used to get the path to the current user’s home directory. This makes it easy for programs to access the home directory when needed. Export command HOME Environment Variable in Unix Systems

# This command will make the environment

variable USER available

# to all child sessions with the value

"Jane Doe".

export USER="Jane Doe"

# To show the path of the home directory

use the following command:

echo $HOME