compgen -back
to see all valid things you can type into a shell.diff -y -W 200 file1 file2
Shows a side by side diff of 2 files with enough column width to see most of what I need usually.
I have actually aliased this command as diffy
ctrl-r
searching bash history
du -sh * | sort -h
shows size of all files and dirs in the current dir and sorts them in ascending order so you can easily see the largest files or dirt ant the end of the list
ls -ltr
Shows the most recently modified files at the end of the listing.
clear
. Constantly, and for no reason.Ctrl-L
CMD/CTRL-K for me.
Someone who doesn’t know the benefits of dedicated, unlimited scrollback buffers. This command is useful but has a bad effect (when unintentionally).
No, I do. Clearing the scrollback because I want a new, very clear start point for a new activity and don’t care about the rest is frequently the goal.
If I do care about the history I’ll do something else or possibly been saving history to disk, although that’s far more rare.
Oh. I know. But you don’t understand - I’m compelled to type it out. I must.
rsync
I use it to backup important work to an external drive.
sudo !!
to rerun last command as sudo.history
can be paired with!5
to run the fifth command listed in history.Fifth as in fifth most recent command or fifth oldest?
I believe it’s the fifth oldest - I think
!-5
will get you the fifth impost recent, but I was shown that and haven’t put it into practice.The most common usecase I do is something like
history | grep docker
to find docker commands I’ve ran, then use!
followed by the number associated with the command I want to run in history.
@papertowels@lemmy.one I’ve been working in the bash shell since 1993 and did not know
sudo !!
was a thing. Good lord, I no longer have to press up, press crtl-left a bunch of times, then type sudo enter space anymore. And I can give it an easy-to-remember alias like ‘resu’ or ‘redo’! Ahahaha, this changes everything! Thank you!!
plz
from https://github.com/m1guelpf/plz-clicd
every single day.You haven’t discovered
exa
? Noob/s
sudo pacman -Syu
I just aliased “sudo pacman -Syu && yay -Syu --aur” to “update” cause I got tired of writing it every day.
Wouldn’t it make more sense to just yay -Syu to update everything, normal packages and AUR packages?
The reason I did it like this is because:
- I didn’t know yay could invoke pacman
- I didn’t want yay “upgrading” my pacman packages with AUR packages.
But I was just misunderstanding yay. As another comment said before you, one can just run yay without any arguments and it accomplishes the same thing.
You can just run
yay
with no arguments and it does exactly what your update script does.Huh, the more you know.
less
,watch
CTR + u will delete the whole command. I use that a lot so I don’t have to backspace. It’s saved me a ton of time
I just use control C, is there a difference other than whether the line shows up or not?
How about ctrl+c to cancel and clear the command you are typing? It’s much easier because you only need 1 hand, and does not impact your shell’s history.
Related: Alt +
.
, to cycle through arguments used in previous commandsThis is great for when you type in your root password incorrectly!
And then ctrl+y to paste it back and recover that text.
I often play an old DOS game in DOSBox, and when I exit it doesn’t reset the screen resolution. So I reset it manually by typing
xrandr -output e-DP1 -auto
Ctrl-r with https://github.com/atuinsh/atuin is amazing. Never forget a command you used ever again.
I trigger it with the up arrow.
ls
ls -ltrc
Show most recently modified files.
exit
Getting cheatsheets via
curl cheat.sh/INSERT_COMMAND_HERE
No install necessary, Also, you can quickly search within the cheatsheets via
~
. For example if you copycurl cheat.sh/ls~find
will show all the examples ofls
that usefind
. If you remove~find
, then it shows all examples ofls
.I have a function in my bash alias for it (also piped into
more
for readability):function cht() { curl cheat.sh/"$1"?style=igor|more }