How does one basically use lastpass-cli?

In searching for a LastPass client on Ubuntu, I found lastpass-cli. I took a look at the documentation but I still do not understand how to basically use it.

I managed to log into my account but now I am wondering how to cover the following use cases:

  • How do I retrieve the password for a specific website?
  • How do I retrieve the email account for a specific website?

Solution 1:

There's some fairly limited documentation here. You have to click on the 'Create, edit, and retrieve passwords on the command line' or 'lpass subcommands' drop downs on that web page.

A full manual page with examples is available on the Lastpass github page.

To retrieve the password for a specific website use:

lpass show --password sitename

You can also add the -c option to clip the password to your copy buffer.

Retrieving the email account for a website isn't as clear, as it depends upon in which field it's stored, if the email address is your username then use:

lpass show --username sitename

Otherwise using the correct field in place of --username should work, --id or --name may be good choices, or you can specify --field=FIELD. Failing that, look at all of the stored fields using:

lpass show --all sitename

Additionally you can view all of your stored information using:

lpass ls