---
title: Solana CLI Basics
seoTitle: Introductory commands for getting started on the Solana CLI
description:
  This section walks through some common Solana CLI commands to get you started.
---

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:

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

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

<Tabs items={["Full commands", "Short commands"]}>

<Tab value="Full commands">

```terminal
$ solana config set --url mainnet-beta
$ solana config set --url devnet
$ solana config set --url localhost
$ solana config set --url testnet
```

</Tab>
<Tab value="Short commands">

```terminal
$ solana config set -um    # For mainnet
$ solana config set -ud    # For devnet
$ solana config set -ul    # For localhost
$ solana config set -ut    # For testnet
```

</Tab>
</Tabs>

## 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:

```txt title="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
===========================================================================
```

<Callout type="info">
  This command will not override an existing account at the default location,
  unless you use the `--force` flag.
</Callout>

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
```

2. Request an airdrop of Devnet SOL:

```terminal
$ solana airdrop 2
```

<Callout>

Devnet airdrops limit requests to 5 SOL per request. If you hit rate limits or
encounter errors, try using the [Web Faucet](https://faucet.solana.com) instead.

</Callout>

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

```terminal
$ solana balance
```
