Excluding directory from grep

For some reason, I can never remember how to do this.

If you ever want to grep for something but leave out a particular directory, use the --exclude-dir=DIR

So if I wanted to search the current directory for the string img, but don’t want to look in the directories tmp or log.

grep -r --exclude-dir=log --exclude-dir=tmp "img" ./

Advertisement
Excluding directory from grep

How to download a file from sourceforge with command line

I often need to download a file from sourceforge to a server or some remote system via command line but I can never remember how. I decided to write it down so I don’t have to keep sifting through AskUbuntu when I need to.

All you need to do is use wget, paste in the link you get from clicking the download button and specify the file name with -O.

So if I wanted to download ClamAV (found here) I’d click on the download link, get the url and filename and paste them in like so.

wget "http://sourceforge.net/projects/clamav/files/latest/download" -O clamav-0.98.tar.gz

That’s all there is to it!

How to download a file from sourceforge with command line