Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

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:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Commands tagged X11 from sorted by
Terminal - Commands tagged X11 - 17 results
xbacklight -set 50
2014-02-07 12:03:57
User: gabe240
1

I'm not sure what apt this is, but it seems to work on most X screens, an is useful for saving power, and not straining your eyes

xdpyinfo | grep dimensions | awk '{print $2}'
xdotool search --name Thunderbird set_window --urgency 1 %@
2013-10-16 16:22:56
User: grapsus
Tags: X11 i3 i3wm
0

Useful for window managers like i3.

With a plugin like Mailbox Alert on can run this command each time a new mail arrives and it will be lighlighted by the window manager.

alias ssh-x='ssh -c arcfour,blowfish-cbc -XC'
ck-list-sessions
xset fp+ /Applications/Mathematica.app/SystemFiles/Fonts/Type1/
x11vnc -rfbauth /etc/x11vnc.pass -o /tmp/x11vnc.log -forever -bg -noxdamage -rfbport 5900 -avahi -display :0
wmctrl -l -p | while read line; do ps -o cmd= "$(echo "$line" | awk '$0=$3')"; done > ~/.windows
2010-07-04 22:11:24
User: matthewbauer
Functions: ps read
4

This will save your open windows to a file (~/.windows).

To start those applications:

cat ~/.windows | while read line; do $line &; done

Should work on any EWMH/NetWM compatible X Window Manager.

If you use DWM or another Window Manager not using EWMH or NetWM try this:

xwininfo -root -children | grep '^ ' | grep -v children | grep -v '<unknown>' | sed -n 's/^ *\(0x[0-9a-f]*\) .*/\1/p' | uniq | while read line; do xprop -id $line _NET_WM_PID | sed -n 's/.* = \([0-9]*\)$/\1/p'; done | uniq -u | grep -v '^$' | while read line; do ps -o cmd= $line; done > ~/.windows
xmodmap -e 'keycode 10 = 1 plus brokenbar exclamdown brokenbar exclamdown' ; xmodmap -e 'keycode 16 = 7 slash bar seveneighths bar seveneighths'
xrandr --auto
2009-12-30 18:52:02
User: kanzure
8

i spent way too many hours trying to fiddle with /etc/X11/xorg.conf trying to hook up various external projectors. too bad i didn't know this would solve all my problems.

xvkbd -xsendevent -text $(date +%Y%m%d)
2009-12-23 12:01:07
User: sputnick
Functions: date
12

That works in all softs, CLI or GUI... I don't want to waste time to all the time typing the same stuff . So, I have that command in my window manager shortcuts ( meta+l ). All the window managers have editable shortcuts AFAIK. If not, or you don't want to use it that way, you can easily use the xbindkeys soft.

I you're using kde4, you can run :

systemsettings

then open "inputs actions" and create a new shortcut.

For Gnome take a look there : http://www.cyberciti.biz/faq/howto-create-keyboard-shortcuts-in-gnome/

A more advanced one, with strings and newlines :

xvkbd -xsendevent -text "---8<-----\nToday date is: $(date +%Y%m%d)\n---8<-----"

For complicated or long paste, you can feed xvkbd with a file :

xvkbd -xsendevent -file <file>

You can simulate ^C ( control+c ) too or others combinations of keys :

xvkbd -text "\C\Ac"

There's no man page nor help ( On my Archlinux distro ), but you can see online doc there : http://homepage3.nifty.com/tsato/xvkbd/

xinit -- :1
2009-07-31 23:42:28
User: flux
Tags: ssh X X11 xinit
3

This starts a very basic X session, with just a simple xterm. You can use this xterm to launch your preferred distant session.

ssh -X john@otherbox gnome-session

Try also startkde or fluxbox or xfce4-session.

To switch between your two X servers, use CTRL+ALT+F7 and CTRL+ALT+F8.

ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 /tmp/outputFile.mpg
2009-06-05 21:11:17
User: dcabanis
Tags: video X11 ffmpeg
45

Grab X11 input and create an MPEG at 25 fps with the resolution 800x600

read -p 'Username: ' u;sudo -H -u $u xauth add $(xauth list|grep :$(echo ${DISPLAY: -4:2}));sudo su - $u
dpkg-reconfigure -phigh xserver-xorg
apt-cache dotty apache2 | dot -T png | display
2009-02-18 14:27:31
User: raphink
Functions: apt dot
7

Requires: imagemagick and graphviz

On Debian systems, displays a graph of package dependencies. Works also with other image formats, like svg :

apt-cache dotty bash | dot -T svg | display
ssh user@host cat /path/to/some/file | xclip
2009-02-18 10:56:38
User: raphink
Functions: cat ssh
Tags: X X11
18

Have you ever had to scp a file to your work machine in order to copy its contents to a mail? xclip can help you with that. It copies its stdin to the X11 buffer, so all you have to do is middle-click to paste the content of that looong file :)