Retrieving the file name and extension in Bash can be completed using basename and shell parameter expansion. Get the file name Using the native unix basename command, the file name can be extracted from the path. 1file_path="/path/to/package.tar.gz" 2file_name=$(basename "$file_path") 3echo "$file_name"Output: 1package.tar.gzGet the file extension Using shell parameter expansion, the prior example can include capturing the file extension: 1file_path="/path/to/package.tar.gz" 2file_name=$(bas...