abbadon420@sh.itjust.works to Ask Lemmy@lemmy.world · 1 month agoLinux question: I like to browse using ls. Than when I find what I'm looking for, I would like to directly move there with cd without having to retype the path. Is there an elegant solution for that?message-squaremessage-square47linkfedilinkarrow-up1122file-text
arrow-up1122message-squareLinux question: I like to browse using ls. Than when I find what I'm looking for, I would like to directly move there with cd without having to retype the path. Is there an elegant solution for that?abbadon420@sh.itjust.works to Ask Lemmy@lemmy.world · 1 month agomessage-square47linkfedilinkfile-text
Maybe there is a tool that does that? Maybe I’m doing this all wrong and there is a different way I should browse?
minus-squareccunning@lemmy.worldlinkfedilinkarrow-up112·1 month agoYou mean something like this? ls /your/long/path/name cd !$
minus-squarevalar@lemmy.calinkfedilinkarrow-up100·1 month agoTo add, !$ gets replaced with the last word from the previous command line !! Repeats the most recent command !-N Repeats the Nth previous command !string Repeats the most recent command that began with ‘string’
minus-squarem-p{3}@lemmy.calinkfedilinkarrow-up32·1 month ago!! is the goat when you needed to run the last command using sudo
minus-square4am@lemmy.ziplinkfedilinkarrow-up23·1 month agoIf !$ isn’t pronounced “ba-ching!” I’m quitting Linux
minus-square🌞 Alexander Daychilde 🌞@lemmy.worldlinkfedilinkEnglisharrow-up10·1 month agoBetter than “bang-ching” which sounds racist to me. lol
minus-squareMinnesotaGoddam@lemmy.worldlinkfedilinkEnglisharrow-up4·1 month agothe (ng) is silent when used in compound punctuation in ba(ng)
minus-square🌞 Alexander Daychilde 🌞@lemmy.worldlinkfedilinkEnglisharrow-up5·1 month agookay, but now THAT sounds racist for whole OTHER reasons… ;-)
minus-squareMinnesotaGoddam@lemmy.worldlinkfedilinkEnglisharrow-up3·1 month agoit probably is, that professor who taught me it was belgian
minus-squareExec@pawb.sociallinkfedilinkarrow-up21·1 month ago!!:n where n is the nth word after the command in your last line cp file1 file2 nano !!:2 Here nano opens file2.
minus-squareOpenopenopenopen@lemmy.worldlinkfedilinkarrow-up8·1 month agoI think, if your using bash alt + . Does the same thing as typing !$ ls /super/long/path/to/dir cd alt + . I believe if you hit it again, it cycles through all previous last words https://ostechnix.com/list-useful-bash-keyboard-shortcuts/
minus-squareiturnedintoanewt@lemmy.worldlinkfedilinkarrow-up7·1 month agoAnd there goes my daily new knowledge snippet! Thanks!
minus-squarequarrel4you@piefed.sociallinkfedilinkEnglisharrow-up4·1 month agoI like the way you think! Too bad a I replied to a seaming empty post some 26 min after you. I always disliked this about Reddit. Seeing someone rewording the top reply for karma.
minus-squaregothic_lemons@lemmy.worldlinkfedilinkarrow-up4·1 month agoHoly fucking shit. I’ve dabbled in Linux for so long to not know. Thank you!
minus-squareRaja@lemmy.worldlinkfedilinkarrow-up3·1 month agoIn some shells (e.g. fish), “running” a directory changes to it so you can save keystrokes and just delete the "ls ".
You mean something like this?
ls /your/long/path/namecd !$To add,
!$ gets replaced with the last word from the previous command line
!! Repeats the most recent command
!-N Repeats the Nth previous command
!string Repeats the most recent command that began with ‘string’
!!is the goat when you needed to run the last command usingsudo💯
If
!$isn’t pronounced “ba-ching!” I’m quitting LinuxBetter than “bang-ching” which sounds racist to me. lol
the (ng) is silent when used in compound punctuation in ba(ng)
okay, but now THAT sounds racist for whole OTHER reasons… ;-)
it probably is, that professor who taught me it was belgian
!!:nwhere n is the nth word after the command in your last linecp file1 file2 nano !!:2Here nano opens file2.
Love it
I’m loving this
Huh - TIL about !-N
Thanks 🙏
I think, if your using bash
alt + .
Does the same thing as typing
!$
ls /super/long/path/to/dir
cd alt + .
I believe if you hit it again, it cycles through all previous last words
https://ostechnix.com/list-useful-bash-keyboard-shortcuts/
And there goes my daily new knowledge snippet! Thanks!
I like the way you think! Too bad a I replied to a seaming empty post some 26 min after you. I always disliked this about Reddit. Seeing someone rewording the top reply for karma.
Holy fucking shit. I’ve dabbled in Linux for so long to not know. Thank you!
In some shells (e.g. fish), “running” a directory changes to it so you can save keystrokes and just delete the "ls ".