Search your torrent directory using find command


Often, when you browse a torrent site for your favorite Linux distribution, you might ask the question, have I already downloaded this torrent or not? One way to find out is to actually go into your torrent directory and search (by the way, new nautilus is pretty good at searching), but it is always good to have a script (that uses find command) to do that.


Create a file inside bin directory in your home folder (lets say with following texts.

# Example ./ Ubuntu Linux Or put it in PATH and type
for i in "$@"; # for loop of all command line parameters
 STR+="$i|" # add pipe character for egrep 
STR="${STR%?})" # remove last pipe character
find ~/Torrent/ | egrep -i "$STR" # search (file1|file2|file3)

This script is nothing special, other than it searches file names with spaces, lower or upper case etc. If Torrent directory is not in your home folder you can use following command to link it there

ln -s /path/to/torrent ~/Torrent

or you could simply change ~/Torrent in above script to where ever you save your torrent files.


First make this file executable with following command

chmod +x ~/bin/

and if you have not done already, add ~/bin to PATH environment variable in .bashrc file.

export PATH=$PATH:~/bin


You can search files in your torrent directory using texts like following ubuntu ubuntu linux


You can modify above script to search other directories and files too. I hope this script was useful to you.

Cheers !!


Leave a comment

Filed under Uncategorized

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s