commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
This command will determine an individuals local weather, based on their I.P. address. I had to learn a lot about SED and a little about XMLStarlet in order to achieve this. This command is my original work and there is much room for improvement; I look forward to any constructive feedback.
This function uses timetrans from the dnssec-tools to calculate the remaining time until a dns entry reaches its time to live and is fetched from the authoritive nameserver again.
Put this command on /etc/rc.local.
-i sets the source file
-r sets the output frame rate, set it to the same frame rate as the input to output each frame
-f sets the output format, trough it might be guessed by the extension
Created to deal with an overzealous batch rename on our server that renamed all files to .jpg files.
The directories are created in the local host with the same structure below of a remote base directory, including the 'basedir' in case that it does not exists.
You must replace user and remotehost (or IP address) with your proper values
ssh will ask for the password of the user in remotehost, unless you had included properly your hostname in the remote .ssh/known_hosts file.
The mogrify command is also part of the ImageMagick suite, and is made to make changes to files in place.
This will find all files in the path "." which are older than 10*24hrs (10 days). This will find any type of file.
You don't need this command often and there are other ways to test output but if you want to be sure if your router and ethernet card are working this is one way.
For Solaris to obtain the same as:
date+%s like in linux
Outputs the PID of any given file run from a command line... Hope it helps!
Count on a specific port (80) - FreeBSD friendly.
-i sets the source file
-f and -acodec both set the output to be raw audio, PCM signed 16-bit little endian
find ip address in all files in /etc directory. can be used to find any string in any directory really
dumpfile is a CSV file, which its 1st field is a phone number in format CC+10 digits
Empty lines are deleted, before the output in format "prefix,ocurrences"
Creates a PDF file where each page will be a layer from de original TIFF file.
You can apply many other filters and transformations.
convert multi_layer.tif -page a4 -compress jpg multi_page.pdf
To set the page size
convert multi_layer.tif -crop 590x790+20+30 -compress jpg multi_page.pdf
To include only a portion of the image (discard first horizontal 20 pixels and first vertical 30 pixels, include the next 590 horizontal and 790 vertical pixels)
convert multi_layer.tif -delete 1,3,5-10 -compress jpg multi_page.pdf
Discard mentioned layers