This is Part 2 of Linux Basics
In this Part we will talk about your first steps with linux.
Logging In and Out:
The Linux system distinguishes between different users. As a consequence, you may not be able to start using the computer immediately after it has been switched on. First you must tell the computer who you are—you need to “log in” (or “on”). Based on the information you provide, the system can then decide what you may access rights do (or not do). Of course you need access rights to the system (an “account”)—the system administrator must have entered you as a valid user and assigned you a
user name (e. g., joe ) and a password (e. g., secret ). The password is supposed to ensure that only you can use your account; you must keep it secret and should not make it known to anybody else. Whoever knows your user name and password can pretend to be you on the system, read (or delete) all your files, send electronic
mail in your name and generally get up to all kinds of shenanigans.
Logging in in a graphical enviroment:
These days it is common for Linux workstations to present a graphical environment (as they should), and the login process takes place on the graphics screen, too. Your computer displays a form that lets you enter your user name and password.
Logging out in a graphical enviroment:
If you are done with your work or want to free the computer for another user, you need to log out. This is also important because the session manager needs to save your current session for the next time. How logging out works in detail depends on your graphical environment, but as a rule there is a menu item somewhere that does everything for you. If in doubt, consult the documentation or ask your system administrator (or knowledgeable buddy).
Graphical Desktop Environments:
Linux lets you choose—when the system is installed, most major distributions offer you a choice between several graphical environments:
KDE and GNOME are “desktop environments” which attempt to provide a comprehensive suite of applications with a similar look and feel. The goal of KDE and GNOME is to offer a user experience that is comparable or superior to that of proprietary systems. They try to include innovative features like KDE’s “semantic search”, which indexes files and documents in the background and is supposed to allow convenient access to “all photographs I took in Spain last month”, regardless of where these are stored on disk 1 . Roughly speaking, KDE focuses on comprehensive customisability for sophisticated users, while GNOME, in the interest of simplicity and usability, tends to lean towards providing defaults that are impossible or less straight forward to change.
LXDE and XFCE are “lightweight” environments. They resemble KDE and GNOME in their basic approach, but are more geared towards economical use of resources and thus dispense with various expensive services like semantic search.
Terminals and Shells:
Even within a graphical Linux environment it is often convenient to access a “terminal window” where you can enter textual commands in a “shell” (the remainder of this manual mostly talks about shell commands, so you are likely to need this). Fortunately, on most Linux desktop environments a terminal window is only a few mouse clicks away. In KDE on Debian GNU/Linux, for example, there is an entry called “Konsole (Terminal)” within the start menu under “System”, which will open a convenient program running a shell that will accept and execute textual commands. Similar methods are available on other desktop environments and distributions.
Creating and Modifying Text Files:
No matter whether you are writing scripts or programs, editing configuration files as the system administrator, or simply jot down a shopping list: Linux is at its best when modifying text files. Hence, one of your first acts as a new Linux user ought to be learning how to create and edit text files. The tool of choice for this is a text editor. Text editors for Linux come in all sizes, shapes, and colours. We’re taking the easy way out by explaining the most important features of “GNU Nano”, a simple, beginner-proof text editor that runs inside a terminal session.
GNU Nano is a “clone” of a simple editor called pico which was part of the PINE e-mail package. (PINE wasn’t free software according to the generally accepted definitions, so the GNU project wrote the new editor from scratch. In the meantime, PINE’s successor is freely available under the name of “alpine”, and it contains a free version of pico , too.) Most distributions should offer either GNU Nano or pico ; for simplicity we will spend the rest of this section talking about GNU Nano. Practically anything we say here also applies to pico.
GNU Nano is most conveniently started inside a terminal window, using a command like
$ nano myfile
(the “$ ” here is just a stylised abbreviation of the command prompt—which may look somewhat more baroque on your system—and you do not need to enter this.
you need more usable space on the screen, you can suppress the help lines using Alt + x (press the Alt key—to the left of the space bar on the keyboard—and hold it down while you press x ). Another Alt + x displays them again. (If you need even more usable space, you can also suppress the empty line immediately below the top line using Alt + o .)
Entering and changing text To enter new text, simply start to type inside the Nano window. If you make a mistake, the “backspace” key ⇐ will delete the character to the left of the cursor. Use the arrow keys to navigate around the text, for example to change something nearer the beginning. If you type something new, it will appear exactly where the cursor is positioned. The Del key removes the character under the cursor and will cause the remainder of the line (if there is one) to move one position to the left. Everything is really fairly obvious.
When you are done entering or editing your text, you can save it using Ctrl + o (hold down Ctrl while pressing o ). Nano asks you for a name
for the file (on the status line), which you can then enter and finish off with ↩ . (You will find out more about file names in Chapter 6 at the latest.) Nano then
stores the text in the named file.
Quitting Nano You can quit Nano using Ctrl + x . If your text contains unsaved
modifications, Nano asks you whether the text should be saved; answer y to do that (Nano may ask you for a file name) or n to quit Nano immediately (which
will cause your unsaved modifications to be discarded).
Loading files A different (already existing) file can be loaded into your current
text using Ctrl + r . it will be inserted at the cursor position. Nano asks you for the name of the file, which you may either enter directly, or alternatively use Ctrl + t to open the “file browser”, which will offer you an interactive choice of existing files. (Incidentally, this also works when saving a file using Ctrl + o .)
Cutting and pasting
You may use the Ctrl + k command to remove (“cut”) the line containing the cursor and store it in a buffer (Caution: Nano will always remove all of the line, no matter where inside the line the cursor is actually positioned!). Ctrl + u will then insert (“paste”) the content of the buffer again—either in the same place, if you have pressed Ctrl + k inadvertently or simply wanted to copy the line rather than move it, or elsewhere in your text.
If you press Ctrl + w , Nano uses the status line to ask you for a piece of text. The cursor then jumps to the next occurrence of that piece of text in your document, starting at its current position. This makes it convenient to locate specific places in your text.