I'm curious about the difference between the /usr/bin and /usr/local/bin directories in a file system. If I want to add a command, which path should I use and why?
3 Answers
/usr/bin is typically reserved for system commands and may be altered during system upgrades. On the other hand, /usr/local/bin is the better option for adding your own scripts or programs without messing with system files. It's generally safer and more appropriate for user-specific commands, especially since some applications like VSCode prioritize commands in /usr/bin, so anything you add to /usr/local/bin will be easily accessible without interference.
Honestly, a simple search on the topic would clear this up quickly. But just to reiterate, /usr/bin is for the system commands maintained by your OS, while /usr/local/bin is the space for user-installed software, ensuring everything runs smoothly without clashes.
If you look up this topic, you'll find plenty of resources discussing it. Here's a quick recap: You usually want to add your personal commands to /usr/local/bin because it doesn't conflict with your system's commands. This way, your scripts stay intact even after upgrades.
Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures