Commands tagged keypress (1)

  • This is a (last resort) way to automate applications that provide no other ways for automation, it would send 'Hello world' to the currently active window. See the manpage (and the -text and -window entries) for how to send special characters and target specific windows. An example: Using xwininfo, I get the id of my XPlanet background window: alanceil@kvirasim:19:51:0:~> xwininfo xwininfo: Please select the window about which you would like information by clicking the mouse in that window. xwininfo: Window id: 0x3600001 "Xplanet 1.2.0" Absolute upper-left X: 0 (..etc..) Now I use xvkbd to tell it to close itself: xvkbd -xsendevent -window 0x3600001 -text "Q" Obviously, the best way is to put these commands in a shellscript - just make sure to include a short sleep (sleep .1 should suffice) after each xvkbd call, or some programs will become confused.


    15
    xvkbd -xsendevent -text "Hello world"
    Alanceil · 2009-03-20 18:58:05 13

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

prints line numbers

Remove all hidden files in a directory
Remove all hidden files in a directory excluding current dir . and parent dir .. with .??* that means files with at least two characters.

Do some learning...
I like it sorted... 2> /dev/null was also needless, since our pipes already select stdin, only.

list files recursively by size

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

share internet connection with only one network interface
the below command create a alias for share your internet connection with another. $ifconfig eth0:1 192.168.0.1/24 Its obviously necessary too activate the iptables post-routing and ip forwarding, as root: $modprobe iptable_nat $iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE $echo 1 > /proc/sys/net/ipv4/ip_forward Be sure that the alias 192.168.0.0/24 is not your active real ip range

Tweak system files without invoking a root shell
only for sudo-style systems. Use this construct instead of I/O re-directors ``>'' or ``>>'' because sudo only elevates the commands and *not* the re-directors. ***warning: remember that the `tee` command will clobber file contents unless it is given the ``-a'' argument Also, for extra security, the "left" command is still run unprivileged.

Run command from another user and return to current

ASCII webcam live stream video using mplayer
Mplayer starts a webcam capture using ASCII art. Only mplayer required


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: