this post was submitted on 25 Nov 2023
78 points (91.5% liked)
Linux
48145 readers
903 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
Is a home directory similar to the users folder in windows, or like the program files folder? Is it ‘everything but the OS’? I’m still trying to get a grasp on how the OS operates conceptually.
Yeah - the home directory in Linux pre-dates the windows Users directory by a long time. You'll see the multi-user nature of your OS exposed much more in Linux than you will in Windows.
Every user will have a /home/username directory on Linux (often referenced by "~" or by the environment variable "$HOME"). By default this is the only directory that user will have any permissions to create things (with some exceptions like /tmp which is used for temporary file creation - but nothing long-term). So all of your configuration, user-created files, etc. will be created there.
Configurations are often stored in 'dot-files' or in directories that begin with a period. These are "hidden" by default with most file-browsing tools (it's just a tradition - there's nothing otherwise special about files or directories that begin with a period). So you'll have a
.bashrc
which is the script that runs when you start a bash shell for example. Or.local
which is where you will find a lot of application configurations these days.So if you copy /home/username somewhere you will copy all of your configurations.
Some applications will install there as well. Steam, for example, will install your programs under $HOME/.steam.
Things you install "system-wide" will be installed to /usr/bin or /bin. This will typically be things that you use a package manager to install. So the steam application may be /usr/bin/steam but then all of its configurations, installed apps, etc. go in your home dir.
If you're curious where a command lives you can use
which cmd
ortype cmd
from the command-line and it will show you (something I often wish Windows had).NOTE: There are exceptions to everything I've said above. But those are the "general" guidelines. In short - if you installed it without needing root permissions it's likely somewhere in $HOME.
Thanks, that's a lot of really helpful info.
What do you mean by this though?
A command can 'live' in different places? And this might be a dumb question...but what is a command in this context?
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!Essentially, yeah. Most programs will install to your root directory, but all your personal configs and personal files will be in your home directory.
What I'd personally recommend is using Timeshift to automatically keep backups if your home directory on a separate partition, then if you want to switch distros or if you need to reinstall for whatever reason you can use Timeshift to restore your home directory pretty easily, as long as your new install uses the same file system.
Timeshift was designed for system snapshots not home files. You can force it to cover home but it's better to use BackInTime which was designed specifically for home snapshots.
The home is like the Windows users directory.
In the shell/terminal it's represented by
~
or$HOME
.