Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

00-Review of Linux Basics

86 views

Published on

  • Be the first to comment

00-Review of Linux Basics

  1. 1. Review of Linux Basics
  2. 2. 4 Key Knowledge Area ● Linux Directory Structure ● File Permissions and Security ● Common Linux Commands and Programs ● Working with Linux Shells ● Bash Shell Scripting
  3. 3. 5 Linux Directory Structure
  4. 4. 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
  5. 5. 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
  6. 6. 8 SETUID and SETGID ●SETUID ●‫را‬ ‫آن‬ ‫تواند‬‫می‬ ‫کاربری‬ ‫هر‬ ، ‫شود‬ ‫داده‬ ‫فایلی‬ ‫به‬ ‫مجوز‬ ‫این‬ ‫که‬ ‫صورتی‬ ‫در‬ :‫فایل‬ ‫روی‬ ‫بر‬ .‫کند‬ ‫اجرا‬ ‫فایل‬ ‫صاحب‬ ‫مجوز‬ ‫با‬ ●.‫ندارد‬ ‫اثری‬ ‫هیچ‬ ‫ها‬ ‫پوشه‬ ‫برای‬ ‫مجوز‬ ‫این‬ :‫پوشه‬ ‫روی‬ ‫بر‬ ●SETGID ●.‫کند‬ ‫اجرا‬ ‫گروه‬ ‫مجوز‬ ‫با‬ ‫را‬ ‫فایل‬ ‫تواند‬‫می‬ ‫کاربری‬ ‫هر‬ :‫فایل‬ ‫روی‬ ‫بر‬ ●‫خواهد‬ ‫مالک‬ ‫گروه‬ ‫مالکیت‬ ‫در‬ ‫پوشه‬ ‫در‬ ‫شده‬ ‫ساخته‬ ‫جدید‬ ‫فایل‬ ‫هر‬ :‫پوشه‬ ‫روی‬ ‫بر‬ ‫صورت‬ ‫به‬ ‫کاربران‬ ‫که‬ ‫هایی‬ ‫پوشه‬ ‫در‬ ‫استفاده‬ ‫برای‬ .‫فایل‬ ‫سازنده‬ ‫گروه‬ ‫نه‬ ‫و‬ ‫بود‬ ‫است‬ ‫مناسب‬ ‫کنند‬‫می‬ ‫کار‬ ‫مشترک‬
  7. 7. 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
  8. 8. 10 Manipulating Files and Directories Work with file rm cp rmdir mkdir mv File and Dir cd ls Home Dir Tiled ~ .and..
  9. 9. 11 Viewing and Searching Files Search find locate grep head,tail which
  10. 10. 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
  11. 11. 13 Bash Shell Scripting ● She Bang $ vi helloworld.sh #!/bin/bash var=oracle echo $var $ vi helloworld.sh #!/bin/bash var=oracle echo $var
  12. 12. 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
  13. 13. 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
  14. 14. 16 Bash Shell Scripting: while ●‫است‬ ‫درست‬ ‫شرط‬ ‫که‬ ‫تازمانی‬ while [ test ] do commands done while [ test ] do commands done
  15. 15. 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
  16. 16. 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

×