Difference between revisions of "Linux-Ubuntu/C2/Basics-of-System-Administration-in-Linux/English"
| Line 1: | Line 1: | ||
'''Title of the Script: Basics of System Administration in Linux''' | '''Title of the Script: Basics of System Administration in Linux''' | ||
| + | |||
'''Author: EduPyramids''' | '''Author: EduPyramids''' | ||
| Line 82: | Line 83: | ||
and press '''Enter'''. | and press '''Enter'''. | ||
| − | '''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. | || Let us now learn how to create a new user. | ||
| Line 210: | Line 213: | ||
and the groups to which the current user belongs. | and the groups to which the current user belongs. | ||
|- | |- | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|| Type''' id -u '''press''' Enter''' | || Type''' id -u '''press''' Enter''' | ||
|| To display only the '''User I D''', type:'''id space hyphen u press Enter''' | || To display only the '''User I D''', type:'''id space hyphen u press Enter''' | ||
| Line 238: | Line 226: | ||
The output shows the '''username''' corresponding to the user ID. | The output shows the '''username''' corresponding to the user ID. | ||
|- | |- | ||
| − | || Type''' id -g '''press''' | + | || Type''' id -g '''press''' Enter. |
| + | |||
| + | Highlight output'''Type''' id -G '''press''' Enter | ||
| + | |||
| + | Highlight output''' | ||
|| Let us now learn the commands related to '''Group ID'''s. | || Let us now learn the commands related to '''Group ID'''s. | ||
| Line 256: | Line 248: | ||
The '''userdel''' command permanently deletes a user account. | 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'''. | ||
| Line 275: | Line 269: | ||
The ''' hyphen r''' option removes the home directory as well. | The ''' hyphen r''' option removes the home directory as well. | ||
|- | |- | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|| | || | ||
|| Let us clear the screen | || Let us clear the screen | ||
| Line 358: | Line 344: | ||
# Check the '''UID''' and '''GID''' of users | # Check the '''UID''' and '''GID''' of users | ||
# Use '''df -h''' and '''du -ch <nowiki>*</nowiki> '''to check disk usage for practice files. | # Use '''df -h''' and '''du -ch <nowiki>*</nowiki> '''to check disk usage for practice files. | ||
| + | |||
|| As an assignment, please do the following. | || As an assignment, please do the following. | ||
|- | |- | ||
| Line 363: | Line 350: | ||
'''Thank you''' | '''Thank you''' | ||
| − | + | ||
| + | This Spoken Tutorial is brought to you by EduPyramids Educational Services Private Limited, SINE, IIT Bombay. | ||
| + | || Thank you. | ||
|- | |- | ||
|} | |} | ||
Latest revision as of 16:27, 11 March 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. |
| 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 Enter.
Highlight outputType id -G press Enter Highlight 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 Enter
Type 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. |
| 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. |