# atuin

*Category: CLI Tools | Website: https://atuin.sh/*

magical history for you terminal


`atuin` gives you a rich command history for your terminal that you can sync across machines. Might sound simple but once you start using it, you'll quickly realize that you never want to live without it. Your command history tells a story, if you really think about it and that story is worth being saved! More importantly, atuin remembers *where* you ran a command i.e. which machine and even more useful which *directory*! This becomes immensely useful if you often hop between different machines and different repositories because (at least if you are like me) you might not remember every command you ever entered but you might have a good recollection of *where* you entered something. atuin replaces your command history that you get when pressing the up arrow with a nicely designed history list that you can configure to your liking. I set it so that it first shows the command history of the current machine but with ctrl-r I can easily toggle between Host, Session, Global and Directory. The last one is really powerful and has sped up my workflow substantially!

You can choose to use the default atuin server or host your own sync server. The data send to the server is always encrypted so even if you chose to use the free service provided by atuin, there is little danger of your data getting leaked. I personally chose to host my own sync server via docker compose in combination with traefik and haven't had any issues with the setup.

## Highlights

atuin focuses on one thing but it does so perfectly:

- **Speed**: I have never experience any kind of latency even though my command history has grown substantially
- **Stats**: One cool little feature is the ability to quickly display stats about your most used commands. My most used command is "y" which is my alias for launching yazi.  
- **Cross-plattform**: It runs on Linux, macOS and in WSL on Windows, so you can take your command history everywhere you go
- **Easy to self-host**: Starting up the sync server can be as easy as running a single command, but spinning up a container stack with docker compose is also very easy and any cheap VPS + a domain will work.

## Installation

Installation is just a one liner

### macOS & Linux

```bash
curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh
```

### Example docker-compose.yml

```yml
services:

  reverse-proxy:
    image: traefik:v3.2
    command:
      - "--log.level=ERROR"
      - "--api.dashboard=false"
      - "--providers.docker"
      - "--providers.docker.exposedbydefault=false"
      - "--entryPoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.tlschallenge=true"
      - "--certificatesresolvers.myresolver.acme.email=youremail@example.com" # Change to your Email address
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.redirections.entrypoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
    labels:
      - "traefik.http.routers.traefik.rule=Host(`subdomain.example.com`)" # Replace with your domain/subdomain
      - "traefik.http.routers.traefik.entrypoints=websecure"
      - "traefik.http.routers.traefik.tls.certresolver=myresolver"
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - proxy

  atuin:
    restart: always
    image: ghcr.io/atuinsh/atuin:v18.4.0
    command: server start
    volumes:
      - "~/atuin:/config"
    links:
      - postgresql:db
    environment:
      ATUIN_HOST: "0.0.0.0"
      ATUIN_OPEN_REGISTRATION: "true"
      ATUIN_DB_URI: postgres://$ATUIN_DB_USERNAME:$ATUIN_DB_PASSWORD@db/$ATUIN_DB_NAME
      RUST_LOG: info,atuin_server=debug
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.atuin.rule=Host(`atuin.example.com`)" # Replace with your domain/subdomain where you want to reach your atuin server
      - "traefik.http.routers.atuin.entrypoints=websecure"
      - "traefik.http.routers.atuin.tls.certresolver=myresolver"
      - "traefik.http.services.atuin.loadbalancer.server.port=8888"
    networks:
      - proxy

  postgresql:
    image: postgres:14
    restart: unless-stopped
    volumes: 
      - "./database:/var/lib/postgresql/data/"
    environment:
      POSTGRES_USER: ${ATUIN_DB_USERNAME}
      POSTGRES_PASSWORD: ${ATUIN_DB_PASSWORD}
      POSTGRES_DB: ${ATUIN_DB_NAME}
    networks:
      - proxy

volumes:
  letsencrypt:
networks:
  proxy:
    external: true
```


---

*Tags: shell, rust, sqlite*
*Supported OS: linux, macos*
