SlideShare a Scribd company logo
00-Review of Linux Basics
Review of Linux Basics
4
Key Knowledge Area
● Linux Directory Structure
● File Permissions and Security
● Common Linux Commands and Programs
● Working with Linux Shells
● Bash Shell Scripting
5
Linux Directory Structure
6
Navigating the Linux File System
● Change Directory
# cd /home/user
# cd ..
# pwd
/home
# cd user/Downloads
# cd /home/user
# cd ..
# pwd
/home
# cd user/Downloads
7
File Permissions and Security
:‫شود‬ ‫می‬ ‫اعمال‬ ‫سطح‬ ‫سه‬ ‫در‬ ‫لینوکس‬ ‫فایل‬ ‫سیستم‬ ‫در‬ ‫دسترسی‬
●) ‫کاربر‬user‫پوشه‬ ‫یا‬ ‫فایل‬ ‫مالک‬ ‫کاربر‬ : (
●) ‫گروه‬group‫پوشه‬ ‫یا‬ ‫فایل‬ ‫مالک‬ ‫گروه‬ : (
●) ‫دیگران‬other‫فایل‬ ‫مالک‬ ‫غیر‬ ‫به‬ ‫ها‬‫گروه‬ ‫و‬ ‫کاربران‬ : (
$ ls -l
drwxr-xr-x 2 user user 4096 Oct 13 13:19 Desktop
drwxr-xr-x 2 user user 4096 Oct 13 13:19 Documents
drwxr-xr-x 2 user user 4096 Oct 13 13:19 Downloads
drwxr-xr-x 2 user user 4096 Oct 13 13:19 Music
$ ls -l
drwxr-xr-x 2 user user 4096 Oct 13 13:19 Desktop
drwxr-xr-x 2 user user 4096 Oct 13 13:19 Documents
drwxr-xr-x 2 user user 4096 Oct 13 13:19 Downloads
drwxr-xr-x 2 user user 4096 Oct 13 13:19 Music
# umask
0022
# umask
0022
8
SETUID and SETGID
●SETUID
●‫را‬ ‫آن‬ ‫تواند‬‫می‬ ‫کاربری‬ ‫هر‬ ، ‫شود‬ ‫داده‬ ‫فایلی‬ ‫به‬ ‫مجوز‬ ‫این‬ ‫که‬ ‫صورتی‬ ‫در‬ :‫فایل‬ ‫روی‬ ‫بر‬
.‫کند‬ ‫اجرا‬ ‫فایل‬ ‫صاحب‬ ‫مجوز‬ ‫با‬
●.‫ندارد‬ ‫اثری‬ ‫هیچ‬ ‫ها‬ ‫پوشه‬ ‫برای‬ ‫مجوز‬ ‫این‬ :‫پوشه‬ ‫روی‬ ‫بر‬
●SETGID
●.‫کند‬ ‫اجرا‬ ‫گروه‬ ‫مجوز‬ ‫با‬ ‫را‬ ‫فایل‬ ‫تواند‬‫می‬ ‫کاربری‬ ‫هر‬ :‫فایل‬ ‫روی‬ ‫بر‬
●‫خواهد‬ ‫مالک‬ ‫گروه‬ ‫مالکیت‬ ‫در‬ ‫پوشه‬ ‫در‬ ‫شده‬ ‫ساخته‬ ‫جدید‬ ‫فایل‬ ‫هر‬ :‫پوشه‬ ‫روی‬ ‫بر‬
‫صورت‬ ‫به‬ ‫کاربران‬ ‫که‬ ‫هایی‬ ‫پوشه‬ ‫در‬ ‫استفاده‬ ‫برای‬ .‫فایل‬ ‫سازنده‬ ‫گروه‬ ‫نه‬ ‫و‬ ‫بود‬
‫است‬ ‫مناسب‬ ‫کنند‬‫می‬ ‫کار‬ ‫مشترک‬
9
File Security Attributes
● lsattr and chattr
a : append only
c : compressed
d : no dump
e : extent format
i : immutable
j : data journalling
s : secure deletion
t : no tail-merging
u : undeletable
A : no atime updates
C : no copy on write
D : synchronous directory updates
S : synchronous updates
T : top of directory hierarchy
a : append only
c : compressed
d : no dump
e : extent format
i : immutable
j : data journalling
s : secure deletion
t : no tail-merging
u : undeletable
A : no atime updates
C : no copy on write
D : synchronous directory updates
S : synchronous updates
T : top of directory hierarchy
# chattr +i /path/to/file# chattr +i /path/to/file
10
Manipulating Files and Directories
Work with file
rm
cp
rmdir
mkdir
mv
File and Dir
cd
ls
Home Dir
Tiled ~
.and..
11
Viewing and Searching Files
Search
find
locate
grep
head,tail
which
12
Environment and Shell Variables
● Shell Variables
● Enviroment Variables
# unset varname# unset varname
# varname=value# varname=value
# export varname=value# export varname=value
# echo $varname# echo $varname
13
Bash Shell Scripting
● She Bang
$ vi helloworld.sh
#!/bin/bash
var=oracle
echo $var
$ vi helloworld.sh
#!/bin/bash
var=oracle
echo $var
14
Bash Shell Scripting: Conditions
● Conditions
test expression
[ expression ]
help test
test expression
[ expression ]
help test
if [ expression ]
then
commands
elif [ expression ]
then
commands
else
commands
fi
if [ expression ]
then
commands
elif [ expression ]
then
commands
else
commands
fi
15
Bash Shell Scripting: case
●‫گزینه‬ ‫چندین‬ ‫انتخاب‬
case $variable in
1 ) echo "You entered one”
;;
2 ) echo "You entered two
;;
3 ) echo "You entered three”
;;
* ) echo "You did not enter a number”
echo "between 1 and 3”
esac
case $variable in
1 ) echo "You entered one”
;;
2 ) echo "You entered two
;;
3 ) echo "You entered three”
;;
* ) echo "You did not enter a number”
echo "between 1 and 3”
esac
16
Bash Shell Scripting: while
●‫است‬ ‫درست‬ ‫شرط‬ ‫که‬ ‫تازمانی‬
while [ test ]
do
commands
done
while [ test ]
do
commands
done
17
Bash Shell Scripting: In-List Syntax of for
for I in list
do
commands
done
for I in list
do
commands
done
for I in /path/to/*
do
commands to $I
done
for I in /path/to/*
do
commands to $I
done
18
Bash Shell Scripting: Controlled Loop Syntax of for
for (( c=1; c<=5; c++ ))
do
commands
done
for (( c=1; c<=5; c++ ))
do
commands
done
for I in {start..end..step}
do
commands
done
for I in {start..end..step}
do
commands
done

More Related Content

PDF
Basic linux commands for bioinformatics
PPT
Happy porting x86 application to android
DOCX
Linux final exam
DOCX
Linux midterm quiz
PDF
Software Dendrology by Brandon Bloom
PDF
Linux system admin
TXT
Logrotate sh
PDF
Linux basic commands with examples
Basic linux commands for bioinformatics
Happy porting x86 application to android
Linux final exam
Linux midterm quiz
Software Dendrology by Brandon Bloom
Linux system admin
Logrotate sh
Linux basic commands with examples

What's hot (20)

PDF
15 3. modulization
PPT
Basic Linux day 6
PPT
Basic linux day 4
PPT
Unix Basics
PPTX
Linux command for beginners
PPTX
Linux basic commands
PPTX
Unix slideshare
PDF
리눅스 간단 강의 5강
PDF
Linux system admin useful commands
ODP
Rpm Introduction
PDF
Unix Commands
PPT
Linux Commands
PPTX
Basic unix commands
PDF
Unix Command Line Productivity Tips
PPT
Basic command ppt
PPT
Unix And Shell Scripting
PPTX
Unix shell scripting basics
PDF
Linux Basic Commands
PPTX
Linux And perl
PDF
2 Unix basics. Part 2
15 3. modulization
Basic Linux day 6
Basic linux day 4
Unix Basics
Linux command for beginners
Linux basic commands
Unix slideshare
리눅스 간단 강의 5강
Linux system admin useful commands
Rpm Introduction
Unix Commands
Linux Commands
Basic unix commands
Unix Command Line Productivity Tips
Basic command ppt
Unix And Shell Scripting
Unix shell scripting basics
Linux Basic Commands
Linux And perl
2 Unix basics. Part 2
Ad

Viewers also liked (7)

PPT
Mbai itm u1.2 planning
DOCX
cover letter for resume
PDF
COURRIER CAB 31 MD
PDF
00251740510626254
PDF
Corporate social-and-financial-performance-an-extended-stakeholder-theory-and...
PDF
Guia de servicio al cliente
Mbai itm u1.2 planning
cover letter for resume
COURRIER CAB 31 MD
00251740510626254
Corporate social-and-financial-performance-an-extended-stakeholder-theory-and...
Guia de servicio al cliente
Ad

Similar to 00-Review of Linux Basics (20)

PPTX
Operating Systems - File Management
PPTX
Operating Systems: File Management
PPTX
Linux System commands Essentialsand Basics.pptx
PDF
Devops for beginners
PDF
Lets make better scripts
DOCX
$ filecount etcetc 153 ordinary 3 executable 7 links 124.docx
PDF
Unix Basics Commands
PDF
Debugging Network Issues
PDF
js_injwqeweqwqewqewqewqewqewqewqeected_xss.pdf
PDF
Unix Shell Scripting
PDF
Types of Linux Shells
PPTX
RHCSA EX200 - Summary
PPT
BITS: Introduction to Linux - Software installation the graphical and the co...
PPTX
Linux basics part 1
PDF
Introduction to the linux command line.pdf
PDF
Sa1 chapter-5-managing-local-linux-users-and-groups-v2 (4)
PDF
55 best linux tips, tricks and command lines
PPT
Sandy Report
PPT
Sandy Report
Operating Systems - File Management
Operating Systems: File Management
Linux System commands Essentialsand Basics.pptx
Devops for beginners
Lets make better scripts
$ filecount etcetc 153 ordinary 3 executable 7 links 124.docx
Unix Basics Commands
Debugging Network Issues
js_injwqeweqwqewqewqewqewqewqewqeected_xss.pdf
Unix Shell Scripting
Types of Linux Shells
RHCSA EX200 - Summary
BITS: Introduction to Linux - Software installation the graphical and the co...
Linux basics part 1
Introduction to the linux command line.pdf
Sa1 chapter-5-managing-local-linux-users-and-groups-v2 (4)
55 best linux tips, tricks and command lines
Sandy Report
Sandy Report

More from behrad eslamifar (15)

PDF
320.1-Cryptography
PDF
200.1,2-Capacity Planning
PDF
108.3-Mail Transfer Agent(MTA) basics
PDF
Chapter 14 - ensuring integrity and availability
PDF
Chapter 12 - network security
PDF
Chapter 11 - voice and video over ip
PDF
Chapter 09 - network operating systems
PDF
Chapter 08 - wireless networking
PDF
Chapter 06 - network hardwares
PDF
Chaoter 05 - topologies and ethernet standards
PDF
Chapter 04 - introduction to tcpip protocols
PDF
Chapter 07 - wa ns and remote connectivity
PDF
Chapter 03 - Transmission basics and networking media
PDF
Chapter02 - network standard and osi model
PDF
Chapter 01 - Introduction to Network+
320.1-Cryptography
200.1,2-Capacity Planning
108.3-Mail Transfer Agent(MTA) basics
Chapter 14 - ensuring integrity and availability
Chapter 12 - network security
Chapter 11 - voice and video over ip
Chapter 09 - network operating systems
Chapter 08 - wireless networking
Chapter 06 - network hardwares
Chaoter 05 - topologies and ethernet standards
Chapter 04 - introduction to tcpip protocols
Chapter 07 - wa ns and remote connectivity
Chapter 03 - Transmission basics and networking media
Chapter02 - network standard and osi model
Chapter 01 - Introduction to Network+

00-Review of Linux Basics

  • 3. 4 Key Knowledge Area ● Linux Directory Structure ● File Permissions and Security ● Common Linux Commands and Programs ● Working with Linux Shells ● Bash Shell Scripting
  • 5. 6 Navigating the Linux File System ● Change Directory # cd /home/user # cd .. # pwd /home # cd user/Downloads # cd /home/user # cd .. # pwd /home # cd user/Downloads
  • 6. 7 File Permissions and Security :‫شود‬ ‫می‬ ‫اعمال‬ ‫سطح‬ ‫سه‬ ‫در‬ ‫لینوکس‬ ‫فایل‬ ‫سیستم‬ ‫در‬ ‫دسترسی‬ ●) ‫کاربر‬user‫پوشه‬ ‫یا‬ ‫فایل‬ ‫مالک‬ ‫کاربر‬ : ( ●) ‫گروه‬group‫پوشه‬ ‫یا‬ ‫فایل‬ ‫مالک‬ ‫گروه‬ : ( ●) ‫دیگران‬other‫فایل‬ ‫مالک‬ ‫غیر‬ ‫به‬ ‫ها‬‫گروه‬ ‫و‬ ‫کاربران‬ : ( $ ls -l drwxr-xr-x 2 user user 4096 Oct 13 13:19 Desktop drwxr-xr-x 2 user user 4096 Oct 13 13:19 Documents drwxr-xr-x 2 user user 4096 Oct 13 13:19 Downloads drwxr-xr-x 2 user user 4096 Oct 13 13:19 Music $ ls -l drwxr-xr-x 2 user user 4096 Oct 13 13:19 Desktop drwxr-xr-x 2 user user 4096 Oct 13 13:19 Documents drwxr-xr-x 2 user user 4096 Oct 13 13:19 Downloads drwxr-xr-x 2 user user 4096 Oct 13 13:19 Music # umask 0022 # umask 0022
  • 7. 8 SETUID and SETGID ●SETUID ●‫را‬ ‫آن‬ ‫تواند‬‫می‬ ‫کاربری‬ ‫هر‬ ، ‫شود‬ ‫داده‬ ‫فایلی‬ ‫به‬ ‫مجوز‬ ‫این‬ ‫که‬ ‫صورتی‬ ‫در‬ :‫فایل‬ ‫روی‬ ‫بر‬ .‫کند‬ ‫اجرا‬ ‫فایل‬ ‫صاحب‬ ‫مجوز‬ ‫با‬ ●.‫ندارد‬ ‫اثری‬ ‫هیچ‬ ‫ها‬ ‫پوشه‬ ‫برای‬ ‫مجوز‬ ‫این‬ :‫پوشه‬ ‫روی‬ ‫بر‬ ●SETGID ●.‫کند‬ ‫اجرا‬ ‫گروه‬ ‫مجوز‬ ‫با‬ ‫را‬ ‫فایل‬ ‫تواند‬‫می‬ ‫کاربری‬ ‫هر‬ :‫فایل‬ ‫روی‬ ‫بر‬ ●‫خواهد‬ ‫مالک‬ ‫گروه‬ ‫مالکیت‬ ‫در‬ ‫پوشه‬ ‫در‬ ‫شده‬ ‫ساخته‬ ‫جدید‬ ‫فایل‬ ‫هر‬ :‫پوشه‬ ‫روی‬ ‫بر‬ ‫صورت‬ ‫به‬ ‫کاربران‬ ‫که‬ ‫هایی‬ ‫پوشه‬ ‫در‬ ‫استفاده‬ ‫برای‬ .‫فایل‬ ‫سازنده‬ ‫گروه‬ ‫نه‬ ‫و‬ ‫بود‬ ‫است‬ ‫مناسب‬ ‫کنند‬‫می‬ ‫کار‬ ‫مشترک‬
  • 8. 9 File Security Attributes ● lsattr and chattr a : append only c : compressed d : no dump e : extent format i : immutable j : data journalling s : secure deletion t : no tail-merging u : undeletable A : no atime updates C : no copy on write D : synchronous directory updates S : synchronous updates T : top of directory hierarchy a : append only c : compressed d : no dump e : extent format i : immutable j : data journalling s : secure deletion t : no tail-merging u : undeletable A : no atime updates C : no copy on write D : synchronous directory updates S : synchronous updates T : top of directory hierarchy # chattr +i /path/to/file# chattr +i /path/to/file
  • 9. 10 Manipulating Files and Directories Work with file rm cp rmdir mkdir mv File and Dir cd ls Home Dir Tiled ~ .and..
  • 10. 11 Viewing and Searching Files Search find locate grep head,tail which
  • 11. 12 Environment and Shell Variables ● Shell Variables ● Enviroment Variables # unset varname# unset varname # varname=value# varname=value # export varname=value# export varname=value # echo $varname# echo $varname
  • 12. 13 Bash Shell Scripting ● She Bang $ vi helloworld.sh #!/bin/bash var=oracle echo $var $ vi helloworld.sh #!/bin/bash var=oracle echo $var
  • 13. 14 Bash Shell Scripting: Conditions ● Conditions test expression [ expression ] help test test expression [ expression ] help test if [ expression ] then commands elif [ expression ] then commands else commands fi if [ expression ] then commands elif [ expression ] then commands else commands fi
  • 14. 15 Bash Shell Scripting: case ●‫گزینه‬ ‫چندین‬ ‫انتخاب‬ case $variable in 1 ) echo "You entered one” ;; 2 ) echo "You entered two ;; 3 ) echo "You entered three” ;; * ) echo "You did not enter a number” echo "between 1 and 3” esac case $variable in 1 ) echo "You entered one” ;; 2 ) echo "You entered two ;; 3 ) echo "You entered three” ;; * ) echo "You did not enter a number” echo "between 1 and 3” esac
  • 15. 16 Bash Shell Scripting: while ●‫است‬ ‫درست‬ ‫شرط‬ ‫که‬ ‫تازمانی‬ while [ test ] do commands done while [ test ] do commands done
  • 16. 17 Bash Shell Scripting: In-List Syntax of for for I in list do commands done for I in list do commands done for I in /path/to/* do commands to $I done for I in /path/to/* do commands to $I done
  • 17. 18 Bash Shell Scripting: Controlled Loop Syntax of for for (( c=1; c<=5; c++ )) do commands done for (( c=1; c<=5; c++ )) do commands done for I in {start..end..step} do commands done for I in {start..end..step} do commands done