Commands using grep (1,935)

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

Detect illegal access to kernel space, potentially useful for Meltdown detection
Based on capsule8 agent examples, not rigorously tested

This allows you to find a string on a set of files recursivly
The -r is for recursive, -F for fixed strings, --include='*.txt' identifies you want all txt files to be search any wildcard will apply, then the string you are looking for and the final * to ensure you go through all files and folders within the folder you execute it.

Remount root in read-write mode.
Saved my day, when my harddrive got stuck in read-only mode.

Swap a file or dir with quick resotre
This lets you replace a file or directory and quickly revert if something goes wrong. For example, the current version of a website's files are in public_html. Put a new version of the site in public_html~ and execute the command. The names are swapped. If anything goes wrong, execute it again (up arrow or !!).

run command on a group of nodes in parallel
The pee command is in the moreutils package.

check open ports without netstat or lsof

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Find status of all symlinks
The symlinks command can show status of all symbolic links, including which links are dangling, which symlinks point to files on other file systems, which symlinks use ../ more than necessary, which symlinks are messy (e.g. having too many slashes or dots), etc. Other useful things it can do include removing all dangling links (-d) and converting absolute links to relative links (-c). The path given must be an absolute path (which is why I used $(pwd) in the example command).

Capture video of a linux desktop
This is identical to the original command, but allows you to specify an offset if you have multiple monitors. In this case you'll record a 1366x768 window that's offset by 1366 pixels in the x axis and 0 pixels in the y axis. Note also that the -sameq option has been replaced by -qscale - at least in ffmpeg version 1.2.1 on Fedora 19.

geoip information
geoip from maxmind try to get the small utility via: apt-get install geoip


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: