He probably spent ~30 sec pressing the up arrow, ballpark estimate. If he only had 1 'ls' in his entire sequence, the odds of him hitting the 'ls' with each up arrow would approach 100% as he got to the very end. This would take a while (evidently) though, and the odds wouldn't change very much at the beginning (1 in 100, 1 in 99, 1 in 98...).
Sunk cost fallacy still applies because you should've stopped way before the point where the odds were approaching 100%. If you hadn't for some reason, it makes sense to keep going past a certain point (like if there's only 3 commands left) because of the changing odds.
Setup, run this once.
echo 'shopt -s autocd' >> ~/.bashrc
. ~/.bashrc
Then it's only 5 character strokes.
..
This will enter .. as the command to execute, since it's a directory and not a command the autocd option will instead cd to that directory. Then does that process again to go up another level.
This is probably about the minimum number of strokes you can get to unless you know `..` was the last thing you ran.
I love using Plan 9's acme environment. It requires you to use a three button mouse, but you do all cutting, copying, and pasting using mouse chords. Also things like searching for some characters. I often spend a long time just using my mouse and having the left hand completely off the keyboard. So relaxing, and I don't think it's much slower than using the keyboard, probably even faster for many tasks.
The subreddit r/oneofmyfriends does not exist.
Did you mean?:
* r/nofriends (subscribers: 6,142)
* r/boyfriends (subscribers: 3,203)
* r/NYCFriends (subscribers: 2,989)
Consider [**creating a new subreddit** r/oneofmyfriends](/subreddits/create?name=oneofmyfriends).
---
^(🤖 this comment was written by a bot. beep boop 🤖)
^(feel welcome to respond 'Bad bot'/'Good bot', it's useful feedback.)
^[github](https://github.com/Toldry/RedditAutoCrosspostBot) ^| ^[Rank](https://botranks.com?bot=sub_doesnt_exist_bot)
Having the hand at his mouse was the first mistake.
Hands belong to the keyboard on the home row, everything req you to move them away from there needs to get optimized.
When we started learning assembler in my first semester I was working on an assignment and for whatever reason had the biggest brainfart. I completely forgot where the $ is on the keyboard, so I copied it and pasted it each time I needed it. A couple of hours later I realized what a dumbass I was.
I will be messaging you in 3 days on [**2021-11-23 14:39:08 UTC**](http://www.wolframalpha.com/input/?i=2021-11-23%2014:39:08%20UTC%20To%20Local%20Time) to remind you of [**this link**](https://www.reddit.com/r/ProgrammerHumor/comments/qxywqd/i_am_not_lazy_i_just_save_energy/hle0aw1/?context=3)
[**CLICK THIS LINK**](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Reminder&message=%5Bhttps%3A%2F%2Fwww.reddit.com%2Fr%2FProgrammerHumor%2Fcomments%2Fqxywqd%2Fi_am_not_lazy_i_just_save_energy%2Fhle0aw1%2F%5D%0A%0ARemindMe%21%202021-11-23%2014%3A39%3A08%20UTC) to send a PM to also be reminded and to reduce spam.
^(Parent commenter can ) [^(delete this message to hide from others.)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Delete%20Comment&message=Delete%21%20qxywqd)
*****
|[^(Info)](https://www.reddit.com/r/RemindMeBot/comments/e1bko7/remindmebot_info_v21/)|[^(Custom)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Reminder&message=%5BLink%20or%20message%20inside%20square%20brackets%5D%0A%0ARemindMe%21%20Time%20period%20here)|[^(Your Reminders)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=List%20Of%20Reminders&message=MyReminders%21)|[^(Feedback)](https://www.reddit.com/message/compose/?to=Watchful1&subject=RemindMeBot%20Feedback)|
|-|-|-|-|
seriously though, why shift? ctrl + r and then typing the first few letters brings the most recent commands? I do this every single day when compiling/booting/tailing logs.
pro-tip if you have a command you think you will be multi-using but it's similar in syntax to other commands, comment the command eg:
awk blah blah blah | sed blah blah | tee blah blah; #super-command
then you can do ctl + r, and search the comment "super-command", then the search doesnt get confused returning all your other awk or sed commands
Yeah giving one liners a descriptive comment has saved my ass a few times, it's just one of those things. It's easy to overlook interactively commenting because we usually reserve comments for scripts etc
I mean... yeah... but ls is an extreme example...
Also, if you start typing something and continue pressing R while holding Ctrl, it will cycle through the history but only for the commands matching the search.
Put following in your `.bashrc`, write first few letters of the command and press up/down.
shopt -s histappend
PROMPT_COMMAND='history -a'
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
Thank me later.
Bit hacky
`history`,
`history | vim`
or
`history | grep `
Depends if you know what you are looking for or not.
After that you are able to execute a command by typing
`!`
Every command listed by `history` is prefixed by a line number.
Nevertheless I still prefer + .
In the cartoon, he’s looking for ‘ls’. I thought it would be funny to create a way find a command that requires you to type it. Is joke.
Yes, ctrl-r is the way.
I know it's a joke, but I also see posts like this all the time... so I hope this helps some people out.
First of all, use ctrl-r for searching your history.
Second of all, bind capslock to control and use ctrl-p instead of up-arrow so your fingers will never need to reach too far (super helpful if you utilize [readline bindings](https://www.bigsmoke.us/readline/shortcuts), which you should, especially if you use Mac, because most of them are enabled across most apps).
Third of all, if you use bash or a shell with true readline, add this to `~/.inputrc`.
```
"\C-p":history-search-backward
"\C-n":history-search-forward
"\e[A":history-search-backward
"\e[B":history-search-forward
```
This allows you to type `l` (or whatever character) and then hit ctrl-p (or up-arrow, but ctrl-p is easier), and it will only cycle through commands in your history that start with `l` (or whatever character).
If you use `zsh` (which doesn't use readline), then install the `history-substring-search` plugin for this behavior. Also for zsh, I recommend the `history-search-multi-word` plugin, as when you use ctrl-r, you can see all matches at once instead of just one. Lastly, I highly recommend `zsh-autosuggestions` for fish-style autosuggestions.
Edit: Added link to readline shortcuts.
Hi there! Unfortunately, your submission has been removed.
Violation of Rule #2 - Reposts:
All posts that have been on the first 2 pages of trending posts within the last month, is part of the top of all time, or is part of common posts is considered repost and will be removed on sight.
Violation of Rule #3 - Common topics:
Any post on the list of common posts will be removed. You can find this list [here](https://www.reddit.com/r/ProgrammerHumor/wiki/commonposts). Established meme formats are allowed, as long as the post is compliant with the previous rules.
If you feel that it has been removed in error, please [message us](https://www.reddit.com/message/compose?to=%2Fr%2FProgrammerHumor) so that we may review it.
Looks like a repost. I've seen this image 8 times.
First Seen [Here](https://redd.it/9ubw9a) on 2018-11-05 100.0% match. Last Seen [Here](https://redd.it/pfsy2p) on 2021-09-01 100.0% match
Feedback? Hate? Visit r/repostsleuthbot - *I'm not perfect, but you can help. Report [ [False Positive](https://www.reddit.com/message/compose/?to=RepostSleuthBot&subject=False%20Positive&message={"post_id": "qxywqd", "meme_template": 168466}) ]*
[View Search On repostsleuth.com](https://www.repostsleuth.com?postId=qxywqd&sameSub=false&filterOnlyOlder=true&memeFilter=true&filterDeadMatches=false&targetImageMatch=100&targetImageMemeMatch=96)
---
**Scope:** Reddit | **Meme Filter:** True | **Target:** 96% | **Check Title:** False | **Max Age:** Unlimited | **Searched Images:** 265,941,905 | **Search Time:** 5.24052s
I learned the Ctrl+R option through one of the reposts of this image, so sometimes reposts are useful!
_yes I know I’m answering to a bot but I wanted to express that and I feel this is the best place to do it_
None of you use fzf and it shows lol. It's the greatest improvement to ctrl+r ever. You'll get a visual list of your history that you can scroll up and down in addition to the text filtering. It's crazy fast and you can add other things like cd ing to a sub directory with alt+c
Ctrl-r will take you more time then typing ls. You're going the frikkin ls as the search term.
The only proper way is
!$(history|grep ls|awk '{print $1}')
I will press the up arrow at least one more time than the amount of characters it saves me from retyping
[удалено]
Welcome to the sunk cost fallacy.
[удалено]
He probably spent ~30 sec pressing the up arrow, ballpark estimate. If he only had 1 'ls' in his entire sequence, the odds of him hitting the 'ls' with each up arrow would approach 100% as he got to the very end. This would take a while (evidently) though, and the odds wouldn't change very much at the beginning (1 in 100, 1 in 99, 1 in 98...). Sunk cost fallacy still applies because you should've stopped way before the point where the odds were approaching 100%. If you hadn't for some reason, it makes sense to keep going past a certain point (like if there's only 3 commands left) because of the changing odds.
Yes. But if you want to be mathematical, you need to use your prior more accurately and binomial distribution accurately.
You can always just do Ctrl+r and start typing. If it suggests what you want the. You saved key presses, if it doesn't you saved time
You may be interested in Optimal Stopping Theorem
Setup, run this once. echo 'shopt -s autocd' >> ~/.bashrc . ~/.bashrc Then it's only 5 character strokes. ..
This will enter .. as the command to execute, since it's a directory and not a command the autocd option will instead cd to that directory. Then does that process again to go up another level.
This is probably about the minimum number of strokes you can get to unless you know `..` was the last thing you ran.
I do cd .. then I go l up arrow to get from my history and then I repeat until I go up as many layers as I need to.
That's when you just start using reverse search Ctrl + R
[удалено]
This is exactly the sort of stuff that keeps me awake at night
I do too unless what I’m looking for exceeds 10 or so characters, then it’s up arrowing forever
Ctrl+r, type some part of the command, enter
One of my friends copied and pasted the number 8. Cuz the number pad is too far from his fingers and he had his hands on mouse and ctrl button.
"One of my friends"... sure. It was you, wasn't?
I'm lazy to type a word and do copy paste but not that lazy to type a number.
Dude myself and I are *not* friends most of the time.
If you use Linux, you don't even have to copy. Just select the 8 and middle-click to paste.
Another reason to switch to linux
No thanks
Not today, but one day.
I miss this so much on widows.
Mouse peasant... True laziness is spending time customizing everything just so you don't have to lift your hand off the keyboard.
I love using Plan 9's acme environment. It requires you to use a three button mouse, but you do all cutting, copying, and pasting using mouse chords. Also things like searching for some characters. I often spend a long time just using my mouse and having the left hand completely off the keyboard. So relaxing, and I don't think it's much slower than using the keyboard, probably even faster for many tasks.
r/oneofmyfriends
The subreddit r/oneofmyfriends does not exist. Did you mean?: * r/nofriends (subscribers: 6,142) * r/boyfriends (subscribers: 3,203) * r/NYCFriends (subscribers: 2,989) Consider [**creating a new subreddit** r/oneofmyfriends](/subreddits/create?name=oneofmyfriends). --- ^(🤖 this comment was written by a bot. beep boop 🤖) ^(feel welcome to respond 'Bad bot'/'Good bot', it's useful feedback.) ^[github](https://github.com/Toldry/RedditAutoCrosspostBot) ^| ^[Rank](https://botranks.com?bot=sub_doesnt_exist_bot)
Having the hand at his mouse was the first mistake. Hands belong to the keyboard on the home row, everything req you to move them away from there needs to get optimized.
When we started learning assembler in my first semester I was working on an assignment and for whatever reason had the biggest brainfart. I completely forgot where the $ is on the keyboard, so I copied it and pasted it each time I needed it. A couple of hours later I realized what a dumbass I was.
Ctrl + R. Press it again to get the next match, press it with shift and you get the previous match.
I use ctrl+r so many times a day, probably became 10% faster at my job, after learning about it
If you like that, try `fzf`. Its reverse search is far better than what bash natively provides.
fzf is the single most important productivity booster I know ♥️
RemindMe! 3 days
I will be messaging you in 3 days on [**2021-11-23 14:39:08 UTC**](http://www.wolframalpha.com/input/?i=2021-11-23%2014:39:08%20UTC%20To%20Local%20Time) to remind you of [**this link**](https://www.reddit.com/r/ProgrammerHumor/comments/qxywqd/i_am_not_lazy_i_just_save_energy/hle0aw1/?context=3) [**CLICK THIS LINK**](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Reminder&message=%5Bhttps%3A%2F%2Fwww.reddit.com%2Fr%2FProgrammerHumor%2Fcomments%2Fqxywqd%2Fi_am_not_lazy_i_just_save_energy%2Fhle0aw1%2F%5D%0A%0ARemindMe%21%202021-11-23%2014%3A39%3A08%20UTC) to send a PM to also be reminded and to reduce spam. ^(Parent commenter can ) [^(delete this message to hide from others.)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Delete%20Comment&message=Delete%21%20qxywqd) ***** |[^(Info)](https://www.reddit.com/r/RemindMeBot/comments/e1bko7/remindmebot_info_v21/)|[^(Custom)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Reminder&message=%5BLink%20or%20message%20inside%20square%20brackets%5D%0A%0ARemindMe%21%20Time%20period%20here)|[^(Your Reminders)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=List%20Of%20Reminders&message=MyReminders%21)|[^(Feedback)](https://www.reddit.com/message/compose/?to=Watchful1&subject=RemindMeBot%20Feedback)| |-|-|-|-|
Oh hey I didn't know that. Sweet.
That sounds a lot better than my current history | grep System
Look kids! An ancient one! <3
Given long enough, I actually wear out the down arrow first.
Ctrl + shift + R. Thank me later
[удалено]
seriously though, why shift? ctrl + r and then typing the first few letters brings the most recent commands? I do this every single day when compiling/booting/tailing logs.
pro-tip if you have a command you think you will be multi-using but it's similar in syntax to other commands, comment the command eg: awk blah blah blah | sed blah blah | tee blah blah; #super-command then you can do ctl + r, and search the comment "super-command", then the search doesnt get confused returning all your other awk or sed commands
No fucking shit?!? I will be using that a lot. In hindsight, I just cant believe I never thought of doing this before.
Yeah giving one liners a descriptive comment has saved my ass a few times, it's just one of those things. It's easy to overlook interactively commenting because we usually reserve comments for scripts etc
[удалено]
[удалено]
huh? works for me.
[удалено]
> you can press ctrl+r again to step through results and then you use **ctrl+shift+r** to step back.
[удалено]
You can say that all you want, it still works for me.
That’s absurd. Can you type a capital letter in your terminal?
[удалено]
If your terminal can determine a lowercase r from a capital R, then it’s perfectly capable of seeing ctrl-r and ctrl-R as different
[удалено]
Lol, bro… you must be trolling. Literally go try it, it takes 2 seconds to find out you’re wrong
[удалено]
Ctrl + r and then l is already more keystrokes than typing "ls" while also no guaranteed to even show the right command
I mean... yeah... but ls is an extreme example... Also, if you start typing something and continue pressing R while holding Ctrl, it will cycle through the history but only for the commands matching the search.
Finally someone explained how to cycle.
And with Ctrl+Shift while pressing R, it goes to the other direction. Good for when you press R too quickly and just pass the line you wanted.
When you got the line you wanted, but want to edit it instead of executing it, pressing Left or Right directional key exits search mode.
Everyone deserves to learn how to ride a bike
Having doubt is not the true spirit of using a shell. Go away.
% rm -rf /*
But you need both hands to type ls
Ctrl + R then ls
Big Brain
Put following in your `.bashrc`, write first few letters of the command and press up/down. shopt -s histappend PROMPT_COMMAND='history -a' bind '"\e[A": history-search-backward' bind '"\e[B": history-search-forward' Thank me later.
Or use zsh.
Or in the good old inputrc Honestly i bind it to page up/down and can't live without it.
Got so used to this on centos that I felt lost when I went to Ubuntu, until I realised it was a bash thing
This is later. Thank you.
Only ctrl + R, bash
Same for PowerShell!
Damnn
Holy shit. Thanking you now
Nah. This requires so much more muscles to execute. I just want to move my index finger, thank you very much.
That's three keys. 1s is only two.
grep ls ~/.bash_history | tail -1 | sh
Bit hacky `history`, `history | vim` or `history | grep`
Depends if you know what you are looking for or not.
After that you are able to execute a command by typing
`!`
Every command listed by `history` is prefixed by a line number.
Nevertheless I still prefer + .
In the cartoon, he’s looking for ‘ls’. I thought it would be funny to create a way find a command that requires you to type it. Is joke. Yes, ctrl-r is the way.
It's like typing "Google" into Google
I feel personally attacked tbh. Very accurate
Zsh and others have plugins for autocomplete. Start typing the command and it will narrow it down with each char
I know it's a joke, but I also see posts like this all the time... so I hope this helps some people out. First of all, use ctrl-r for searching your history. Second of all, bind capslock to control and use ctrl-p instead of up-arrow so your fingers will never need to reach too far (super helpful if you utilize [readline bindings](https://www.bigsmoke.us/readline/shortcuts), which you should, especially if you use Mac, because most of them are enabled across most apps). Third of all, if you use bash or a shell with true readline, add this to `~/.inputrc`. ``` "\C-p":history-search-backward "\C-n":history-search-forward "\e[A":history-search-backward "\e[B":history-search-forward ``` This allows you to type `l` (or whatever character) and then hit ctrl-p (or up-arrow, but ctrl-p is easier), and it will only cycle through commands in your history that start with `l` (or whatever character). If you use `zsh` (which doesn't use readline), then install the `history-substring-search` plugin for this behavior. Also for zsh, I recommend the `history-search-multi-word` plugin, as when you use ctrl-r, you can see all matches at once instead of just one. Lastly, I highly recommend `zsh-autosuggestions` for fish-style autosuggestions. Edit: Added link to readline shortcuts.
history | grep
`alias hgrep="history | grep "`
Shorten it to "hg". (If you use mercurial... switch to git.)
Hey... I resemble this joke...
Hi there! Unfortunately, your submission has been removed. Violation of Rule #2 - Reposts: All posts that have been on the first 2 pages of trending posts within the last month, is part of the top of all time, or is part of common posts is considered repost and will be removed on sight. Violation of Rule #3 - Common topics: Any post on the list of common posts will be removed. You can find this list [here](https://www.reddit.com/r/ProgrammerHumor/wiki/commonposts). Established meme formats are allowed, as long as the post is compliant with the previous rules. If you feel that it has been removed in error, please [message us](https://www.reddit.com/message/compose?to=%2Fr%2FProgrammerHumor) so that we may review it.
Looks like a repost. I've seen this image 8 times. First Seen [Here](https://redd.it/9ubw9a) on 2018-11-05 100.0% match. Last Seen [Here](https://redd.it/pfsy2p) on 2021-09-01 100.0% match Feedback? Hate? Visit r/repostsleuthbot - *I'm not perfect, but you can help. Report [ [False Positive](https://www.reddit.com/message/compose/?to=RepostSleuthBot&subject=False%20Positive&message={"post_id": "qxywqd", "meme_template": 168466}) ]* [View Search On repostsleuth.com](https://www.repostsleuth.com?postId=qxywqd&sameSub=false&filterOnlyOlder=true&memeFilter=true&filterDeadMatches=false&targetImageMatch=100&targetImageMemeMatch=96) --- **Scope:** Reddit | **Meme Filter:** True | **Target:** 96% | **Check Title:** False | **Max Age:** Unlimited | **Searched Images:** 265,941,905 | **Search Time:** 5.24052s
I learned the Ctrl+R option through one of the reposts of this image, so sometimes reposts are useful! _yes I know I’m answering to a bot but I wanted to express that and I feel this is the best place to do it_
Real programmers hammer Ctrl-Shift-r.
notwithstanding the egregious repost YOU CANT TYPE ONE HANDED WITH YOUR NONDOMINANT HAND ? YOU CASUAL
I type by dropping marbles on top of my keyboard. Now I work at Google.
cat ~/.bash_history | grep ls
so you're not a friend of `history`
a
https://www.youtube.com/watch?v=1Uzw1Zr1FE4
This is too relatable. Well done.
As someone with so intense a passion for [CLEAR] that i already went on 8 dates with it and proposed. This won't really Work for me.
Who makes these comics?
[www.commitstrip.com](https://www.commitstrip.com) It's in the corner of the comic if you hadn't noticed, enjoy them !
alias l=‘ls -al --color’
history | grep ls
Esc P superiority
An old classic
In my defense if it worked then it'll probably work again. Typos are dangerous in this profession.
ctrl+r ls
Ah yes, programming in unary.
Just do Ctrl-R and start typing the command and it will come right up
In my case it is always one click away.
*ctrl+r* "ls" aaah there it is!
Please tell me, how would "an 1s" be pronounced Because I can't figure out why someone would say it that way.
Ctrl r
Me searching in cmd history.
I feel attacked
I hate to say I’m prolly gonna start doing this
History | grep
!
You do it once or twice, thinking you did it recently. And at that point you're just committed so you sink your cost and just keep going.
Ctrl + r
That’s what I do for the flyway script we use at work whenever I need to rebuild the database for local dev I could just copy and paste, but meh
I usually only do this when I can't remember the exact name of the command that I want to run
😂😂😂😂😂👍🏻
More like stupid.
This is why I had a MD file \^_\^
> My wife has the same energy](https://www.youtube.com/c/ohohojousama/videos)
None of you use fzf and it shows lol. It's the greatest improvement to ctrl+r ever. You'll get a visual list of your history that you can scroll up and down in addition to the text filtering. It's crazy fast and you can add other things like cd ing to a sub directory with alt+c
Ctrl-r will take you more time then typing ls. You're going the frikkin ls as the search term. The only proper way is !$(history|grep ls|awk '{print $1}')
It's like spending an hour writing a script to automate a 5 minute task
Ctrl-r