• renzev@lemmy.world
    link
    fedilink
    arrow-up
    26
    ·
    3 months 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
    
  • zlatiah@lemmy.world
    link
    fedilink
    arrow-up
    24
    ·
    3 months 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
      5
      ·
      3 months 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.

      • BaumGeist@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        3 months 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
          ·
          3 months 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

  • Jess@lemmy.world
    link
    fedilink
    arrow-up
    23
    ·
    3 months 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
      12
      ·
      3 months 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.

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

  • umbrella@lemmy.ml
    link
    fedilink
    arrow-up
    23
    ·
    3 months 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.

  • notfromhere@lemmy.ml
    link
    fedilink
    arrow-up
    15
    arrow-down
    1
    ·
    3 months ago

    Since nobody has said yet, I use screen pretty heavily. Want to run a long running task, starting it from your phone? Run screen to create a detachable session then the long running command. You can then safely close out of your terminal or detach with ctrl a, d and continue in your terminal doing something else. screen -r to get back to it.

    • tetris11@lemmy.ml
      link
      fedilink
      arrow-up
      2
      ·
      3 months ago

      Also, screen can connect to an UART device or serial or anything that offers up a TTY

    • krash@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      3 months ago

      How does screen / tmux work when detached from a session, how does it keep the session alive (both when running locally, and while ssh:ing to a server)? Is there a daemon involved?

    • muzzle@lemm.ee
      link
      fedilink
      arrow-up
      1
      ·
      3 months ago

      I Always forget to run screen first, so I just rely heavily on dtach

  • lud@lemm.ee
    link
    fedilink
    arrow-up
    13
    arrow-down
    1
    ·
    edit-2
    3 months 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
  • sgtnasty@lemmy.ml
    link
    fedilink
    arrow-up
    10
    ·
    3 months 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.