this post was submitted on 25 Nov 2023
79 points (91.6% liked)
Linux
48311 readers
794 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
This is the actually the thing same as Windows - in Linux you've got the
which
command, and it's equivalent iswhere
in Windows. Both do the same thing - find out where a program lives.OP meant a "program" in this context. Both Linux and Windows have specific paths where programs typically lives. For example, in Windows, if you type "notepad" in a command prompt or the 'Run' dialog, it'll search for it in known system paths such as
C:\Windows
,C:\Windows\system32
etc. These paths are declared in thePATH
environment variable - which you may have encountered when certain applications try to (or ask you to) add their program folder to the PATH, such as say Java or Python. If a program is added to thePATH
, typing 'java' or 'python' from anywhere will automatically launch it, so you don't need to specify the full path or the program.Now whilst this is convenient, sometimes it can cause unwanted issues. For example, say you installed some other program that uses a specific version of Java or Python, and it installed that version in your system, and added that folder to the
PATH
- now when you typejava
orpython
in a command prompt, you wouldn't know which version you're executing. This is what OP meant by a program living in multiple places. As you can imagine, this can now cause issues, and can even break some scripts expecting a particular version of Java/Python etc and some other version is being picked up. This is where thewhere
command in Windows comes in handy, as it tells you where exactly that program is located. And it's Linux equivalent iswhich
.So at least in this department, the behavior of Windows and Linux is virtually identical. :)
TIL there's a
where
command in Windows! Thanks!