Learn Linux Quickly
eBook - ePub

Learn Linux Quickly

A beginner-friendly guide to getting up and running with the world's most powerful operating system

Ahmed AlKabary

Compartir libro
  1. 338 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Learn Linux Quickly

A beginner-friendly guide to getting up and running with the world's most powerful operating system

Ahmed AlKabary

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

Learn over 116 Linux commands to develop the skills you need to become a professional Linux system administratorKey Features• Explore essential Linux commands and understand how to use Linux help tools• Discover the power of task automation with bash scripting and Cron jobs• Get to grips with various network configuration tools and disk management techniquesBook DescriptionLinux is one of the most sought-after skills in the IT industry, with jobs involving Linux being increasingly in demand. Linux is by far the most popular operating system deployed in both public and private clouds; it is the processing power behind the majority of IoT and embedded devices. Do you use a mobile device that runs on Android? Even Android is a Linux distribution. This Linux book is a practical guide that lets you explore the power of the Linux command-line interface. Starting with the history of Linux, you'll quickly progress to the Linux filesystem hierarchy and learn a variety of basic Linux commands. You'll then understand how to make use of the extensive Linux documentation and help tools. The book shows you how to manage users and groups and takes you through the process of installing and managing software on Linux systems. As you advance, you'll discover how you can interact with Linux processes and troubleshoot network problems before learning the art of writing bash scripts and automating administrative tasks with Cron jobs. In addition to this, you'll get to create your own Linux commands and analyze various disk management techniques. By the end of this book, you'll have gained the Linux skills required to become an efficient Linux system administrator and be able to manage and work productively on Linux systems.What you will learn• Master essential Linux commands and analyze the Linux filesystem hierarchy• Find out how to manage users and groups in Linux• Analyze Linux file ownership and permissions• Automate monotonous administrative tasks with Cron jobs and bash scripts• Use aliases to create your own Linux commands• Understand how to interact with and manage Linux processes• Become well-versed with using a variety of Linux networking commands• Perform disk partitioning, mount filesystems, and create logical volumesWho this book is forThis book doesn't assume any prior Linux knowledge, which makes it perfect for beginners. Intermediate and advanced Linux users will also find this book very useful as it covers a wide range of topics necessary for Linux administration.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Learn Linux Quickly un PDF/ePUB en línea?
Sí, puedes acceder a Learn Linux Quickly de Ahmed AlKabary en formato PDF o ePUB, así como a otros libros populares de Informatique y Administration du système. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2020
ISBN
9781800561205
Edición
1
Categoría
Informatique
Controlling the Population
Linux is a multiuser operating system, which means that many users are allowed to access the system at the same time. In real life, you barely find a Linux server with just one user. On the contrary, you see a lot of users on one server. So let's get real and populate our system with various users and groups. In this chapter, you will learn how to add users and groups to your Linux system. You will also learn how to manage user and group accounts in all sorts of ways. Furthermore, you will also learn how to manage Linux file permissions.

The /etc/passwd file

In Linux, user information is stored in the /etc/passwd file. Every line in /etc/passwd corresponds to exactly one user. When you first open /etc/passwd, you will see a lot of users, and you will wonder, where are all these users coming from? The answer is simple: most of these users are service users, and they are used by your system to start up various applications and services. However, our main focus of this chapter will be system users; those are real people like you and me!
Every line in /etc/passwd consists of 7 fields, each separated by a colon, and each field represents a user attribute. For example, the entry for user elliot will look something like this:
Figure 1: The 7 fields in /etc/passwd
The following table breaks down those seven fields in /etc/passwd and explains each one of them:

Field
What does it store?
1
This field stores the username.
2
This field usually has an X in it, which means the user's password is encrypted and stored in the file /etc/shadow.
3
This field stores the UID (User ID) number.
4
This field stores the primary GID (Group ID) of the user.
5
This field stores a comment on the user, which is usually the user's first and last name.
6
This field stores the path of the user's home directory.
7
This field stores the user's default shell.
Table 10: Understanding /etc/passwd

Adding users

Before you can add a user on your system, you have to become root:
elliot@ubuntu-linux:~$ su - 
Password:
root@ubuntu-linux:~#
Now, we are ready to add users. We all love Tom & Jerry, so let's begin by adding user tom. To do that, you need to run the command useradd -m tom:
root@ubuntu-linux:~# useradd -m tom
And just like that, the user tom is now added to our system. You will also see a new line added to the end of the /etc/passwd file for the new user tom; let's view it with the lovely tail command:
root@ubuntu-linux:~# tail -n 1 /etc/passwd 
tom:x:1007:1007::/home/tom:/bin/sh
We used the -m option with the useradd command to ensure that a new home directory will be created for user tom. So let's try to change to the /home/tom directory to make sure it's indeed created:
root@ubuntu-linux:~# cd /home/tom 
root@ubuntu-linux:/home/tom# pwd
/home/tom
Awesome! We verified that /home/tom is created.
The first thing you may want to do after creating a new user is to set the user's password. You can set tom's password by running the command passwd tom:
root@ubuntu-linux:~# passwd tom 
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Now, let's create user jerry. But this time, we will choose the following attributes for user jerry:
UID
777
Comment
Jerry the Mouse
Shell
/bin/bash
This is easy to do with the useradd command:
root@ubuntu-linux:~# useradd -m -u 777 -c "Jerry the Mouse" -s /bin/bash jerry
The -u option is used to set the UID for jerry. We also used the -c option to add a comment for user jerry, and finally we used the -s option to set the default shell for jerry.
Now, let's view the last two lines of the /etc/passwd file to make some comparisons:
root@ubuntu-linux:~# tail -n 2 /etc/passwd 
tom:x:1007:1007::/home/tom:/bin/sh
jerry:x:777:1008:Jerry the Mouse:/home/jerry:/bin/bash
Notice how the comment field for user tom is empty as we didn't add any comments while creating user tom, and notice how the UID for user tom was chosen by the system, but we have chosen 777 for user jerry. Also, notice that the default shell for user tom is chosen by the system to be /bin/sh, which is an older version of /bin/bash. However, we chose the newer shell /bin/bash for user jerry.
Now, let's set the password for user jerry:
root@ubuntu-linux:~# passwd jerry 
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Amazing! We have now created two users: tom and jerry. Now, let's switch to user tom:
root@ubuntu-linux:~# su - tom
$ whoami tom
$ pwd
/home/tom
$
We were able to switch to user tom, but as you can see, the shell looks so much different as the command prompt doesn't display the username or the hostname. That's because the default shell for user tom is /bin/sh. You can use the echo $SHELL com...

Índice