Back to Article List

How to create a Linux alias from Discord with an OpenClaw bot

How to create a Linux alias from Discord with an OpenClaw bot - How to create a Linux alias from Discord with an OpenClaw bot

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 ~/.bashrc or ~/.bash_aliases if 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.

Your idea deserves better hosting

24/7 support 30-day money-back guarantee Cancel anytime
Billing Cycle

1 GB RAM VPS

£2.95 Save  50 %
£1.47 Monthly
  • 1 vCPU AMD EPYC
  • 30 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Firewall management
  • Free server monitoring

2 GB RAM VPS

£3.68 Save  20 %
£2.95 Monthly
  • 2 vCPU AMD EPYC
  • 30 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Firewall management
  • Free server monitoring

6 GB RAM VPS

£10.33 Save  29 %
£7.38 Monthly
  • 6 vCPU AMD EPYC
  • 70 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Firewall management
  • Free server monitoring

AMD EPYC VPS.P1

£5.16 Save  28 %
£3.69 Monthly
  • 2 vCPU AMD EPYC
  • 4 GB RAM memory
  • 40 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

AMD EPYC VPS.P2

£9.59 Save  31 %
£6.64 Monthly
  • 2 vCPU AMD EPYC
  • 8 GB RAM memory
  • 80 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

AMD EPYC VPS.P4

£19.19 Save  31 %
£13.29 Monthly
  • 4 vCPU AMD EPYC
  • 16 GB RAM memory
  • 160 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

AMD EPYC VPS.P5

£23.99 Save  29 %
£16.98 Monthly
  • 8 vCPU AMD EPYC
  • 16 GB RAM memory
  • 180 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

AMD EPYC VPS.P6

£36.18 Save  31 %
£25.10 Monthly
  • 8 vCPU AMD EPYC
  • 32 GB RAM memory
  • 200 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

AMD EPYC VPS.P7

£45.78 Save  35 %
£29.53 Monthly
  • 16 vCPU AMD EPYC
  • 32 GB RAM memory
  • 240 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

EPYC Genoa VPS.G1

£3.68 Save  20 %
£2.95 Monthly
  • 1 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture.
  • 1 GB DDR5 memory
  • 25 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

EPYC Genoa VPS.G2

£7.38 Save  20 %
£5.90 Monthly
  • 2 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture.
  • 4 GB DDR5 memory
  • 50 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

EPYC Genoa VPS.G4

£14.02 Save  32 %
£9.59 Monthly
  • 4 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture.
  • 8 GB DDR5 memory
  • 100 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

EPYC Genoa VPS.G5

£22.15 Save  27 %
£16.24 Monthly
  • 4 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture.
  • 16 GB DDR5 memory
  • 150 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

EPYC Genoa VPS.G6

£25.84 Save  23 %
£19.93 Monthly
  • 8 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture.
  • 16 GB DDR5 memory
  • 200 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

EPYC Genoa VPS.G7

£42.82 Save  26 %
£31.75 Monthly
  • 8 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture.
  • 32 GB DDR5 memory
  • 250 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

FAQ

How do I create a Linux alias from Discord with OpenClaw?

Ask your OpenClaw agent for the alias, add it to ~/.bashrc or ~/.bash_aliases over SSH, then reload the shell with source ~/.bashrc.

Automate faster, for less

Bring your winning ideas to life with AMD power, NVMe speed and unmetered bandwidth. Everything backed by 24/7 support, plus a 30-day refund period.