Install and Use the SUDO Tool to Run Commands as sudo with a Single Keystroke
This guide explains how to clone the SUDO repository from GitHub, install the tool, configure your ~/.bashrc, and then run any Linux command in uppercase to automatically execute it with sudo privileges, while preserving safety features like password prompts and backup files.
Installation of SUDO
Clone the SUDO source code from its GitHub repository and enter the project directory:
$ git clone https://github.com/jthistle/SUDO.git
$ cd SUDO/Run the provided install.sh script. It appends alias definitions to ~/.bashrc that map each executable found in $PATH to an uppercase alias invoking sudo:
# SUDO - shout at bash to su commands
# Distributed under GNU GPLv2, @jthistle on github
shopt -s expand_aliases
IFS_=${IFS}
IFS=":" read -ra PATHS <<< "$PATH"
for i in "${PATHS[@]}"; do
for j in $(ls "$i"); do
if [ ${j^^} != $j ] && [ $j != "sudo" ]; then
alias ${j^^}="sudo $j"
fi
done
done
alias SUDO='sudo $(history -p !!)'
IFS=${IFS_}
# end SUDOThe installer backs up the original ~/.bashrc as ~/.bashrc.old. After installation, apply the changes with:
$ source ~/.bashrcUsing Uppercase Commands as sudo
Commands that normally require a sudo prefix can be run by typing the command name in uppercase. For example:
$ sudo mkdir /test_dir
# equivalent to
$ MKDIR /test_dir
$ TOUCH /test_dir/test.txt
$ LS /test_dirThe tool does not bypass the sudo password prompt; you will still be asked for your password when the command executes. Using the traditional sudo prefix remains optional.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
