"dirname" Command

Learn all about dirname command

HOME

dirname - strip last component from name

root:~# man dirname
          
Output each NAME with its last non-slash component and trailing slashes removed; if NAME contains no /'s, output '.' (meaning the current directory).