This document provides an introduction to Linux system and network administration. It discusses Linux modes, user accounts, basic commands, and the directory structure. Key points include:
- Linux has two modes: the GUI mode and CLI mode, with CLI used more commonly for configurations, installations, and exams.
- There are three types of users: root/super users, system users, and normal users. Users can login to CLI simultaneously while only one can login to GUI at a time.
- Basic commands covered include switching modes, shutdown, restart, logout, viewing files and directories, copying/moving files, and deleting files/directories.
- The Linux directory structure is explained, following the File System H
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
Linux lecture
1. INTRO TO LINUX SYSTEM AND
NETWORK ADMINISTRATION
Aziz M Azizi
Computer Science
Paktia University
2. We have to remember 3 things in Linux
(Modes, Users and Commands)
Introduction to Linux
Linux Modes
Linux has two modes:
- GUI (Graphic User Interface) Mode <weak>
- CLI (Command Line Interface) Mode <strong>
• Technically in Linux OS, CLI mode used a lot instead
of GUI mode and all configurations, Installations,
exams and Interview are based on CLI mode.
3. Login (CLI & GUI), User Account
Introduction to Linux
Login (CLI & GUI):
• In a time, we can login by up to 6 users in CLI mode but we can
login by one user in GUI mode a time.
User Account:
• We have three types user in Linux
- Root / Super user # <Administrator>
- System user
- Ordinary / Normal user $ <Standard>
4. Basic Command of Linux
Introduction to Linux
Switching Mode:
• If we want Switch from CLI to GUI mode & inverse…, follow these
command.
# Ctrl+Alt+F1 <to GUI mode in rhel>
# Ctrl+Alt+F2 <to CLI mode user 1>
# Ctrl+Alt+F3 <to CLI user mode 2>
# Ctrl+Alt+F4 <to CLI user mode 3>
# Ctrl+Alt+F5 <to CLI user mode 4>
# Ctrl+Alt+F6 <to CLI user mode 5>
# Ctrl+Alt+F7 <to GUI user mode in ubntu>
5. Contd…
Introduction to Linux
Linux Shutdown:
# Init 0
# halt
Linux Restart:
# Init 6
# reboot
# Alt+Ctrl+Delete
Linux Logout:
# exit
# logout
# Ctrl+D
6. Contd…
Introduction to Linux
Linux Trash-away
# Clear
# Ctrl+L
Exist Directory and File Details
# ls <List>
Enter to a Directory
# cd directory_name/ <change directory>
ex: cd Desktop/
Making Directories (Folders)
# mkdir dir1 dir2 dir3 dir… <make directories>
ex: mkdir Ali Nabi Jan
7. Contd…
Introduction to Linux
Making Files
# touch 1st
file 2nd
file 3rd
file …
ex: touch Ab Ac Ad
ex: touch Ab
Copying the file to a directory <Copy Paste>
# cp file_name directory_name/ <copy>
ex: cp Ab Ali/
Moving the file to a directory <Cut Paste>
# mv file_name directory_name … <move>
ex: mv Ab Ali/
8. Contd…
Introduction to Linux
Go back <one stage>
# cd .. <change directory>
Go back from sub_directories to home directory
# cd <change directory>
Deleting a file
# rm file_name <remove>
ex: rm Ab ? y/n
Deleting a directory
# rm –r directory_name <remove>
ex: rm –r Ali ? y/n <-r = shift-delete>
9. Contd…
Introduction to Linux
Viewing a directory which we in right now
# pwd <print name of working directory>
Viewing information about other command
# man directory_name <manual>
ex: man pwd
Viewing current date & time, calendar and
complete calendar of a year
# date <date and time>
# cal <calendar>
# cal 2018
10. Contd…
Introduction to Linux
Switching users in CLI mode
# su username <switch>
ex: su Jan <from Ali switch in Jan>
• If we switch from root user to ordinary, it will be
without asking authentication but if we want to
switch from ordinary to root; authentication will
asked.
11. Linux vs. Windows
Introduction to Linux
Windows
Windows > My Computer > Partitions (Drives C, D, E, F)
• System Drive also called Primary partition drive which
contain Operating system.
• In Windows-Server system drive contain (Document &
Setting, Winnet, Program file, Inetpub)
• All kinds of user exist in (Doc & Setting).
• Other partitions are called Secondary Partition.
19. Contd…
Introduction to Linux
/usr
•UNIX Sharable Resourcesread-onlysub
Linux: /usr/lib, /usr/lib, /usr/sbin, /usr/local, /usr/src
Windows: c:program files
/opt
•/.usrsub.third party software.Windows: c:program filesms
office
20. Contd…
Introduction to Linux
/bin
•Binary filesordinary user
/sbin
•Super user’s binary filessuper user
/dev
•
ex: /dev/hdd … for hard disk, /dev/dvd … for dvdrom similar
to device manager of windows.
DriverOP
23. Directory
Introduction to Linux
Deleting a directory/ directories:
# rmdir directory_name/ <without asking y/n>
ex: rmdir ahmad/
# rm –rvf directory_name1,2,3,…/
<rvf stands for Recursive Verbose File>
ex: rm –rvf ahmad/ <like shift delete with all contents>
Making Tree Structure Directories
# mkdir –p Ali/{A/{A1,A2},B,C} <-p=parent>
24. Linux Text Editor
Introduction to Linux
Vim Text Editor
•upward Text EditorProgrammer Text EditorNotepadWordPad
Text Editor
• Built-in <Vim Text Editor> 2) Non-Built-in <open Office>
•Linux Text Editor
•2Configuration
•Vim Text EditorMode
1) Command Mode <Default mode> 2) Insert Mode
25. Contd…
Introduction to Linux
1)Command ModeEditing ((Move, Copy, Delete.. ,
2Insert Mode
1)Command ModeInsert ModeiEsc.
Command of creating file by Vim Text Editor
# vim file_name (ex: vim Afghanistan)
Command of editing saved Vim Txt or other text file
# vi file_name (ex: vi Afghanistan)
Command of viewing saved text file contents
# cat file_name (ex: cat Afghanistan)
1( Command of bringing date & Cal in Text: :.!date / :.!cal
28. User Account and Group
Management in RHEL
Introduction to Linux
User:
• User is an object, which is used to access the
computer resource (Like file, directory and printer
etc…) with some specific privilege. Each user is
identified by a unique numerical identification
number called user ID (UID).
Group:
• Group is collection of those user, who has the same
privilege on a specific resource. Each group has a
unique numerical identification number called group
ID (GID).
29. Types of User Account
Introduction to Linux
• There are three types of users available Linux:
Super user / root user (#):
• Super user or root user is the most powerful user
account in Linux operating system. It is administrator of
Linux System.
System user:
• System users are the user that is created by software or
application. For example if we install Apache server,
then it will create a user account named ‘Apache’. These
type users are known as System users. By default the
User Manager does not display the System Users.
30. Contd…
Introduction to Linux
Normal user / Ordinary user ($):
• Normal users are the user that is created by rot user account.
They are normal users like John, Rajesh etc. Only the root user
account has the permissions to add or remove the user
account.
• Note: The range of UID_MIN and GID_MIN is specified in
31. User Configuration Files
Introduction to Linux
/etc: this directory is contains local configuration files:
•Each line in the file contains the login information of a single
user on the system.
Take a look at a single line to see what information it contains:
The field of information are separated by a colon (:) character.
32. Contd…
Introduction to Linux
• There are seven fields on each line in a typical Linux “ /etc/passwd “ file.
/etc/passwd
33. Creation of User Account
Introduction to Linux
Creating:
# useradd user_name
Ex: useradd Ali
Giving password to user account:
• We used <passwd> command for two purpose:
1) Giving password to a user by this command.
2) Changing old password of the user.
If we create a user in Linux CLI mode we do it in two steps: 1st
creating user 2nd
giving password to the created user.
p# asswd user_name (ex: passwd Ali)
<then enter and type and re-type the password>
34. Contd…
Introduction to Linux
Deleting User Account
• Deleting user without deleting its directory. use the directory
deleting command <rm –rvf dir_nm1,2..>
# userdel user_name (ex: userdel Ali)
• Deleting user with its directory
# userdel –rv user_name (ex: userdel -rv Ali)
Changing user account password
# passwd user_name <enter key>
(ex: passwd Ali ) <enter key>
New password: … Retype password: …
• If we want to apply any policy on two or more
Users 1st
we bring them under a group then apply the policy
on that group.
35. Command of disabling / enabling
user and password
Introduction to Linux
Enabling & Disabling User Account
# vi /etc/passwd <go on the user (/bin/bash) which you want to make
disable then add ! (/bin/bash!). >
# vi /etc/passwd < according to the upper method just remove
the ! from the /bin/bash for enabling the disabled user. >
Enabling & Disabling User Account Password
# vi /etc/passwd < for removing password, go on the user and
remove x from (aziz:x:500) likes.. (aziz: :500).>
# vi /etc/passwd <for bringing password back, go on the user
and bring again the x (aziz: :500) likes.. (aziz:x:500).>
36. Command of Creating & Deleting
Group
Introduction to Linux
• If we create user, group will created with it automatically <ex:
user: Ali, group: Ali> while we create group user will not
created with it.
# groupadd group_name <ex: groupadd HR>
# groupdel group_name <ex: groupdel HR>
• (vi /etc/group) command of viewing groups
• (vi /etc/passwd) command of knowing which user is our group
members.
37. How to make user as a group
member
Introduction to Linux
• Go through (vi /etc/passwd) command and following
these tips:
• Means: we membered aziz and ali user to root group.
• If you want to know, that I am which group member
follow (whoami) command.
• If a group has member it will not dilated.
38. File and Directory Permission in
Linux
Introduction to Linux
• We can set the file or directory permissions using
(chmod) command in the command line mod.
• There are two methods to define permission:
Explicitly (Symbolic Mode)
Binary Reference (Numeric Mode)
39. Explicitly (Symbolic) Mode
Introduction to Linux
• To explicitly define permission you will need to reference the
Permission Group and Permission Types.
• The Permission Groups used are:
Owner u
Group g
All other users o
All user ( Owner + Group + All other users) a
• The Permission Types that are used are:
Read r
Write w
Execute x
40. Available Operations are in
Symbolic Mode
Introduction to Linux
o + (add the permission to what currently exists)
o - (remove the permission from currently exists)
o = ( set the this value only , replacing existing permissions)
To add permission:
# chmod permission_groups + permission_types
filename/directory
To remove permission:
# chmod permission_groups - permission_types
filename/directory
Where Permission Groups are: Owner(u), Group(g) and All other Users(o).
Permission Types are: Read(r), Write(w) and Execute
41. Binary Reference (Numeric Mode)
Introduction to Linux
• To set the permission using binary reference you must first
understand that the input is done by entering three integers /
numbers.
• A sample permission string would be (chmod 750 mycv.txt)
Which means that the owner has read, write and execute
permissions, the group has read and execute permissions and
all other users have no rights to the file.
#chmod 777 mycv.tx
44. To set permission using Binary
Reference (Numeric Mode)
Introduction to Linux
• To set permission on a file or directory for a Owner, Group
and All other users at a time, then you will have to execute the
following command:
#chmod user_permission filename/directory_name
For example, if you want to assign Ful Permission (read, write
and execute) to Owner, read and execute permission to Group
and All other user on a directory named “mydata” you will
have to execute the following command.
#chmod 750 mydata
Command of viewing the Persission
# ll (long list) # ls (list) –l
45. Default Permission of File and
Directory
Tips
Introduction to Linux
• never we can take permission from root user.
•rwx (7) is full permission, --- (0) is no permission.
d rwx r-x r--
directory owner group All other user
drwx(7) r-x(5) r--(4)
u g o
46. File Archiving and Compression
Introduction to Linux
• Used for easy file sharing
• Sending simplicity
• Decrease the exact size of files
• In Linux 1st tar then compress
• In Windows both (archive & compress) mean zip.
• In Linux archived file color is (red) & its extension is .tar (af.tar)
• In Linux archiving will not decrease the size.
Declaring the size of files and directories
# du (disk usage) file/directory name (ex: du Afghan) /kb
# du –h file/directory name (ex: du –h Afghan) /kb
# ls –l file/directory name (ex: ls –l Afghan) /full details (byte)
# ll file/directory name (ex: ll Afghan) /full details (byte)
47. Archiving, Opening Archived &
Extract Archived file command
Introduction to Linux
Archiving
# tar cvf archive file_name file_name 1 2 3 …
# tar cvf Mydata.tar Ali, Nabi, Zabi …
Opening Archived File
# tar tvf (archived file_name)
# tar tvf Mydata.tar
Extracting Archived File
# tar xvf (archived file_name)
# tar xvf Mydata.tar
48. Compression and Decompression
Files in Linux
Introduction to Linux
Compressing
#gzip file_name (ex: gzip Mydata.tar)
result: Mydata.tar.gz
#bzip2 file_name (ex: bzip2 Mydata.tar)
result: Mydata.tar.bz2
Decompressing
#guzip Mydata.tar.gz (result: Mydata.tar)
#buzip2 Mydata.tar.bz2 (result: Mydata.tar)
Note: bzip2 compress more the file than gzip.
49. Package Management In RHEL
• rpm stands for Redhat Package Manager.
How to install packages in Linux?
• Insert Linux DVD into your DVD drive.
• Mount the DVD (mount /dev/dvd /media)
• Go to /media directory open /Packages then install the
package which you want to install.
(ex: rpm –Uvh vsftp.rpm )
Mount: Mapping a physical device to a directory (/dev)
device.
Introduction to Linux
Linux Windows
Package Setup
vsftp.rpm VLC.exe