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

Make ISO image of a folder
Create ISO image of a folder in Linux. You can assign label to ISO image and mount correctly with -allow-lowercase option.

calulate established tcp connection of local machine
If you want prepend/append text just wrap in echo: $echo Connected: `netstat -an|grep -ci "tcp.*established"`

password recovery on debian
Appended to grub boot parameters ... gives shell ... password recovery

Skip banner on ssh login prompt
This allows you to skip the banner (usually /etc/issue.net) on ssh connections. Useful to avoid banners outputted to your mail by rsync cronjobs.

Show running services (using systemctl)

Re-use the previous command output
The $(!!) will expand to the previous command output (by re-running the command), which becomes the parameter of the new command newcommand.

Run the last command as root
Same as `sudo !!`. If you do not have permission to be sudo or sudo does not installed on your system, you can use this.

Recursively move folders/files and preserve their permissions and ownership perfectly

Find the package that installed a command

Print just line 4 from a textfile
Prints the 4th line and then quits. (Credit goes to flatcap in comments: http://www.commandlinefu.com/commands/view/6031/print-just-line-4-from-a-textfile#comment.)


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: