Visit the LXF web site (internet connection required) |
|
New to Linux?If you're new to Linux and bamboozled by all the jargon and commands, here are some beginner-friendly guides to get you started. Note that Linux distributions can vary in terms of file locations and commands, so some things may be slightly different on your specific machine.
What is Linux?
How do I install it?
Common Linux terminology
The Linux filesystem layout
Choosing a distro
Linux equivalents of Windows apps
Using the command-line
Root and normal users
Installing software
Getting help onlineWhat is Linux?Linux is an operating system, like Microsoft Windows or Mac OS X, that controls the programs and hardware on your computer. It is completely free of charge and open source - anyone can download the programming code behind it and make modifications. With thousands of people around the world improving it, Linux is very powerful, flexible and reliable. Huge companies such as Google and Amazon make heavy use of Linux; IBM, Novell, Red Hat and others pay programmers to enhance the system. But many people contribute code to Linux in their spare time, just for the love of it! Because Linux is a unique operating system, it looks and works differently to Windows and OS X. It won't natively run Windows applications (although there are compatibility layers such as Wine which lets it run certain Windows apps), but there's a vast amount of high quality software available for free. You may already have heard of Firefox and OpenOffice.org, for instance. Exploring and understanding Linux is a fascinating experience - it may work differently to your expectations, but you'll love its stability, freedom from viruses and spyware, and zero cost. The GPL licence used by Linux means it will always be free. What is a distribution? Linux is available in many different forms. Because it's free, anyone can make their own version built from the same core components but with differing software selections, themes and so forth. Some 'distros' are made by large companies (eg Novell's SUSE Linux and Red Hat Enterprise Linux) whereas others are one-man efforts (Slackware) or built by the internet community. See below for a guide to choosing a distro. How do I install it?Every month, our DVD includes one or more Linux distributions, most of which let you install Linux on your PC. Some of these distributions run in Live mode, which means they load and run straight from the DVD, so you can try Linux without installing. Other distros boot straight into the installer, which lets you copy Linux to your hard disk. If you're currently running Windows, the installer may give you the option to set up a 'dual boot' system, whereby you can choose to start Windows or Linux when you boot up your PC. You'll find a step-by-step guide to using this DVD's main distro in the magazine's disc pages - but here are some general tips. Booting this DVD You should be able to boot this disc by restarting your PC with it in the drive. If you have problems, first check that your computer is configured to boot from the DVD (rather than the hard disk). Usually, you will need to access your PC's BIOS settings screen and make sure that the DVD drive comes first. On most PCs you can get this screen by pressing F1, F2 or Del after turning on the power. If you still have problems, you can try burning and booting the Smart Boot Manager CD-R ISO image in the System section. Hard drive partitioning A computer's hard disk is divided into partitions, each of which is accessed as a separate data storage area. Windows usually exists in a single partition occupying the whole drive, so adding a second operating system will require that each OS has its own portion of the disk. Linux installations generally use two or more partitions: a root (/) partition for storing the OS files, and a 'swap' partition for virtual memory (ideally 512MB or 1GB). During the installation of a distro, you could opt to put the /home directory in a separate partition, so that you don't have to back up personal files when switching to a different distro. Most Linux installers let you manage partitions and even resize Windows partitions to make room for Linux, so that you can set up the aforementioned dual-boot system. But as with any disk drive operation, we strongly recommend backing up your important data before doing anything! Common Linux terminologyHere are some of the words and phrases you'll come across regularly in the Linux world...
The Linux filesystem layoutWhen Linux is installed, it creates a tree of directories (folders) on your hard drive to store the operating system and programs. These directories start in what's called the 'root' directory: / . The slash means the absolute start of all directories - everything else is a subdirectory from it. Here are some of the most common ones:
Choosing a distroAs you've read in the magazine, Linux is available in different bundles called distributions (or distros). There are hundreds of Linux distros available, covering a vast range of tasks from network monitoring to mobile phones. However, for most of us, the choice really comes down to a small handful. Which one is right for you? Read on, and then try them yourself!
There are many other distros, and you can find a vast amount of information online at DistroWatch.com. So, where do you get these distros? All the ones listed above are free, so you can grab them online via the DistroWatch.com links, or find them on future editions of Linux Format DVDs. Every month we include one or more Linux distros -- so build up a library, try them out, and find the one you feel most comfortable with! Linux equivalents of Windows applicationsWhen you first start using Linux, some of the application names may sound odd. This chart will help you to find free Linux equivalents of your favourite Windows programs.
Using the command-lineWhile most day-to-day tasks in Linux can be achieved through the graphical user interface, some jobs require the (very powerful) Linux command-line, typically found as 'Shell', 'Terminal', 'Konsole' or 'XTerm' in your program menu. It's extremely versatile, but don't worry - it's not difficult to grasp! Read on to understand how it works... Listing files and moving around The most common command is ls, which means 'list files' and shows the files in the current directory. Most commands can take extra options, sometimes called arguments or parameters, eg ls -lh (ls space dash l h). This means 'run the ls command, but in the mode that it lists files horizontally, and displays human-readable information on file sizes'. Give it a try and see - to get help on ls and other commands, enter man command (eg man ls). Press Q to exit the manual page viewer. Perhaps the second most-used command is cd, which means 'change directory'. For instance, if you see a directory (aka folder) called mypics in your current directory, enter: cd mypics/ Now you will be in the mypics directory, which may be represented by a change in your command-line prompt (or you can enter pwd, 'print working directory'). To go down a directory, ie into the previous directory, enter cd .. (cd space dot dot). And to return to your home directory, enter cd ~ (cd space tilde - hunt it down on your keyboard!). Copying, moving and deleting files Copying files is simple. Say you want to copy file1.txt to file2.txt: cp file1.txt file2.txt Et voila, a new file2.txt. If you want to copy files into a directory, use: cp blah.txt foo.txt mydir/ Next we have mv, the 'move' command. This can also be used to rename a file, as such: mv oldfilename.txt newfilename.txt To move multiple files into a directory, follow the example for cd above. Finally, we have rm, which removes files: rm file1.txt file2.txt To remove a directory, rm needs to be given a 'recursive' option, -r, eg rm -r mydir. Also note the use of wildcards in Linux commands. If you use an asterisk (*) character, it means 'replace with any file name'. For instance, say you want to delete all files in a directory: you'd enter rm * (rm space asterisk). To delete files that end in .deb, use: rm *.deb So, those are the most common commands and parameters you will use on the command-line. Experiment and have fun! Keyboard shortcuts After you've entered a command, you can press the Up cursor key to retrieve it and execute it again. Indeed, you can press Up and Down as many times as you want to cycle through previous commands! When you're entering a command or filename, you can type the first few letters and then press Tab to auto-complete the file/command. To exit the command-line quickly, you can press Ctrl+D. If you've entered a command that's going to take ages to complete (eg listing every file on the system), and you want it to quit, press Ctrl+C - it sends a 'stop' signal to the program. Alternatively, you can put it in the 'background' by pressing Ctrl+Z - you'll get your normal prompt back, and you can enter fg to resume the program you backgrounded. Extracting archives Most Linux software is supplied in compressed archive format, a single file that expands to a bunch of other files. You'll no doubt be familiar with .zip files on Windows, and the principle is the same here. You can extract these files in your file manager, but sometimes you may prefer to use the command-line. For instance, say you have a file called stuff.zip in your home directory. Open a command-line and enter: unzip stuff.zip You'll see a list of the new files being created. In most cases, they'll be created in a separate directory. Say the previous command created stuff/file1.txt and stuff/file2.jpg. You can switch into the new directory by entering: cd stuff/ cd means 'change directory' and does exactly what it says! To go 'down' a directory - ie into the parent directory, enter cd .. (cd space dot dot). The '..' means 'directory beneath this one'. If you enter that, you'll be back in your home directory. Some files are provided in different formats, the most common of which are .tar.gz (aka .tgz) and .tar.bz2 (aka .tbz2). For the former, enter: tar xfvz filename.tar.gz And for the latter, use: tar xfvj filename.tar.bz2 You can then cd into the newly created directory and then enter ls to see what files are there. Quick tip: to get more information on files, such as their modification time and size, enter ls -lh. To get back to your home directory from wherever you are, simply enter cd on its own. To work with files saved to your desktop, enter cd Desktop when you're in your home directory. Redirecting output Sometimes you'll want to send the output of a command to a text file. For instance, if you're listing all the files in a directory and too much information is whizzing by, you can direct the ls output like this: ls -lh > filelist.txt Now you can open filelist.txt in a text editor to view the results, or enter less filelist.txt to view them at the command-line (less is a simple file viewer - press Q to quit). Another useful tactic is to 'pipe' the output of one program into another. A few moments ago, we redirected the results of an ls command to a text file, and then viewed that file. But we can do this quicker! We can feed the output of ls straight to the less viewer like this: ls -lh | less That pipe character is usually found on the bottom-left of keyboards (Shift+\). Now we can view the output of the command in less without needing a separate text file - use the Up and Down cursor keys to navigate through the file, Space to skip a page and Q to quit. Root and normal usersLinux is a multi-user operating system: that is, many people can use it at the same time (if logged in remotely). For home machines, you typically set up two user accounts during installation - one for your day-to-day work, and one for 'root', the administrator user. To protect your system, only root can change critical files such as startup scripts and libraries. Consequently, during installation of a distro you'll provide passwords for your normal user account and root. After installation, when you run certain programs that modify the system (such as a package installer), you'll be prompted for the root password. Note: Ubuntu Linux has a slightly different system, in that the root account is disabled and you're prompted for your normal user password to do administration jobs. At the command line, you can switch to the root user with su in most distros. You'll then be prompted for the root password. In Ubuntu, enter sudo bash which will prompt for your normal user password. Installing softwareIf you're using a distribution such as Ubuntu, Mandriva, Fedora or OpenSUSE, you'll have access to a vast wealth of software in your distro's package manager. Where possible, we recommend installing software from that source - everything is pre-packaged and carefully tailored for your choice of distro. However, sometimes you'll want to install software from another source: when a program isn't available via your distro's package manager, when a newer version is released on the program's website, or when you've got it from this DVD. There are literally thousands of combinations of file formats, dependencies and installation methods in use, which can make things tricky, but with some experimentation there's always a way! Let's take .deb packages, as used by Ubuntu, Debian and other Debian-based distros. If you've copied a .deb package from our DVD (or several .debs) into your home directory, you can install it via the command-line. First, switch to the root admin user with sudo bash in Ubuntu or just su in Debian; you'll be prompted for your password. You can then enter: dpkg -i filename.deb The dpkg utility will try to install your program, or alert you to any missing dependencies. If you want to install multiple packages at once, enter dpkg -i *.deb - the asterisk (*) is a wildcard, meaning 'all files that end with .deb'. The other main binary package format is .rpm, used on Fedora, Mandriva, PCLinuxOS, OpenSUSE and many other distros. With the .rpm (or multiple .rpms) in your home directory, open up a command-line and switch to the root admin user by entering su. Then try: rpm -ivh filename.rpm For multiple packages, use rpm -ivh *.rpm, where the asterisk (*) is a wildcard meaning 'all packages that end with .rpm'. If you are alerted to missing dependencies, try finding them in your distro's package manager. Note that to upgrade packages, you should use rpm -Uvh filename.rpm. Installing from source code When a developer releases a new version of his/her program, he/she will typically just release the source code, not having time to package it for the hundreds of Linux distributions out there! That's why many of the new programs on this DVD are supplied only in source code format. So if the new version isn't in your distro's package manager, you can try building it from the source code - that is, the human-readable recipe that makes up the program. Before do you this, you'll need the right software to compile programs. Again, this varies greatly from distro to distro, but you'll typically need the 'gcc' C compiler as a starting point, available in almost every distro. In Ubuntu, you can install the 'build-essential' package which provides many tools for compiling source code. Let's say you have a source code archive called coolprog-1.0.tar.gz in your home directory. You already know how to extract it from the instructions above, but here's a full run-through: tar xfvz coolprog-1.0.tar.gz You'll see a list of files whizz by as the archive is extracted. This will usually create a new directory, so take note of that and enter: cd coolprog-1.0/ Now you're in the directory of the source code. The first thing to do is enter ls and see if there are any files called README or INSTALL lying around. If so, check them out (eg less INSTALL) for instructions on how to procede from here, as installation methods and dependencies vary greatly. Most source code bundles use a common method involving three commands. If you see a file called 'configure' amongst the other files, enter: ./configure The dot-slash at the start is essential: it tells the command-line to run the file called 'configure' right here, and not search for it in /bin, /usr/bin etc. This script analyses your system to make sure you have the right dependencies - if it fails, make a note of the dependency you're missing, and install it via your distro's package manager. For instance, if it complains about 'missing gtk libraries' or similar, find a package called 'gtk-dev' or 'libgtk-dev' in your package manager and install it. Again, there's so much variation in distros and we'd love to be more specific, but you'll get used to finding dependencies! Re run the ./configure script, and continue to install any dependencies needed. When the script finishes without an error, enter: make This will compile the source code into an executable binary program. Depending on the size of the program (and speed of your machine), this can take anywhere between 20 seconds and a couple of hours! When the compilation process has finished, you're ready to install the new program into your Linux system. Switch to the root user (sudo bash in Ubuntu or just su in other distros), then enter: make install If all's well, you can enter exit (so that you're back as your normal user account), then enter the name of the program to start it up (eg coolprog). In most cases, software will be installed in the /usr/local directory - eg /usr/local/bin/coolprog as the main program executable. You can uninstall the program by switching back to root and entering make uninstall in the program's source code directory. Phew! It's a lot of work at first, but after some playing it becomes second-nature. As mentioned, it's always easiest to see if a program is available via your package manager at first - this is the second option. Good luck! Getting help onlineIf you have access to the internet, you have a huge amount of help at your disposal if something goes wrong. There are millions of Linux users online -- if you're stuck with a problem, chances are someone else has come across the same thing, and knows a solution! To start with, your best bet is the Linux Format Forums, maintained by the LXF team. It's free to sign up (don't worry, no spam!) and the forums are very friendly. However, if you can't get any help there, or your problem is very distro-specific, you can also try:
There are many other Linux-related forums out there -- as always, Google is your friend! Forum tips: When posting a message, make sure you provide plenty of detail. Just saying "Firefox doesn't work!" won't get you anywhere -- state which distro you're using, which version of Firefox you're running, what error messages you see etc. If your question is hardware-related, provide lots of info on your machine (CPU, RAM, graphics card etc). Most of the regulars on these forums are volunteers, so if you don't get the right sort of help, stay calm and try a different website. Good luck! |