bash users⦠zsh is much better
linuxmemes
Hint: :q!
Sister communities:
Community rules (click to expand)
1. Follow the site-wide rules
- Instance-wide TOS: https://legal.lemmy.world/tos/
- Lemmy code of conduct: https://join-lemmy.org/docs/code_of_conduct.html
2. Be civil
- Understand the difference between a joke and an insult.
- Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
- Don't get baited into back-and-forth insults. We are not animals.
- Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
- Bigotry will not be tolerated.
3. Post Linux-related content
- Including Unix and BSD.
- Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of
sudo
in Windows. - No porn, no politics, no trolling or ragebaiting.
4. No recent reposts
- Everybody uses Arch btw, can't quit Vim, <loves/tolerates/hates> systemd, and wants to interject for a moment. You can stop now.
5. π¬π§ Language/ΡΠ·ΡΠΊ/Sprache
- This is primarily an English-speaking community. π¬π§π¦πΊπΊπΈ
- Comments written in other languages are allowed.
- The substance of a post should be comprehensible for people who only speak English.
- Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
6. (NEW!) Regarding public figures
We all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations. - Keep discussions polite and free of disparagement.
- We are never in possession of all of the facts. Defamatory comments will not be tolerated.
- Discussions that get too heated will be locked and offending comments removed. Β
Please report posts and comments that break these rules!
Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.
.. And waste an opportunity to type on my ludicrously expensive mechanical keyboard?
FRIG no
Ctrl + R and start typing the command, it'll come up, press enter. Im just more lazy because I know there are still faster ways.
Edit: instead of hitting enter, keep pressing ctrl + R to cycle through history commands that contain what you typed in
Note: if the above isnβt working, you may need to first set your shell to accept emacs commands:
set -o emacs
Oh my freaking god thank you
Ctrl+R
What the fuck!? How am I only learning this now, after years of linux as daily driver?!
Shit is usually a pain in the ass. The challenge is divining how much of a pain in the ass something has to be that someone else might have made a solution for it.
I didn't know you could ctrl+shift+c to copy in the terminal until a month ago when my linux n00b wife said "there has to be a better way to do this. I've been right clicking to copy for 10 years.
most DE's have a thing where you can paste highlighted text using the middle mouse button
Same.
Ctrl + p is the way.
I used to be like this but people seriously. CTRL+R
Do it. Don't make this one of those things you've heard about and just never got around to trying. Open your terminal right now and CTRL+R and type any part of the command you did before. If the command you want is not showing first just hit CTRL+R again to go to the next one back.
DO IT.
Edit: I did learn from this thread today though that ZSH has it set to where you can just type part of what you're looking for then hit up to do the same thing. Neat!
Holy shit. I just tried it. ctrl+r
is a revelation! How the fuck did I not know about this?
You can empower Ctrl+r event more by using fzf. After I started using it, I can't imagine going back to without it.
WHAT THE FUCJ IS THIS SORCERY BRO I'VE BEEN USING LINUX FOR AGES AND NEVER KNEW THIS BROOOOOOOOOO
You're in vim, you forgot to sudo, the file is read only and you have loads of changed you don't feel like saving off to /tmp and playing the copy file shell game.
[esc]:w !sudo tee %
it shoves the current buffer through tee (termina adapter) with sudo privs vim will warn you that the file changed, just [esc]:q! and don't let it save, you already saved it.
I don't see how this is relevant but thanks for the tip.
I offered one for !ssh, then noticed people were giving other obscure tips so i offered this one.
!ssh
run the last command that started with ssh
I... Well... Thank you !
It's as amazing as it is dangerous :) use with care!
Ah crap how did I set my battery charge interval again?
history | grep battery
history | grep bios
history | grep sudo smbios
Ah! There you are you little shit!
edit to add: Actually, I think the last time I did this I remembered some numbers I set it to before. So it worked well with something like "history | grep 75" even though there were a bunch of results.
Why are you making personal attacks against me.
What, and type 'ls' again?
If I haven't ran it in a while or I don't know it by heart then I 'nano /home/mehblah/.bash_history'
I do history | grep keyword
.
I forget that exist. One problem with being really old school on linux is you don't adopt new ways unless there is a reason to do so.
zsh-history-substring-search
I lazily type part of the thing I want like "sys" and then ctrl+β¬οΈ/β¬οΈ and sudo systemctl start libvirtd
etc. appear like magic.
I see everyone posting about Ctrl+R, here's a couple more useful CLI shortcuts you might enjoy:
cd - (change directory to $OLDPWD usually the previous directory)
git checkout - (similarly checkout the previous branch)
Ctrl+A (return caret to beginning of command, great when you forgot a positional argument and you were almost done typing the command)
Ctrl+E (similar to Ctrl+A but move to the end of the command)
Ctrl+A, Ctrl+E
Many more basic Emacs keybindings work, actually! Including C-f, C-b, C-p and C-n (if you prefer them over arrow keys) as well as M-f and M-b to move by words, C-k, M-d and C-y for killing/yanking (but not M-w) and C-SPC, C-w, C-x C-x for region manipulation (tested in Bash and ZSH)
Guilty!
history 500 | grep *snippet of command*
Pretty much, yeah.
Rather than jot down in a text file the various ffmpeg
commands I use frequently...
Raktajino@laptop:~/Downloads$ history | grep ffmpeg
12 sudo apt install audacity gimp ffmpeg mplayer
184 history | grep ffmpeg
215 ffmpeg -i source.mkv -ss 629 -t 7 out.mkv
217 ffmpeg -i out.mkv -s 0.5 -vf scale=1280:720 out.mp4
218 ffmpeg -i out.mkv -ss 0.5 -vf scale=1280:720 out.mp4
231 ffmpeg -i out.mp4 -vf "subtitles=out.srt" final.mp4
503 ffmpeg -i toofat.wav toofat.mp3
...
682 history | grep ffmpeg
684 ffmpeg -i 1.gif -i 2.gif -filter_complex "[1:0] [2:0] concat=n=2" out.gif
685 ffmpeg -i 1.gif -i 2.gif -filter_complex "[1:0] [2:0] concat=n=2:v=1" out.gif
686 ffmpeg -i 1.gif -i 2.gif -filter_complex "[1:0] [2:0] concat=n=2:v=1" -map '[v]' out.gif
687 history | grep ffmpeg
688 ffmpeg -i 1.gif -i 2.gif -filter_complex "[0:0] 12:0] concat=n=2:v=1" -map '[v]' out.gif
689 ffmpeg -i 1.gif -i 2.gif -filter_complex "[0:0] 1:0] concat=n=2:v=1" -map '[v]' out.gif
690 ffmpeg -i 1.gif -i 2.gif -filter_complex "[0:0] [1:0] concat=n=2:v=1" -map '[v]' out.gif
691 ffmpeg -i 1.gif -i 2.gif -filter_complex "[0:0] [1:0] concat=n=2" out.gif
694 history | grep ffmpeg
history | grep then !cmd_number