Tutorial : Linux 101

Last modified by Mohamad Roffizal Bin Romali on 2015/03/20 11:42

What is Linux?

If you wanna be a jerk about it, Linux technically isn't an operating system. Linux proper is actually a kernel, which is only a portion of an OS (albeit, the main portion). When most people say "Linux" however, they are talking about a Linux distribution, which is indeed a full-fledged operating system. Luckily for any beginners out there, it's not as complicated as you might think -- what makes Linux Linux is a small combination of components, that kernel included. In fact, we can break them down into four main parts, in no specific order:

A piece of software called the "bootloader" 

The Linux Kernel we all love so much.

Userland (Think Firefox and Libre Office and, for those of you up on your jargon out there, the GNU part of GNU/Linux). We'll get to that later.

The filesystem, the place where we put our music and save all those great images from reddit.com/r/earthporn.

That's the short version. Now let's take a moment to break each of these down.

The bootloader

For the sake of keeping things simple, the bootloader is a piece of software that helps get the Linux kernel loaded into memory so that you can use your computer. It is required. When you hit the power button, your computer does what's called a POST (Power-On Self Test) and then the BIOS (Basic Input / Output System) reads data from your disk drive, which says, "Hey, I'm a bootloader, execute me!" Your computer says, "Okay," and executes that bit of code. At that point, the bootloader tells your processor and memory to load and execute the Linux kernel that's been waiting so eagerly to run. There are three main bootloader options in the Linux World:

LILO (The Linux Loader)

GRUB (GNU GRand Unified Bootloader) versions 1 and 2

Syslinux

LILO

An oldie but goodie, LILO seems to be used less nowadays, especially compared to GRUB. One drawback is that it lacks support for EFI, which many newer computers support. There is, at least, a modified version of LILO called "elilo," which does support EFI.

Pros:

It's been around a very long time and is very stable.

Works great on older hardware.

Supports multiple operating systems.

Cons:

Again, no support for EFI and GPT, though if you do need EFI, there's always elilo.

GRUB

GRUB has quite a few points in its favor, including the fact that you don't need to re-install it every time you change something, as with LILO. GRUB version 1 (aka GRUB Legacy) is the most commonly used bootloader today. Just keep in mind that, like LILO, it's in maintenance mode by now, which means no new features are being added. You'll find those in GRUB v2, which is used by default in the ever-popular Ubuntu, among other distributions. GRUB v2 was officially released June 26th, 2012. That's how new it is.

Pros:

GRUB is, hands down, the most commonly used bootloader, and it's very stable.

Development remains active and ongoing, so expect to see new features for v2 and bug fixes on v1.

Supports multiple operating systems (even Oracle Solaris).

Supports EFI.

Cons:

We tried, and really couldn't think of any.

Syslinux

Syslinux is a slightly lesser-known bootloader that was originally designed to boot the Linux kernel from a FAT/MSDOS filesystem. Written by a bright guy named Hans Peter Anvin, it has a decently broad feature set and supports the bleeding-edge filesystem known as BTRFS. Also, pretty much any ISO image of any Linux distribution you boot utilizes Syslinux, in the form of Isolinux.

Pros:

Stable.

Active developer community.

Anvin is involved (trust us, this guy is awesome).

Syslinux is actually a set of bootloaders, which includes a PXE bootloader (Network boot) and tons of other features.

Cons:

Nope, can't think of any here either.

Really, these all do the job pretty well. The beautiful thing about open source and using a Linux-based operating system is the freedom to choose exactly what you'd like to use.

The Linux Kernel

So, what is the Linux Kernel? Let's begin with the layman's version: the Linux Kernel is essentially the boss of your computer once the bootloader assists it into execution. The kernel controls memory, the CPU, input and output, and any peripherals you connect to your computer. It controls what application can access what memory, and what user can run what task.

Now, the "I've got a degree in computer science" version:

The Linux Kernel is a monolithic operating system kernel that supports loadable device drivers (kernel modules) and preemptive scheduling. It is highly portable, and runs on 90 percent of the world's top 500 super computers. It's written in the C programming language and is supported and maintained by several individuals worldwide. It's open source, meaning the code is open to anyone who would like to modify it. It's also freely available to download.

Userland

These are the bits of software that include your web browser, video games, your spreadsheets, your text editors. This is also the software you use to get around your computer's filesystem, copying file A to file B, moving a picture into a folder, creating a new folder, etc.

The most important parts of userland are the GNU core utilities, also known as coreutils. This GNU toolset contains the base tools and commands to complete a Linux distribution on the most basic levels.

Some basic commands from coreutils that you need to familiarize yourself with:

ls -- List files in your current location on the filesystem.

mkdir -- Create a directory.

cd -- Change directory

man -- Invoke the manual or more commonly referred to as "the manpages." This is one of the most important commands. Wanna know how best to use "ls"? Type "man ls" on the command line and you'll find out.

cat -- This command will spit out the contents of a text file to your terminal.

rm -- Remove a file from the system.

The Linux filesystem

The Linux filesystem could get tricky, and seems to be the item that takes the most time for people to master. To begin, every filesystem has a filesystem type, as well as a filesystem layout. The type refers to how a hard drive is formatted, which has a direct impact on how Linux reads and writes files. Luckily for you, confused newbies, there's a boatload of filesystem types out there. For now, and for the sake of this article not becoming a Frank L. Herbert novel, we'll only discuss one here. That would be ext4, a filesystem in wide-enough use that it makes sense as a go-to choice. Once you become a Linux Jedi Master feel free to take a swim in the ocean of alternative open source filesystem types.

Now let's move onto the filesystem layout, the most detailed section of this article.

The filesystem layout in Linux is naturally different than what you're used to if you're coming from Windows. If you're coming to Linux from Mac OS X, you're in somewhat better shape. The filesystem is where your files live (obviously), as well as where all the above components are stored when the computer is turned off. The layout of the folders is what we really need to talk about. First off, if your background is in Windows, all of the \'s become /'s.

Example time:

C:\myname\myfolder\myfile.txt in Windows, becomes /home/myname/myfolder/myfile.

Now, here's a more general view of the layout of a Linux filesystem. It's important you get familiar with this; almost all Linux filesystem layouts look like this, regardless of the distribution.

Don't close your browser window out yet -- we'll walk you through these so that you know them like the back of your hand.

Check it out:

/ -- Root, not shown above, is the top level in the filesystem hierarchy. Not to be confused with the root user account you'll see later.

/bin -- System binaries, essential for system functionality.

/boot -- Your bootloader and Linux kernel live here.

/dev -- In Linux, everything is treated as a file, even your mouse. That's right, there's a /dev/mouse. So, /dev is used for device access.

/etc -- System configuration files go here, the equivalent of C:\Windows\System32 in Windows or /System on Mac.

/home -- Users' home directories are contained under /home, similar to C:\Users and Settings\MyName in Windows or /Users/myname on a Mac.

/lib -- System libraries, things you normally don't have to interact with directly. Equivalent to C:\Windows\System32 on Windows and /Library on Mac.

/lib64 -- The 64-bit version of /lib. You won't see this on 32-bit machines.

/media -- You won't see this on every Linux distribution, but in case you do, it's just an alternate place to mount thumb drives or network shares (more on that later).

/mnt -- Same as above, just a different name; more common than /media. By the way, "mnt" is short for "Mount"

/opt -- "Optional software." This writer always sticks third-party applications here.

/proc -- A special filesystem in Linux operating systems for accessing process info.

/root -- The root user's home directory. The root user, by the by, is the system administrator account, something we'll also discuss in more detail later.

/sbin -- System binaries, similar to /bin but not as essential, though still important.

/srv -- Server files, not on all Linux distributions.

/sys -- A special filesystem in Linux known as sysfs which holds information about devices and drivers.

/tmp -- A temporary folder for keeping scratch files (don't put anything important here).

/usr -- A general folder for keeping userland applications in. Think programs like Firefox.

/var -- A system folder that holds variable files -- essentially, files that change often. Log files are a good example.

We understand that if you're new to this, this might seem overwhelming, but believe us when we say you'll get it with time. The filesystem hierarchy of Linux can be a bit of a struggle at first, but after a while it actually starts to make sense. You may even like it better than whatever it is you're used to.

Also, keep in mind that not all Linux distributions use the standard filesystem hierarchy listed above. There are some distros that take a completely different approach. Open source is all about choices. As you fall further into the rabbit hole, you'll find out just how deep it goes.

Now that we've armed you with a basic overview of what Linux is and how it breaks down, let's put it all together.

What's the best way to choose a Linux distribution?

Each of the thousands of Linux distros out there naturally has its pros and cons. Peek into forums and you'll bear witness to heated flamewars over which distribution is better than which. The answer to this question is that it's up to you. This may seem like a cop-out, but it really is true. Open source is about freedom. You have the freedom to choose what you like and go with it.

With that said, we do want to suggest two Linux distributions that will not hold your hand too much, and that don't hide the underpinnings of the OS behind a fancy UI. This will help you in the long run by forcing you to actually learn the OS. You'll probably have to do some Googling to make things work, whereas installing Ubuntu and spinning up Firefox would take an easy 20 minutes. Don't get us wrong here: Ubuntu is great. If you just want a quick-and-easy distro that will help get you up and running quickly, Ubuntu is awesome. Not to mention that Steam has been officially announced for Ubuntu. If that's what you had in mind, stop reading now and head on over to ubuntu.com, download an ISO and get started. If you want more of a challenge, though (or maybe more leet hax0r cred), read on....

Created by Administrator on 2013/06/28 09:44

Start Here

Welcome to the UNIMAS WIKI.
To start, use search function by entering keywords in the search box below :
 

Quick Navigation

About UNIMAS

HOW-TO, Tutorial & User Manual

HOW-TO, Tutorial & User Manual

Macros

STB2242 - PLANT BIOTECHNOLOGY

signatureattach

Recently Created

jtpresley | 67154 | noora | 66168 | e-Adu

Recently Modified

My Recent Modifications


This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 5.0.3 - Documentation