Commands by TexasDex (2)

  • If your admin has disabled Apache's directory index feature but you want to have a cheap way to enable it for one folder, this command will just create an index.html file with a link to each file in the directory (including the index.html file, which is not ideal but makes the command much simpler). The HTML isn't even remotely compliant, but it could easily be improved on. Also, the command needs to be run each time a file is added or removed to update the index.html file. Show Sample Output


    8
    for i in *; do echo "<li><a href='$i'>$i</a>"; done > index.html
    TexasDex · 2011-05-02 21:31:00 5
  • Generates a random 8-character password that can be typed using only the left hand on a QWERTY keyboard. Useful to avoid taking your hand off of the mouse, especially if your username is left-handed. Change the 8 to your length of choice, add or remove characters from the list based on your preferences or kezboard layout, etc.


    6
    </dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c8; echo ""
    TexasDex · 2010-06-17 19:30:36 3

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

Watch active calls on an Asterisk PBX
Only the number of calls nothing else.

mirrors directory to a ftp server
http://lftp.yar.ru/

list files recursively by size

github push-ing behind draconian proxies!
If you are behind a restrictive proxy/firewall that blocks port 22 connections but allows SSL on 443 (like most do) then you can still push changes to your github repository. Your .ssh/config file should contain: Host * ForwardX11 no TCPKeepAlive yes ProtocolKeepAlives 30 ProxyCommand /usr/local/bin/proxytunnel -v -p -d %h:443 Host User git Hostname ssh.github.com ChallengeResponseAuthentication yes IdentityFile ~/.ssh/id_rsa IdentitiesOnly yes Basically proxytunnel "tunnels" your ssh connection through port 443. You could also use corkscrew or some other tunneling program that is available in your distro's repository. PS: I generally use "github.com" as the SSH-HOST so that urls of the kind git@github.com:USER/REPO.git work transparently :) You

list files recursively by size

list files recursively by size

Create QR codes from a URL.
QR codes are those funny square 2d bar codes that everyone seems to be pointing their smart phones at. Try the following... $ qrurl http://xkcd.com Then open qr.*.png in your favorite image viewer. Point your the bar code reader on your smart phone at the code, and you'll shortly be reading xkcd on your phone. URLs are not the only thing that can be encoded by QR codes... short texts (to around 2K) can be encoded this way, although this function doesn't do any URL encoding, so unless you want to do that by hand it won't be useful for that.

host - DNS lookup utility
host is a simple utility for performing DNS lookups. It is normally used to convert names to IP addresses and vice versa. When no arguments or options are given, host prints a short summary of its command line arguments and options.

power off system in X minutes
Replace 60 with the number of minutes until you want the machine to shut down. Alternatively give an absolute time in the format hh:mm (shutdown -h 9:30) Or shutdown right away (shutdown -h now)

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


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: