this post was submitted on 21 Sep 2024
143 points (96.1% liked)

Asklemmy

43411 readers
1759 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_A@discuss.tchncs.de~

founded 5 years ago
MODERATORS
top 50 comments
sorted by: hot top controversial new old
[โ€“] lluki@feddit.org 2 points 1 hour ago

xdg-open FILE - opens a file with the default GUI app. I use it for example to open PDFs and PNG. I have a one letter alias for that. It can also open a file explorer in the current directory xdg-open . . Should work on any compliant desktop environment (gnome/kde).

[โ€“] electric_nan@lemmy.ml 1 points 2 hours ago

Saving this thread for later, but I use rsync -a a lot.

[โ€“] LazaroFilm@lemmy.world 22 points 6 hours ago (1 children)

cd then ls then cd then ls maybe Iโ€™ll throw a la -a

[โ€“] vrighter@discuss.tchncs.de 4 points 2 hours ago

I use -A instead, which doesn't show "." and ".."

[โ€“] toastal@lemmy.ml 1 points 3 hours ago

GNU Parallel

[โ€“] pyr0ball@sh.itjust.works 3 points 4 hours ago* (last edited 4 hours ago)

Going to shamelessly plug my custom bashrc setup which has a ton of little scripting helpers and a few useful aliases. Remember to clone recursively if you want to try it out. (Still very much a work in progress, but it's getting to be pretty robust)

https://GitHub.com/pyr0ball/PRbL-bashrc.git

[โ€“] zlatiah@lemmy.world 15 points 8 hours ago (1 children)

clear because apparently I am too scatterbrained to comprehend more than one full page of text in the terminal

I almost never use clear because i'm afraid if i will need the text later.(just like infinity tab number on firefox)

[โ€“] Revan343@lemmy.ca 11 points 8 hours ago (1 children)

Uhhh...sudo su

Don't be like me

[โ€“] berryjam@lemmy.world 2 points 5 hours ago
[โ€“] pemptago@lemmy.ml 17 points 9 hours ago (2 children)

I went a little overboard and wrote a one-liner to accurately answer this question

history|cut -d " " -f 5|sort|uniq -c|sort -nr|head -5

Note: history displays like this for me 20622 2023-02-18 16:41:23 ls I don't know if that's because I set HISTTIMEFORMAT='%F %T ' in .bashrc, or if it's like that for everyone. If it's different for you change -f 5 to target the command. Use -f 5-7 to include flags and arguments.

My top 5 (since last install)

   2002 ls
   1296 cd
    455 hx
    427 g
    316 find

g is an alias for gitui. When I include flags and arguments most of the top commands are aliases, often shortcuts to a project directory.

Not to ramble, but after doing this I figured I should alias the longest, most-used commands (even aliasing ls to l could have saved 2002 keystrokes :P) So I wrote another one-liner to check for available single characters to alias with:

for c in a b c d e f g h i j k l m n o p q r s t u v w x y z; do [[ ! $(command -v $c) ]] && echo $c; done

In .bash_aliases I've added alias b='hx ${HOME}/.bash_aliases' to quickly edit aliases and alias r='source ${HOME}/.bashrc' to reload them.

[โ€“] MigratingtoLemmy@lemmy.world 2 points 7 hours ago (1 children)
[โ€“] pemptago@lemmy.ml 1 points 5 hours ago (1 children)

Yup! Migrated from VSCodium; wanted to learn a modal editor but didn't have the time or confidence to configure vim or neovim. It's been my go-to editor for 2+ years now.

I've been using vi (just the basics) for ~4 years, I don't think I could be arsed to pick up the keybindings the other way around lol. I've heard very good things about Helix, of course

load more comments (1 replies)
[โ€“] pineapplelover@lemm.ee 3 points 6 hours ago (1 children)

let me guess, you either use arch or gentoo

[โ€“] LaSirena@lemmy.world 22 points 10 hours ago (1 children)

tldr because I am too impatient to read through man pages or google the exact syntax for what I want to do.

[โ€“] pixelscript@lemm.ee 14 points 9 hours ago (1 children)

There are exactly three kinds of manpages:

  1. Way too detailed
  2. Not nearly detailed enough
  3. There is no manpage

I will take 1 any day over 2 or 3. Sometimes I even need 1, so I'm grateful for them.

But holy goddamn is it awful when I just want to use a command for aguably its most common use case and the flag or option for that is lost in a crowd of 30 other switches or buried under some modal subcommand. grep helps if you already know the switch, which isn't always.

You could argue commands like this don't have "arguably most common usecases", so manpages should be completely neutral on singling out examples. But I think the existence of tl;dr is the counterargument.

Tangent complaint: I thought the Unix philosophy was "do one thing, and do it well"? Why then do so many of these shell commands have a billion options? Mostly /s but sometimes it's flustering.

[โ€“] wuphysics87@lemmy.ml 2 points 7 hours ago (1 children)

tldr is the first of 4 ways I rtfm. Then -h, man, and then the arch wiki

[โ€“] vrighter@discuss.tchncs.de 1 points 2 hours ago

i never use man at all. It's just too confusing.

[โ€“] SinkingLotus@lemmy.world 21 points 10 hours ago (1 children)

Sudo !!

It reruns the last command as sudo.

Pretty useful since I'm always forgetting.

load more comments (1 replies)
[โ€“] kittenzrulz123@lemmy.blahaj.zone 5 points 8 hours ago (2 children)

Btop is an amazing resource monitor

load more comments (2 replies)
[โ€“] some_guy@lemmy.sdf.org 12 points 10 hours ago (1 children)
[โ€“] InternetCitizen2@lemmy.world 4 points 9 hours ago* (last edited 9 hours ago)

You haven't discovered exa? Noob

/s

[โ€“] Spider89@lemm.ee 5 points 9 hours ago
[โ€“] squid_slime@lemm.ee 5 points 9 hours ago

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.

[โ€“] pocopene@lemmy.world 6 points 9 hours ago
[โ€“] plumcreek@lemmy.ml 4 points 9 hours ago (1 children)

qmv -f do ${dir}

... for quickly moving and renaming files. The default 'qmv' opens up your preferred text editor with a list of the source and destination name of the directory of files you want to move/rename. The '-f do' tells the command we only want to see/edit the [d]estination [o]nly. If you need to rename/move a bunch of files, it's much quicker to do it in vim (at least for me).

load more comments (1 replies)
[โ€“] umbrella@lemmy.ml 19 points 14 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.

[โ€“] korthrun@lemmy.sdf.org 5 points 11 hours ago (1 children)

Seems like an appropriate place to share https://github.com/agarrharr/awesome-cli-apps

I'm a fan of ripgrep and lsd in particular.

[โ€“] x00za@lemmy.dbzer0.com 3 points 8 hours ago

Big fan of lsd too.

But on a blotter

load more comments
view more: next โ€บ