Chapter 2. Basic Unix concepts

Table of Contents
2.1. Users and groups
2.2. File basics
2.3. Processes
2.4. Small introduction to the command line
2.4.1. cd: Change Directory
2.4.2. Some environment variables and the echo command
2.4.3. cat: print the contents of one or more files to the screen
2.4.4. less: a pager
2.4.5. ls: listing files (LiSt)
2.4.6. Useful keyboard shortcuts

The name "Unix" may be familiar to some of you. You may even use a Unix system at work, in which case this chapter may not be very interesting to you.

For those of you who have never used it, reading this chapter is absolutely necessary. Knowing the concepts which will be introduced here answers a surprisingly high amount of questions commonly asked by beginners in the GNU/Linux world. Similarly, it's likely that some of these concepts can answer most of the problems you may encounter in the future.

2.1. Users and groups

The concept of users and groups is extremely important, for it has a direct influence on all other concepts that this chapter will introduce.

GNU/Linux is a true multi-user system, so in order to use your GNU/Linux machine you must have an account on it. When you created a user during the installation you actually created a user account. You may remember you were prompted for the following items:

The two important parameters here are the login name (commonly abbreviated by login) and the password. These are what you will use in order to enter the system.

Another action which occurs when creating a user account is the creation of a group. By default, the installation program will have created one group per user. As we will see later, groups are useful when you have to share files between several people. A group can therefore hold as many users as you wish, and it's very common to see such a separation in large systems. For example: In a university you can have one group per department, another group for teachers, and so on. The reverse is also true: a user can be a member of one or more groups. A math teacher, for example, can be a member of the teachers group and also be in the group of his beloved math students.

All of this information does not tell you how to log in, however. Here it comes.

If you have chosen to use the graphical interface upon bootup, your startup screen will look similar to figure 2-1.

Figure 2-1. Graphical mode login session

In order to login, you must enter your login name into the Login: text field, then enter your password into the password field. Note that you will have to type your password blindly; there will be no echo into the text field.

If you are in console mode, your screen will look similar to figure 2-2.

Figure 2-2. Console mode login session

You will then have to enter your login name at the Login: prompt and press Enter, after which the login program (called, what a surprise, login) will display a Password: prompt, where you will need to enter the password for this account. Because the console login does not echo characters that represent the password, you will have to be careful when typing in your password -- blindly.

Note that you can login several times with the same account on additional consoles and under X. Each session that you open is independent of any others, and it is even possible to have several X sessions opened concurrently. By default, Linux-Mandrake has six virtual consoles in addition to the one reserved for the graphical interface. You can switch to any of them by typing the key sequence Alt-F<n>, where <n> is the number of the console which you want to switch to. By default, the graphical interface is on console number 7.

In addition to the creation of user accounts, you will also have noticed that during the install, DrakX (or the program you used) will have prompted you for the password of a very special user: root. This user is special for a simple reason: it's the account normally held by the system administrator which will most likely be you. For your system's security, it is very important that the root account always be protected by a good password.

If you regularly login as root it is very easy to make a mistake which can render your system unusable; one big mistake can do it. In particular, if you have not created a password for the root account, any user can alter any part of your system. This is obviously not a very good idea.

It is worth mentioning that internally, the system does not identify you with your login name but with a unique number assigned to this login name: the user ID (UID for short). Similarly, every group is identified by its group ID (GID) and not its name.


Tux on Star from MandrakeSoft Linux is a registered trademark of Linus Torvalds. All other trademarks and copyrights are the property of their respective owners.
Unless otherwise stated, all the content of these pages and all images are Copyright MandrakeSoft S.A. and MandrakeSoft Inc. 2000.
http://www.linux-mandrake.com/