r/linuxmint • • Apr 18 '21

Always opt for the easier way.

Post image
862 Upvotes

30 comments sorted by

59

u/Serindu Apr 18 '21

I learned about Ctrl + r recently, and my up arrow thanks me.

14

u/[deleted] Apr 18 '21

This is the way.

4

u/Tmain116 Apr 19 '21

Also Sudo !! has helped me.

4

u/perdigaoperdeuapena Apr 19 '21

I use an alias in my .bashrc file which goes like this:

alias hg="history | grep"

Then I just have to type hg followed by the command I want to reuse and voilá... done!

Example:

hg grub
   49  sudo nano /etc/default/grub 
   50  sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
  177  sudo dnf reinstall grub2-efi grub2-efi-x64 grub2-pc grub2-pc-modules grub2-tools-efi grub2-tools-extra shim

If I remember, I learned this from some arch user, in their forums, even if I don't use arch :-(

1

u/Tasgall Apr 21 '21

alias hg="history | grep"

*sad Mercurial noises*

1

u/haml12 Apr 19 '21

I came here to comment the same!

14

u/CommunismIsForLosers Apr 18 '21

"history", then !{the line num of the command}

0

u/[deleted] Apr 18 '21

[removed] — view removed comment

2

u/ryebreadnyc Apr 19 '21

I have often used grep search_str ~/.bash_history

10

u/[deleted] Apr 18 '21

The command was probably ls -al.

7

u/jezzackk Apr 18 '21

No, only ls

6

u/Nico_Weio Apr 18 '21

Even better than Ctrl+R is resh.

0

u/[deleted] Apr 19 '21

[deleted]

2

u/Nico_Weio Apr 19 '21

Nope, I don't know that. fzf (a general-purpose fuzzy finder) provides a similar GUI and I assume there is something using it for what you want. I personally use https://github.com/OrkoHunter/keep which does not have such a pretty UI, but for occasional use it's just fine.

6

u/bottleboy8 Apr 18 '21

One of my favorite commands that I never remember:

nc -l -p 7000 | pv | tar x

It receives a netcat pipe from a command like this:

tar cf - ./* | pv | nc 192.168.1.30 7000

I didn't write it. Not even completely sure how it works. But it sure sends a bunch of files quickly from one computer to another.

4

u/kesslar21 Apr 19 '21

I usually do history | grep -i something~that~I~remember~from~the~command lol then in Linux mint, highlight the command, and then middle click to paste into the session.

1

u/perdigaoperdeuapena Apr 19 '21

Yep, same here, as I've answered to a comment above.

I have an alias in my .bashrc

alias hg="history | grep"

then I just have to

hg some-command-I-want-to-reuse

2

u/perticalities Apr 18 '21

Low effort != easy tho

1

u/PleasantGuide Apr 19 '21

Brilliant, I also do EXACTLY the same thing, it works perfectly!

1

u/[deleted] Apr 19 '21

cat ~/.bash_history | grep for the command you wrote weeks ago

1

u/_P4TR10T Apr 19 '21

Finally, someone who isn't afraid to admit it.

1

u/Key-Towel-9532 Apr 20 '21

It took me two days to understand this, but its funny.

1

u/goatmale Apr 22 '21

Gotta use Fish shell, I only have to type a few characters and then hit up a few times.

0

u/SmallerBork Apr 18 '21

All I want is for Ctrl + C and Ctrl + V to do what they do in every other program

2

u/revdandom Apr 19 '21

I just wish there was Linux distro that made the win/command key the default for copy paste undo. In the mean time there is Kinto.

0

u/[deleted] Apr 18 '21

[deleted]

2

u/0x507 Linux Mint 18 Sarah | Cinnamon Apr 18 '21

ctrl + insert and shift + insert works as well.

4

u/SmallerBork Apr 18 '21

I didn't say I didn't know how to copy and paste. I said I want the shortcuts to be the same as in other programs.

I hate having to use the shift key for this, it's not really hard but it's quite uncomfortable.

1

u/[deleted] Apr 19 '21

I prefer to ctrl+c my mistake, copy and paste is less important!

1

u/SmallerBork Apr 19 '21

That's Ctrl + Z, but if they were easily remappable everyone would be happy.

1

u/CyberSkepticalFruit Linux Mint 22.3 Zena | Cinnamon Apr 18 '21

Often tho only if you know it.