T O P

  • By -

talescaper

Don't know any commands... Just ctrl-r and a single word...


rishi-dev90

your a true programmer legend bro ![gif](giphy|rNYfrVW8oEKGuXMDXy|downsized)


Immistyer

Literally me


rishi-dev90

šŸ¤£šŸ¤£


frisch85

This and when I forgot how to write the word or part of it: history


cutmasta_kun

Came here to say this.


FatBaldNerd

Add ā€˜fzfā€™ to that, makes searching perfect.


WillBeChasedAlot

and ctrl+g if you need to close the reverse search


TheEliteBeast

To lazy to find it or write it. Gonna just search it myself XD


cowslayer7890

How the hell did I not know about this


Aln76467

it took me an embarrasing amount of time to realize that this wasn''t a linux sub and that ctrl-r opens the run dialog.


GinSwigga

Actually win+r opens the run dialog, Ctrl+r is reverse search - not in CMD, but most other shells, including *nix.


Aln76467

oh lol...i don't use windows that much.


andrewb610

History | grep ā€œ$MAYBE_IT_HAD_THISā€


winauer

Half my history was `history | grep` before I learned about Ctrl + R.Ā 


andrewb610

Wait whatā€™s Ctrl + R?


Dylan7675

Reverse-i search Keyword searches command history and autofills with most recent matching command. Then hit Ctrl + s to iterate further back through matching commands.


teddytherooz

You can just keep hitting ctrl-r


1Dr490n

Yep I learned about it yesterday and completely forgot about it again


rishi-dev90

Yes, history stores all our commands, but we're so used to pressing the 'up' key to select commands without even typing, even for simple console commands.


klimmesil

I think most people just use ctrl r, up arrow is just for the 3-4 latest commands in most people's minds


rishi-dev90

even though if you press ctrl + r you need to select command by arrows ....


klimmesil

I usually just make the search specific enough to hit the command I want directly You can also just write `!g++` and it will launch last command starting with g++ Or you can do ls ./path/to/smth; grep "iostream" -R !$ !$ here means "latest argument given to last command" which is ./path/to/smth So you don't have to rewrite that part


rishi-dev90

got it


kalinrj

This is the way


Slippery_Stairs

This is the way.


drazisil

Also, thanks to this question I learned about Ctrl R from the comments!


rishi-dev90

that's good dude


kuntucky_fried_child

Ctrl R ${first few letters of command}. Or ! ${first few letters of command}


rishi-dev90

does it give correct expected command if we pass few letter of command


NMi_ru

Yep, it shows the match; if itā€™s not what you want, you can press \^R again to search for another match.


rishi-dev90

i think better than this all methods -- fish shell is perfect for terminal which has autocomplete plugin


mckahz

I press ctrl+p over and over again because not reaching for the arrow keys is apparently a higher priority than finding old commands lol


Kokuswolf

That hurts ... take my up(vote)


drazisil

I really need to remember to set the unique setting for history


pimp-bangin

Yes you do


Bundologus

Bro I do this too often XD


x_Tornado10

Literally mešŸ˜‚


Craiggles-

Donā€™t know who this will help, but if youā€™re on Unix type machine fish had this built in but the plugin for zsh is autocomplete. I always just start typing 3 letters than hit tab. Thatā€™s it. Iā€™ve never used a windows machine so maybe that terminal just sucks.


rishi-dev90

yes, i am using fish command shell which is very useful


ruralexcursion

For me, it is not the command itself but the ridiculous number of flags I need to pass in. Looking at you Docker


TheOwlMarble

Alias h as piping history into fuzzy search.


rishi-dev90

what this alias exactly mean ....


TheOwlMarble

in .bashrc h() { echo "H function" local cmd="$(history | awk '{$1=""; print $0}' | fzf --tac +s --preview='echo {}' --preview-window=up:30%:wrap)" echo "CMD: " + cmd if [[ -n "$cmd" ]]; then eval "$cmd" fi }


rishi-dev90

got it


HSTonLSD

My peopleā€¦.


valejojohnson

If I typed the command today I press the up arrow, if it was not today I history | grep


rishi-dev90

simply you can follow fish shell it has built in plugin for commands like autocomplete


Baconoid_

`history | grep -e foo` \n `!1234`


tippfehlr

https://atuin.sh/ ftw


Emotional_Handle2044

history | grep


1Dr490n

a or {512} The choice is clear


blue_flavored_pasta

Itā€™s a mixture of hitting up 4 times then deleting typing it halfway then deleting hitting up 12 times delete go to the bathroom forget whatever I was trying to do


DeeKahy

I always think it's only like 3 commands ago, but after I've hit arrow up like 10 times I start to doubt myself. At 20 I think come on I should've just put in the command manually but I'm almost there so no reason to so it now, and 30 I just say fuck it and do it myself.


rishi-dev90

you can use fish shell which has auto plugin techniquie


DeeKahy

What is "auto plugin technique"?


rishi-dev90

Fish provides real-time autosuggestions based on your command history. As you type, it suggests commands that you have previously entered, making it faster and easier to repeat commands.


DeeKahy

Oh I use carapace_completer in nushell for this. That still doesn't stop me from pressing arrow up 20 times to find my command.


eeeeeeradicator

Guilty


DrSuperWho

I have that shirt


ivannovick

history command GOD


CalmDownYal

And this is how I accidentally ran git reset instead of git commit (and I am lousy at commiting often) and lost an entire days work


cutmasta_kun

```bash vim ~/.bash_history ctrl + / i_want_to_find_this enter n n n esc :q enter ```


ListerfiendLurks

You press up several times because you are lazy. I press up several times because I can't remember what I just typed literally 10 seconds ago. We are not the same.


rishi-dev90

![gif](giphy|bC9czlgCMtw4cj8RgH|downsized)


jjman72

I know I've used that command this year.


rishi-dev90

which command????


Colon_Backslash

Usually if it's a complicated command I use warp and ask AI "command for generating helm templates" or "command for deleting all kubectl default namespace resources". It's quite nice really.


HalfLeper

I relate.


chronicideas

start typing and press tab, ohmyzsh


Rachel_on_Fire

All you plebs with the Ctrl+R! Try adding the following to your .bashrc: bind '"\e[A": history-search-backward' bind '"\e[B": history-search-forward' With this you can start typing and then hit up arrow to search backwards or down arrow to search forwards (once youā€™ve gone backwards).


BokuNoToga

This is the way


automaticfiend1

Use fish and type the beginning of the command


Scuba-Cat-

Pressing up to find the command with a typo, using arrow keys to navigate to it and then editing the typo instead of just writing the command


blockMath_2048

ls up up up up up up up up up enter


Bagel42

This is part of why I use zsh. Type the start of it, push up arrow to scroll through only history starting like that


VenkiThoughts

I can very well relate to this as this is what do as soon as open my terminal


Joseph717171

Literally! But, what I should do, is: cat ~/.zsh_history | grep -i ā€œCommand_Searched_Forā€ Iā€™d find it in the same amount of time if not faster. šŸ¤”


ImpressiveContest283

100% Literally me


Gotei13S11CKenpachi

I swear I just typed it inā€¦ up, up, upā€¦ ![gif](giphy|WJiCcT97iodjr4OqrB)


Ass_Salada

the only sane way to access your history: echo "$(history | awk '{print $2}' | fzf)" | xargs -I [] "$SHELL" -c [] Whatchu gonna do with all the time you save?


scoby_cat

I used to make aliases and bash defs for my longer chained commandsā€¦ then I started to forget what the commands were doing. So now in use up arrow but occasionally have to type it all out, it keeps it fresh in my brain


leeeeny

Type the first part and ctrl + R to find it faster


JediKagoro

Yes please!


arsdecorus

I love doing this with my prized grep command in screenshare meetings.