Commands by farazyashar (2)

  • Install the Linux kernel headers for currently running kernel version on Debian-based systems via apt-get Show Sample Output


    2
    sudo apt-get install linux-headers-`uname -r`
    farazyashar · 2013-04-18 03:18:26 9
  • As of March 7, 2012: brew update - downloads upgraded formulas brew upgrade [FORMULA...] - upgrades the specified formulas brew outdated - lists outdated installations Note updating all packages may take an excruciatingly long time. You might consider a discriminating approach: run `brew outdated` and select specific packages needing an upgrade. For more information see homebrew's git repository: https://github.com/mxcl/homebrew Show Sample Output


    11
    brew update && brew upgrade `brew outdated`
    farazyashar · 2012-03-07 14:26:41 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

shuffle lines via perl
Same, without modules... Probably smarter option: just use the shuf command or even sort -R.

Bypass with hexencoding, dump /etc/passwd

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" }

makes screen your default shell without breaking SCP or SFTP
I changed my shell to screen by editing .bashrc, this stopped scp from connecting. Adding two tests before screen fixed them problem.

Speed up upgrades for a debian/ubuntu based system.
Please install aria2c before you try the above command. On ubuntu the command to install aria2c would be: $sudo aptitude install aria2

Terrorist threat level text

Print with tabular

New command with the last argument of the previous command.

List the most recent dates in reverse-chronological order
bash brace expansion, sequence expression

get a mysqldump with a timestamp in the filename and gzip it all in one go
Performs a mysqldump and gzip-compresses the output file with a timestamp in the resulting dump file. Inspect the file for integrity or fun with this command afterward, if you desire: $ zcat mysqldump-2009-06-12-07.41.01.tgz | less


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: