3

In my Ubuntu 12.04 Terminal one can press Alt + # which leads to the repeation of the following character #-times. Simple question: For what is it good for? Is it some fancy feature one can use for some purpose?

Greetz, Tik0

dessert
  • 39,982
Tik0
  • 327
  • 1
  • 7
  • 18

2 Answers2

2

This is not just for characters; it repeats the next command several times. E.g. if you want to delete the next three words type Alt+3+Alt+D

Alex1357
  • 1,122
2

This "feature" doesn't refer to the terminal, but is related to readline arguments in bash.

For what is it good for?

You can pass numeric arguments to Readline commands. Sometimes the argument acts as a repeat count, other times it is the sign of the argument that is significant. If you pass a negative argument to a command which normally acts in a forward direction, that command will act in a backward direction. For example, to kill text back to the start of the line, you might type 'M-- C-k'.

The general way to pass numeric arguments to a command is to type meta digits before the command. If the first 'digit' typed is a minus sign ('-'), then the sign of the argument will be negative. Once you have typed one meta digit to get the argument started, you can type the remainder of the digits, and then the command. For example, to give the C-d command an argument of 10, you could type 'M-1 0 C-d', which will delete the next ten characters on the input line.

More about:

Radu Rădeanu
  • 169,590