All commands (14,055)

What's this? 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

How to run X without any graphics hardware
This starts an X server using Xvfb(1) (no graphics hardware required), then starts a VNC server on the display. Change :1 if there's a conflict with an existing display, and change 800x600x24 to suit your tastes (24 is the bit depth, 800x600 is the size). This command obviously requires X be installed, and also x11vnc(1); both are available via your favourite package manager. You can also use another VNC server of your choosing, as long as DISPLAY is set to the display of Xvfb(1). To change your desktop environment (the default is twm(1), which is rather fail), you can add it to your ~/.xinitrc file (see the startx(1) manpage for details).

Get AWS temporary credentials ready to export based on a MFA virtual appliance
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token. This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use: `awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'` You must adapt the command line to include: * $MFA_IDis ARN of the virtual MFA or serial number of the physical one * TTL for the credentials

Convert the contents of a directory listing into a colon-separated environment variable
Useful for making a CLASSPATH out of a list of JAR files, for example. Also: export CLASSPATH=.:$(find ./lib -name '*.jar' -printf '%p:')

Base conversions with bc
Easily convert numbers to their representations in different bases. Passing "ibase=16; obase=8; F2A" to bc will convert F2A (3882 in decimal) from Hex to Octal, and so on.

Get movie length

Test for Weak SSL Ciphers
...if you get a certificate back, the server is accepting weak SSL ciphers

put command in a loop to keep trying a connection
This will keep trying to reconnect your netcat connection can be used with SSH or Telnet, just substitute nc for ssh or telnet very useful for troubleshooting VPNs were you want to send continuous packets towards a destination to trace.

Exclude multiple columns using AWK
Print all columns except the 1st and 3rd.

Monitor a file with tail with timestamps added
Should be a bit more portable since echo -e/n and date's -Ins are not.

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

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.


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: