• ian@feddit.uk
    link
    fedilink
    English
    arrow-up
    3
    ·
    3 hours ago

    I thought command line users like typing things. I avoid typing where possible, and dont use the command line on Linux.

    • ChickenLadyLovesLife@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      30 minutes ago

      In my first professional programming job writing custom software for clients in 1995, one of our standard sales pitches to clients was the idea that a GUI-based application would do away with the need for command prompts. This was always met with applause and great rejoicing. It’s kind of remarkable that command prompts are still going strong thirty years later. I’m sure nobody would appreciate having this phenomenon compared to the Amish so I won’t do it. But I think it’s pretty cool that the Amish are still around doing their thing.

      • plyth@feddit.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        6 minutes ago

        People do not just point and nod. Using words and not just guestures makes life easier in many, but not all situations.

    • hansolo@lemmy.today
      link
      fedilink
      arrow-up
      1
      ·
      29 minutes ago

      For a while I was using a VPN where the connections we all via command line. I loved it, because once you type it, it’s just up up up to find that location again and swap around.

      Now I have to use the mouse and click like a damn fool!

  • Dave@lemmy.nz
    link
    fedilink
    arrow-up
    3
    ·
    4 hours ago

    Everyone sharing their Ctrl+R tips, here’s my Control+R question:

    How does scope work? Some command history only seems to exist in certain tabs.

    Also sometimes I Ctrl+R in a tab then the command is there but I forget I need a different one first, so I ctrl+c but the next time I search for that original command somehow it doesn’t exist anymore.

    I’m using the default terminal on Nobara (fedora based).

    • PotatoesFall@discuss.tchncs.de
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      1 hour ago

      This actually doesn’t depend on your terminal but on the shell running inside it. Bash is the default on most distros. I have also frequently had this issue. There might be config to fix it.

      I switched to fish instead of bash, and now I use fzf and the https://github.com/PatrickF1/fzf.fish plugin and it works GREAT. There might be a similar thing for bash, I don’t know.

    • Trail@lemmy.world
      link
      fedilink
      arrow-up
      8
      ·
      4 hours ago

      As far as I remember, there is a bash setting that controls whether the command history is written immediately after execution (in which case it is immediately available on all tabs/windows of the console) or after closing the session (in which case it will be available next time/potentially lost if the window is forcibly closed etc).

      The default is the second one as far as I remember.

      That said, I had changed to a more powerful one in zsh years ago, so it’s been a while…

  • bdonvr@thelemmy.club
    link
    fedilink
    arrow-up
    49
    ·
    edit-2
    7 hours ago

    I used to be like this but people seriously. CTRL+R

    Do it. Don’t make this one of those things you’ve heard about and just never got around to trying. Open your terminal right now and CTRL+R and type any part of the command you did before. If the command you want is not showing first just hit CTRL+R again to go to the next one back.

    DO IT.

    Edit: I did learn from this thread today though that ZSH has it set to where you can just type part of what you’re looking for then hit up to do the same thing. Neat!

  • Nikls94@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    5 hours ago

    Me, playing indie games on Apple and doing the same with xattr -d com.apple.quarantine ~filepath

    • yes
    • Mikelius@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      5 hours ago

      I’m shocked how far I had to scroll down before it was mentioned, I was getting scared I would have to say it lol

      • Dave@lemmy.nz
        link
        fedilink
        arrow-up
        1
        ·
        4 hours ago

        Just checking, because I learnt to type before I worked this out, and because surely someone reading doesn’t know: press tab. Bash will fill in file names from your current directory.

        E.g. say you have files fred1file, fred2file, jim.

        Type f then press tab, it will fill to “fred”. Then press 2 and press tab again and it will fill the full “fred2file”.

        Have a play, it works in heaps of situations.

      • ch00f@lemmy.world
        link
        fedilink
        arrow-up
        24
        ·
        12 hours ago

        Shit is usually a pain in the ass. The challenge is divining how much of a pain in the ass something has to be that someone else might have made a solution for it.

        I didn’t know you could ctrl+shift+c to copy in the terminal until a month ago when my linux n00b wife said "there has to be a better way to do this. I’ve been right clicking to copy for 10 years.

      • grrgyle@slrpnk.net
        link
        fedilink
        arrow-up
        5
        ·
        9 hours ago

        Congratulations! I remember where I was when I first learned it (in a noisy server room at the back of a machine shop).

        Now pair it with FZF for fuzzy finding – it’s surprisingly easy to set up, just following any guide. It’s insanely useful. I find myself even doing things like typing:

        $ xinput --disable $(xinput --list | grep -i touchpad | grep 'id=[0-9]\+' -o | cut -d= -f2)  # Disable synaptic touchpad trackpad pointer
        

        commands with these like comments on the ends as sort of “tags” so I can ctrl+r search for them later. Yes, I know I could just use a named function, but this is like the step just before that–before I know if I’ll be issuing the same command all the time, or just for the next couple weeks. (This one was from when I was resting my notebook on my laptop.)

        • oddlyqueer@lemmy.ml
          link
          fedilink
          English
          arrow-up
          1
          ·
          5 hours ago

          I like this; I have a lot of commands that I don’t use often enough to justify an alias, but still need to rerun all the time. thanks!

      • lmmarsano@lemmynsfw.com
        link
        fedilink
        English
        arrow-up
        3
        ·
        edit-2
        9 hours ago

        As usual, that’s documented (we can RTFM).

        Before trying ctrl-s, you may want to disable software flow control: run stty -ixon & add it to your initialization files. Otherwise, you’ll pause terminal output. ctrl-q resumes terminal output.

        stty reveals terminal special characters

        $ stty -a
        ⁝
        intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; …
        ⁝
        

        These special characters/keys often perform special functions. To illustrate

        • ctrl-d on empty input typically exits/logs out of interactive terminal applications (including shells)
        • ctrl-u discards input (useful for inputs like password prompts that don’t echo input back)
        • ctrl-v inputs next character literally (such as tab)
    • Cenzorrll@lemmy.world
      link
      fedilink
      arrow-up
      11
      ·
      edit-2
      12 hours ago

      I’m not going to say how long I used linux before learning this. It isn’t “this many days old”, but it may as well be.

      I have 7 headless linux boxes running.

    • Damage@feddit.it
      link
      fedilink
      arrow-up
      5
      arrow-down
      1
      ·
      11 hours ago

      Even quicker with zsh or atuin: write the first few letters then arrow up to cycle through all matches

      • Ephera@lemmy.ml
        link
        fedilink
        English
        arrow-up
        5
        ·
        10 hours ago

        Even quicker with fish: Write the first few letters then it auto-suggests the last-run command matching that prefix (and then you can still arrow up to cycle through all matches).

        (There is also a zsh plugin for that, called zsh-autosuggestions.)

        • Cethin@lemmy.zip
          link
          fedilink
          English
          arrow-up
          1
          ·
          7 hours ago

          A lot of stuff assumes Bash, so occasionally when the syntax differs its slightly annoying; sometimes you have to modify a few lines of a file or something (or run it as in Bash manually). Fish is so nice though. It really should replace Bash for almost everyone. If you really need Bash you can still use it.

          • Ephera@lemmy.ml
            link
            fedilink
            English
            arrow-up
            3
            ·
            4 hours ago

            With script files, you can (and should regardless of Fish usage) put a shebang at the top, like #!/bin/sh or #!/bin/bash. Then it will run with Bash as you’d expect.

            I also recommend not setting Fish as your system-wide default shell (since then a missing shebang will cause it to run in Fish), but rather just have your terminal emulator start fish by default.

            And yeah, outside of scripting, if I notice a command requires Bash syntax (which you can often tell from Fish’s syntax highlighting turning red), then I just run bash, execute the Bash command in there and then exit back out of there.

            Having said all that, I’m not trying to take away from your point. If I wasn’t just joking around, I would caveat a Fish recommendation just as much.

            • Cethin@lemmy.zip
              link
              fedilink
              English
              arrow-up
              2
              ·
              3 hours ago

              Yeah, it’s just some scripts that come with programs sometimes not including that is the issue. Like I said, it isn’t a big issue, just occasionally requires small edits if you try to run the script in Fish, or, like you said, running them with Bash.

    • Jankatarch@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      12 hours ago

      I like to imagine someone added it in for their own personal use and told nobody because surely they are the only one.

  • Iced Raktajino@startrek.website
    link
    fedilink
    arrow-up
    22
    ·
    edit-2
    13 hours ago

    Pretty much, yeah.

    Rather than jot down in a text file the various ffmpeg commands I use frequently…

    Raktajino@laptop:~/Downloads$ history | grep ffmpeg
       12  sudo apt install audacity gimp ffmpeg mplayer
      184  history | grep ffmpeg
      215  ffmpeg -i source.mkv -ss 629 -t 7 out.mkv
      217  ffmpeg -i out.mkv -s 0.5 -vf scale=1280:720 out.mp4
      218  ffmpeg -i out.mkv -ss 0.5 -vf scale=1280:720 out.mp4
      231  ffmpeg -i out.mp4 -vf "subtitles=out.srt" final.mp4
      503  ffmpeg -i toofat.wav toofat.mp3
      ...
      682  history | grep ffmpeg
      684  ffmpeg -i 1.gif -i 2.gif -filter_complex "[1:0] [2:0] concat=n=2" out.gif
      685  ffmpeg -i 1.gif -i 2.gif -filter_complex "[1:0] [2:0] concat=n=2:v=1" out.gif
      686  ffmpeg -i 1.gif -i 2.gif -filter_complex "[1:0] [2:0] concat=n=2:v=1" -map '[v]' out.gif
      687  history | grep ffmpeg
      688  ffmpeg -i 1.gif -i 2.gif -filter_complex "[0:0] 12:0] concat=n=2:v=1" -map '[v]' out.gif
      689  ffmpeg -i 1.gif -i 2.gif -filter_complex "[0:0] 1:0] concat=n=2:v=1" -map '[v]' out.gif
      690  ffmpeg -i 1.gif -i 2.gif -filter_complex "[0:0] [1:0] concat=n=2:v=1" -map '[v]' out.gif
      691  ffmpeg -i 1.gif -i 2.gif -filter_complex "[0:0] [1:0] concat=n=2"  out.gif
      694  history | grep ffmpeg