Last Updated: 11 October 2013

The Debian Basics FAQ

Back to the Unofficial Debian FAQ

Summary

This page goes over some of the basics of using Linux, and a few basics of using Debian in particular. It's helpful to know these things before reading the Unofficial FAQ.

Table of Contents

Some Linux Basics

  1. What is a terminal? How to I "open a terminal?"
  2. What is root? How do I "become root?"
  3. I installed a program, how do I start it?
  4. What is a runlevel?
  5. How do I start in text-only mode (no graphical environment)?
  6. How do I run something when the computer starts?
  7. How do I reset my root password?

Some Debian Basics

  1. What is a "service?" How do I manage services in Debian?
  2. What is rescue mode and how do I boot into it?

The FAQ

Some Linux Basics

  1. Q: What is a terminal? How to I "open a terminal?"
    A: A "terminal" is a way of typing commands to the computer. That may sound very strange, but it's actually really, really nice and easy once you get used to it. You can use Debian as a totally graphical system, or you can use it totally with the terminal. I like to do both; I use whichever one is easier for the task I'm doing.

    You can either open a terminal inside of your graphical environment, or you can switch your whole screen to a terminal.

    To open a terminal in a graphical environment:

    1. Press the "super" (Windows icon) key to access the overview and start typing "terminal". Or move the mouse point into the top-left corner (the "hot corner") and click the "terminal" icon in the dock.)
    2. If using the menus then go to Applications > Accessories, click on Terminal.

    To switch your entire screen to a terminal, press Ctrl-Alt-F1. You can then switch between six different terminals, by using Alt-F1 through Alt-F6. Pressing Alt-F7 will bring you back to your graphical environment

  2. Q: What is root? How do I "become root?"
    A: "root" is the name of the user who can control everything on the entire computer. We call this the "super user."

    To become root, first you must open a terminal. Then, you type:

    su -

    Note that the "-" is very important -- it sets things so that you have easy access to all the commands on the computer.

    Then type in your root password. You would have set this when you installed Debian.

    Another way is to press the "super" (Windows icon) key to access the overview and start typing "root". Then click on the "Root Terminal" icon.

  3. Q: I installed a program, how do I start it?
    A: The easiest way is to press the "super" (Windows icon) key to access the overview and then start typing the name of the program. It should appear automatically assuming you have typed the correct name and spelling.
    You can also try the menu by looking in Applications and trying to find it in one of the categories on the right-hand side.

    If you can't find it in the menu, you can use the Terminal (see above about how to access the terminal). Most programs are executed by their name. For example, to launch the web browser, Firefox, you can simply open a terminal and type:

    firefox

    You can also type only part of the command and then press Tab. So you could type:

    fir[Tab]

    And that would type out firefox for you. If there's more than one command that starts with fir, you'll hear a beep. Hit Tab again and you'll see a list of all the programs on your computer that start with those letters.

    If you really can't figure out the name of the command, but you know the name of the package the program came in, try this to list the programs in a package:

    dpkg --listfiles packagename | grep bin

  4. Q: What is a runlevel?
    A: A runlevel is a number which indicates what "mode" you want to computer to boot into. For example, runlevel 2 is the normal graphical mode, where runlevel 6 means to reboot. Runlevel 1 is "single-user" mode, used for troubleshooting problems.

    There are three ways to change your runlevel:

    • While the Computer is Running:
      1. Open a Terminal.
      2. Become root:

        su -

      3. Type:

        init number

        where number is the runlevel that you want to change to.

      You will then be switched into the new runlevel.

    • While You Are Booting the Computer:
      1. When you first start your computer, the GRUB screen (where you choose your Operating System) appears. Select the Debian that you want to boot into, but press the a key instead of pressing Enter.
      2. You will see a line somewhat like the following:

        kernel /boot/vmlinuz-2.6.30 root=/dev/sda2 ro

        Add the number of your runlevel to the end of that line, and then press Enter. For example, to boot into text-only mode, the line would look like:

        kernel /boot/vmlinuz-2.6.30 root=/dev/sda2 ro 3

      You will then boot into the new runlevel this time only.

    • Permanently Set a Default Runlevel:
      1. Open a Terminal.
      2. Become root:

        su -

      3. Open the file /etc/inittab in your favorite text editor:

        vim /etc/inittab

      4. Find the line:

        id:number:initdefault:

        where number is your current default runlevel (probably 2).

      5. Change the number in the middle of the line to the new runlevel that you want your computer to start in by default. For example, if you want to start in single-user text-only mode by default, change it to:

        id:1:initdefault:

      You will then boot into that runlevel every time you start the computer.

  5. Q: How do I start in text-only mode (no graphical environment)?
    A: If you want to start in text-only mode then run this as root and reboot:

    update-rc.d -f gdm remove

    To revert back to a graphical login then run this as root:

    update-rc.d -f gdm defaults

  6. Q: How do I run something when the computer starts?
    A: You have two choices, either you can run something before anybody logs in, or you can run something immediately after you log in.

    To run a command right after you boot, before anybody logs in, add the command to the file /etc/rc.local:

    1. Open a Terminal.
    2. Become root:

      su -

    3. Open the file in your favorite text editor:

      vim /etc/rc.local

    4. Add the command that you want to run to the end of the file, on its own line.

    If you want to start a program right after you log in:

    1. Log in.
    2. Wait for everything to start, press the "super" (Windows icon) key to access the overview and then start typing the name of the program. It should appear automatically assuming you have typed the correct name and spelling.
      Now start only the program that you want to start automatically from now on.
    3. Now press the "super" (Windows icon) key to access the overview and then start typing "start" to match the "Startup Application Preference". Click the icon and in the "Options" tab click "Automatically remember running applications..." and then log-out.
      From now on, when you log in, that program will be automatically started.

    Another way is to press the "super" (Windows icon) key to access the overview and then start typing "start" to match the "Startup Application Preference". Click the icon and in the "Startup Programs" tab click "Add" and then specify the name of the program. You can do this for as many programs as you need.

  7. Q: How do I reset my root password?
    A: If you've forgotten your root password, and you want to change it, don't worry! It's possible. You need to boot into what's called "single-user mode." You must be in front of the computer to do this -- you can not do it remotely:
    1. Using the instructions in the runlevel question (under the "While You Are Booting the Computer" section), boot into runlevel 1.
    2. Set the new root password with by typing:

      passwd

      And then enter your new root password when asked.

    3. Reboot your machine, and you will now be able to log in as root with the new password that you entered.

Some Debian Basics

  1. Q: What is a "service?" How do I manage services in Debian?
    A: A "service" is a program that starts automatically when you start your computer and runs in the background. For example, the "network" service sets up your connection to the Internet and keeps it running correctly.

    There are several ways to manage services in Debian, one using the graphical tools (although not all services can be managed this way), another is using a text user interface (TUI) and lastly using only the command line. If you're not in a graphical environment, use the command line method. It is highly recommended to use the command-line whatever environment you are in.

    Using the command line (replace servicename with the name of the service you want):

    You must be root for this to work.

    • Check if a service is running:

      service servicename status

    • Starting a service:

      service servicename start

    • Stopping a service:

      service servicename stop

    • Have a service start automatically at boot:
      1. Use the update-rc.d program:

        update-rc.d servicename enable runlevel

      Or...
      1. Open the sysv-rc-conf program (installed with package sysv-rc-conf):
      2. Find your service in the list and press space to disable it. Services marked with a X will start automatically at boot in that runlevel. Remember that the default run-level in Debian is 2.
  2. Q: What is rescue mode and how do I boot into it?
    A: Rescue mode provides the ability to boot a small Debian environment entirely from a CD-ROM or USB drive instead of the system's hard drive. As the name implies, rescue mode is provided to rescue you from something. In rescue-mode you can mount and edit your files, such as configuration files and by doing so solve your problems.

    To boot into rescue mode, you must be able to boot the system using one of the following methods:

    1. By booting the system from an installation boot CD-ROM, or a boot image on a USB disk.
    2. By booting the system from the Debian CD-ROM #1.

    Once you have booted using one of the described methods, enter the following command at the installation boot prompt:

    linux rescue

This FAQ is maintained by Imran Chaudhry. That's imran [at] debianfaq *dot* org or "imran-uk" in the #debian Freenode IRC channel.

You can help us keep this FAQ up to date! If you discover an issue we don't cover, find any errors in the answers already here or have a suggestion of some kind, please contact me and I'll get on it.

Inspired by the FedoraFAQ which is maintained by Max Kanat-Alexander. His ideas are used here by kind permission.