Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
26
rated 0 times [  26] [ 0]  / answers: 1 / hits: 9904  / 2 Years ago, fri, june 10, 2022, 5:51:56

There are many shortcuts that I use while interacting with bash command line to make the work easier and faster.



Like:




  • ctrl+L: to clear the screen

  • ctrl+a/ctrl+e: to move start/end of the line

  • ctrl+r: to search the history of command just writing few of chars

  • ctrl+u/ctrl+y: to cut/paste the line.



and many many more, that I want to know and which will definitely useful to learn.



I want to know from where can I get the list of these shortcuts in Ubuntu? Is there any manual which lists these shortcuts?



NOTE:



I want to get the list of shortcuts and their actions at one place. It will really help to learn many of them in a small duration of time. So is there way we can get the list like this? Though thanks for answer given here..


More From » bash

 Answers
5

The defaults are in man bash, along with details as to what each command does. See BroSlow's answer if you have changed your key bindings.



   Commands for Moving
beginning-of-line (C-a)
Move to the start of the current line.
end-of-line (C-e)
Move to the end of the line.
forward-char (C-f)
Move forward a character.
backward-char (C-b)
Move back a character.
forward-word (M-f)
Move forward to the end of the next word. Words are composed of alphanumeric characters (letters and digits).
backward-word (M-b)
Move back to the start of the current or previous word. Words are composed of alphanumeric characters (letters and digits).
shell-forward-word
Move forward to the end of the next word. Words are delimited by non-quoted shell metacharacters.
shell-backward-word
Move back to the start of the current or previous word. Words are delimited by non-quoted shell metacharacters.
clear-screen (C-l)
Clear the screen leaving the current line at the top of the screen. With an argument, refresh the current line without clearing the screen.


...



       reverse-search-history (C-r)
Search backward starting at the current line and moving `up' through the history as necessary. This is an incremental search.


...



       unix-line-discard (C-u)
Kill backward from point to the beginning of the line. The killed text is saved on the kill-ring.


...



       yank (C-y)
Yank the top of the kill ring into the buffer at point.


EDIT



These commands are all in a contiguous section of the manual, so you can browse it from Commands for Moving. Alternatively, you can save this entire section to a text file with



man bash | awk '/^   Commands for Moving$/{print_this=1} /^   Programmable Completion$/{print_this=0} print_this==1{sub(/^   /,""); print}' > bash_commands.txt


(N.B. this prints the whole section, including commands with no default keyboard shortcut.)



Explanation of awk code




  • On the (only) occurrence of Commands for Moving, set the variable print_this to 1.

  • On the (only) occurrence of Programmable Completion, which is the following section, set the variable to 0.

  • If the variable is 1, then get rid of the leading whitespace (three spaces), and print the line.


[#26148] Saturday, June 11, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rstride

Total Points: 305
Total Questions: 112
Total Answers: 118

Location: Mali
Member since Sat, Dec 26, 2020
3 Years ago
;