• Home
  • Releases
  • Submit Vuln
  • Press
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
    • VDP
  • Tutorials
    • All Posts
    • Photoshop on Linux
    • macOS on Linux
  • Supporters
  • Projects
  • Training
Sick Codes - Security Research, Hardware & Software Hacking, Consulting, Linux, IoT, Cloud, Embedded, Arch, Tweaks & Tips!
  • Home
  • Releases
  • Submit Vuln
  • Press
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
    • VDP
  • Tutorials
    • All Posts
    • Photoshop on Linux
    • macOS on Linux
  • Supporters
  • Projects
  • Training
No Result
View All Result
Sick Codes - Security Research, Hardware & Software Hacking, Consulting, Linux, IoT, Cloud, Embedded, Arch, Tweaks & Tips!
  • Home
  • Releases
  • Submit Vuln
  • Press
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
    • VDP
  • Tutorials
    • All Posts
    • Photoshop on Linux
    • macOS on Linux
  • Supporters
  • Projects
  • Training
No Result
View All Result
Sick Codes - Security Research, Hardware & Software Hacking, Consulting, Linux, IoT, Cloud, Embedded, Arch, Tweaks & Tips!
No Result
View All Result
Home Tutorials

Linux HotKey to Type a Pre-defined String (xdotool)

by Sick Codes
December 6, 2016 - Updated on June 24, 2020
in Tutorials
0
Use xdotool and bash to paste strings via pre-defined hot keys.

Depending on your distro, you should have a keyboard shortcut program already installed.

Use xdotool and bash to paste strings via pre-defined hot keys.

I wanted to be able to paste the following very oftenly typed command when pressing a certain key combination:

cd /home/admin/web/*/public_html/

First, you’ll need xdotool

sudo apt-get install xdotool

I was having trouble putting the commands directly into the keyboard shortcut entry, so I put the commands in a mini bash script.
Open a text editor and paste the following:

cdp=$(echo 'cd /home/admin/web/*/public_html/')
sleep 0.3
xdotool type --clearmodifiers "$cdp"

Save the file, I saved mine as /home/user/scripts/xdotool-cdp.sh

Next, add a keyboard shortcut for the following (I used Alt+P):

sh /home/user/scripts/xdotool-cdp.sh

Now when you press Alt + P keys, it executes the script.
The script sets a variable cdp to echo cd /home/admin/web/*/public_html/
Then it sleeps for 0.3 seconds.
Then it types cd /home/admin/web/*/public_html/
Make sure to include –clearmodifiers if you’re using keys such as ctrl, alt or shift as the shortcut as it will affect the way xdotool types.

Check it out:

Use xdotool and bash to paste strings via pre-defined hot keys.

Next Post

Create a Hidden Tor Service with VestaCP in 10 MINUTES! ULTIMATE ONION SITE GUIDE! Ubuntu/Debian/CentOS!

Download WeVideo video with cURL

Download a WeVideo video with cURL

VestaCP: Error Establishing a database connection (Digital Ocean/VPS Fix)

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result
  • Home
  • Releases
  • Submit Vuln
  • Press
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
    • VDP
  • Tutorials
    • All Posts
    • Photoshop on Linux
    • macOS on Linux
  • Supporters
  • Projects
  • Training

© 2017-2021 Sick.Codes

@sickcodes

@sickcodes

@sickcodes

Discord Server

sickcodes.slack.com

t.me/sickcodeschat

./contact_form