Get current directory name (without full path) in a Bash script
Asked 07 September, 2021
Viewed 1.3K times
  • 58
Votes

How would I get just the current working directory name in a bash script, or even better, just a terminal command.

pwd gives the full path of the current working directory, e.g. /opt/local/bin but I only want bin

21 Answer