du -sh /too/bar
to get size of files/folders.sudo !!
inserts sudo into previous command when forgotten.yay
for full system update if yay is installed.cat
reads files.sudo
doas
Zoxide, dust, fd, rg, btm, tokei. So many newer Rust tools that are way better than the old stuff.
plz
from https://github.com/m1guelpf/plz-clicompgen -back
to see all valid things you can type into a shell.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.
I really like how nushell can parse output into it’s native structures called tables using the
detect
command.Unlike string outputs, tables allow for easy data manipulation through pipes like
select foo
will select foo key and you can filter and even reshape the datasets.This is great if you need to work with large data pipes like kuberneters so you can do something like:
kubectl get pods --all-namespaces | detect columns | where $it.STATUS !~ "Running|Completed" | par-each { |it| kubectl -n $it.NAMESPACE delete pod $it.NAME }
This looks complex but it parses kubectl table string to table object -> filters rows only where status is not running or completed -> executes pod delete task for each row in parallel.
Nushell take a while to learn but having real data objects in your terminal pipes is incredible! Especially with the
detect
command.There’s are few more shells that do that though nu is the most mature one I’ve seen so far.
Alt + F4
sudo !!
to rerun last command as sudo.history
can be paired with!5
to run the fifth command listed 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!!We’re all learning tricks in this thread! Grateful for all y’all nerds.
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.
Love these, I used a terminal select from history with fuzzy finding to do the !5 as
redo
jq
I use
atuin
(link) all the timeI’ll probably start using this for the Pratchett reference alone
ls
ls -ltrc
Show most recently modified files.
git
rsync
I use it to backup important work to an external drive.
less
,watch