# Cheat Sheet #day55 - whoami

# `whoami` Command Cheatsheet

The `whoami` command is used to display the current logged-in user’s username. It is a simple yet useful command, particularly for scripting and troubleshooting.

## Syntax

```bash
whoami
```

## Description

* **Purpose**: Returns the username of the current user.
    

## Examples and Use Cases

### Display Current User

```bash
whoami
```

* Outputs the username of the currently logged-in user (e.g., `john`).
    

### Use in Scripts

You can use `whoami` in scripts to dynamically reference the current user. For example:

```bash
#!/bin/bash
echo "Current user is: $(whoami)"
```

* This script will print the current user’s name.
    

### Check User Privileges

Combine `whoami` with `id` to display user and group information:

```bash
whoami
id -u $(whoami)
```

* Outputs the user ID of the current user.
    

## Options

`whoami` has no options. It simply returns the username.

## Additional Information

* **Man Page**: For more details, you can refer to the `whoami` man page:
    
    ```bash
    man whoami
    ```
    

---

This cheatsheet provides a quick reference to the `whoami` command. Let me know if you need more information or additional examples!
