1

The xdotool manpage says:

key: Type a given keystroke.

type: Types as if you had typed it.

It is beyond my understanding. Could you explain how they differ?

Eliah Kagan
  • 117,780
Tim
  • 25,177

1 Answers1

5

Basically type will type a string, key will type individual keys or key combos. For example here's two ways to type "Hello world!":

xdotool type "Hello world!"
xdotool key H e l l o space w o r l d exclam

More info from man xdotool (trimmed down a bit):

key keystroke [keystroke ...]

    Type a given keystroke. Examples being "alt+r", "Control_L+J", "ctrl+alt+n",
    "BackSpace". Multiple keys are separated by '+'.

    Example: Send the keystroke "F2"
     xdotool key F2

    Example: Send 'a' with an accent over it (not on English keyboards, but 
    still works with xdotool)
     xdotool key Aacute

    Example: Send ctrl+l and then BackSpace as separate keystrokes:
     xdotool key ctrl+l BackSpace

type something to type

    Types as if you had typed it. Supports newlines and tabs (ASCII newline and 
    tab).

    Example: to type 'Hello world!' you would do:
     xdotool type 'Hello world!'
wjandrea
  • 14,236
  • 4
  • 48
  • 98
  • Thanks. I see. I also appreciate if you could consider my other related questions https://askubuntu.com/questions/1098762/does-xdotool-key-delay-pause-for-specified-delay-between-typing-every-two-co https://askubuntu.com/questions/1098726/what-is-the-purpose-of-sync-with-xdotool-mousemove-command https://askubuntu.com/questions/1098769/import-unable-to-read-x-window-image-resource-temporarily-unavailable – Tim Dec 05 '18 at 23:57