• renzev@lemmy.world
    link
    fedilink
    arrow-up
    37
    ·
    2 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
    
  • lud@lemm.ee
    link
    fedilink
    arrow-up
    19
    arrow-down
    1
    ·
    edit-2
    2 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
  • Dr. Moose@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    2 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.

  • SorteKanin@feddit.dk
    link
    fedilink
    arrow-up
    3
    ·
    1 day ago

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

  • NauticalNoodle@lemmy.ml
    link
    fedilink
    arrow-up
    7
    ·
    edit-2
    2 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

      • NauticalNoodle@lemmy.ml
        link
        fedilink
        arrow-up
        6
        ·
        2 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.

  • pemptago@lemmy.ml
    link
    fedilink
    English
    arrow-up
    37
    ·
    3 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.

  • Jess@lemmy.world
    link
    fedilink
    arrow-up
    40
    ·
    3 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
      link
      fedilink
      English
      arrow-up
      26
      ·
      3 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
            link
            fedilink
            arrow-up
            4
            ·
            2 days ago

            I can appreciate that. Appologies if you know this already, but just don’t like them. Here are some tips.

            It helps a lot to get title/subtitle/flag highlighting. By default man pages are hard to use simply because of how dense they are. It’s much easier to skim when you can separate the parts you are looking for up front from the text.

            Don’t forget ‘/’, ‘n’, and ‘N’. First way to use man pages more effectively is to search them easily. And you can search via regex. Often I’m looking for more info on a particular flag. So I’ll press ‘/’ followed by ‘^ *-g’. For a g flag.

            Take notes on the side. It saves you time later. Your future self will thank you. And you learn a lot by skimming them.

            Man pages can be intimidating/confusing, but, imho, it’s worth training that skill. Even if you are slower up front, it’s totally worth it.

            • vrighter@discuss.tchncs.de
              link
              fedilink
              arrow-up
              2
              ·
              edit-2
              2 days ago

              thanks for the advice. I knew about the search feature, but sometimes the stuff you need isn’t even on the page. I have no idea how to find what I need when it’s not in “man cmdname” how am I supposed to know that the feature i want has a dedicated page?

              how could I find certain commands if i didn’t already know it was a shell builtin and not a command? It’s not like you get a manpage saying “this is not a command”. And even if i did have the idea to open the bash page, it’s still useless, because builtins are their own dedicated page. That sort of stuff. It rarely ever makes things easier for me.

              edit, it is occasionally useful phen I have already found what I want on google and just want some more in depth details.

              • JackbyDev@programming.dev
                link
                fedilink
                English
                arrow-up
                1
                ·
                1 day ago

                If something is a bash built-in run help blah for it’s “man page”

                But yeah, man pages tick me off. Wait until you learn that there are sometimes more than one per command. I have to Google which page is which because they’re all for specific things. man foo is the equivalent of man 1 foo. What’s annoying is that the few times I’ve seen something referenced on another page the entry usually just says something like it’s on “the relevant man page” rather than just telling you exactly which.

                • vrighter@discuss.tchncs.de
                  link
                  fedilink
                  arrow-up
                  1
                  ·
                  1 day ago

                  ok but that still entails trying random things until i find it. If I didn’t already know it was a builtin i wouldn’t know to search there. The bash thing was just an example. I have learned this stuff since i encountered the problem. This is just me recollecting my experience of trying to use man

              • wuphysics87@lemmy.ml
                link
                fedilink
                arrow-up
                1
                ·
                2 days ago

                Unfortunately, sometimes (often) there is no man page for what you are looking for. So if you get a page not found, that’s usually the case. You can usually find associated pages all the way at the bottom. That helps when what you are looking for isn’t a command, but a reference. I don’t remember exactly where it is, but man pages are stored in a directory. Probably /etc or /usr. You can always dump that list into fzf or use grep to search to see if there is a page for what you are looking for. It’s not a perfect system by any means, but it’s a good one to have in your toolbelt.

  • zlatiah@lemmy.world
    link
    fedilink
    arrow-up
    31
    ·
    3 days ago

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

    • feddylemmy@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      2 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.

        • zlatiah@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          2 days ago

          Oh god I also do this… See the comment below, I ran history|cut -d " " -f 5|sort|uniq -c|sort -nr|less on my personal laptop, my third most commonly used command (behind ls and cd) is just typing in nothing…

      • BaumGeist@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        2 days ago

        Use script instead, you can even have it in your .*shrc to run automatically whenever a shell is invoked (make sure to add a check that the shell wasn’t invoked by script, so you don’t inadvertently forkbomb yourself)

        Alternatively, just use Terminator as yout terminal emulator and enable the logger anytime you need it to record the shell session.

        Also, use bookmarks. That’s what they’re there for. 100 tabs is a great way to clutter your brain, but terrible for productivity. If you forget about it after bookmarking, it wasn’t important to begin with.

        • mexicancartel@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 days ago

          100 tabs is in mobile. I don’t even scroll back to clutter my brain but its there. Tabs are history for me… So I use firefox focus and if there is anything important, i open with firefox.

          What script are you reffering to? To log all output? I don’t wanna store that but need an assurance that its there till i close terminal window lol