Linux and Networking

Linux and Networking

3.13 Users

Linux, as a clone of Unix, a system born on the Internet, is designed to serve several users at the same time. For this, there is the “root” or superuser account, and  the other system users accounts.

 

3.13.1 creating a user

 

To create a user, we type, logging in as root, “useradd” without the quotes plus the username. Ex:

 

useradd carlos

 

You will have created a user without an access code. It will be necessary to create an access key for the new user created and for that we will see the passwd command later

 

3.13.2 Deleting a user

 

To delete a user, simply write the command:

“userdel” and the username, example:

user del carlos

 

3.13.3 User change

 

su [options] [username]

 

With su we can login to the system as if we were another user.

If we type su user we will start a new shell as if we were the user usuario

Example:

 

su carlos

 

Once this is typed, it will ask us for the password of the user carlos. (root will not be prompted)

 

3.13.4 I want to change the password

 

passwd [user]

 

Users can change their password with this command.

Root can change the password of any user on the system.

 

3.13.5 Miscellany

Rebooting the system

  • reboot

 

How much free memory do I have in the system?

  • free

 

How much does this information occupy?

directory?

  • du

 

How much space do I have left on the disk

hard?

  • df -k .

 

Search for a file… Search for the file mio.txt in the /home/antonio directory:

  • find /home/antonio –name my.txt

 

Search for the file mio.txt in the WHOLE system:

  • find / –name of mine.txt

 

What will this file have…. Command: cat file_name

  • cat mio.txt

It will show the content of the file mio.txt

 

Searching for strings in files: grep command Example:

  • grep “sofia” file.txt

It will look for sofia in the file named file.txt

 

Will these two files be the same???

  • diff file1 file2

The diff command compares the contents of any pair of files. It will tell us the lines that do not match. With this command we can know if our files are equal or they differ in some way.

The Demeter Project