/etc/apt/sources.list file contains repositories your operating system searches for when it looks for packages.
So if some tutorial asks you to modify /etc/apt/sources.list, you are modifying (most likely adding) repositories your operating system looks at when it searches for packages.
Warning: Adding new unknown repositories can be dangerous, because you don’t know what the packages in these repositories contain. Keep this in mind.
Besides installing, removing and upgrading packages, there are a lot of things you can do with them – you can list installed packages, determine whether a package was installed, display information about an installed package and find which package installed a file. (Shotts, 2019) I have never used these functionalities so far, so I will not talk about them. A quick Google search or a look at the reference can give you the answers to these queries, if you ever need to use them.
Thank you for reading!
References
Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 202-203
Here is how you can remove packages from your computer: (“How can you completely remove a package?,” n.d.)
sudo apt --purge remove packageName
Then after that, to remove the dependencies that were just used by that package and aren’t used by any other package anymore:
sudo apt --purge autoremove
There may be some configuration files left over, either in the .config directory in your home folder or as a standalone hidden file (which means its filename starts with a .). You have to delete those manually.
To preface this: I personally always use Google to find the packages I need. Either I look for the package name on the distribution website or I am looking for specific packages I need to install for some purpose. I never used the commands that follow so far, but they are useful to know about.
To find a package you want to install, you can use the following command: (Shotts, 2019)
apt-cache search query
An example:
mislav@mislavovo-racunalo:~/Linux_folder$ apt-cache search zip
advancecomp - collection of recompression utilities
node-almond - minimal AMD API implementation for use in optimized browser builds
amanda-client - Advanced Maryland Automatic Network Disk Archiver (Client)
amanda-server - Advanced Maryland Automatic Network Disk Archiver (Server)
…
You get a list of packages related to your search query.
Before we go into how to install packages and related operations, let’s first establish a rule, if you will: Always run sudo apt-get update before doing any of the operations we will cover (besides removing a package).
Why is it so? Your operating system has a list of packages. Before installing any packages, it is a good idea to tell the operating system: “OK, operating system. Please check if there are more recent versions of packages available or if there are any new packages available.” (“What does ‘sudo apt-get update’ do?,” n.d.) You do so with sudo apt-get update. You need superuser permissions to run this command, hence the sudo.
Again, remember to run this command before any other package manipulation related actions besides removing a package.
Let’s talk about package management today. What is package management and why do we need it?
Let’s start with why do we need it. We need it because packages are a convenient way to deliver software – we deliver software like a package. Package management is a term for installing, modifying and removing packages. The alternative to installing software from a package is to install the software from source, but that is for another article.
Different Linux distributions use different packaging systems. (Shotts, 2019) A package consists of files that contain the software we are installing. Packages are available in repositories. Each distribution has its own repository with packages. If a software depends on something to run (such as an external piece of code to calculate something), then we say that that external piece of code is a dependency. Package managers (programs that manage packages) take care of dependencies when installing packages.
There are high-level package management tools (such as apt and apt-get in Debian-like distributions) and low-level package management tools (such as dpkg in Debian-like distributions). We will use those to manage our packages.
Hope you learned something new!
A caveat: In the following articles I will cover package management operations (installing, removing, …) using package manager that is used in Debian and Debian-like Linux distributions. I won’t cover other distributions. In case you have another distribution, I suggest using Google to find the equivalent commands.
References
Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 196-199
The tar command is used to create an archive of files or to extract files from an already existing archive of files. (Ward, 2014) To create an archive of files, use the following syntax:
tar cvf archiveName.tar file1 file2 …
cvf mean the following – c enters the create mode (telling tar to create a new archive), v is the flag for verbose output (so you know what is happening) and f means that the next argument will be the name of the to-be-constructed archive.
To extract files from an already existing archive, use the following syntax:
tar xvf archiveName.tar
v and f mean the same things as I explained above, but x is the extract mode, telling tar to extract the archive provided as the argument.
Memorize these two commands by heart. That’s what I did.
When extracting files, it is always a good idea to extract them in a newly created folder. That way, if the extracted files make a mess, you can always move that folder to the location you want to (or delete it). There are options in tar to check the archives contents, but I haven’t used them – I used the method of extracting the archive in a new folder.
Hope you learned something useful!
References
Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Page 37