You forgot the pwd after each ‘cd’.
ls*
Ls doesn’t tell them where they are, just what files exist in their current location.
Yup,
But I want to know if the file I’m looking for is in this directory or I have to cd… once more
That’s when locate piped to grep is your best friend.
In your rc: alias ..='cd ..' alias ...='cd ../..' alias ....='cd ../../..' Usage: 1/2/3 $ ... 1 $
That’s pretty neat
This is the way.
Or just use zsh
Yeah, let’s use whole different shell, because you can’t add some few aliases to your
.bashrc
.That’s not why I use a whole different shell. It just happens to be a perk of the one I use.
.....
for zsh usersExcuse me what? I’ve been multi cd’ing for years like a chump?
Exactly. The fucking what now?
Doesn’t work on my machine… is it a setting that needs to be enabled or something?
Same. I LLMd it and said it needs aliasing so not sure what these users are saying now actually.
alias cd..='cd ..' alias cd...='cd ../..' alias cd....='cd ../../.. alias cd.....='cd ../../../..'
Then forget all that and just use
cd ~
orcd /
No need for
~
- justcd
works as well.
alias ..='cd ..' #: up one directory alias ...='cd ../..' #: up two directories
The first two options (
autocd
andcdspell
) have been a lifesaver in fixing my frustrations with the defaultbash
settings (and even lets me stick with bash, instead of feeling I should move to zsh or any other shell.I can just type a foldername, tabcomplete it and press enter to go there. It’s great.
# == shopts == # https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html shopt -s autocd # cd into folder without cd, so 'dotfiles' will cd into the folder shopt -s cdspell # attempt spelling correcting on folders shopt -s direxpand # expand a partial dir name shopt -s checkjobs # stop shell from exit when there's jobs running shopt -s dirspell # attempt spelling correcting on folders shopt -s expand_aliases # aliases are expanded shopt -s histappend # append to the history file, don't overwrite it shopt -s histreedit # lets your re-edit old executed command shopt -s histverify # I'm confused. shopt -s hostcomplete # performs completion when a word contains an '@' shopt -s cmdhist # save multiple-line command in single history entry shopt -u lithist # multi-lines are saved with embedded newlines rather than semicolons; explictly unset shopt -s checkwinsize # update LINES and COLUMNS to fit output
for i in { 1…4 }; do cd …; done
i use fish shell with https://github.com/nickeb96/puffer-fish
basically when i type
it expands to
../..
and adds another/..
for every additional dot i typeits similar to what the zsh users in the comment section are doing
I was about to post something similar. With fish you can do your own functions, right? So, you can pass any dots as arguments to a function called
cd
, so, for every extra dot after..
, you append a/..
at the end.yeah, but its less visual
cd .....
is harder to understand thancd ../../../..
also the extension work with any commend, not just
cd
deleted by creator
I use a lot
cd -
(go to previous) or justcd
to go home.cd .. !! !! !!
cd .. && ls !! !! !! !!
What’s so surprising?? What did you see in that dir??
Double-bang repeats the previous command. Great if you forget
sudo
.$ rm -rf <folder> permission denied $ sudo !!
Haha yeah I was just being silly
Easiest solution, use fish instead of bash! Default fish keybindings will allow you to just type . . or name a directory similar to how you could do with Zoxide.
Also, wait until you find about pushd and popd ;)
Really buried the lede there:
pushd
andpopd
are what I use instead ofcd
most times!
cd .....
I use zsh btwWhaaaaaaaaaaaaaaat
don’t even need the cd since if it’s a dir, zsh automatically cd to that path ;)
just
…..
works greatI didn’t know that. Thanks!
.....
alias .4=cd …/…/…/…
alias -g .4=“…/…/…/…”
cd …/…