What is this “(arg: 1)” appearing in terminal/tty after I pressed a combination of keys?

That’s a digit argument, a feature of the readline library built into bash:

digit-argument (M-0, M-1, ..., M--)
    Add  this digit to the argument already accumulating, or start a
    new argument. M-- starts a negative argument.

This feature makes it simpler to add or delete text in the currently edited command line. Let’s say you want to write echo gggg:

  1. Enter echo followed by space
  2. Press the Meta key (which may be Win, Alt and/or Esc for you) and type 4g

But how often do you need to type a single letter so many times that this would save you anything? The feature is primarily designed for readline commands, see chapters 8.2.1–8.2.3 of the Reference Manual (“C” meaning Ctrl, “M” meaning Meta).

You can move back one word with Meta and B, but what if you wanted to move back multiple words at once? You can either hold Alt and press B multiple times, or use the digit argument:

  1. There’s a typo on your command line five words back:

    $ echo one two tree four five six seven█
    
  2. Press the Meta key, type 5 and press Meta and B. Et violà:

    $ echo one two █ree four five six seven
    
  3. Fix the typo and either press Enter to shoot or End or Ctrl+E to move to the end of the line again.

You can delete a single word by pressing Meta and Backspace, but what if you wanted to delete multiple words at once?

  1. You forgot a word on your command line:

    $ echo one two four five six seven█
    
  2. Press the Meta key, type 4 and press Meta and Backspace.

    $ echo one two █
    
  3. Type the missing word followed by space and press Ctrl+Y to paste what was just deleted. Et violà:

    $ echo one two three four five six seven█
    

You’re right, you could’ve also moved to there as just explained without deleting anything. We’re on Linux, there are always several ways of doing the same thing.

And what’s a “negative argument”? It does the same, but in the opposite direction, so Meta -2 Meta Backspace deletes the next two words of the command line. “But one could use Meta 1 Meta D to do the same thing!” Glad you got that, welcome to your command line.

Further reading: