• @[email protected]
    link
    fedilink
    41 hour 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.

  • @RagingRobot
    link
    62 hours ago

    CTR + u will delete the whole command. I use that a lot so I don’t have to backspace. It’s saved me a ton of time

  • @[email protected]
    link
    fedilink
    195 hours ago

    sudo !! to rerun last command as sudo.

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

      • @[email protected]
        link
        fedilink
        2
        edit-2
        3 hours 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.

  • @[email protected]
    link
    fedilink
    84 hours 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.

  • BougieBirdie
    link
    fedilink
    English
    86 hours ago

    Not a specific command, but I learned recently you can just dump any executable script into ~/bin and run it from the terminal.

    I suffer greatly from analysis paralysis, I have a very hard time making decisions especially if there’s many options. So I wrote a script that reads a text file full of tasks and just picks one. It took me like ten minutes to write and now I spend far more time doing stuff instead of doing nothing and feeling badly that I can’t decide what to do.

    • @friend_of_satan
      link
      English
      156 hours ago

      This is because $HOME/bin is in your $PATH environment variable. You can add more paths that you’d like to execute scripts from, like a personal git repo that contains your scripts.

  • @macattack
    link
    English
    2
    edit-2
    4 hours ago

    Getting cheatsheets via curl cheat.sh/INSERT_COMMAND_HERE

    No install necessary, Also, you can quickly search within the cheatsheets via ~. For example if you copy curl cheat.sh/ls~find will show all the examples of ls that use find. If you remove ~find, then it shows all examples of ls.

    I have a function in my bash alias for it (also piped into more for readability):

    function cht() { curl cheat.sh/"$1"?style=igor|more }

    • Sneezycat
      link
      fedilink
      24 hours ago

      I just aliased “sudo pacman -Syu && yay -Syu --aur” to “update” cause I got tired of writing it every day.

  • @I_Miss_Daniel
    link
    English
    158 hours ago

    sudo udevadm monitor

    Figuring out which usb device went on holiday.

  • @[email protected]
    link
    fedilink
    148 hours 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.

    • @[email protected]
      link
      fedilink
      Deutsch
      355 minutes ago

      I recently switched to tmux and boy, it’s way better. I basically use only tmux now anymore. Creating panes to have two processes in one glance, multiple windows, awesome. Plus all the benefits of screen.

      • @[email protected]
        link
        fedilink
        124 minutes ago

        Simply change your terminal command to execute the terminal multiplexer of your choice.

        man terminal_of_choice, look for (start) command.

  • @friend_of_satan
    link
    English
    3
    edit-2
    6 hours ago

    compgen -back to see all valid things you can type into a shell.

  • @emb
    link
    2410 hours ago

    I really like that cd command. :P

      • LalSalaamComrade
        link
        fedilink
        English
        -2
        edit-2
        9 hours ago

        It’s six letters. Can’t they just call it zd or something? Yeah sure, I can use aliases, but why complicate in the first place?

          • LalSalaamComrade
            link
            fedilink
            English
            07 hours ago

            This is most probably a distro-specific aliasing. Tried it on Guix, it does not work:

            $ z
            bash: z: command not found
            
            $ zoxide
            zoxide 0.9.2
            ....
            
            • @[email protected]
              link
              fedilink
              26 hours ago

              It’s in the official docs for zoxide, you are supposed to use the z alias, and many distros just set it up directly like that. I love doing z notes from wherever I am.

              • @[email protected]
                link
                fedilink
                128 minutes ago

                Description fifth point (5.)

                That doesn’t require a separate package, especially one which uses eval on every new shell. And isn’t messing with my distros or personal aliases (and doesn’t introduce cargo-packaging).

                Simply adding one to two (you get the gist) directories and a keybind for cd .. is more slick. There are cases where you might use pushd . but even then other tooling should already cover your needs.

                It’s also so easy that you can temporarly append to $CDPATH for a specific session. But again, then a second pane or pushd is already available.

                Now downvote me, lemmy.

    • Jeena
      link
      fedilink
      49 hours ago

      Hm I wonder, is it really a command? I thought it is just a function of the shell to change the working directory.