|
|
|
|
|
by MawKKe
1891 days ago
|
|
Another one: cdof () {
cd "$(dirname $1)"
}
as in 'Change into Directory Of"Changes into the directory of a file. This is useful when you're doing complicated commands with long path names, but realize it would be easier if you were to cd into that directory. Use in combination with <Alt+.>. Especially useful if the filename component is long: $ pwd
=> ~/
$ ls -l path/to/whatever/deep/somewhere/2021-04-22-filewithverylongnamefoobarbaz.xyz
$ cdof <Alt+.>
$ pwd
=> path/to/whatever/deep/somewhere
|
|