https://www.commandlinefu.com/commands/browse/sort-by-votes
https://www.commandlinefu.com/commands/view/3314/bashksh-function-given-a-file-cd-to-the-directory-it-lives
https://askubuntu.com/questions/316628/going-to-the-parent-directory-of-a-file-with-cd
You can not
cd
into a file. Here is a (command line) function that will automatically cd
into a path for a given fully qualified file path:function fcd () { [ -f "$1" ] && { cd "$(dirname "$1")"; } || { cd "$1"; } ; pwd; }