(As commented under another answer:) "
/usr/sbin/ paths are often excluded from the PATH variable by design, because the executables in those directories typically require root privileges, and are thus not expected to be run by normal users."
Use the full sudo command, but start with
echo instead. Then, if something goes wrong, like accidentally you hit the
Enter key, the command is simply displayed on screen and you return to the command prompt without anything actually happening (be careful with command substitutions, though). Then, you can use the
Up arrow to go back to edit the command as you were.
Check the manual pages of the commands themselves as well, because some of them offer an option to only show what the command would do, without actually doing it.
sfdisk has the option
--no-action), which does all the things you ask it to do, but does not write to the device, so no actual modifications are made.
To make permanent changes, edit the
.bashrc file in a user's home directory (if you use BASH). To make the change permanent for new users, you can set up or change a relevant file in
/etc/skel/. The contents of this directory are, under default behaviour, copied in the home directories of any new users you add.
Security Notice: The tutorial in the following link suggests adding a
bin/ directory in the home directories for each user to allow them to use their own executables. However, a good security practice is to disable executables from being run from a
/home partition, by using the
noexec modifier in
fstab. Doing this will ensure that only admin-approved executables can be run. The
/usr/local/ directory tree provides space to add executables that do not come through a standard (safe) repository, so that admin control can be maintained while still allowing expansion from the standard packages provided by the distribution.
Perhaps useful to look at a short tutorial like this one: https://www.tecmint.com/set-path-variable-linux-permanently/