Skip to main content
45 votes

What is the benefit of /etc/apt/sources.list.d over /etc/apt/sources.list

Having each repository (or collection of repositories) in its own file makes it simpler to manage, both by hand and programmatically: It allows new installations that need their own repos to not ...
DopeGhoti's user avatar
  • 76.7k
41 votes
Accepted

/etc/udev/rules.d/ vs /lib/udev/rules.d/ - which to use and why?

The difference between the two folders is that: /lib/udev/rules.d Contains default rules files. Do not edit these files. /etc/udev/rules.d/*.rules Contains customized rules files. You can modify ...
Dababi's user avatar
  • 3,395
19 votes
Accepted

Is it a good idea to replace files in etc with symlinks?

No! You'll have a non-standard system. Future system updates to files in /etc will break the symlinks. Many security and authentication programs regard their configuration files in /etc not being ...
waltinator's user avatar
  • 5,014
16 votes

if statement query user id in etc/passwd?

To do that in a bash loop, I suggest using read and IFS like: #!/usr/bin/env bash while IFS=':' read -r user passwd uid gid comment home shell; do if [ "$uid" -gt 1000 ] ; then echo GT $...
Stephen Rauch's user avatar
15 votes
Accepted

Use `/etc/paths` or `/etc/paths.d` to add items to the PATH in macOS Sierra?

Use /etc/paths.d. The primary reason is that /etc/paths will be modified and/or replaced by system upgrades. /etc/paths.d/ items will not. Files are generally named with the pattern index-source. E.g.,...
bahamat's user avatar
  • 39.9k
15 votes
Accepted

What is the benefit of /etc/apt/sources.list.d over /etc/apt/sources.list

On a technical level, as someone who has had to handle these changes in a few large and popular system info tools, basically it comes down to this: For sources.list.d/ # to add if [[ ! -e /etc/apt/...
Lizardx's user avatar
  • 3,068
15 votes

Is it a good idea to replace files in etc with symlinks?

If you have your home directory within the root filesystem, it might work. Mostly. With some pretty important caveats. Some security-sensitive files, like /etc/sudoers, may become ineffective if ...
telcoM's user avatar
  • 99.3k
14 votes

if statement query user id in etc/passwd?

Instead of reading /etc/passwd directly, you should use getent passwd, that will also work if some of your users are saved in something like LDAP or such. awk should be well-suited for the colon-...
ilkkachu's user avatar
  • 141k
13 votes

Reload settings in /etc/fonts/conf.d

I have tried running fc-cache -rv and restarting the terminal. As far as I can tell my updates are not being applied. Restarting an application should be enough to reload changes. A few applications ...
dequis's user avatar
  • 231
11 votes

What is the benefit of /etc/apt/sources.list.d over /etc/apt/sources.list

If you're manually managing your servers I'll agree it makes things more confusing. However, it benefits programmatic management (i.e. "configuration as code"). When using config management software ...
Martijn Heemels's user avatar
10 votes
Accepted

How to write an automatically sourced shell script to /etc/profile

/etc/profile is a file. Hence the error when trying to create /etc/profile/foo.sh. /etc/profile.d is the directory you're thinking of. Scripts placed in there get sourced on login. In your example,...
steve's user avatar
  • 22k
9 votes
Accepted

How to get copies of default Linux etc files

While the topic of configuration files backup/versioning might seem simple on the surface, it is one of the hot topics of system/infrastructure administration. Distribution agnostic, to keep ...
Rui F Ribeiro's user avatar
9 votes
Accepted

Entries in /etc/passwd are all duplicated (and entries in /etc/shadow are also all duplicated)

This is unexpected and non standard. Each username should have exactly one entry in /etc/passwd and no more than one entry in /etc/shadow. Remediation should be handled with care. For starters I'd get ...
Chris Davies's user avatar
9 votes

Is it a good idea to replace files in etc with symlinks?

If the files you're modifying are considered "configuration files" by your package management system so they won't get overwritten then what you're proposing might work under certain ...
Stephen Harris's user avatar
8 votes
Accepted

if statement query user id in etc/passwd?

Try this: if grep -E '^[^:]*:[^:]*:[^:]{4}' /etc/passwd | grep -Evq '^[^:]*:[^:]*:1000:' The first grep searches passwd for lines with a uid of four or more digits. The second grep filters out the ...
Tom Zych's user avatar
  • 933
8 votes
Accepted

Why is /etc/localtime a symbolic link?

You mention RHEL in your tags, so I assume this is what you're using. With RHEL 6 and earlier, when you upgrade the tzdata package then it triggers tzdata-update. This reads /etc/sysconfig/clock for ...
Stephen Harris's user avatar
6 votes

What do the scripts in /etc/profile.d do?

jordanm's answer is incorrect. /etc/profile is not sourced by all shells. As you point out, it is not sourced by csh, tcsh - I'm not sure about zsh. It is sourced by Bourne shell (sh) derivatives, ...
Damocles's user avatar
6 votes

What is the benefit of /etc/apt/sources.list.d over /etc/apt/sources.list

As nemo pointed out in a comment, one of the key advantages of a directory is it allows for the notion of "ownership". Modern Linux distributions and installers are all based around the idea of ...
IMSoP's user avatar
  • 481
6 votes

Why does the primary group of my user show up in /etc/group?

The rule isn’t quite accurate; it should say on systems using /etc/passwd and /etc/group, the primary group of a user is defined in /etc/group (this determines its identifier); a user doesn’t need to ...
Stephen Kitt's user avatar
6 votes
Accepted

Is the .d notation for folders in /etc recommended or not?

The typical use of a .d directory is to hold multiple config files (typically sharing a common file extension, such as *.conf) which are then merged or composed to produce a single logical ...
filbranden's user avatar
  • 21.9k
6 votes

Someone is locking /etc/group for a very long time - what to do?

Try lslocks will show files locked with flock manually or by apps. Try using lsof to get the user who locked the file. lsof /etc/.group.swp Should show similar too. ~]# lsof /etc/.group....
Mark Stewart's user avatar
6 votes

Fake /etc/os-release for an application to make it think it runs on Ubuntu instead of Debian

Or can I "mount" a fake /etc/os-release file for a certain systemd service unit? This is exactly what systemd's BindPaths and BindReadOnlyPaths options are for (docs): BindPaths=, ...
larsks's user avatar
  • 35.6k
5 votes
Accepted

Why should one use update-locale instead of directly setting LANGUAGE?

There are just two sanity checks: the requested locale must exist (otherwise update-locale exits and /etc/default/locale isn't modified) if a value is specified for LANGUAGE, it must be valid (...
Stephen Kitt's user avatar
5 votes
Accepted

What is wrong with my copy command?

In mac it seems that /etc is only a symbolic link pointing to /private/etc. You only copied the link not a directory. You can achieve what you are trying by copying the directory where the link is ...
StefanR's user avatar
  • 1,392
5 votes

Error message id: cannot find name for group ID after logging in

This happened when my user "jackson" wasn't assigned a group. I knew the solo group id for my user was 1000 (when a user is created with $ adduser and no parameters are defined, the user is assigned ...
Jacksonkr's user avatar
  • 201
5 votes

What is the purpose of /etc/hosts?

Using the /etc/hosts file to give a human readable name to a local system within a desktop environment is perfectly reasonable. The hosts file is great to use in a home network or even in a small ...
francois P's user avatar
  • 1,239
5 votes
Accepted

Are http://cdn-fastly.deb.debian.org/ and deb.debian.org one and the same service?

cdn-fastly.deb.debian.org and deb.debian.org are part of the same service, but they’re not the same. The latter serves two purposes: its DNS records contain SRV records which allow apt to find mirrors ...
Stephen Kitt's user avatar
5 votes

What replaces /etc/services in openSUSE, and how

Since Jetchisel will not turn his comment into an answer, I am doing it here, with more details. Warning: I am not an expert on these issues and this is only to make available whatever understanding ...
babou's user avatar
  • 848
4 votes

How to check if a shared library is installed?

Use the command file `which ffmpeg` to determine whether ffmpeg is compiled for 64-bit or 32-bit. If it is 64-bit, look for the libraries in /usr/lib64. If it is 32-bit then look for the libraries ...
gmorganVA's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible