Commands by altern (5)


  • -1
    find . -name *.properties -exec /bin/echo {} \; -exec cat {} \; | grep -E 'listen|properties'
    altern · 2014-02-17 02:25:49 1
  • while [ $orig_size -gt $dest_size ] ; do dest_size=$(stat -c %s $2) pct=$((( 69 * $dest_size ) / $orig_size )) echo -en "\r[" for j in `seq 1 $pct`; do echo -n "=" done echo -n ">" for j in `seq $pct 68`; do echo -n "." done echo -n "] " echo -n $((( 100 * $pct ) / 69 )) echo -n "%" done Show Sample Output


    0
    progr
    altern · 2011-07-27 15:17:51 7

  • -1
    dd bs=1 if=/dev/zero of=/path/to/imagename.raw seek=50G count=1 conv=notrunc
    altern · 2011-07-15 09:54:26 0

  • -2
    ls -t1 | head -n1
    altern · 2011-05-27 09:49:30 2
  • shows opened ports on machine in continuous mode (refreshing every 10 sec) Show Sample Output


    0
    netstat -tulpnc
    altern · 2011-04-20 07:30:31 1

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

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

My Git Tree Command!
this creates a tree of your branch merges. very useful if you want to follow the features you add.

Email HTML content
Note, this works because smtp is running

Create the oauth token required for a Twitter stream feed
This is the THIRD in a set of five commands. See my other commands for the previous two. This step creates the oauth 1.0 token as explained in http://oauth.net/core/1.0/ The token is required for a Twitter filtered stream feed (and almost all Twitter API calls) This token is simply an encrypted version of your base string. The encryption key used is your hmac. The last part of the command scans the Base64 token string for '+', '/', and '=' characters and converts them to percentage-hex escape codes. (URI-escapeing). This is also a good example of where the $() syntax of Bash command substitution fails, while the backtick form ` works - the right parenthesis in the case statement causes a syntax error if you try to use the $() syntax here. See my previous two commands step1 and step2 to see how the base string variable $b and hmac variable $hmac are generated.

Deal with dot files safely

tar directory and compress it with showing progress and Disk IO limits
tar directory and compress it with showing progress and Disk IO limits. Pipe Viewer can be used to view the progress of the task, Besides, he can limit the disk IO, especially useful for running Servers.

gpg decrypt a file
gpg command to decrypt a previously encrypted file on the command line. Can be optionally made into an alias: alias decrypt='gpg --output foo.txt --decrypt foo.txt.pgp'

Check the current price of Bitcoin in USD

Bitcoin Brainwallet Private Key Calculator
A bitcoin "brainwallet" is a secret passphrase you carry in the "wallet" of your brain. The Bitcoin Brainwallet Private Key Calculator calculates the standard base58 encoded bitcoin private key from your "brainwallet" passphrase. The private key is the most important bitcoin number. All other numbers can be derived from it. This command uses 3 other functions - all 3 are defined on my user page: 1) brainwallet_exponent() - search for Bitcoin Brainwallet Exponent Calculator 2) brainwallet_checksum() - search for Bitcoin Brainwallet Exponent Calculator 3) b58encode() - search for Bitcoin Brainwallet Base58 Encoder Do make sure you use really strong, unpredictable passphrases (30+ characters)! http:brainwallet.org can be used to check the accuracy of this calculator.

Record MP3 audio via ALSA using ffmpeg
Record audio to an MP3 file via ALSA. Adjust -i argument according to arecord -l output.


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: