We ramble about code, technology and life. Sometimes we actually code...

Linux - Part 1

by Kyluke McDougall on 27 June 20144 min read

A technical look at the basics around using Linux.

So you're new to Linux but have no idea where to start or how to make sense of things. That's okay. I'm gonna attempt to break down the Linux OS a little for you to get a better understanding of it.

Where do I get my favourite applications from and how do I install them?

The package manager is where you will find all your software. Linux makes use of online repositories to store the "installer" files for the most common applications around (common != less than 100 000 packages). These repositories are maintained by either the people who maintain your distribution or a 3rd party company.

What repositories are currently in use on my machine?

/etc/apt/sources.list.d/official-package-repositories.list (assuming you're running an Ubuntu based distribution) is where you will find a list of Linux repositories "active" on your Linux installation. These URI's are then used to query the repositories for what packages are available and at what version they are currently in. The directory /etc/apt/sources.list.d can make use of multiple .list files and will make use of all URI's in each file when querying the repository.

How do I query my repository?

This is either done automatically or it can be invoked using the command sudo apt-get update which will update your source list. Keep in mind this does not update your actual software, we will get to that next.

I've updated my sources, now what?

Now you can make use of that information to update the software installed on your PC. These software updates will not only update your Operating System but all your installed software as well. To do this, we use the command sudo apt-get upgrade.

What if I don't find my software?

Not everything is developed for Linux or with Open Source in mind. You will sometimes run into situations where you cannot find the software that you need and this is an unfortunate reality. However, there are many alternatives that have been developed and it's just a matter of finding them. If all else fails, you can always install Wine and run Windows applications inside of Linux. I don't recommend this but you may certainly do it.

How do I now run the software I installed?

Many Desktop Environments (I will get to this in part 2, think Explorer in Windows) will have menus of all your listed applications. In the very rare occasion that the application you installed does not have a User Interface, simply open up the terminal and type in the application name and hit enter. Or read the manual :)

Where is everything stored? None of this makes sense!

  • /bin is where all your binary files that are used during boot up and regular usage are stored. Things like cat, df, ls
  • /boot contains all the files required to boot up, this would include files like the Linux kernel
  • /dev contains all devices attached to your PC, including the processor, cdrom, hard drive etc
  • /etc is the folder which contains all your configuration files. Almost every application which requires a config file will store it here, if not in your home directory.
  • /home is where all of your user directories live.
  • /lib contains kernel images and shared libraries used to boot the system and run commands on the root system ( / )
  • /lost + found is used to recover files that have been lost due to an unexpected shutdown
  • /media is a temporary holding area for removable devices connected to the PC
  • /mnt is a mounting directory similar to /media but is mainly used for external devices which are mounted for extended periods of time if not all the time.
  • /opt is the directory where you would install all 3rd party applications (not something you ever really have to worry about for now)
  • /proc is a directory which contains all running processes, the information regarding each process and the process-id
  • /root this is the home directory of the root user
  • /run this directory is the only clean solution for early-runtime-dir problem
  • /sbin this directory contains executables/binary files used by the System Administrator mainly for maintenance
  • /srv service is abbreviated as 'srv'. This directory contains server specific and service related files.
  • /sys modern Linux distributions include a /sys directory as a virtual filesystem, which stores and allows modification of the devices connected to the system.
  • /tmp stores all temporary files. This directory is cleaned at boot
  • /usr contains binary files, documentation and shared libraries for your installed applications. The ones you install yourself.
  • /var stands for variable. This contains log files, mail files and temp files as well