Commands tagged grep (409)

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

Recover remote tar backup with ssh
Here how to recover the remote backup over ssh

Reuse all parameter of the previous command line
!* is all of the arguments to the previous command rather than just the last one. This is useful in many situations. Here's a simple example: $ vi cd /stuff oops! [exit vi, twice] $ !* expands to: cd /stuff

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

recursive search and replace old with new string, inside files
recursively traverse the directory structure from . down, look for string "oldstring" in all files, and replace it with "newstring", wherever found also: $ grep -rl oldstring . |xargs perl -pi~ -e 's/oldstring/newstring'

Find the process you are looking for minus the grepped one
faster ;) but your idea is really cool

Compression formats Benchmark
See: http://imgur.com/JgjK2.png for example. Do some serious benchmarking from the commandline. This will write to a file with the time it took to compress n bytes to the file (increasing by 1). Run: $ gnuplot -persist

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Lists installed kernels
no need for rpm, no need for piping to another command. also no real fu but lacking in unnecessary complexity and distro specific commands.

Diff two directories by finding and comparing the md5 checksums of their contents.
Compares the md5 checksums of the contents of two directories, outputting the checksum and filename where any files differ. Shows only the file name, not the full path.

Create higher quality gif from videos
I had to compress it a bit to meet the 255 limit. See sample for full command (274) usage: ffgif foo.ext Supports 3 arguments (optional) ffgif filename seek_time time_duration scale ffgif foo 10 5 320 will seek 10 seconds in, convert for 5 seconds at a 320 scale. Default will convert whole video to gif at 320 scale. Inspiration - http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality/556031#556031


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: