How you can work in Bash with the working directory (ie current, PWD, OLDPWD)

Bash Liste Des Attaques Ovh

About

This article is about the management of the current directory in Bash.

Management

Query

You can query the current working directory via:

echo $PWD

Shell variable

shell variable concerning the current directory

Current: PWD

working directory

pwd stands for “print working directory”.

echo $PWD

Old: OLDPWD

Old working directory (“OLD-Print-Working-Directory”, previous directory you were in).

cd must have be used once.

echo $OLDPWD

Change

You can set it via the:

echo ~+ # ie PWD
echo ~-  # ie OLDPWD





Discover More
Bash Liste Des Attaques Ovh
Bash - (Builtin|Intern|System|Reserved|Shell) variable name

Reserved variable name are named that have a special meaning for the bash shell. PS1 defines the shell's command-line prompt. HOME defines the home directory for a user. PATH defines a list...
Bash Liste Des Attaques Ovh
Bash - Directory

directory management with bash. See To get the space by directory, you can use the du command. It summarize disk usage of each FILE, recursively for directories. With a redirection, you...
Bash Liste Des Attaques Ovh
Bash - Print Working directory (pwd)

pwd displays the absolute pathname of the current directory in bash. where: -P will print the pathname with no symbolic links or the -o physical option to the set builtin command is enabled. ...
Bash Liste Des Attaques Ovh
Bash - Tilde (~) Expansion

The tilde expansion replaces the tilde with a path value which is dependent of the syntax. If the tilde expansion fails, the word is unchanged. If a word begins with an unquoted tilde character (~),...
Card Puncher Data Processing
How to replace in bulk a text in multiple file with a bash pipeline

An step by step that shows you how to create bash pipeline to replace in bulk text in files
Undraw File Manager Re Ms29
What is the working or current directory ?

The current or working directory is the directory where all relative directories are calculated



Share this page:
Follow us:
Task Runner