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

Extract domain from URl
Extracts 2nd-level domain part (or 3rd level, for co.* or com.*) from the URI's hostname. See sample output.

Fix Ubuntu's Broken Sound Server
Ever since the switch to pulseaudio, Ubuntu users including myself have found themselves with no sound intermittently. To fix this, just use this command and restarts firefox or mplayer or whatever.

Monitor open connections for httpd including listen, count and sort it per IP
It's not my code, but I found it useful to know how many open connections per request I have on a machine to debug connections without opening another http connection for it. You can also decide to sort things out differently then the way it appears in here.

follow the content of all files in a directory
The `-q' arg forces tail to not output the name of the current file

Highlight network TX, RX information change

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

make, or run a script, everytime a file in a directory is modified

run a command from within vi without exiting
":! ls -l " results in listing the files in the current directory. pressing "enter" will get you back into vi.

Quick network status of machine
credit to tumblr engineering blog @ http://engineering.tumblr.com/

Empty a file
The downside of output redirection is that you need permissions. So something like $ > file won't play nicely w/ sudo. You'd need to do something like $ bash -c '> file' instead, you could go w/ $ sudo truncate -s0 file


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: