1๏ธโฃ Method 1: Add /sbin to $PATH (Temporary)
๐น For the current session only
export PATH=$PATH:/sbin
โ Now you can run:
nginx -vt
โ ๏ธ This change will be lost after closing the terminal.
2๏ธโฃ Method 2: Permanently Add /sbin to $PATH
๐น For all future sessions
Modify ~/.bashrc or ~/.profile (Debian typically uses ~/.profile):
echo 'export PATH=$PATH:/sbin' >> ~/.profile
Then apply the changes:
source ~/.profile
โ Now nginx -vt will work every time you open a terminal.
๐ This applies to the current user only. To apply it system-wide, modify /etc/profile.
3๏ธโฃ Method 3: Create a Symbolic Link (Recommended)
๐น The simplest and most effective method
sudo ln -s /sbin/nginx /usr/local/bin/nginx
โ Now you can run nginx -vt from anywhere:
nginx -vt
๐ Summary
๐ Summary
Method | Persistent? | Use Case | Notes |
---|---|---|---|
Method 1: export PATH=$PATH:/sbin | โ No (Only for current session) | Temporary fix | |
Method 2: Edit ~/.profile | โ Yes (For current user) | User-specific solution | |
Method 3: ln -s /sbin/nginx /usr/local/bin/nginx | โ Yes (For all users) | Best and simplest solution |