Lukap Lukap - 1 year ago 120
Linux Question

Take the last part of the folder path in shell

If you type pwd you get something like:


How to take the last part? The

This must be simple but I couldn't find easy solution in shell. I know how to take care of this in java but not in shell.


Answer Source

You're right--it's a quick command:

basename "$PWD"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download