Solana DocumentationLocal development

Solana CLI Basics

This section provides some common commands and examples to help you get you started using the Solana CLI.

Solana config

Your Solana config specifies the following variables:

  • Config file: The path to your config file
  • RPC URL & Websocket URL: The Solana cluster to which the CLI makes requests
  • Keypair path: The path to the default Solana wallet (keypair) used to pay transaction fees and deploy programs. By default, this file is stored at ~/.config/solana/id.json.

To see your current configuration settings, enter the follow command in your terminal.

Terminal
$
solana config get

A successful command will return output similar to the following:

Example output
Config File: /Users/test/.config/solana/cli/config.yml
RPC URL: https://api.mainnet.solana.com
WebSocket URL: wss://api.mainnet.solana.com/ (computed)
Keypair Path: /Users/test/.config/solana/id.json
Commitment: confirmed

You can change the Solana CLI cluster with the following commands:

Terminal
$
solana config set --url mainnet-beta
$
solana config set --url devnet
$
solana config set --url localhost
$
solana config set --url testnet

Create a wallet

Before you can send a transactions using the Solana CLI, you need a Solana wallet funded with SOL.

To generate a keypair at the default keypair path, run the following command:

Terminal
$
solana-keygen new

A successful command will return output similar to the following:

Example output
Generating a new keypair
For added security, enter a BIP39 passphrase
NOTE! This passphrase improves security of the recovery seed phrase NOT the
keypair file itself, which is stored as insecure plain text
BIP39 Passphrase (empty for none):
Wrote new keypair to /Users/test/.config/solana/id.json
===========================================================================
pubkey: 8dBTPrjnkXyuQK3KDt9wrZBfizEZijmmUQXVHpFbVwGT
===========================================================================
Save this seed phrase and your BIP39 passphrase to recover your new keypair:
cream bleak tortoise ocean nasty game gift forget fancy salon mimic amazing
===========================================================================

This command will not override an existing account at the default location, unless you use the --force flag.

To view your wallet's address (public key), run:

Terminal
$
solana address

Airdrop SOL

Request an airdrop of SOL to your wallet to pay for transactions and program deployments.

  1. Set your cluster to Devnet:
Terminal
$
solana config set -ud
  1. Request an airdrop of Devnet SOL:
Terminal
$
solana airdrop 2

Devnet airdrops limit requests to 5 SOL per request. If you hit rate limits or encounter errors, try using the Web Faucet instead.

To check your wallet's SOL balance, run the following command:

Terminal
$
solana balance

Is this page helpful?

Table of Contents

Edit Page
© 2026 Solana Foundation. All rights reserved.