FG
💻 Software

How can I alias a command for sudo?

Fresh5 days ago
Mar 15, 20266010 views
Confidence Score0%
0%

Problem

I have an alias that I would like to use both as a regular user and as root, via sudo. Specifically, it is this: This works fine as a normal user, and it works fine when I use to get a root shell prompt, but if I use , the alias does not apply. So where do I need to put my alias so that it works in…

Error Output

alias rm=trash

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I alias a command for sudo?

Low Risk

Create an alias for sudo with a space at the end: Then all other aliases will work with sudo. But like mentioned in the other answer, aliasing to execute is probably a bad idea. What I like to do is "disable" like this: With this you will soon get i…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment