Debian GNU/Linux: Guide to Installation and Usage - John Goerzen and Ossama Othman (top fiction books of all time .txt) 📗
- Author: John Goerzen and Ossama Othman
- Performer: -
Book online «Debian GNU/Linux: Guide to Installation and Usage - John Goerzen and Ossama Othman (top fiction books of all time .txt) 📗». Author John Goerzen and Ossama Othman
Sometimes you’ll have the root password even on a shared corporate or educational server, because the system administrator trusts you to use it properly. In that case, you’ll be able to help administer the system and customize it for your needs. But you should be sure to use the password responsibly, respecting other users at all times.
If you have the password, try logging on as root now. Enter the whoami command to verify your identity. Then log out immediately. When you’re root, the kernel will not protect you from yourself, because root has permission to do anything at all to the system. Don’t experiment while you’re root. In fact, don’t do anything as root unless absolutely necessary. This isn’t a matter of security, but rather of stability. Your system will run much better if it can keep you from making mistakes.
You may find the su command more convenient than logging in as root. su allows you to assume the identity of another user, usually root unless you specify someone else. (You can remember that su stands for Super User, though some say it stands for Set UserID.) Here’s something to try. Log on as yourself - that is, not as root. Then your session will look something like the one in Figure 4.1.
When you’re doing system administration tasks, you should do as much as possible as yourself. Then use su, do the part that requires root privileges, and use the exit command to turn off privileges so you can no longer harm anything.
You can use su to assume the identity of any user on the system, not just root. To do this, type su user where user is the user you want to become.
You’ll have to know the user’s password, of course, unless you’re root at the time or the user has no password.
Figure 4.1: Sample session with su begin{figure}parparbegin{list}{}{ setlength{rightmargin}{leftmargin}
ra… …~~~~~~~~~~~~~}textrm{textit{Exit your lqlq normal”
shell}}end{list}end{figure}
Virtual Consoles The Linux kernel supports virtual consoles. These provide a way of making your single screen and keyboard seem like multiple terminals that are connected to the same system. Thankfully, using virtual consoles is one of the simplest things about Debian: There are “hot keys” for switching among the consoles quickly. To try it, log in to your system and press Alt-F2 (simultaneously press the left Alt key, and F2, that is, function key number 2).
You should find yourself at another login prompt. Don’t panic: You are now on virtual console (VC) number 2! Log in here and do some things - more whoami commands or whatever - to confirm that this is a real login shell.
Now you can return to virtual console number 1 by pressing Alt-F1. Or you can move on to a third virtual console, in the obvious way (Alt-F3).
Debian comes with six virtual consoles enabled by default, which you access with the Alt key and function keys F1 through F6. (Technically, there are more virtual consoles enabled, but only six of them allow you to log in. The others are used for the X Window system or other special purposes.)
If you’re using the X Window system, it will generally start up on the first unused virtual console - probably VC 7. Also, to switch from the X
virtual console to one of the first six, you’ll have to add Ctrl to the key sequence. So that’s Ctrl-Alt-F1 to get to VC 1. But you can go from a text VC to the X virtual console using only Alt. If you never leave X, you won’t have to worry about this; X automatically switches you to its virtual console when it starts up.
Once you get used to them, virtual consoles will probably become an indispensable tool for getting many things done at once. (The X Window system serves much the same purpose, providing multiple windows rather than multiple consoles.) You can run a different program on each VC or log on as root on one VC and as yourself on another. Or everyone in the family can use his or her own VC; this is especially handy if you use X, in which case you can run several X sessions at once on different virtual consoles.
Shutting Down Do not just turn off the computer! You risk losing valuable data!
If you are the only user of your computer, you might want to turn the computer off when you’re done with it.
To avoid possibly weakening some hardware components, only turn off the computer when you’re done for the day. Power up and power down are the two greatest contributors to wear and tear on computer components. Turning the computer on and off once a day is probably the best compromise between your electric bill and your computer’s lifespan.
It’s a bad thing to just press the power switch when you’re done using the computer. It is also bad to reboot the machine (with the Reset button) without first taking proper precautions. The Linux kernel, in order to improve performance, has a disk cache. This means it temporarily stores information meant for permanent storage in RAM. Because memory is thousands of times faster than a disk, this makes many file operations move more quickly. Periodically, the information Linux has in memory is actually written to the disk. This is called syncing. In order to turn off or reboot the computer safely, you’ll have to tell the computer to clear everything out of memory and put it in permanent storage.
To reboot, just type reboot or press Ctrl-Alt-Del (that’s Ctrl, Alt, and Delete).
To shut down, you’ll have to log in as root. As root, just type the command shutdown -h now. The sytem will go through the entire shutdown procedure, including the sync command, which clears the disk cache as described above. When you see System halted, it’s safe to turn off the computer. If you have Advanced Power Management (APM) support in your kernel and BIOS, the computer might shut itself off and save you the trouble. APM is common in laptops and is also found in certain desktop mainboards.
The Basics It’s now time to explore the system in more detail. You’ve seen how to log in and shut down the system. In this chapter, we explore the Linux comand line, how Linux deals with files and directories, and some basics on identifying yourself to others.
The Command Line and Man Pages We’ve already discussed the command line - that is, commands you type after the shell prompt. This section describes the structure of more complicated command lines.
A minimal command line contains just a command name, such as whoami. But other things are possible. For example, you might type: man whoami. This command requests the online manual for the whoami program (you may have to press the space bar to scroll through the documentation or press q to quit). A more complicated example is man -k PostScript. This command line has three parts. It begins with the command name, man. Then it has an option or switch, -k, followed by an argument, PostScript. Some people refer to everything except the command name as the parameters of the command. So, options and arguments are both parameters.
Options change the behavior of a command, switching on particular features or functionality. They usually have a - before them. The GNU utilities also have “long forms” for the options; the long form of -k is -apropos.
You can enter man -h or man -help to get a full list of options for the man command. Every command will have its own set of options, though most have -help and -version options. Some commands, such as tar, do not require the “-” before their options for historical reasons.
Anything that isn’t an option and isn’t the command name is an argument (in this case, PostScript). Arguments can serve many purposes; most commonly, they are filenames that the command should operate on. In this case, PostScript is the word you want man to search for. In the case of man whoami, the argument was the command you wanted information about.
Here’s a breakdown of the man -k PostScript command line: man.
The command name, tells the computer to look at the manual pages.
These provide documentation for commands. For example, man whoami will give you documentation on the whoami command.
-k.
The option, changes the behavior of man. Normally man expects a command name, such as whoami, for an argument and looks for documentation of that command. But with the -k or -apropos option, it expects the argument to be a keyword. It then gives a list of all manual pages with that keyword in their description.
PostScript.
is the argument; because we used the -k option, it’s the keyword to search for.
-k and PostScript are both parameters.
Go ahead and type man -k PostScript, and you will see a list of all the manual pages on your system that have something to do with PostScript. If you haven’t installed much software, you might see the message PostScript: nothing appropriate instead.
Describing the Command Line
Note: You can skip this section if you want to move on.
There’s a traditional, concise way of describing command syntax. Syntax means the correct ways to combine various options and arguments. For example, if you type man man to get the manual page about man, you’ll see several syntax descriptions beginning with the command name man. One of them will look like this: man -k [-M path] keyword …
Anything in brackets ([]) is an optional unit. In this case you don’t have to use the -M option, but if you do, you must use a path argument. You must use the -k option and the keyword argument. The … means that you could have more of whatever came before it, so you could look up several keywords.
Let’s look at one of the more complex descriptions from the man manual page:
man [-c|-w|-tZT device] [-adhu7V]
[-m system[,…]] [-L locale] [-p string]
[-M path] [-P pager] [-r prompt] [-S list]
[-e extension] [[section] page …] …
There’s no need to go through all of this (and don’t worry about what it all means), but do pay attention to the organization of the description.
First, clusters of options usually mean you can use one or more of them in different combinations, so -adhu7V means you can also use -h. However, you can’t always use all combinations; this description doesn’t make that clear. For example, -h is incompatible with other options, but you could do man -du. Unfortunately, the description’s format does not make this clear.
Second, the | symbol means “or.” So you can use the -c, the -w, or the -tZT option, followed by a device argument.
Third, notice that you can nest the brackets, because they indicate optional units. So if you have a section, you must also have a page, because e page is not optional within the [[section] page] unit.
There’s no need to memorize any of this, just refer to this section as you read documentation.
Files and Directories Files are a facility for storing and organizing information, analogous to paper documents. They’re organized into directories, which are called folders on some other systems. Let’s look at the organization of files on a Debian system:
/.
A simple / represents the root directory. All other files and directories are contained in the
Comments (0)