Bash get filename from given path on Linux or Unix

Originally published at: https://www.cyberciti.biz/faq/bash-get-filename-from-given-path-on-linux-or-unix/

How do I extract filename and extension in the Bash shell script from the given path? How can I get filename from the path under the bash shell?