Linux-Ubuntu/C2/Basics-of-System-Administration-in-Linux/English

From Script | Spoken-Tutorial
Jump to: navigation, search

Title of the Script: Basics of System Administration in Linux

Author: EduPyramids

Keywords: su, adduser, usermod, userdel, UID, GID, du, df, Linux, System Admin, EduPyramids, video tutorial.


Visual Cue Narration
Slide 1

Title Slide

Welcome to this spoken tutorial on Basics of System Administration in Linux.
Slide 2

Learning Objectives

In this tutorial, we will learn to:
  • Create, modify, switch, and delete Linux user accounts.
  • View details of users, groups, and system IDs.
  • Monitor disk usage, file and directory sizes, and file system space.
  • Use basic Linux commands for system and storage management.
Slide 3

System Requirements

To record this tutorial, I am using,

Ubuntu version 24 point zero 4.

Slide 4

Pre-requisites

https://EduPyramids.org

To follow this tutorial,

Learners should have Ubuntu version 24 point zero 4.

Admin access or the root permission to execute the commands shown in the tutorial.

For the prerequisite Linux tutorials please visit this website.

Slide 5

Code files

The following code file is required to practice this tutorial.

sa-commands.txt

This file is provided in the Code Files link of this tutorial page.

The following code file is required to practice this tutorial.

This file is provided in the Code Files link of this tutorial page.

Let us create a new user account.
Slide 6

adduser

The adduser command creates a new user with login credentials.

We can add user accounts with the help of the sudo command.

Slide 7

sudo

The sudo command lets authorized users run commands as administrators.

The sudo command has several options.

We will learn these as we progress in this tutorial.

Type: sudo adduser

and press Enter.

Type administrator password and press Enter. Highlight message adduser: Only one or two names allowed

Let us now learn how to create a new user.

In the terminal type sudo space add userand press Enter.

Type the administrator password and press Enter.

The password typed in the terminal is not visible, so type it carefully.

After entering the password, a message sayingOnly one or two names allowed.

Type sudo adduser edupyramids

Press Enter.Show side by side in files edupyramids.

So, let us create a new user account named edupyramids.

Type: sudo space adduser space edupyramids and press Enter.

We have now created a new user called edupyramids.

A separate home directory is created automatically during the user creation.

Type password: edup12345Press Enteragain type password: edup12345 press Enter


Highlight additional details asking in the terminal.

Please note that you will be prompted to set a new password for the user edupyramids.

Type a password of your choice.

I am typing edu p 1 2 3 4 5 as the password and press Enter.

We will be asked to type the new password again.

The password is requested twice for security and confirmation.

The password for the new user is now set.

Full Name: EduPyramidspress Enter

Press yPress Enter

Next, we are prompted to enter additional details.

Let us enter only the Full Name as EduPyramids.

Let’s leave the remaining fields blank by pressing the Enter key.

Finally, to confirm the information type y and press Enter.

This confirms that all the entered details are correct.

Type ls /homePress EnterHighlight edupyramids Let us now check if the user account has been created.

For that type: l s space slash home and press Enter.

Here, we can see our newly created user named edupyramids.

The next command we will look at is su.

Slide 8

su command

su stands for switch user.

It is used to switch from the current user to another user account.

Switch to the terminal

Type

su - edupyramids

press enter

Highlight edupyramids@spoken-Inspiron-One- :/$

enter password: edup12345

Type logout

and press enter

Now type, su space hyphen space edupyramids and press Enter.

At the prompt enter the password for the user edupyramids.

Please recall that the password we had set was edu p 1 2 3 4 5.

Observe that the Terminal shows the new user prompt.

To log out from this user, type logout and press Enter.

The terminal now logs out from the current user, edupyramids.

It returns to the previous user account, spoken.

Slide 9

usermod command

Let us now learn about the user mod command.

The user mod command lets a superuser modify existing user accounts.

It can lock or disable accounts, manage passwords, and set account expiry dates.

Type sudo usermod -e 2026-12-27 edupyramids

Highlight -e

We will now set an expiry date for the user account edupyramids.

Type: sudo space usermod space hyphen e space 2026 hyphen 12 hyphen 27 space edupyramids and press Enter.

If prompted, type the admin password.

The user account expiry date is now set using the hyphen e option.

This means the user account edupyramids will be disabled after 27 December 2026.

Type id

and press Enter.

At the terminal, type id and press Enter.

The output shows, User I D, Group I D, and the groups to which the current user belongs.

Slide 10

UID

U I D stands for User I D. It is a unique number assigned by the system to each user account.

It identifies the user for permissions and ownership.

Slide 11

GID

G I D stands for Group I D.

It is a unique number assigned to a group.

It identifies a group of users for file and directory permissions.

Type id -u press Enter To display only the User I D, type:id space hyphen u press Enter

The output shows only the user ID of the current user.

Type id -n -u press Enter To see the username instead of the numeric ID, type id space hyphen n space hyphen u

and press Enter.

The output shows the username corresponding to the user ID.

Type id -g press EnterHighlight outputType id -G press EnterHighlight output Let us now learn the commands related to Group IDs.

At the terminal, type id space hyphen g and press Enter.

This displays the primary group ID of the current user.

To see all group IDs of the current user,

type: id hyphen capital G and press Enter

You can now see a list of all group IDs associated with the current user.

Now let us learn to delete a user using the userdel command.

The userdel command permanently deletes a user account.

Type sudo userdel -r edupyramids press EnterType ls /home press Enter Type sudo space userdel space hyphen r space edupyramids and press Enter.

The hyphen r option removes the user along with its user’s home directory.

Press Enter to see what happens.

Now, the user edupyramids has been deleted.

To verify this, type:

ls space slash home

and press Enter.

We can see that the user account edupyramids has been deleted.

The hyphen r option removes the home directory as well.

Slide 12

df and du

Some useful system administration commands are d f and d u.

The d f command displays the available and used disk space.

The d u command shows how much disk space a file or directory occupies.

Let us clear the screen
Type df -h press Enter

On the terminal type:

d f space hyphen h

and press Enter.

We see:

  • The size of each file system.
  • The space used and available.
  • The mount points.

The hyphen h option shows the sizes in human-readable format, for easy understanding.

Type: touch test1 test2 test3 and press Enter. Let us now try some options with the d u command.

Let me create test files named as test1 test2 test3 in my home directory.

Type du -s * press Enter

Highlight the summary in the output

Type cd /home/spoken and press Enter.

type: du -s * and press Enter.

Highlight the summary of the sizes shown in the output

type du -ch *press Enter

Highlight the output

Now type:

d u space hyphen s space asterisk and press Enter.

Option hyphen s gives a summary per file.

This command gives a summary of the sizes of all files in the folder.

Next, type du hyphen c h asterisk press Enter to observe the output.

hyphen c provides a total size.

h makes sizes human-readable.

Slide 13

Summary

In this tutorial we have learnt to:

  • Create, modify, switch, and delete Linux user accounts.
  • View details of users, groups, and system IDs.
  • Monitor disk usage, file and directory sizes, and file system space.
  • Use basic Linux commands for system and storage management.
With this we come to the end of this tutorial.

Let us Summarize.

Slide 14

Assignment

As an assignment

  1. Create a new user demo and verify the home directory.
  2. Switch users using su and logout.
  3. Set an expiry date for this user using usermod -e.
  4. Check the UID and GID of users
  5. Use df -h and du -ch * to check disk usage for practice files.
As an assignment, please do the following.
Slide 15

Thank you

This Spoken Tutorial is brought to you by EduPyramids Educational Services Private Limited, SINE, IIT Bombay.Thank you.

Contributors and Content Editors

Ketkinaina, Madhurig