bytebuster: (ITCrowd-Moss)
[personal profile] bytebuster
Невинне питання: In the terminal, I can type CTRL-R to search for a matching command previously typed in BASH. E.g., if I type CTRL-R then grep is lists my last grep command, and I can hit enter to use it. This only gives one suggestion though. Is there any way to cycle through other previously typed matching commands?

Невинна відповідь: If I understand the question correctly you should be able to cycle through alternatives by repeatedly hitting Ctrl+R.

Ctrl+R grep Ctrl+R Ctrl+R ...

Але друга відповідь порвала на шматки:

If you feel the command will be used frequently, you could add a tag

command #useful

Then ctrl+r #useful

This works because # is a comment delimiter, i.e. everything that comes after the symbol is not interpreted as a command.
However, it will be recorded in the history and is thus searchable.

І коментар: The original hashtag. The bashtag, if you will

...

Дата: Вівторок, 10 Січень 2017 18:07 (UTC)
henry_flower: A melancholy wolf (Default)
Від: [personal profile] henry_flower
kids this days.

if you feel a command will be used frequently, you should put an alias or a function in your .bashrc.

btw, ctrl-r has little to do w/ bash itself, it's a readline lib thingy.

...

Дата: Вівторок, 10 Січень 2017 19:32 (UTC)
dogmaton: (Default)
Від: [personal profile] dogmaton
спробуйте csh/tcsh, або ще краще zsh
там з пошуком по історії ще прикольніше
ну і якшо ліньки міняти шел, то й баш можна заточить на нормальній пошук:
http://unix.stackexchange.com/questions/96510/search-for-a-previous-command-with-the-same-prefix-when-i-press-up-at-a-shell-pr

суть такого пошуку в тому, шоби набрати перші символи команди, а потім клацаючи на стрілки вгору/вниз будуть відшукуватись команди, які починаються на ці символи

PS
конфіги для tcsh/csh/zsh можу ппідігнати

...

Дата: Середа, 11 Січень 2017 20:43 (UTC)
link0ff: Juri (Default)
Від: [personal profile] link0ff
Useful trick - just verified it works in the Emacs command minibuffer as well!
Сторінку створено Неділя, 18 Січень 2026 21:17

Грудень 2025

П В С Ч П С Н
1234567
891011121314
15161718192021
22232425262728
2930 31    
Створено з Dreamwidth Studios

За стиль дякувати