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

modify a file in place with perl
changes THIS to THAT in all files matching fileglob* without using secondary files

Number of CPU's in a system
This appears to do the same. Utility is verified to be present on Ubuntu and OpenSuse out-of-the-box.

Remove duplicate lines whilst keeping empty lines and order
Remove duplicate lines whilst keeping order and empty lines

Prepend a text to a file.
Prepend text to a file. It doen't need temporary files, ed or sed.

Show apps that use internet connection at the moment. (Multi-Language)
Show apps that use internet connection at the moment. Can be used to discover what programms create internet traffic. Skip the part after awk to get more details, though it will not work showing only unique processes. This version will work with other languages such as Spanish and Portuguese, if the word for "ESTABLISHED" still contain the fragment "STAB"(e.g. "ESTABELECIDO")

Delete all but the latest 5 files, ignoring directories

Kill a process by its partial name (BSD/Mac)
This kills Activity Monitor

Find total Terabytes written to a SSD
You must have smartmontools installed for this to work. This also assumes you 512 byte sector sizes, this is pretty standard.

Decode a MIME message
will decode a mime message. usefull when you receive some email and file attachment that cant be read.

show the working directories of running processes
this shows the CWD of every running `java' command. YMMV but we often switch to a working directory for each service to start and run from there -- therefore this quicly shows what is running by a more meaningful name than command alone (the -bw prevents using blocking system calls which speeds this up quite a bit in the presence of remote mounted filesystems)


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: