section_2
section_2
section_2
System
PRESENTED BY SALMA KISHK
Outline
Review
users type
create, delete and switch users
Introduction to linux file system
navigate file system
create, copy, moves, remove directories and files
Linux component
user account
john:x:1002:1002:,,,:/home/john:/bin/bash
Users type
The root user account
This is the main user account in Linux system.
It is automatically created during the installation.
It has the highest privilege in system.
It can do any administrative work and can access any service.
id : 0
tail /etc/passwd
get information about users in system
tail /etc/shadow
get users’ password
Practice
sudo su -
switch to root user
su - username
switch to username
adduser user_name
another way to add user
userdel -r username
delete user and home directory
task
Create a user account with the following
attribute:
username: sara
Fullname/comment: sara mohamed
Password: 1234
window vs linux
File system for linux
/var ==> Variable data of the system, these files are dynamically
changed
(database files, mail directory, log files, printer and website content)
File system for linux
/lib ==> The /lib directory contains kernel modules and those shared
library images (the C programming code library) needed to boot the
system and run the commands in the root filesystem
File system for linux
cd path
change directory
cd -
last working directory
cd or cd ~
go to home directory
cd ~user_name
go to username home directory
destination
current directory
For example absolute path : /home/jono/photos
relative path : ./photos
current directory
destination
task
destination
current directory
task
absolute path : /usr/lib
relative path : ./../../../usr/lib
destination
current directory
create, copy, moves, remove directories and
files
file directory
cp source_directory
cp source_file directory
destination_file copy dir (if empty)
copy file put -r (recursive) if has
contents
create, copy, moves, remove directories and
files
file directory
rm -r dir_name ------------> delete dir if not empty in this case terminal ask
before delete any of dir contents
more fname
• Scrolling keys for the more command
– Spacebar: moves forward on screen
– b: move back one screen
– /string: search forward for pattern
– q: quit and return to the shell prompt
head –n fname
show first n lines
tail -n fname
show last n lines
Editing Files with gedit
1- The gedit text editor is a graphical tool for
editing text files.
gedit new_filename
nano new_filename
task
create text file using gedit or nano
called hello.text and cat the contents
Display the first 4 lines of /etc/passwd