TransWikia.com

How to find /etc/apt/sources.conf file

Ask Ubuntu Asked on February 11, 2021

I am wondering how to find the /etc/apt/sources.conf filein Ubuntu 16.04.4 terminal ? It should contains URLs to archive.ubuntu.com.

2 Answers

My favorite way to do this is by traversing the directory structure. To move up a level in the directory, it's ../.

You want to go all the way to the filesystem root to get to /etc. So, that's up two levels of directories - assuming you started in your /home/user directory.

So, let's say I want to edit the file you probably meant to mention - sources.list. My command would look like:

sudo nano ../../etc/apt/sources.list

The sudo is, of course, to elevate my permissions. The 'nano' is a text editor that you can use in the terminal - and it's easy to learn to use. Then, the following is the path to the file.

As you see in the path, I went up two levels, each with a ../. That takes me to the filesystems root (not to be confused with root user) which is just plain /. Once it takes me there, it then digs down into the directories and opens the file in question.

If, for some reason, you were in your Downloads folder (under your /home/user directory) then it'd be:

sudo nano ../../../etc/apt/sources.list

It's pretty easy this way, so long as you know where you are in the directory structure.

Answered by KGIII on February 11, 2021

The file is just /etc/apt/sources.list. The file part is just referring to the file that it just mentions, which is /etc/apt/sources.list

Answered by Thomas Ward on February 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP