Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can the location for APT sources, named /etc/apt/sources.list, be named differently (e.g. /foo/my-renamed-apt-sources-file"), without breaking APT (i.e. via some configuration)?

share|improve this question
Why do you want to change that name - what are you planning to do, or what is the reason for your question? – Nils Jun 12 '12 at 20:07
I am merely curious. – Tshepang Jun 12 '12 at 20:21
up vote 3 down vote accepted

This is set by the Dir::Etc::sourcelist configuration directive. This could be changed with the following in /etc/apt.conf.d/00sourcelist:

Dir::Etc::sourcelist "/foo/my-renamed-apt-sources-file";

You don't really want to do this though. Other applications which use the source list may break (e.g. apt-file, command-not-found).

share|improve this answer
You were 10 seconds faster... ;) There is no need to provide full path. In default configuration apt will look for sourcelist file (and all other important files) in /etc/apt/. @Tshepang: take a look at /usr/share/doc/apt/examples/configure-index.gz - there is an index of all apt configuration options. – pbm Jun 12 '12 at 20:42
@pbm I'm quick on the draw ;-) The OP's example was outside /etc/apt, hence the absolute path. – mgorven Jun 12 '12 at 20:44

This may not quite be what you're looking for, but Debian (and probably Ubuntu by now) supports the /etc/apt/sources.list.d/ directory. You can place files there (so long as they end with "sources.list" (e.g., foo.sources.list)) that will be included by apt when used. Going one step further, you can put them anywhere and symlink from /etc/apt/sources.list.d to the real file.

But as for /etc/apt/sources.list the sources.list(5) man page talks about it as though it's unchangeable.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.