$ cd .. $ ls $ cd .. $ ls
“hmm yes… everything seems to be in order”
I need a shell/plugin/tool/whatever that always shows me the content of the current dir in a little popup or something.
Anything I do in the shell is like cd this, ls, cd there, ls *, I feel like a have the navigational awareness of a amnesiac goldfish
Put this in bashrc or whatever flavour of shells’s bashrc you use:
function cs () { cd “$@” && ls }
I didnt remember the function sintax of bash so I just copied it from SO.
cs () { cd $1; ls ${@:2} }
You (probably) only want to pass the first argument to
cd
, this’ll send the rest tols
.Did that years ago, just called it cds. I also have an “up” command which is an alias to “cds …”. Oh, and I have a “setup server_name” they copy all my aliases to a server and create an alias that allow me to “ssh -A server_name” using only server_name.
You probably want rangerfm or vifm. They use miller columns for to show you your surrounding context.
that, or you have to make ABSOLUTELY SURE that you haven’t accidentally pressed a button on your keyboard that has inevitably resulted in the total destruction of the directory contents
Alternatively, you could use a TUI file manager. Once you get the navigation down you can manage things pretty quickly. Especially with ones that have options for dual directory layouts, like Midnight Commander or vifm.
A window, you say!?
It is called windows 2000 explorer and it’s great for file operations :) In Linux i have yet to find a really good replacement ;(
What’s a GUI?
Try Dolphin. Press F4 to open the terminal view. It stays in dync with the gui so if you use cd in the terminal, the contents of the new folder will be shown.
That sounds really cool but I spent so much time making things look pretty …
cd .. pwd ls ls -a tree -d git status -bs cd .. ...
I ain’t reading allat
Then you invite chaos to sit in your lap, friend
Sometimes I throw off the linux admin reading my log by throwing in a pwd before going to the next one. Know it’s not gonna be in that directory you know?
pwd
seems more appropriate thanls
Doesn’t let you rifle through things approvingly as you go. "Yes this is the correct directory because it has the three files I was looking at earlier–
You know what let’s do a ls -al just to be super sure it’s the right modification
fair point
In your rc: alias ..='cd ..' alias ...='cd ../..' alias ....='cd ../../..' Usage: 1/2/3 $ ... 1 $
That’s pretty neat
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.
This is the way.
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.
Honestly I haven’t tried this on Linux yet, but didn’t Windows implement this somewhere along the way?..
cd ....
I aliased
cd
to a custom funtion in my bashrc to do this at one point, butcd ../../../..
is too engrained so I never rembered to use it.You will probably like zoxide (i am not sure about policy on links here, but here you go https://github.com/ajeetdsouza/zoxide)
Zoxide is nice, or use Yazi so you can actually see where you’re going.
Windows be like
cd …
ls
grumble grumble
dir
I believe,
zsh
supports that.Interesting, I might have to check that out someday.
Though when I write scripts, I’m not a fan of blind folder navigation like that, there’s a good reason for the pushd and popd script commands.
Oh yeah, I wouldn’t use that for scripts. I wouldn’t use
zsh
for scripts either.
I mean, I believe, it’s generally compatible withbash
, but just throwing a shebang likeor
into the first line of the script will make it execute with
sh
orbash
, even when you run it fromzsh
.
Or the alias I have set up
……
Once you’ve typed … you know if you type more dots it’s to go up more dir, so you don’t really need two dots for each additional dir.
Ya, this is the way. I use
all the time
I kept saying “cd up” in my mind so I just made an alias for
cdu
, became a reflex within the next day
I’ve used a script that made ‘up 4’ a thing. Forgot to migrate it though.
Biggest issue I have with custom macros is I’m logging into like 5 different machines a day. Don’t wanna keep copying over my custom bash files. Prefer built-in commands.
Yeah, I get that. But I’m traversing my machine a lot while developing, so I want that as hassle free as possible.
Heyy I have that in my .bashrc
Works a charmHad it in my .zshrc. I should look for it, it was helpful
cd … ls cd … ls cd … ls cd … ls
cd ..
⭡ ⏎
⭡ ⏎
⭡ ⏎
Oh, shit.
square
cd…
bind '"^H":"cd ..^M"'
Nah, I always
cd
to full path, that way I can easily use my history to move back therealias cdr=‘cd /’
Heh
I feel called out. Should definitely make an alias or two that auto CDs me the amount of times I need…
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 great
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