# redis-cli Basics — Redis

Source: https://www.geekswithgeeks.com/en/redis/redis-cli

> The interactive shell for talking to a Redis server.

## Connecting

Run without arguments for an interactive prompt, or connect to a remote host and port directly.

```bash
redis-cli
127.0.0.1:6379> SET greeting "hello"
OK
127.0.0.1:6379> GET greeting
"hello"

# or connect elsewhere
redis-cli -h cache.example.com -p 6379 -a mypassword
```

## One-shot commands

You don't need the interactive prompt for scripting — pass the command as arguments: `redis-cli SET k v`, handy inside shell scripts.

**Quiz:** What does a healthy Redis server reply to `PING`?

- [ ] OK
- [x] PONG
- [ ] ALIVE

*Answer:* PONG. `PING` is the standard liveness check and always returns `PONG`.
