I have some text in a file copied to the clipboard via command line and I then wish to paste this content to a website.

cat file | pbcopy 

/usr/bin/open -a "/Applications/Google Chrome.app" 'http://google.com/'

(1) How do I paste to say google (if it's even possible)?

(2) Is it possible to open a different website, tab x amount of times and then paste?

1 Answer 1


For sending keystrokes to a graphical application from a command-line program you can use xdotool (you may need to install it first). See the answer by Gilles to the question "How to send keystrokes (F5) from terminal to a process?" on Unix & Linux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.