top 50 comments

sorted by: hot top controversial new old
[–] 202 points 1 year ago (45 children)
  • [–] 59 points 1 year ago (26 children)

    What the fuck!? How am I only learning this now, after years of linux as daily driver?!

  • source
  • parent
  • hideshow 26 child comments
  • [–] 42 points 1 year ago (17 children)

    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.

  • source
  • parent
  • hideshow 17 child comments
  • [–] 26 points 1 year ago (6 children)

    most DE's have a thing where you can paste highlighted text using the middle mouse button

  • source
  • parent
  • hideshow 6 child comments
  • [–] 10 points 1 year ago (2 children)
  • load more comments (2 replies)
  • load more comments (8 replies)
  • [–] 11 points 1 year ago (1 child)

    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.)

  • source
  • parent
  • hideshow 1 child comment
  • load more comments (1 reply)
  • [–] 8 points 1 year ago* (last edited 1 year 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)
  • source
  • parent
  • load more comments (5 replies)
  • load more comments (13 replies)
    [–] 97 points 1 year ago (5 children)
    load more comments (5 replies)
    [–] 72 points 1 year ago* (last edited 1 year ago) (7 children)

    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!

  • source
  • hideshow 7 child comments
  • load more comments (2 replies)
    [–] 67 points 1 year ago (4 children)
    load more comments (4 replies)
    [–] 43 points 1 year ago

    What, and type 'ls' again?

  • source
  • [–] 28 points 1 year ago* (last edited 1 year ago) (2 children)

    Ctrl + R and start typing the command, it'll come up, press enter. Im just more lazy because I know there are still faster ways.

    Edit: instead of hitting enter, keep pressing ctrl + R to cycle through history commands that contain what you typed in

  • source
  • hideshow 2 child comments
  • load more comments (2 replies)
    [–] 23 points 1 year ago* (10 children)

    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
    
  • source
  • hideshow 10 child comments
  • load more comments (7 replies)
    [–] 21 points 1 year ago (1 child)

    More like ⬆️⬆️⬆️⬆️⬆️⬆️ mother fucker ⬇️

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 19 points 1 year ago (1 child)
    load more comments (1 reply)
    [–] 17 points 1 year ago (3 children)

    history | grep ‘part of the command I remember’

  • source
  • hideshow 3 child comments
  • load more comments (2 replies)
    [–] 13 points 1 year ago

    history | grep then !cmd_number

  • source
  • [–] 13 points 1 year ago (15 children)
  • load more comments (9 replies)
    [–] 13 points 1 year ago (2 children)

    history | grep thethingyou'relookingfor

  • source
  • hideshow 2 child comments
  • load more comments (2 replies)
    [–] 13 points 1 year ago (6 children)
    load more comments (6 replies)
    [–] 12 points 1 year ago

    zsh-history-substring-search

    I lazily type part of the thing I want like "sys" and then ctrl+⬆️/⬇️ and sudo systemctl start libvirtd etc. appear like magic.

  • source
  • [–] 11 points 1 year ago (2 children)

    You're in vim, you forgot to sudo, the file is read only and you have loads of changed you don't feel like saving off to /tmp and playing the copy file shell game.

    [esc]:w !sudo tee %

    it shoves the current buffer through tee (termina adapter) with sudo privs vim will warn you that the file changed, just [esc]:q! and don't let it save, you already saved it.

  • source
  • hideshow 2 child comments
  • load more comments (2 replies)
    [–] 11 points 1 year ago (2 children)
    load more comments (2 replies)
    [–] 11 points 1 year ago (2 children)

    !ssh

    run the last command that started with ssh

  • source
  • hideshow 2 child comments
  • load more comments (2 replies)
    [–] 10 points 1 year ago
    [–] 9 points 1 year ago

    https://junegunn.github.io/fzf/shell-integration/

    fzf is a nice tool for this and other things

  • source
  • [–] 9 points 1 year ago* (4 children)

    I see everyone posting about Ctrl+R, here's a couple more useful CLI shortcuts you might enjoy:

    cd - (change directory to $OLDPWD usually the previous directory)

    git checkout - (similarly checkout the previous branch)

    Ctrl+A (return caret to beginning of command, great when you forgot a positional argument and you were almost done typing the command)

    Ctrl+E (similar to Ctrl+A but move to the end of the command)

  • source
  • hideshow 4 child comments
  • load more comments (4 replies)
    [–] 8 points 1 year ago (3 children)

    Or just use fish shell. Rarely need ctrl+r anymore.

  • source
  • hideshow 3 child comments
  • load more comments (3 replies)
    [–] 8 points 1 year ago

    Report post

    Report reason: ⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️"There it is" I'm in this picture and I don't like it

  • source
  • load more comments
    view more: next ›