DEV Community

Euber Alexandre Barbosa
Euber Alexandre Barbosa

Posted on

1

GNU Readline: Uma experiência Shell mais agradável no seu terminal

O usual de iniciantes usando Shell em terminais, como o GNU Bash, após errar comandos, é usar bastante o mouse para correção.

Por exemplo, para editar a lista de repositórios do Debian você usaria esse comando:

nano /etc/pat/source.list |

Então nota que o nome do diretório era apt não pat, e para corrigir puxa o mouse e clica em cima do p, seguido de DELETE e novamente o mouse, agora após o a e escrever p e voilà:

nano /etc/apt/source.list |

Mas você poderia meramente usar os atalhos do GNU Readline para essa edição.

Como usar o alt+b 3 vezes para voltar o cursor até o pat então usar o ctrl-f para ir para o a:

nano /etc/p|at/source.list

e então ctrl-t para inverter o a e p de posição para finalmente:

nano /etc/apt/source.list

Pronto!

Bem mais simples e sem usar o mouse.

Não curte os atalhos GNU Emacs, também tem os de vi. ;)

Para conhecer mais atalhos, consulte a Wikipédia do GNU Readline:

https://en.wikipedia.org/wiki/GNU_Readline

E também o seu manual: https://tiswww.cwru.edu/php/chet/readline/rltop.html

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

The discussion has been locked. New comments can't be added.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more