Search code examples
terminalcygwin

absolute and relative paths in CYGWIN


are they same or completely different? relative path works when youre in a folder and youre trying to go 'back' but absolute paths you have to type out the full directory

is there a shorter way around absolute paths rather than typing out the whole directory path everytime?


Solution

  • the absolute and relative paths are not peculiar of Cygwin. It works in the same way on Unix/Linux and similar in Windows

    of course the relative depends from where you are

    $ cd /usr/lib/gcc/x86_64-pc-cygwin/9.3.0/
    $ pwd
    /usr/lib/gcc/x86_64-pc-cygwin/9.3.0
    $ cd include
    $ pwd
    /usr/lib/gcc/x86_64-pc-cygwin/9.3.0/include
    

    but

    $ cd /usr
    $ pwd
    /usr
    $ cd include
    $ pwd
    /usr/include
    

    you can use PWD or other variables to short the absolute path

    $ cd /usr/lib/gcc/x86_64-pc-cygwin/9.3.0/
    $ pwd
    /usr/lib/gcc/x86_64-pc-cygwin/9.3.0
    $ echo $PWD
    /usr/lib/gcc/x86_64-pc-cygwin/9.3.0
    $ cd $PWD/include
    $ pwd
    /usr/lib/gcc/x86_64-pc-cygwin/9.3.0/include