Commands using head (314)

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

Make directory including intermediate directories
This will create the intermediate directories that do not exist. I did not know about this for a long time.

check open ports without netstat or lsof

remove files and directories with acces time older than a given date
touch a dummy file with the specified date, then use find with -anewer .

convert UNIX timestamp to UTC timestamp
date -ud @1320198157

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

Set all CPU cores' CPU frequency scaling governor to maximum performance

Lurk what's going on on remote console

Video Google download
Download google video with wget. Or, if you wish, pass video URL to ie mplayer to view as stream. 1. VURL: replace with url. I.e. http://video.google.com/videoplay?docid=12312312312312313# 2. OUPUT_FILE : optionally change to a more suited name. This is the downloaded file. I.e. foo.flv # Improvements greatly appreciated. (close to my first linux command after ls -A :) ) Breakedown pipe by pipe: 1. wget: html from google, pass to stdout 2. grep: get the video url until thumbnailUrl (not needed) 3. grep: Strip off everything before http:// 4. sed: urldecode 5. echo: hex escapes 6. sed: stipr of tailing before thumbnailUrl 7. wget: download. Here one could use i.e. mplayer or other...

Add an iptables rule on RH/CentOs before the reject
Rather then editing the /etc/sysconfig/iptables file, or during a kickstart doing some awk/sed magic, easily add a rule in the correct place within iptables

Advanced python tracing
Trace python statement execution and syscalls invoked during that simultaneously


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: