Difference between revisions of "Linux-Ubuntu/C2/Basics-of-System-Administration-in-Linux/English"
Ketkinaina (Talk | contribs) (Created page with "'''Title of the Script: Basics of System Administration in Linux''' '''Author: EduPyramids''' '''Keywords: '''su, adduser, usermod, userdel, UID, GID, du, df, Linux, System...") |
|||
| Line 83: | Line 83: | ||
'''Type administrator password''' and press '''Enter'''. Highlight message '''adduser: Only one or two names allowed''' | '''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 user'''and press '''Enter'''. | + | || Let us now learn how to create a new user. |
| + | |||
| + | In the terminal type '''sudo space add user'''and press '''Enter'''. | ||
Type the '''administrator password''' and press '''Enter'''. | Type the '''administrator password''' and press '''Enter'''. | ||
| Line 94: | Line 96: | ||
Press '''Enter'''.Show side by side in files '''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'''. | + | || 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'''. | We have now created a new user called '''edupyramids'''. | ||
| Line 106: | Line 110: | ||
|| Please note that you will be prompted to set a '''new password''' for the user '''edupyramids'''. | || 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 | + | 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. | The password for the new user is now set. | ||
| Line 115: | Line 124: | ||
Press '''y'''Press '''Enter''' | Press '''y'''Press '''Enter''' | ||
| − | || Next, we are prompted to enter additional details.Let us enter only the '''Full Name''' as '''EduPyramids'''. | + | || 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. | 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. | + | Finally, to confirm the information type '''y''' and press Enter. |
| + | |||
| + | This confirms that all the entered details are correct. | ||
|- | |- | ||
|| Type''' ls /home'''Press '''Enter'''Highlight '''edupyramids''' | || Type''' ls /home'''Press '''Enter'''Highlight '''edupyramids''' | ||
|| Let us now check if the user account has been created. | || Let us now check if the user account has been created. | ||
| − | For that type: '''l s space slash home'''and press '''Enter'''. | + | 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'''. | + | Here, we can see our newly created user named '''edupyramids'''. |
| + | |||
| + | The next command we will look at is '''su'''. | ||
|- | |- | ||
|| '''Slide 8''' | || '''Slide 8''' | ||
'''su command''' | '''su command''' | ||
| − | || '''su''' stands for '''switch user'''.It is used to switch from the current user to another user account. | + | || '''su''' stands for '''switch user'''. |
| + | |||
| + | It is used to switch from the current user to another user account. | ||
|- | |- | ||
|| '''Switch to the terminal''' | || '''Switch to the terminal''' | ||
| Line 150: | Line 168: | ||
|| Now type, '''su space hyphen space edupyramids''' 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'''. | + | 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. | Observe that the Terminal shows the new user prompt. | ||
| Line 174: | Line 194: | ||
|| We will now set an expiry date for the user account '''edupyramids'''. | || 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. | + | 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. | The user account expiry date is now set using the '''hyphen e''' option. | ||
| Line 185: | Line 207: | ||
|| At the terminal, 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. | + | The output shows, '''User I D, Group I D''', |
| + | and the groups to which the current user belongs. | ||
|- | |- | ||
|| '''Slide 10''' | || '''Slide 10''' | ||
| Line 224: | Line 247: | ||
To see all group IDs of the current user, | To see all group IDs of the current user, | ||
| − | type: '''id hyphen capital G '''and press '''Enter''' | + | type: '''id hyphen capital G ''' and press '''Enter''' |
You can now see a list of all '''group IDs''' associated with the current user. | 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. | + | || 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''' Enter'''Type''' ls /home '''press''' Enter''' | || Type''' sudo userdel -r edupyramids '''press''' Enter'''Type''' ls /home '''press''' Enter''' | ||
| − | || Type '''sudo space userdel space hyphen r space edupyramids '''and 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. | + | The '''hyphen r ''' option removes the user along with its user’s home directory. |
Press '''Enter''' to see what happens. | Press '''Enter''' to see what happens. | ||
| Line 248: | Line 273: | ||
We can see that the user account '''edupyramids''' has been deleted. | We can see that the user account '''edupyramids''' has been deleted. | ||
| − | The''' hyphen r''' option removes the home directory as well. | + | The ''' hyphen r''' option removes the home directory as well. |
|- | |- | ||
|| '''Slide 12''' | || '''Slide 12''' | ||
| Line 276: | Line 301: | ||
* The mount points. | * The mount points. | ||
| − | The '''hyphen h '''option shows the sizes in human-readable format, for easy understanding. | + | The '''hyphen h ''' option shows the sizes in human-readable format, for easy understanding. |
|- | |- | ||
|| Type: '''touch test1 test2 test3''' and press '''Enter'''. | || Type: '''touch test1 test2 test3''' and press '''Enter'''. | ||
| Line 298: | Line 323: | ||
|| Now type: | || Now type: | ||
| − | '''d u space hyphen s space asterisk '''and press '''Enter'''.Option '''hyphen s''' gives a summary per file. | + | '''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. | This command gives a summary of the sizes of all files in the folder. | ||
| − | Next, type '''du hyphen c h asterisk '''press''' Enter '''to | + | Next, type '''du hyphen c h asterisk '''press''' Enter '''to observe the output. |
'''hyphen c''' provides a total size. | '''hyphen c''' provides a total size. | ||
Latest revision as of 19:54, 24 January 2026
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:
|
| Slide 3
System Requirements |
To record this tutorial, I am using,
Ubuntu version 24 point zero 4. |
| Slide 4
Pre-requisites |
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
|
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 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:
|
With this we come to the end of this tutorial.
Let us Summarize. |
| Slide 14
Assignment As an assignment
|
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. |