This guide assumes a common OpenClaw setup: OpenClaw is running on an Ubuntu server, and you interact with the OpenClaw AI agent through Discord while administering the server itself over SSH.
The OpenClaw AI agent can generate shell commands, explain what they do, and write files on the server when filesystem access is enabled. It cannot directly modify the state of an already running SSH shell. Bash aliases and similar environment changes only take effect after that shell reloads its configuration.
If you haven’t connected OpenClaw to Discord yet, start with connect OpenClaw to Discord, then return here once the bot is active.
What you are configuring
In this guide you’ll create a Linux alias that runs a system update command. The alias name used here is Blast, chosen purely as an example. I named the OpenClaw AI agent “Blaster”, but the name of the bot is not relevant to how aliases work.
apt update && apt upgrade
What an alias is in Bash
An alias is a feature of the Bash shell. Bash expands an alias name into a longer command line before execution. It does not create a real command in /usr/bin, and it does not apply system-wide unless explicitly configured that way.
For official documentation, see the GNU Bash manual.
What OpenClaw can and can’t do from Discord
From Discord, the OpenClaw bot can:
- Generate correct Linux commands for Ubuntu
- Edit files like
~/.bashrcor~/.bash_aliasesif filesystem tools are enabled - Explain why a command behaves the way it does
The OpenClaw bot cannot inject changes into an already running Bash process. Reloading the shell configuration with source ~/.bashrc is required for aliases to become available.
Step 1: Ask the OpenClaw bot on Discord for the alias
In Discord, send the OpenClaw AI agent a message like:
I need to create an alias command that updates and upgrades my OS.
Can you make one that executes "apt update && apt upgrade" when I type it in my terminal?
The alias can be named "Blast".

A correct response usually includes:
- The alias definition
- Where to store it so it persists across sessions
On Ubuntu systems, this normally means writing the alias to ~/.bashrc or ~/.bash_aliases.
Step 2: Add the alias on the server
Choose the approach that matches how you manage your server.
Option A: Use ~/.bash_aliases
Ubuntu commonly sources ~/.bash_aliases from ~/.bashrc, which keeps alias definitions separate from other shell configuration.
echo "alias Blast='sudo apt update && sudo apt upgrade'" >> ~/.bash_aliases
If you SSH in as root, remove sudo:
echo "alias Blast='apt update && apt upgrade'" >> ~/.bash_aliases
Option B: Add directly to ~/.bashrc
echo "alias Blast='sudo apt update && sudo apt upgrade'" >> ~/.bashrc
APT operations require root privileges. On most OpenClaw VPS setups, using sudo is expected.
You can add -y to auto-confirm upgrades, but this removes an important safety check on servers that run persistent services.
alias Blast='sudo apt update && sudo apt upgrade -y'
Step 3: Why it didn’t work
At this point many users try:
Blast
And see “command not found”.

This happens because the current SSH shell loaded its configuration earlier. Bash does not automatically reload .bashrc when the file is modified.
Step 4: Reload your shell configuration
In the same SSH session, run:
source ~/.bashrc

Then test again:
Blast

The alias is now available in the running shell.
What actually happened
- Discord is only the communication interface
- OpenClaw receives the request and produces instructions
- Your SSH terminal runs its own Bash process
Editing .bashrc updates a file on disk. Running source explicitly reloads that file into the active shell process.
Where aliases should live on an OpenClaw server
Per-user aliases
Aliases should live in the home directory of the user you SSH in as. If the OpenClaw bot edits files for one user but you log in as another, the alias will not appear.
whoami
echo $HOME
System-wide aliases
System-wide aliases can be placed under /etc/profile.d, but this affects all users. On VPS systems this is rarely necessary.
Ubuntu documents shell startup behavior here: Ubuntu Bashrc documentation.
Aliases are for interactive use only
Aliases do not apply to:
- systemd services
- cron jobs
- non-interactive shells
For services and automation, always use full commands. This matches the approach used in OpenClaw systemd setup with Discord and Qwen.
Useful aliases when managing OpenClaw
Once your alias works, you may want shortcuts for gateway management.
alias oc-status='sudo systemctl status openclaw-gateway.service'
alias oc-restart='sudo systemctl restart openclaw-gateway.service'
alias oc-logs='sudo journalctl -u openclaw-gateway.service -f'
Regular OS updates are part of baseline security. This pairs naturally with OpenClaw security best practices.
Troubleshooting
Alias still not found
alias Blast
If nothing prints, reload the configuration:
source ~/.bashrc
The OpenClaw bot says the alias exists but SSH can’t see it
Confirm you are editing the same user account:
whoami
ls -la ~/.bashrc ~/.bash_aliases 2>/dev/null
Using aliases in scripts
Don’t. Use scripts or shell functions instead.

