Home / Exciting tips / Linux / How to access Bitwarden passwords from the Linux command-line

How to access Bitwarden passwords from the Linux command-line

Do you use the open-source password manager Bitwarden on your Linux PC? Do you like the GUI application, but wish that they had a command-line tool to use as well? As it turns out, they do! Follow along with this guide to learn how to access Bitwarden passwords from the Linux command-line!

Installing Bitwarden CLI on Linux

Bitwarden CLI must be installed before we demonstrate how to use it. Thankfully, the developers of the app have made it quite easy to set up. To start the installation, open up a terminal window on your Linux desktop by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. With the terminal window open, follow along with the command-line installation instructions outlined below that correspond with your Linux operating system.

Snap package

The best and quickest way to get the Bitwarden CLI application working on a Linux distribution is to get the Snap package version. Why? There’s no need to install NodeJS or NPM, or anything like that. Install the Snap runtime, install the package, and go.

If you’re looking to get the Bitwarden CLI through the Snap Store, start by enabling the Snap runtime on your Linux PC. The runtime is easily set up by installing the “snapd” package and enabling the snapd.socket service with systemd.

Note: Can’t figure out how to set up Snapd on your Linux PC? Check out our in-depth tutorial on how to set up Snap packages on Linux.

Once the Snapd runtime is up and running on your Linux PC, the Bitwarden CLI app can quickly be set up on your Linux PC with the following snap install command below.

sudo snap install bw

When the installation is complete, access the help area for Bitwarden CLI by executing the following command.

bw --help


Those that are unable to run Snap packages must install the Bitwarden CLI tool using the NodeJS package manager (NPM). To get NPM working, enter the commands that match your Linux PC.


sudo apt install npm


sudo apt-get install npm

Arch Linux

sudo pacman -S npm


sudo dnf install npm


sudo zypper install npm

With the NPM package management tool working, use the npm install command to grab the latest release of Bitwarden CLI. Please note that during the installation, NPM may show some errors. These errors usually mean NPM is out of date. To update your release, check the official NodeJS website.

sudo npm install -g @bitwarden/cli

The installation may take some time, as it is built and not a static package like with the Snap release. Sit back and be patient for a couple of minutes till the installation is complete.

When NPM finishes, you’ll be able to confirm Bitwarden CLI is installed on Linux by running:

bw --help

Configuring Bitwarden CLI

The Bitwarden CLI app is set up. Now it is time to configure it so that it can display passwords. To start the configuration, open up a terminal window and follow the step-by-step instructions below.

Step 1: Use the bw login command. This command will allow you to generate a configuration file, and attach your Bitwarden user account to the app.

bw login

Step 2: Upon entering the bw login command, you will see a prompt in the terminal window that says “Email address.” Enter the email address associated with your Bitwarden account, and press the Enter key.

Step 3: After entering your email address, the bw login command will print a second prompt on the screen. This prompt says, “Master password.” Enter the password to your Bitwarden password vault.

Step 4: Once you’ve logged in, you’ll see a message that says, “you are logged in!” Followed by export BW_SESSION=”YOUR_SESSION_KEY_HERE.”

Copy the export BW_SESSION=”YOUR_SESSION_KEY_HERE” command from the output to your clipboard. Then, open up .bashrc in the Nano text editor with the command below.

Note: BW_SESSION=”YOUR_SESSION_KEY_HERE” is an example. The actual command in the Bitwarden CLI prompt will be various letters, symbols, and numbers.

nano -w ~/.bashrc

Step 5: Make a new line in the Nano text editor by pressing the Enter key on the keyboard. Then, paste the code below. Please note that you must change “YOUR_SESSION_KEY_HERE” in the code with the actual session key that appears in the terminal prompt after running bw login.

alias bw-unlock='export BW_SESSION="YOUR_SESSION_KEY_HERE"'

Step 6: Save the edits to your Nano text editor by pressing Ctrl + O. Then, use Ctrl + X to close the Nano text editor.

Step 7: Close the terminal window and re-open it. When the terminal window is back open, run the command bw-unlock to unlock your Bitwarden password vault.


Using Bitwarden CLI

Using Bitwarden CLI is done through various bw sub-commands. To learn how to find passwords in your vault, try the command-examples below.

List all passwords available

To list all passwords available in the Bitwarden vault, run:

bw list items --pretty

For more information on the bw list command, run bw list –help. It outlines the in-depth operations you can do with it.

List password for a specific website

Need to find the password to a particular site from your vault? Execute the bw bw list items –search command.

 bw get password example.com

Sync passwords with Bitwarden server

To re-sync, the Bitwarden CLI app with the Bitwarden central server, run the bw sync command.

bw sync

Delete item

To delete an item in the vault, do the following. First, run bw list –pretty and find the item’s ID code. Then, use bw delete item.

bw delete item YOUR_ID_CODE_HERE

More BW commands

We covered the basic Bitwarden CLI commands. However, there is more to the app. For more information on how to use Bitwarden commands, run:

bw --help

Need help with a specific sub-command? Remember to replace “sub-command” in the command below with the command you want more information about. Such as bw get, bw list, etc.

bw sub-command --help

About excitingtips

Check Also

How to play Steam games on Chrome OS with Linux Support

Do you have a Google Chromebook? Do you love video games? Want to play Steam …

Leave a Reply

Your email address will not be published. Required fields are marked *