Commands using wget (286)

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

Join lines
This command turns a multi-line file into a single line joined with <SOMETEXT>. To skip blank lines, use: $ perl -pe '(eof()||s/^\s*$//)||s/\n//g' file.txt

A function to find the newest file in a directory
Works recusivley in the specified dir or '.' if none given. Repeatedly calls 'find' to find a newer file, when no newer files exist you have the newest. In this case 'newest' means most recently modified. To find the most recently created change -newer to -cnewer.

Join lines
awk version of 7210. Slightly longer, but expanding it to catch blank lines is easier: $ awk 'BEGIN{RS="\0"}{gsub(/\n+/,"");print}' file.txt

Show the UUID of a filesystem or partition
Shows the UUID of the given partition (here /dev/sda7). Doesn't need to be root.

Create a listing of all possible permissions and their octal representation.

url shortner using google's shortner api
First get a api key for google url shortner from here https://developers.google.com/url-shortener/ Then replace the API_KEY in the command

Deploy git server repo
After, check if working by executing this command locally : git clone git@192.168.0.18:repositories/gitosis-admin.git Tutorial : http://blog.hemca.com/?p=560

grep -v with multiple patterns.
Use multiple patterns with grep -v. So you can print all lines in a file except those containing the multiple patterns you specify.

Recursive chmod all files and directories within the current directory


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: