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
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..
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