| |

Intro to Linux for Gamers

A lot of exciting stuff is happening for gamers in Linux, and many Windows gamers are probably looking to make the leap to Linux, but aren't familiar enough with the platform to actually make the jump.
by Sunny Kalsi on Dec. 27, 2012, 2:56 p.m.

If you've had nightmares of trying to give yourself permissions to a folder in Windows and it's not friggin' working and even when it does work it takes forever to change all the files, Linux will feel like a nice compromise between security and sanity.

A lot of exciting stuff is happening for gamers in Linux, and many Windows gamers are probably looking to make the leap to Linux, but aren’t familiar enough with the platform to actually make the jump. There are many tutorials on the internet regarding Linux, but many nowadays are targeted towards the mythical grandmother, and the more in-depth tutorials were written 20 odd years ago. So what does one do when they come from a world of editing config.sys and autoexec.bat files for gaming and is now a complete beginner? This guide is for you1!

Filesystem

There’s no C: or D: etc. in Linux. There is a single filesystem heirarchy2 which contains everything. The path separator is a forward slash / in linux, like on the web, instead of a backslash \ in Windows. There is exactly one root, called / and literally everything branches off there. Hard drive partitions will get mounted on a “mount point”, for example /home/leetnoob/ might actually be pointing to a partition which you think of as D:. This might make it a bit harder to keep track of free space but overall, the way the actual filesystem is organised actually makes keeping track of hard drives easier.

Linux also has a better way of naming these drives and partitions. The first hard drive is named sda (or hda if you still use old IDE drives), the second is named sdb, and so on. The first partition on the first drive is named sda1, then sda2, etc. etc. If you’ve been driven slightly mad by Windows’ NTFS partitions having drive assignments per partition so you have to remember your F: is your second partition on your first hard drive and your C: is your third partition on your first hard drive, this consistent naming scheme is quite good3.

In Linux you’ll probably be using the ext4 filesystem instead of FAT32 and NTFS. You’ll also rue the day that you formatted anything to be exFAT, because Linux doesn’t really support it. If you’re reading this in the world of tomorrow, you might be using btrfs. The important thing to know about ext4 and btrfs is that they’re fast, they’re “journalled” (which means you shouldn’t lose any data if you lose power), and they never need defragging. Nice!

Linux also has easier file permissions. If you’ve had nightmares of trying to give yourself permissions to a folder in Windows and it’s not friggin’ working and even when it does work it takes forever to change all the files, Linux will feel like a nice compromise between security and sanity. All files in Linux have a “user” and “group”. Everyone else is considered “other”. You have read, write, and execute permissions on every file for the user, group, and other. These are concisely written as “@rwx@” permissions for “@ugo@”. They always go in that order — “@rwxrwxrwx@”, the first for “user”, then “group”, then “other”.

Programs also aren’t installed in Linux like they are in Windows. In Windows, most of a program goes under C:\Program Files, but under Linux the program will be littered throughout the filesystem. You might hate this at first but eventually you’ll love it. Remember that you should never need to manually create or delete files for programs you install. The installer / uninstaller system in Linux works more like an “app store” (and it’s been around for 20 odd years). You install new programs in a consistent way (except Steam apps) and updates all happen through a single, consistent interface.

Here’s what the filesystem4 looks like at the “root” (or /):

  • System Directories — The software on your PC goes here. This is controlled by your installer “app store”, and user data is not kept here. You should never need to mess with the files in here.
    • boot — Contains everything necessary for the system to actually boot up. However, this won’t take you as far as a GUI or even a command prompt. The Linux “kernel” is kept here5.
    • bin — Contains absolute minimum binaries required for the system to run (like a command prompt).
    • sbin — Contains absolute minimum binaries required for the system to run that only the superuser will use.
    • etc — Contains configuration files for the system level. Nowadays you rarely edit these files.
    • run — Fairly new directory which contains state for core system services.
    • lib, lib32, and lib64 — Absolute minimum shared libraries required for the system to run. Think of lib as being like a system32 directory. For 64 bit linux, lib32 is where the (bare minimum) 32 bit specific libraries are kept, and lib64 for 64 bit specific libraries.
    • usr — Slightly badly named, but it means “stuff for users”. Anything you want to do in a day-to-day way will be kept here, like office applications or your UI. It’ll be the largest non-data part of your filesystem. We’ll look at the subdirectories in here:
      • usr/bin & usr/sbin — All the non-bare-minimum binaries (executables) for your system are kept here. usr/sbin is for the superuser only.
      • usr/games — well behaved games will keep their binaries here (ironically, that’s like none of them).
      • usr/lib & usr/lib32 — Libraries. You should see a pattern here. A bunch of directories in your root are repeated here.
      • usr/share — All the “data” for apps, like icons, bitmaps, levels etc. are kept here. If you think about Doom, your WAD files will be kept here, but the doom.exe equivalent would be kept in usr/bin (or better, usr/games). All the DLL files (they’re called .so files in Linux) would be in usr/lib. usr/share should be the biggest part of usr.
      • usr/local — If you take a look in there, you’ll see a bunch of directories just like in the root directory as well as the usr directory. This sub-heirarchy is for programs you installed yourself outside of the installer system. If at all possible, you should never ever use this. It’s unlikely that you’ll ever need to.
      • usr/include & usr/src — for compiling stuff, ignore it.
    • opt — This directory was designed for people who hate Linux or can’t be bothered figuring out the filesystem. It’s basically a free-for-all, and works a lot like Program Files does for Windows. Most non-open-source games actually use this directory to keep everything — binaries, data, sometimes even config files. If you’re a gamer, this will potentially become the biggest part of your filesystem.
  • Data Directories — Contains all your data, either at a system level or user level. Note that I haven’t included configuration data here, but that is usually taken care of by the install system. You should only ever need to mess with files in your home directory.
    • home — This is like Windows’ Users directory. All your user stuff goes here (under /home/yourusername). Note that steam actually keeps itself and all apps under your home directory.
    • var — Contains “varying” data. Any system wide caching, system logs, or stuff that changes all the time at a system level will be stored in var6
    • srv — This is like a new var directory, but where var is a “standard place” for all computers, srv is where you keep stuff specific to your PC (at a system level). This is only of interest if you want your computer to be a headless web server or something to that effect.
    • tmp — Temporary files. These get created and destroyed by users and the system. Same as C:\Temp
  • Virtual Directories — These directories don’t actually exist. They are created by the operating system so you can communicate with the low level hardware. Programs which show you system information are actually looking at “files” in these directories. You should never need to look in here directly.
    • proc — This is where information about currently running processes exists. Also stuff like memory usage, CPU usage, etc.
    • sys — This is where information about the current system exists. Stuff like the state of your hard drives or what’s plugged into usb ports is kept here.
    • dev — This is where all the devices on your system are kept. Literally every device on your system is represented as a file, from sound cards to video cards to USB devices. Every program which talks to those devices does so via the dev directory.
  • Miscellaneous Directories — For stuff that doesn’t fit anywhere else. You’ll probably never need these.
    • root — This is the home directory of the “root” user, or “superuser”. Nowadays, no one is the superuser, so this directory is usually empty.
    • lost+found — This is where, if the filesystem does something wacky with your files, where they end up. This is not your recycling bin. This is where you will have to trawl if your filesystem gets corrupt. This shouldn’t ever happen on modern Linux.
    • selinux — “se” means “security enhanced”. SELinux is a set of things you can do to harden your system up for running as an internet server. Unless you’re doing that, don’t worry about selinux.
    • media — If you plug in a USB drive, or still have CD Rom drives, etc. How will you look at the files in it? In Windows, you get a new drive letter. In Linux, the drive is “mounted”, likely somewhere under this directory. Today all this happens automagically, so you don’t really need to know, but in case you were curious.
    • cdrom — Modern systems no longer have this directory. This is the old media directory. It was called cdrom because that was what you used to use all the time. In case you still have it, this is why.
    • mnt — This is a convenient mount point if you’re doing some low level stuff. You’ll never need to use this unless your system is in the shit.

So, in a nutshell, that’s the Linux Filesystem. Hopefully you can use this knowledge to know the lay of the land, and be comfortable as master of your new domain. Next time we’ll talk about Distributions and what that even means, and specifically at Debian based distributions.

1Note that I’m going to be making reference to some technical aspects of Windows in order to explain how Linux works by comparison.

2See the FHS for a complete and technical look at the filesystem heirarchy in Linux.

3Hmm yes quite.

4Whenever it matters, I’ll be using conventions followed in Debian, which is about the most standards compliant distribution. I’ll explain what this means later.

5Linux is in fact just the kernel. Literally everything else (like the command prompt or the GUI) comes from other projects, most of them from GNU (hence the term “GNU/Linux”).

6This is where the brilliance of the linux filesystem shows up. You could put your bin, lib, and etc directories on an SSD, but keep var and home on a spindle disk, which will ensure that except for software updates, your data on the SSD never changes. It’s also how a lot of people used to partition drives — C: for Programs, D: for Data, only in Linux it works in a far more natural way. Nice!

comments powered by Disqus