• @squid_slime@lemm.ee
    link
    fedilink
    61 year 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.

  • Dr. Moose
    link
    fedilink
    English
    4
    edit-2
    1 year 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.

  • @papertowels@lemmy.one
    link
    fedilink
    711 year ago

    sudo !! to rerun last command as sudo.

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

    • Kelly Aster 🏳️‍⚧️
      link
      fedilink
      English
      51 year ago

      @papertowels@lemmy.one I’ve been working in the bash shell since 1993 and did not know sudo !! was a thing. Good lord, I no longer have to press up, press crtl-left a bunch of times, then type sudo enter space anymore. And I can give it an easy-to-remember alias like ‘resu’ or ‘redo’! Ahahaha, this changes everything! Thank you!!

      • @papertowels@lemmy.one
        link
        fedilink
        8
        edit-2
        1 year 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.

    • Caveman
      link
      fedilink
      11 year ago

      Love these, I used a terminal select from history with fuzzy finding to do the !5 as redo