216
submitted 1 week ago by cybercitizen4@lemm.ee to c/asklemmy@lemmy.ml
top 50 comments
sorted by: hot top controversial new old
[-] renzev@lemmy.world 38 points 5 days ago

tldr is great. Basically a crowd-sourced alternative to man with much more concise entries. Example:

$ tldr dhcpcd

  DHCP client.
  More information: <https://roy.marples.name/projects/dhcpcd>.

  Release all address leases:

      sudo dhcpcd --release

  Request the DHCP server for new leases:

      sudo dhcpcd --rebind
[-] SturgiesYrFase@lemmy.ml 9 points 5 days ago

Well....slap my ass and call me Mary.....
Thanks kind internet stranger!

load more comments (1 replies)
[-] LazaroFilm@lemmy.world 55 points 6 days ago* (last edited 6 days ago)

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

[-] blackbirdbiryani@lemmy.world 9 points 5 days ago

Nah you gotta alias ls -a to la for more efficiency.

load more comments (1 replies)
[-] vrighter@discuss.tchncs.de 13 points 6 days ago

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

load more comments (2 replies)
[-] lud@lemm.ee 20 points 5 days ago* (last edited 5 days ago)

As primarily a Windows admin (Yes, we exist on Lemmy ;) ) here are few I use often.

  • Enter-PSSesion
  • Get-ADUser (also group and computer)
  • CLS (aka the superior clear)
  • ii . (short for Invoke-Item . which runs the selected object using the default method. For paths (like .) the default is explorer, so ii . opens the current directory using explorer.)
  • ft (short for Format-Table formats piped input as a table.)
  • fl (short for format-like. Used like ft but for lists.)
  • Where-Object
  • Select-Object
[-] mexicancartel@lemmy.dbzer0.com 25 points 5 days ago
[-] lud@lemm.ee 5 points 5 days ago

Fucking hell Lol ๐Ÿ˜‚

[-] hactar42@lemmy.world 8 points 5 days ago

There are dozens of us.

Also, I'll add:

  • Get-Help
  • Get-Command
  • Get-Member
[-] LaSirena@lemmy.world 41 points 6 days ago

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 27 points 6 days ago

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 8 points 6 days ago

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

load more comments (6 replies)
[-] pemptago@lemmy.ml 39 points 6 days ago

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.

[-] SinkingLotus@lemmy.world 35 points 6 days ago

Sudo !!

It reruns the last command as sudo.

Pretty useful since I'm always forgetting.

load more comments (1 replies)
[-] zlatiah@lemmy.world 31 points 6 days ago

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

[-] feddylemmy@lemmy.world 6 points 6 days ago

I like using CRTL+L to clear. It's nice because you can have a command typed out and still be able to press CTRL+L to clear the screen and keep the command typed out.

load more comments (6 replies)
[-] Appoxo@lemmy.dbzer0.com 16 points 6 days ago
load more comments (2 replies)
[-] Revan343@lemmy.ca 20 points 6 days ago

Uhhh...sudo su

Don't be like me

[-] nameisnotimportant@lemmy.ml 6 points 5 days ago
load more comments (1 replies)
[-] lluki@feddit.org 13 points 6 days 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).

[-] drmoose@lemmy.world 5 points 5 days ago* (last edited 5 days ago)

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.

[-] some_guy@lemmy.sdf.org 16 points 6 days ago
load more comments (1 replies)
[-] unionagainstdhmo@aussie.zone 6 points 5 days ago
[-] Cruxil@aussie.zone 6 points 5 days ago

I've recently started using tmux when starting a new SSH session to try to build the habit.

https://github.com/tmux/tmux/wiki

[-] beirdobaggins@lemmy.world 9 points 6 days ago

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.

[-] NauticalNoodle@lemmy.ml 7 points 6 days ago* (last edited 6 days ago)

For Debian based/descended distros:

sudo apt-get update && sudo apt-get upgrade

And technically I also regularly use

redshift -O 3000

all of the blue light filter programs try to align themselves with a user's geographic location and time, but I don't keep normal hours

[-] sirico@feddit.uk 8 points 6 days ago

Chuck the -y in there for extra lazy mode

[-] NauticalNoodle@lemmy.ml 6 points 6 days ago

I would but much like somebody else's recent post I have in the past nuked my install by blindly agreeing to some recommended software removals before. These days I like to double check what packages are being updated and replaced.

load more comments (1 replies)
[-] olafurp@lemmy.world 6 points 6 days ago

g-push which is alias for

git push origin `git branch --show`

Which I'm writing on my phone without testing or looking

load more comments (4 replies)
[-] Shimon@slrpnk.net 12 points 6 days ago
load more comments (2 replies)
[-] ColdWater@lemmy.ca 3 points 5 days ago
load more comments (1 replies)
[-] SorteKanin@feddit.dk 3 points 5 days ago

Zoxide, dust, fd, rg, btm, tokei. So many newer Rust tools that are way better than the old stuff.

Btop is an amazing resource monitor

load more comments (2 replies)
load more comments
view more: next โ€บ
this post was submitted on 21 Sep 2024
216 points (96.6% liked)

Asklemmy

43460 readers
693 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