Skip to content

Instantly share code, notes, and snippets.

@jottr
Last active July 19, 2024 19:02
Show Gist options
  • Save jottr/a2351377b7584abf100b to your computer and use it in GitHub Desktop.
Save jottr/a2351377b7584abf100b to your computer and use it in GitHub Desktop.
readline shortcuts

Readline

GNU readline is a commonly used library for line-editing; it is used for example by Bash, FTP, and many more (see the details of [readline][5] package under "Required By" for more examples). readline is also customizable (see man page for details).

Keyboard Shortcut Description

Ctrl+l Clear the screen

Cursor Movement

Ctrl+b Move cursor one character to the left

Ctrl+f Move cursor one character to the right

Alt+b Move cursor one word to the left

Alt+f Move cursor one word to the right

Ctrl+a Move cursor to start of the line

Ctrl+e Move cursor to end of the line

Copy & Paste

Ctrl+u Cut everything from line start to cursor

Ctrl+k Cut everything from the cursor to end of the line

Alt+d Cut the current word after the cursor

Ctrl+w Cut the current word before the cursor

Ctrl+y Paste the previous cut text

Alt+y Paste the second latest cut text

Alt+Ctrl+y Paste the first argument of the previous command

Alt+./_ Paste the last argument of the previous command

History

Ctrl+p Move to the previous line

Alt+n Move to the next line

Ctrl+s Search

Ctrl+r Reverse search

Ctrl+j End search

Ctrl+g Abort search (restores original line)

Alt+r Restores all changes made to line

Completion

Tab Auto-complete a name

Alt+? List all possible completions

Alt+* Insert all possible completions

source: arch wiki

@hinell
Copy link

hinell commented Jul 22, 2021

Where does the ctrl+c (aka C-c or \C-c) come from? Any ideas?

@kmeaw
Copy link

kmeaw commented Jan 11, 2023

It comes from the line discipline part of the TTY driver.

@drio
Copy link

drio commented Jul 19, 2024

Thank you for the post.

I recently tried to move from macOS to Linux (i3) and for the most part was pretty straight forward but one thing that killed me was the lack of readline support at the UI level. Specifically when working with chrome/brave in the url input text area (although I use that everywhere).

I am so use to ctrl+a ctrl+e ctrl+k. For the most part it works fine in macOS on all the UI tools.

Am I missing something? Has anyone experienced this? Did you find a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment