Change directory using relative path

Viewed 97

When I open terminal, my working directory is a/b/c/ and my shell script is placed under a/b/d/e/f/ which gets triggered through Autosys. I want to change my working directory from a/b/c/ to a/b/d/e/f/ using relative path.

Currently I'm hard coding cd a/b/d/e/f/. I don't want to do it anymore. Could you please let me know how can this be achieved.

1 Answers
cd ../d/e/f/

The trick being the .. which is the "parent directory" of the one you're in

You can see a reference to it (including its permissions) if you use ls -a or more completely

$ ls -lhaF
total 0
drwxr-xr-x  20 user  group   xxB Jun 15 00:00 ./
drwxr-xr-x   3 user  group   xxB Jun 15 00:00 ../
-rw-r--r--   1 user  group   xxB Jun 15 00:00 e/
Related