Getting current path in variable and using it August 12, 2023 by Tarik myvar="$PWD" cd "$myvar" (Quotes are necessary if your path contains whitespaces.)