Using find(1) instead of tree(1)

Stefan Gehr stefan.kerman.gehr at fau.de
Mon Sep 25 07:44:34 UTC 2023


Hi,

> I don't have 552 passwords, but I use pass(1) also as a bookmark for
> websites.
>
> 	$ pass show www/foss/kernel/bugzilla/
> 	www/foss/kernel/bugzilla
> 	├── alx
> 	│   ├── id
> 	│   └── pass
> 	└── url
>
> For example, for the kernel bugzilla, you can see that I not only store
> the password, but I also store the username (id), and the url.
>
> 	$ pass show www/foss/kernel/bugzilla/url
> 	https://bugzilla.kernel.org/
>
> 	$ pass show www/foss/kernel/bugzilla/alx/id
> 	alx at kernel.org

Is there any good reason for doing it this way? Most people would put
everything in one file, encoded via `key: value` pairs.

	$ pass show bugzilla.kernel.org
	correcthorsebatterystaple
	login: alx at kernel.org
	url: https://bugzilla.kernel.org/

You could then `grep`/`sed` the relevant information out of the file.

Best regards,
Stefan

On 2023-09-24T15:22:25+0200, Alejandro Colomar wrote:
> Hi,
> 
> I would like to be able to filter the results of pass using standard
> Unix tools.  The reason is I have a rather large password database (and
> it's only going to increase):
> 
> 	$ pass show | wc -l
> 	552
> 
> I don't have 552 passwords, but I use pass(1) also as a bookmark for
> websites.
> 
> 	$ pass show www/foss/kernel/bugzilla/
> 	www/foss/kernel/bugzilla
> 	├── alx
> 	│   ├── id
> 	│   └── pass
> 	└── url
> 
> For example, for the kernel bugzilla, you can see that I not only store
> the password, but I also store the username (id), and the url.
> 
> 	$ pass show www/foss/kernel/bugzilla/url 
> 	https://bugzilla.kernel.org/
> 
> 	$ pass show www/foss/kernel/bugzilla/alx/id 
> 	alx at kernel.org
> 
> 
> The problem comes when I need to search for something I don't remember:
> Let's say I want to see everything I have for "kernel", but don't
> remember where kernel is:
> 
> 	$ pass find kernel
> 	Search Terms: kernel
> 	└── www
> 	    └── foss
> 		└── kernel
> 
> Okay, so I want to search "www/foss/kernel"; but I have to type it!  It
> would be preferable to have some '--find' ('-f') that worked like this:
> (The name --find would be because it would use find(1) underneath.)
> 
> 	$ pass find --find kernel
> 	www/foss/kernel/
> 
> (Notice the trailing slash (which find(1) doesn't add).  It's useful to
>  know it's a dir.)
> 
> Then I would just pass that to my next command:
> 
> 	$ pass find --find kernel \
> 	  | xargs pass show --find
> 	www/foss/kernel/
> 	www/foss/kernel/smtp/
> 	www/foss/kernel/smtp/pass
> 	www/foss/kernel/bugzilla/
> 	www/foss/kernel/bugzilla/url
> 	www/foss/kernel/bugzilla/alx/
> 	www/foss/kernel/bugzilla/alx/id
> 	www/foss/kernel/bugzilla/alx/pass
> 
> And then I can just grep from there what I need (say the bugzilla
> password):
> 
> 	$ pass find --find kernel \
> 	  | xargs pass show --find \
> 	  | grep 'bugzilla.*/pass'
> 	www/foss/kernel/bugzilla/alx/pass
> 
> And finally show the pass:
> 
> 	$ pass find --find kernel \
> 	  | xargs pass show --find \
> 	  | grep 'bugzilla.*/pass' \
> 	  | xargs pass show
> 	pw
> 
> 
> Would you want this feature?  If you agree, I'll start writing it, and
> will ask if I have any doubts.
> 
> Thanks,
> Alex




More information about the Password-Store mailing list