this post was submitted on 21 Sep 2024
88 points (97.8% liked)

Asklemmy

43404 readers
1276 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy ๐Ÿ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_[email protected]~

founded 5 years ago
MODERATORS
top 50 comments
sorted by: hot top controversial new old
[โ€“] [email protected] 1 points 28 minutes ago
[โ€“] [email protected] 1 points 44 minutes ago* (last edited 42 minutes ago)

Not a command but bang expansions. For example !? is the args of last command useful for stuff like mkdir foo ; cd !?

https://www.redhat.com/sysadmin/bash-bang-commands learn these. you suck at using your computer if you don't know them.

[โ€“] [email protected] 6 points 2 hours ago

control+R

in bash, it lets you quickly search for previously executed commands.

its very useful and makes things much quicker, i recommend you give it a try.

[โ€“] [email protected] 7 points 3 hours ago (1 children)

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

[โ€“] [email protected] 7 points 2 hours ago

Related: Alt + ., to cycle through arguments used in previous commands

[โ€“] [email protected] 4 points 4 hours ago* (last edited 4 hours ago)
  • atools, which includes als, aunpack, apack. so you can stop caring about the kind of archive and just unpack it. it also saves you from shit archives that have multiple files/dirs in their root.
  • perl -e / perl -lne / ...
  • units
  • bc - a calculator that's actually good
  • pass - the only non-shit password store tool i've found so far. no gui, uses gpg and git to do the encrypting and storage/sharing
  • alias lr='ls -lrth' - so you can easily find the newest file, cos that's frequently what you want
  • unip - my script to look up things in the unicode db
  • find -type f -exec xzgrep 're' {} + - because xzgrep cant do -r

oh yeah, and for the shell readline, alt-b, alt-f, ctrl-w, ctrl-u, ctrl-k, ctrl-a, ctrl-e

[โ€“] [email protected] 8 points 5 hours ago

pv (Pipe Viewer) is a command line tool to view verbose information about data streamed/piped through it. The data can be of any source like files, block devices, network streams etc. It shows the amount of data passed through, time running, progress bar, percentage and the estimated completion time.

[โ€“] [email protected] 3 points 5 hours ago* (last edited 5 hours ago)

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 copy curl cheat.sh/ls~find will show all the examples of ls that use find. If you remove ~find, then it shows all examples of ls.

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 }

[โ€“] [email protected] 3 points 5 hours ago

less, watch

[โ€“] [email protected] 7 points 5 hours ago
[โ€“] [email protected] 5 points 6 hours ago
[โ€“] [email protected] 26 points 6 hours ago (1 children)

sudo !! to rerun last command as sudo.

history can be paired with !5 to run the fifth command listed in history.

[โ€“] [email protected] 3 points 5 hours ago (1 children)

Fifth as in fifth most recent command or fifth oldest?

[โ€“] [email protected] 4 points 4 hours ago* (last edited 4 hours ago)

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.

load more comments
view more: next โ€บ