• Save
[ArabBSD] Unix Basics
Upcoming SlideShare
Loading in...5
×
 

[ArabBSD] Unix Basics

on

  • 1,018 views

[ArabBSD] Unix Basics

[ArabBSD] Unix Basics

Statistics

Views

Total Views
1,018
Views on SlideShare
1,018
Embed Views
0

Actions

Likes
3
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

[ArabBSD] Unix Basics [ArabBSD] Unix Basics Document Transcript

  • ‫مبادئ ‪UNIX‬‬ ‫تمت الترجمة بواسطة‬ ‫معتز عالء عثمان‬ ‫تمت المراجعة بواسطة‬ ‫محمد فراج‬‫1‬
  • ‫الفهرس‬ Subject Page Number 1-1 Virtual Consoles and Terminals 5 1-1-1 The consoles 5 1-1-2 Logging into FreeBSD 6 1-1-3 Multiple Consoles 7 1-1-4 The /etc/ttys File 7 1-1-5 Single User Mode Console 8 1-1-6 Changing Console Video Mode 8 1-2 Permissions 9 1-2-2 Symbolic Permissions 10 1-2-3 FreeBSD File Flags 11 1-3 Directory Structure 12 1-4 Disk Organization 14 1-5 Mounting and Unmounting File Systems 19 1-5-1 The fstab File 19 1-5-2 The mount Command 20 1-5-3 The unmount Command 20 1-6 Processes 21 1-7 Daemons, Signals, and Killing Processes 24 1-8 Shells 26 1-8-2 Changing Your Shell 27 1-9 Text Editor 28 1-10 Devices and Device Nodes 29 1-10-2 Creating Device Nodes 29 1-10-2-1 DEVFS (DEVice File System) 29 1-11 Binary Formats 302
  • ‫ِفزبػ اٌّظطٍؾبد‬ Virtual Consoles and Terminals Permissions Directory Structure Disk Organization Daemons, Signals, and Killing Processes Shells Text Editor Devices and Device Nodes Binary Formats File system Kernel Directory PPP UFS3
  • ‫موجز عه الموضوع‬ FreeBSD operating ( ‫٘زا اٌفظً ع١زؾذس ػٓ أُ٘ ا٤ٚاِش ٚاٌٛظبئف اٌزٟ رخض‬ )system. ‫ ٌزا إرا وٕذ عذ٠ذ‬UNIX operating system ٗ‫اٌىض١ش ِٓ ٘زٖ اٌّٛاد راد طٍخ ٚرشج‬ .‫ الشأ ٘زا اٌفظً ثؼٕب٠خ‬FreeBSD operating system ٟ‫ف‬ : ٍُ‫ثؼذ لشاءح ٘زا اٌفظً ,عززؼ‬ How to use the “virtual consoles” of FreeBSD.  How UNIX file permissions work along with understanding file flags in  FreeBSD. The default FreeBSD file system layout.  The FreeBSD disk organization.  How to mount and unmount file systems.  What processes, daemons, and signals are.  What a shell is, and how to change your default login environment.  How to use basic text editors.  What devices and device nodes are.  What binary format is used under FreeBSD.  How to read manual pages for more information. 4
  • Virtual Consoles and Terminals : 1.1 Text Terminal ٟ‫ ثبٌؼذ٠ذ ِٓ اٌطشق ِٕٙب وزبثخ ا٤ٚاِش ف‬FreeBSD َ‫٠ّىٓ اعزخذا‬ .‫ ثٙزٖ اٌطش٠مخ‬FreeBSD َ‫ عزىْٛ ِزبؽخ ٌه ػٕذ اعزخذا‬UNIX ‫وض١ش ِٓ ِشٚٔخ ٚلٛح‬ . FreeBSDٟ‫ ٚو١ف رغزخذُِٙ ف‬consoles and terminal ٛ٘ ‫ٚ٘زا اٌفظً ٠ششػ ِب‬ The consoles 1.1.1 ‫ رٍمبئ١ب ع١ؼشع ٌه‬graphical environment ً‫ ثشى‬FreeBSD ‫إرا ٌُ رىٓ اخزشد اْ ٠جذأ‬ :ٟ‫إٌظبَ ثؼذ اْ ٠فزؼ ٔبفزٖ ٌزغغ١ً اٌذخٛي ِشبثٙخ ٌ٣ر‬Additional ABI support:.Local package initialization:.Additional TCP options:.Fri Sep 20 13:01:06 EEST 2002FreeBSD/i386 (pc3.example.org) (ttyv0)login: :ٓ٠‫عزشٜ ش١ئب ٠شجٗ ٘زا ٌٚىٕٕب عٕٙزُ فمؾ ثأخش عطش‬FreeBSD/i386 (pc3.example.org) (ttyv0) :ًّ‫ اٌزٞ ثذأ ٠ؼ‬system ٓ‫٘زا اٌغطش ٠ؾزٛٞ ػٍٝ ِؼٍِٛبد ػ‬ ‫ ٚاعّٙب‬Intel processor X86 architecture ٍٝ‫ رؾزٛٞ ػ‬FreeBSD console ٖ‫٘ز‬ (pc3.example.org) .ُ‫ ٌٙب اع‬UNIX machine ً‫ٍِؾٛظخ :و‬ . terminal ٛ٘ (ttyv0) ٚ : ‫ٚأخ١شا‬ ًlogin: 5
  • ‫فٟ ٘زا اٌغضء ٠غت وزبثخ اعُ اٌّغزخذَ ٚع١زُ ششػ ٘زا فٟ اٌفظً ا٨ؽك.‬ ‫1.1.1 ‪Logging into FreeBSD‬‬ ‫٠ؼذ ‪ٚ FreeBSD‬اؽذ ِٓ ‪٘ٚ multiuser ,multiprocessing system‬زا اٌٛطف ٠طٍك‬‫ػٍٝ أٞ ٔظبَ ٠ّىٓ اْ ٠غزخذَ ػٓ ؽش٠ك اٌؼذ٠ذ ِٓ اٌّغزخذِ١ٓ اٌز٠ٓ ٠ؼٍّْٛ‬ ‫ػٍٝ اٌؼذ٠ذ ِٓ اٌجشاِظ فٟ ٔفظ اٌٛلذ.‬ ‫وً ‪٠ multiuser system‬غت اْ ٠ّ١ض ث١ٓ وً ِغزخذَ ٌٗ, ٚ٘زا ٠ؾذس ثطٍت‬ ‫اي ‪ username and password‬وً ِشح ػٕذ ا٦عزخذاَ.‬ ‫وً ِغزخذَ ٌٗ ‪ّ٠ ٨ username‬ىٓ رىشاسٖ ٚ‪ password‬خبطخ ثٗ ٠غت اْ ٠مَٛ‬ ‫ثئدخبٌٙب لجً اْ ٠غزخذَ أٞ ثشٔبِظ.‬ ‫ٌزا ثؼذ اْ ٠مَٛ ‪ FreeBSD boot‬عزظٙش اٌشبشخ اٌزبٌ١خ.‬‫:‪login‬‬ ‫فٍٕفشع اْ اعُ اٌّغزخذَ :‪Moataz‬‬‫‪login: Moataz‬‬‫:‪Password‬‬ ‫لُ ثئدخبي ‪ password‬اٌخبص ثـ ‪ٌٚ Moataz‬ىٕٗ ٌٓ ٠ظٙش ٌزا ٨ رمٍك ؽ١بي رٌه ا٢ْ‬ ‫,ٌٕمٛي اْ ٘زا ٤عجبة إِٔ١ٗ ‪. security reasons‬‬ ‫إرا لّذ ثئدخبي ‪ password‬طؾ١ؾخ عزشٜ )‪٠ MOTD (message of the day‬زجؼٙب‬ ‫)‪٘ command prompt (a #, $, or % character‬زا ٠ؼٕٟ أٔه عغٍذ اٌذخٛي‬ ‫ثطش٠مخ طؾ١ؾخ.‬ ‫6‬
  • Multiple Consoles 1.1.1 ِٓ ‫ ٠ّىٕه اْ رؼًّ ػٍٝ أوضش‬FreeBSD ٟ‫ ع١ذ, ٌٚىٓ ف‬UNIX ٟ‫اعزخذاَ ٔبفزٖ ٚاؽذح ف‬ .‫ثشٔبِظ فٟ ٔفظ اٌٛلذ‬ ِٓ ‫ٌزا إرا اعزخذِذ ٔبفزح ٚاؽذٖ ٌٓ رىْٛ ؽش٠مٗ ع١ذح ِغ ٔظبَ ٠ّىٓ اْ ٠ذ٠ش اٌؼذ٠ذ‬ . Virtual consoles ‫اٌجشاِظ فٟ ٔفظ اٌٛلذ, ٕٚ٘ب ٠أرٟ دٚس‬ ُٕٙ١‫ ٚ٠ّىٕه اْ رٕزمً ث‬virtual consoles ِٓ ‫٠ّىٓ اْ ٠ؼًّ ػٍٝ اٌؼذ٠ذ‬FreeBSD‫ ثزٕمٍه ٚؽفع ٚرؾٛ٠ً ِذخ٩د ٌٛؽخ‬FreeBSD ُ‫ثئعزخذاَ ٌٛؽخ اٌّفبر١ؼ ثغٌٙٛخ ٚع١ٙز‬ . ‫ آخش‬console ٌٝ‫ إ‬console ِٓ ‫اٌّفبر١ؼ ػٕذ أزمبٌه‬ ٝ‫ ؽز‬Alt-F1, Alt-F2َ‫ ثبعزخذا‬FreeBSD ‫ٚلذ رُ ؽغض ثؼغ اٌّفبر١ؼ ٌٍزؾٛ٠ً ث١ٓ ٔٛافز‬ .‫ ,ٚػٕذ اٌزؾٛي ِٓ ٔبفزٖ إٌٝ أخشٜ ٨ رزٛلف ػٓ اٌؼًّ ػٕذِب رىْٛ غ١ش ظب٘شح‬Alt-F8 1.1.4 The /etc/ttys File ٞٛ‫ ٚوً عطش ٠جذأ ثـ(#) ٠ؾز‬virtual consoles 8 ٍٝ‫إْ ا٦ػذاداد ا٤عبع١خ رؾزٛٞ ػ‬.ttyv ‫ٚ ٠ّىٕه ِؼشفزُٙ اْ وً ٚاؽذ ٠جذأ ثـ‬virtual console or a terminal ‫ػٍٝ اػذاداد ي‬ # name getty type statuscomments # ttyv0 "/usr/libexec/getty Pc" cons25 on secure # Virtual terminals ttyv1 "/usr/libexec/getty Pc" cons25 on secure ttyv2 "/usr/libexec/getty Pc" cons25 on secure ttyv3 "/usr/libexec/getty Pc" cons25 on secure ttyv4 "/usr/libexec/getty Pc" cons25 on secure ttyv5 "/usr/libexec/getty Pc" cons25 on secure ttyv6 "/usr/libexec/getty Pc" cons25 on secure ttyv7 "/usr/libexec/getty Pc" cons25 on secure ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure 7
  • Single User Mode Console 1.1.1 ‫ ٚ إػذاداد ٌٙزا‬virtual consoles ٞ‫ ٚاؽذح ٚ٨ ٠ٛعذ أ‬console ‫فٟ ٘زا إٌظبَ عزغذ فمؾ‬ . console ‫/ اثؾش ػٓ اٌغطش اٌجبدا ثـىٍّخ‬etc/ttys ٟ‫إٌظبَ ٠ّىٓ اْ رغذ٘ب أ٠ؼب ف‬# name getty type status comments## If console is marked "insecure", then init will ask for the root password# when going to single-user mode.console none unknown off secure : ‫ٍِؾٛظخ‬ root ‫ ٌٚىٓ ٠غت اْ رىْٛ ػٍٝ ػٍُ ثـ‬secure to insecure ِٓ ‫٠ّىٕه اْ رؼذي ا٨ػذاداد‬ ‫ ٚإرا ٔغ١زٗ ٌ١ظ ِٓ اٌّغزؾ١ً رشغ١ً إٌظبَ صبٔ١ب ٌٚىٕٗ طؼت إرا‬password .FreeBSD ًٌ ‫وٕذ ِغزخذَ عذ٠ذ‬ Changing Console Video Mode 1.1.1 ‫4201 أٚ أٞ ِغبؽخ‬x768 , 1280x1024 ٍٝ‫ إػذادارٙب اٌشئ١غ١خ ػ‬FreeBSD video mode recompile the Kernel َٛ‫ِبخٛرح ِٓ وبسد اٌشبشخ ,٠ّىٕه رغ١ش٘ب ٌٚىٓ ٠غت أٚ٨ اْ رم‬ .ٓ١١‫ثبػذاد٠ٓ اػبف‬options VESAoptions SC_PIXEL_MODE hardware ّٗ‫ اٌزٞ ٠ذػ‬video mode ٛ٘‫ ٠ّىٓ اْ رشٜ ِب‬Kernelً٠‫ثّغشد اْ لّذ ثزؼذ‬ vidcontrol َ‫اٌخبص ثه ثبعزخذا‬# vidcontrol -i mode َ‫ ثبعزخذا‬root console ٟ‫٠ّىٓ ثؼذ ِؼشفزه ٌٗ اْ رذخٍٗ ف‬# vidcontrol MODE_279 ‫ ػٓ ؽش٠ك‬boot ‫ ِمجٛي ٠ّىٓ اْ ٠ؼذ دائّب ثؼذ‬video mode ْ‫إرا وب‬allscreens_flags="MODE_279" 8
  • Permissions 1.1.1‫ ؽ١ش ٠ّىٕٗ اْ ٠مَٛ ثبٌؼذ٠ذ ِٓ اٌّٙبَ اٌزٟ ٌ١ظ‬FreeBSD multiuser operating systemhardware devices, ‫ث١ٕٙب طٍخ فٟ ٔفظ اٌٛلذ. ٚ٠ىْٛ إٌظبَ ِغئٛي ػٓ ِشبسوخ ٚإداسح‬ .َ‫ ٌىً ِغزخذ‬peripherals, memory and CPU time fairly permission ٟ‫ٚثغجت اْ إٌظبَ ٠زؼبًِ ِغ اٌؼذ٠ذ ِٓ اٌّغزخذِ١ٓ, ٠زؾىُ إٌظبَ ٚ٠ؼط‬3 octets ٟ‫ ف‬permissionsٓ٠‫ ٠زُ رخض‬who can read, write and execute the resources one to the owner ,one to the group it belongs to ‫ ٠ٕمغُ إٌٝ ص٩س لطغ‬octet ً‫ٚو‬ :‫ ,ٚ٘زا اٌزّض١ً اٌشلّٟ ٠ؼًّ ٘ىزا‬and one for everyone else Value Permission Directory Listing 0 No read, no write, no execute --- 1 No read, no write, execute --x 2 No read, write, no execute -w- 3 No read, write, execute -wx 4 Read, no write, no execute r-- 5 Read, no write, execute r-x 6 Read, write, no execute rw- 7 Read, write, execute rwx ‫ ِضبي‬file permission ‫ ٌزظٙش‬ls –l ‫٠ّىٕه اعزخذاَ أِش‬% ls –ltotal 530-rw-r--r-- 1 root wheel 512 Sep 5 12:31 myfile-rw-r--r-- 1 root wheel 512 Sep 5 12:31 otherfile-rw-r--r-- 1 root wheel 7680 Sep 5 12:31 email.txt... :‫ٚ٘زا ششػ اٌٍّف‬-rw-r--r-- (directory, a ْٛ‫ػ٩ِخ )-( الظٝ اٌشّبي رش١ش إٌٝ أٗ ٍِف ػبدٞ ؽ١ش ٠ّىٓ اْ ٠ى‬ special character device, a socket, or any other special pseudo-file device) group that the file belong ‫ ,ثؼذ٘ب ص٩س ي‬owner of the file ‫اٌض٩س ؽشٚف ثؼذ٘ب ٟ٘ ي‬ . for everyone else ‫ ,ثؼذ٘ب ص٩س ي‬toread, write to the owner ,read to the group and read to everyone else ‫ٕٚ٘ب ِٕؼ أِش‬ .permission ‫ٚ٠ّىٓ رّض١ً ٘زا ؽجمب ٌٍغذٚي أػ٩ٖ 466 .ؽ١ش ٠ّضً اٌشلُ ص٩س اعضاء ِٓ اي‬ . 9
  • read , write and ُٙ‫ ؽ١ش ٠ّىٓ اػطبئ‬files ً‫ ِض‬directories ًِ‫٠ّىٕه ا٠ؼب اْ رؼب‬ ٍٗ‫ رغزط١غ اْ رغؼ‬directory as execute ‫ ٌٚىٓ ػٕذِب رؼذ‬execute permission . traversed so you can cd (change directory) ‫ ٌٚىٟ رغزط١غ اْ رّغؼ‬read permission ‫ ٠غت اػطبء‬directory listing ‫ٌٚىٟ رمَٛ ثـ‬‫ اٌزٞ ٠ؾزٛٞ ػٍٝ اٌٍّف‬directory ًٌ write and execute permission ‫ٍِف ٠غت اػطبء‬ . Symbolic Permissions 1.1.1 ٟ٘ٚ symbolic permissions َ‫ ثب٨سلبَ ٠ّىٕه اعزخذا‬permission ‫ثذ٨ ِٓ اػطبء اي‬ : (who) (action) (permissions) ‫رغزخذَ ػ٩لخ‬ option Letter represents (who) U User (who) G Group owner (who) O Other (who) A All (action) + Adding permissions (action) - Removing permissions (action) = Explicitly set permissions (permissions) R Read (permissions) W Write (permissions) X Execute (permissions) T Sticky bit (permissions) S Set UID or GID : ‫٠ّىٓ اعزخذاَ ا٨ِش وّب فٍغبثك‬%chmod go=file execute permission ‫ ٚ٠ؼطٟ أِش‬group and world write permission ‫٘زا ا٨ِش ٠ّغؼ‬ .‫ٌٍغّ١غ‬% chmod go-w,a+x FILE 11
  • FreeBSD File Flags 1.1.1 ‫ ٚ٘زا ٌٍٍّفبد فمؾ ٌٚ١ظ‬Security and control ِٓ ‫ رغزخذَ ٨ػطبء اٌّض٠ذ‬File flags .directories. ّٟ‫ػٕذ اعزخذاَ ٘زٖ اٌخبط١خ ٠ّىٕه اٌزأوذ أٗ ٨ اؽذ ٠ّىٕٗ ِغؼ أٚ اعزجذاي ٍِف ِؾ‬ ‫ رغزخذَ أِش‬file1 ٍٝ‫ ػ‬file flag ً‫ٌزفؼ‬# chflags sunlink file1 :َ‫ٚ٦ٌغبء٘ب اعزخذ‬# chflags nosunlink file1 flags of file1 ‫٨ظٙبس‬#ls –lo file1Output will look like :-rw-r--r-- 1 trhodes trhodes sunlnk 0 Mar 1 05:54 file1 11
  • 1.3.1 Directory StructureThe FreeBSD directory hierarchy is fundamental to obtaining an overallunderstanding of the system.a brief overview of the most common directories. directory Description / Root directory of the file system. /bin/ User utilities fundamental to both single-user and multi- user environments. /boot/ Programs and configuration files used during operating system bootstrap. /boot/defaults/ Default bootstrapping configuration files /dev/ Device nodes /etc/ System configuration files and scripts. /etc/defaults/ Default system configuration files /etc/mail/ Configuration files for mail transport agents such as send mail /etc/namedb/ named configuration files /etc/periodic/ Scripts that are run daily, weekly, and monthly /etc/ppp/ ppp configuration files /mnt/ Empty directory commonly used by system administrators as a temporary mount point. /proc/ Process file system /rescue/ Statically linked programs for emergency recovery /root/ Home directory for the root account. /sbin/ System programs and administration utilities fundamental to both single-user and multi-user environments. /tmp/ Temporary files. The contents of /tmp are usually NOT preserved across a system reboot. A memory-based file system is often mounted at /tmp. This can be automated using the tmpmfs-related variables of rc.conf /usr/ The majority of user utilities and applications. /usr/bin/ Common utilities, programming tools, and applications. /usr/include/ Standard C include files. /usr/lib/ Archive libraries. /usr/libdata/ Miscellaneous utility data files. /usr/libexec/ System daemons & system utilities (executed by other 12
  • programs). /usr/local/ Local executables, libraries, etc. Also used as the default destination for the FreeBSD ports framework. Within /usr/local, the general layout sketched out by hier for /usr should be used. Exceptions are the man directory, which is directly under /usr/local rather than under /usr/local/share, and the ports documentation is in share/doc/port. /usr/obj/ Architecture-specific target tree produced by building the /usr/src tree. /usr/ports/ The FreeBSD Ports Collection (optional). /usr/sbin/ System daemons & system utilities (executed by users). /usr/share/ Architecture-independent files. /usr/src/ BSD and/or local source files. /usr/X11R6/ X11R6 distribution executables, libraries, etc (optional). /var/ Multi-purpose log, temporary, transient, and spool files. A memory-based file system is sometimes mounted at /var. This can be automated using the varmfs-related variables of rc.conf(5) (or with an entry in /etc/fstab; see mdmfs(8)). /var/log/ Miscellaneous system log files. /var/mail/ User mailbox files. /var/spool/ Miscellaneous printer and mail system spooling directories. /var/tmp/ Temporary files. The files are usually preserved across a system reboot, unless /var is a memory-based file system. /var/yp/ NIS maps.13
  • Disk Organization 1.1 case-ٟ٘ٚ. ‫ أْ ٠غزخذَ ٌٍجؾش ػٓ اٌٍّفبد ٘ٛ اعُ اٌٍّف‬FreeBSD ِٓ ‫أطغش ٚؽذح‬ .ْ٩‫ ٍِفبْ ِٕفظ‬readme.txt ٚReadme.txt ْ‫ ، ِّب ٠ؼٕٟ أ‬sensitiveٚ‫ اٌٍّف ٌزؾذ٠ذ ِب إرا وبْ اٌٍّف ٘ٛ ثشٔبِظ، أٚ ِغزٕذ، أ‬extension َ‫ ٨ ٠غزخذ‬FreeBSD .‫أٞ شىً آخش ِٓ اٌج١بٔبد‬‫ لذ ٨ رؾزٛٞ ػٍٝ ٍِفبد ، أٚ أٔٙب لذ رؾزٛٞ ػٍٝ ػذح‬directories ٟ‫٠زُ رخض٠ٓ اٌٍّفبد ف‬ ‫ أخشٜ، ِّب ٠غّؼ ٌه ٌجٕبء‬directories ٍٝ‫ِئبد ِٓ اٌٍّفبد .٠ّىٓ أْ رؾزٛٞ أ٠ؼب ػ‬ُ١‫ داخً ثؼؼٙب اٌجؼغ . ٘زا ٠غؼً ِٓ ا٨عًٙ ثىض١ش ٌزٕظ‬directories ًٌ ِٟ‫اٌزغٍغً اٌٙش‬ .‫اٌج١بٔبد اٌخبطخ ثه‬ ‫ ثئػطبء اعُ اٌٍّف أٚ اٌذٌ١ً، ، /، رٍ١ٙب أٞ أعّبء‬directories ٚ ‫٠زُ اٌشعٛع إٌٟ اٌٍّفبد‬ ٍٝ‫ ، اٌزٞ ٠ؾزٛٞ ػ‬directory named Foo ‫ ا٤خشٜ اٌؼشٚس٠خ .إرا وبْ ٌذ٠ه‬directories ٌٝ‫ ، صُ ا٨عُ اٌىبًِ، أٚ اٌّغبس إ‬Readme.txt ‫ ، اٌزٞ ٠ؾزٛٞ ػٍٝ ٍِف‬directory bar . foo/bar/readme.txt. ٛ٘ ‫اٌٍّف‬ ٍٝ‫ ٠ؾزٛٞ ػ‬File System ً‫ .و‬File system ٟ‫ ٚاٌٍّفبد ف‬directories ٓ٠‫٠زُ رخض‬. File System ‫ ٌٙزا‬root directory ٝ‫ ٚاؽذ ثبٌؼجؾ ػٍٝ أػٍٝ ِغزٜٛ ، ٚ ٠ذػ‬directory .ٜ‫ أخش‬directories ٍٝ‫ ٠ّىٓ اْ رؾزٛٞ ػ‬root directory ‫٘زا‬ . C:/ foo/bar/readme.txt ً‫ ِض‬path nameٍٝ‫ ٨ ٠ؾزٛٞ ػ‬FreeBSD a1,a2 as other directories ٖ‫ 3 ٚوً ُِٕٙ ػٕذ‬file System A,B and C ‫افزشع أٔه ػٕذن‬ . B and C ‫ٚوزٌه‬ .ً‫ وّب ثبٌشى‬root file system ٛ٘ A ْٛ‫ع١ى‬ a1 ‫ ثـ‬B ‫ .ع١غزجذي‬a1 directory ٍٝ‫ ٌٗ ػ‬mount ًّ‫ ٚ ٔمَٛ ثؼ‬B ‫صُ ٔفشع أْ أؽؼشٔب‬ :ٟ‫ٚع١ظٙش اٌشىً و٥ر‬ 14
  • ‫وً اٌٍّفبد اٌّٛعٛدح فٟ 2‪ّ٠ b1 , b‬ىٓ اٌٛطٛي اٌ١ٗ ػٓ ؽش٠ك 2‪/a1/b1 or /a1/b‬‬‫ٚوً اٌٍّفبد اٌّٛعٛدح فٟ 1‪ a‬رُ اخفبء٘ب ِؤلذ ,ٚع١زُ اظٙبس٘ب إرا لّٕب ‪unmount for‬‬ ‫1‪.B from a‬‬ ‫ٚ٠ّىٓ ا٠ؼب اْ ٔمَٛ ثـ ‪ mount for C‬إٌٝ 1‪ b‬ف١ىْٛ و٥رٟ:‬ ‫أٚ ٔمَٛ ثـ ‪ mount for C‬إٌٝ ‪ِ A‬جبششح و٥رٟ:‬‫51‬
  • ‫إٔه رمَٛ ثئػذاد ‪ File Systems‬ػٕذِب رمَٛ ثـ ‪ ٨ٚ FreeBSD installation‬رمَٛ ثزغ١شُ٘ إٌٝ‬ ‫إرا لّذ ثبػبفخ ‪. new disk‬‬ ‫ٕٚ٘بن ِضا٠ب ٚػ١ٛة ٨عزؼّبي ‪. one big file system‬‬ ‫ِضا٠ب اعزخذاَ ‪: multiple file system‬‬ ‫‪ّ٠ٚ ‬ىٕٗ اػطبئه ِخزٍف اٌخ١بساد ‪ for mounting‬ػٍٝ عج١ً اٌّضبي ، ِغ اٌزخط١ؾ‬ ‫اٌذل١ك ، ٠ّىٓ رشو١جٗ ػٍٝ ‪ root file system‬وأٔٗ ‪ِّ ، read-only‬ب ٠غؼً ِٓ‬ ‫اٌّغزؾ١ً ثبٌٕغجخ ٌه ٌؾزف ػٓ غ١ش لظذ أٚ رؼذ٠ً ٍِف ؽشعخ.‬ ‫وّب اْ فظً ‪ّٕ٠ writable file systems‬غ ‪ suid and guid bits‬اْ رؾذس رغ١ش ِّب‬ ‫٠ؼذٞ اٌّض٠ذ ِٓ اٌؾّب٠خ.‬ ‫‪٠ FreeBSD ‬ؾغٓ رٍمبئ١ب رخط١ؾ اٌٍّفبد ػٍٝ ‪ ،file system‬اػزّبدا ػٍٝ و١ف١خ‬ ‫اعزخذاَ ‪ٚ File system‬ػٍٝ ٘زا فئْ ٔظبَ اٌٍّفبد اٌزٟ رؾزٛٞ ػٍٝ اٌؼذ٠ذ ِٓ‬ ‫اٌٍّفبد اٌظغ١شح اٌزٟ رزُ وزبثزٙب ثشىً ِزىشس ع١ىْٛ ٌٙب رخط١ؾ ِخزٍف ٠ؾزٛٞ‬ ‫ػٍٝ ػذد ألً ِٓ أوجش اٌٍّفبد .ٌٚىٓ ٚعٛد ‪ٚ file system‬اؽذ وج١ش ع١غؼً ٘زا‬ ‫اٌزؾغ١ٓ ٠ٕٙبس.‬ ‫‪ FreeBSDs file systems ‬لٛ٠خ عذا ٚ٠ٕجغٟ أْ رفمذ اٌغٍطخ .ِٚغ رٌه، ٠ّىٓ ٌفمذاْ‬‫اٌطبلخ فٟ ٌؾظخ ؽشعخ اٌؼشس ثـٙ١ىً ‪file system‬ػٓ ؽش٠ك رمغ١ُ اٌج١بٔبد ػجش ‪file‬‬ ‫‪ِ systems‬زؼذدح ، ِّب ٠غؼً ِٓ ا٤عًٙ ثبٌٕغجخ ٌه ٨عزؼبدح ِٓ إٌغخخ‬ ‫ا٨ؽز١بؽ١خ ‪ backup‬ؽغت اٌؼشٚسح.‬ ‫ِضا٠ب اعزخذاَ ‪: single file system‬‬‫‪ٌٙ File systems ‬ب ؽغُ صبثذ .إرا لّذ ثئٔشبء ‪ file system‬ػٕذ ‪FreeBSD installation‬‬ ‫ٚاػطبئٙب ؽغُ ِؾذد، لذ رىزشف فٟ ٚلذ ٨ؽك أٔه رؾزبط ٌغؼً ‪ partition‬اوجش .‬ ‫ٚ٘زا ٨ ٠زؾمك ثغٌٙٛخ دْٚ إٌغخ ا٨ؽز١بؽٟ ‪ٚ ،backup‬إػبدح ثٕبء‪ِ file system‬غ‬ ‫اٌؾغُ اٌغذ٠ذ، صُ اعزؼبدح اٌج١بٔبد‬ ‫61‬
  • ِٓ ‫ ِغبؽخ‬FreeBSD َ‫ , ٠مذ‬swap spaceً‫ ٠غزخذَ أ٠ؼب ِغبؽخ ِٓ أع‬FreeBSD ‫اٌزاوشح ا٨فزشاػٟ ,٠غّؼ ٘زا اٌىّج١ٛرش اٌزظشف وّب ٌٛ أْ ِغبؽزٗ أوضش ِٓ اٌزاوشح‬ ‫اٌّٛعٛدح ػٕذِب رٕفذ اٌزاوشح رزؾشن ثؼغ اٌج١بٔبد اٌزٟ ٨ رغزخذَ ؽبٌ١ب إٌٝ اٌزاوشح‬ .‫ا٨فزشاػ١خ‬ : ‫ ٚثؼغ ا٨رفبل١بد اٌّشرجطخ ثٙب‬partitions ‫ثؼغ‬ Partition Convention A Normally contains the root file system B Normally contains swap space C Normally the same size as the enclosing slice. This allows utilities that need to work on the entire slice (for example, a bad block scanner) to work on the c partition. You would not normally create a file system on this partition. D Partition d used to have a special meaning associated with it, although that is now gone and d may work as any normal partition. .‫ شش٠ؾخ‬slice ٝ‫ ٠ذػ‬file system ٍٝ‫ ٠ؾزٛٞ ػ‬partition ً‫و‬ FreeBSD from UNIX ‫، ِٚشح أخشٜ، ٚ٘زا ٘ٛ ثغجت اسرجبؽ‬FreeBSD ‫ ٘ٛ ِظطٍؼ‬Slice .4 ٌٝ‫ ٠زُ رشل١ُ اٌششائؼ، اثزذاء ِٓ 1 إ‬backgroundُ‫ٚأخ١شا، ٠ زُ رؾذ٠ذ وً لشص ػٍٝ إٌظبَ اعُ اٌمشص ٠جذأ ِغ سِض ٠ش١ش إٌٝ ٔٛع اٌمشص، ص‬ُ‫ ، اٌمشص رشل١ُ ٠جذأ فٟ 0 ٠ز‬slides ‫ػذد، ِش١شا إٌٝ اٌمشص اٌزٞ ٘ٛ ػٍ١ٗ .ٚػٍٝ ػىظ‬ :‫عشد اٌشِٛص اٌّشزشوخ اٌزٟ عٛف رشا٘ب فٍغذٚي‬ Code Meaning Ad ATAPI (IDE) disk Da SCSI direct access disk Acd ATAPI (IDE) CDROM Cd SCSI CDROM Fd Floppy disk : ‫ِضبي‬ Name Meaning Ad0s1a The first partition (a) on the first slice (s1) on the first IDE disk (ad0). Da1s2e The fifth partition (e) on the second slice (s2) on the second SCSI disk (da1). 17
  • ٍٝ‫ ٌج١ئخ رطٛ٠ش ِزىبٍِخ اٌمشص ا٤ٚي رؼٍك ػ‬FreeBSD ‫٠ظٙش ٘زا اٌشعُ اٌج١بٟٔ ػشع‬ 2 ‫إٌظبَ. ٔفزشع أْ اٌمشص ٘ٛ 4 غ١غب ثب٠ذ فٟ اٌؾغُ ، ٚ٠ؾزٛٞ ػٍٝ اصٕ١ٓ ِٓ ششائؼ‬ٞٛ‫ ٚ٠ؾز‬c:،MS-DOS disk ٍٝ‫). اٌشش٠ؾخ ا٤ٌٚٝ رؾزٛٞ ػ‬MS-DOS partitions( ‫غ١غبثب٠ذ‬ .swap partition ٚ ،‫. ٌٗ ص٩صخ ألغبَ اٌج١بٔبد‬FreeBSD instllation ‫ػٍٝ شش٠ؾخ اٌضبٔ١خ‬ e for /var directory ، A for root file system , file system َ‫ٚع١ىْٛ ثبٌض٩صخ ألغب‬ . f for /usr directory hierarchy ٚ hierarchy18
  • Mounting and Unmounting File Systems 1.1‫ وفشٚع اٌزٟ ٠ّىٓ اْ ٠ىْٛ ٌٙب‬directories ٟ‫ ٘ٛ وٍشغشح ٚثبل‬file system ًٌ ‫أفؼً ٚطف‬ .‫ٟ٘ ا٠ؼب فشٚع خبطخ ثٙب‬ . file systems ٟ‫ ف‬directories ً‫ٕٚ٘بن أعجبة ػذ٠ذح ٌفظ‬ ‫/ ٘ٛ شٟء‬var form / ً‫ ٌ١ظ فىشٖ ع١ذٖ ٌزٌه فئْ فظ‬root file system ٥ِ ْ٤ ٨ٚ‫أ‬ .ً‫ِفؼ‬ The fstab File 1.1.1 .‫ رٍمبئ١ب‬mounting ‫/ ٚ٠ؾذس‬etc/fstab ٟ‫ رىْٛ ف‬file systems , booting ‫خ٩ي ػٍّ١خ‬ :ٗ١ٌ‫/ ٠ؾزٛٞ ػٍٝ لبئّٗ ِٓ اٌغطٛس ٌٙب اٌظ١غخ اٌزب‬etc/fstab device /mount-point fstype options dumpfreq passno device A device name (which should exist) Mount-point A directory (which should exist), on which to mount the file system. Fstype The file system type to pass to mount. The default FreeBSD file system is ufs. Options Either rw for read-write file systems, or ro for read-only file systems, followed by any other options that may be needed. A common option is noauto for file systems not normally mounted during the boot sequence. Other options are listed in the mount(8) manual page. Dumpfreq This is used by dump(8) to determine which file systems require dumping. If the field is missing, a value of zero is assumed. passno This determines the order in which file systems should be checked. File systems that should be skipped should have their passno set to zero. The root file system (which needs to be checked before everything else) should have its passno set to one, and other file systems passno should be set to values greater than one. If more than one file systems have the same passno then fsck(8) will attempt to check file systems in parallel if possible. 19
  • The mount Command 1.1.1 ٗ‫أوضش ؽش٠مٗ ِؼشٚف‬ # mount device mountpoint : ‫ٕ٘بن اٌؼذ٠ذ ِٓ ا٦خز١بساد ٌٚىٓ أشٙش٘ب‬ -a Mount all the file systems listed in /etc/fstab. Except those marked as “noauto”, excluded by the -t flag, or those that are already mounted. -d Do everything except for the actual mount system call. This option is useful in conjunction with the -v flag to determine what mount(8) is actually trying to do. -f Force the mount of an unclean file system (dangerous), or forces the revocation of write access when downgrading a file systems mount status from read-write to read-only. -r Mount the file system read-only. This is identical to using the ro argument to the -o option. -t fstype Mount the given file system as the given file system type, or mount only file systems of the given type, if given the -a option. “ufs” is the default file system type. -u Update mount options on the file system. -v Be verbose. -w Mount the file system read-write. -o option takes a comma-separated list of the options, including the following: Noexec Do not allow execution of binaries on this file system. This is also a useful security option. Nosuid Do not interpret setuid or setgid flags on the file system. This is also a useful security option. The unmount Command 1.1.1 . file system ‫ ٠ّىٕٗ رذِ١ش اٌىّج١ٛرش أٚ اٌج١بٔبد ػٍٝ اي‬unmounting file systems ‫وش٘ب‬ .unmount all mounted file systems ‫- رغزخذَ ي‬A ٚ-a : ‫ٍِؾٛظخ‬ . file systemًٌ unmount ‫٨ رمَٛ ثـ‬21
  • ‫1.1 ‪Processes‬‬ ‫‪ٔ ٛ٘ FreeBSD‬ظبَ رشغ١ً ِزؼذد اٌّٙبَ .ٚ٘زا ٠ؼٕٟ أٔٗ ٠جذٚ وّب ٌٛ أْ أوضش ِٓ ثشٔبِظ‬ ‫ٚاؽذ ٘ٛ اٌزٞ ٠شزغً فٟ آْ ٚاؽذ .ٚ٠غّٝ وً ثشٔبِظ ٠ؼًّ فٟ ٔفظ اٌٛلذ ػٍّ١خ‬‫‪, process‬فئْ وً أِش ٠جذء ٠شغ ً ػٍٝ ا٤لً ػٍّ١خ عذ٠ذح، ٕٚ٘بن ػذد ِٓ اٌؼٍّ١بد اٌزٟ‬ ‫رمَٛ ثزشغ١ً إٌظبَ فٟ وً ٚلذ ٚ٨ رزٛلف ، ٚاٌؾفبظ ػٍٝ إٌظبَ ٠ؼًّ.‬ ‫٠زُ اٌزؼشف ثشىً فش٠ذ وً ػٍّ١خ ثٛاعطخ ػذد ٠غّٝ ِؼشف اٌؼٍّ١خ، أٚ ‪ِٚ ،PID‬ضً‬ ‫اٌٍّفبد، وً ػٍّ١خ ٌٙب ِبٌه ٚاؽذ ِٚغّٛػخ .٠زُ اعزخذاَ اٌّؼٍِٛبد اٌّبٌه ٚاٌّغّٛػخ‬ ‫ٌزؾذ٠ذ ِب ٟ٘ اٌٍّفبد ٚا٤عٙضح اٌزٟ ٠ّىٓ أْ رفزؼ ، ٚرٌه ثبعزخذاَ ‪. permissions‬‬ ‫ِؼظُ اٌؼٍّ١بد ٌٙب ػٍّ١خ اطٍ١ٗ . ٚػٍّ١خ ا٤طٍ١خ ٟ٘ اٌؼٍّ١خ اٌزٟ ثذأد ِٕٙب .ػٍٝ‬‫عج١ً اٌّضبي، إرا وٕذ رىزت ا٤ٚاِش إٌٝ ‪ shell‬فٟٙ ػٍّ١خ ، ٚأ٠خ أٚاِش رشغ١ً اخشٜ رىزجٙب‬ ‫ٟ٘ ػٍّ١بد ٟ٘ أ٠ؼب .ٚ وً ػٍّ١خ ف١ غ١ىْٛ ‪ ٟ٘ shell‬اطٍٙب . اعزضٕبء ‪process called‬‬ ‫)‪ ٛ٘ (init‬دائّب أٚي ػٍّ١خ، ٌزٌه ‪ٌٙ PID‬ب ٟ٘ دائّب 1 .ثذء ‪INIT‬رٍمبئ١ب ثٛاعطخ ٔٛاح‬ ‫‪ FreeBSD Kernel‬ػٕذِب ٠جذأ إٌظبَ.‬ ‫ٕ٘بن اِشاْ ِّٙبْ ٌّؼشفخ اٌؼٍّ١بد ػٍٝ اٌغٙبص ‪ , PS and top‬أِش ‪٠ ps‬غزخذَ ٌؼشع‬ ‫لبئّخ صبثزٗ ثبٌؼٍّ١بد اٌغبس٠خ.‬ ‫أِش ‪ top‬وً اٌؼٍّ١بد اٌغبس٠خ ٚرؼذ٠ٍٙب وً ثؼغ صٛأٟ ٌزٌه ٠ّىٕه ِزبثؼخ اخش اٌزؼذ٠٩د.‬ ‫:‪Example‬‬ ‫‪% ps‬‬ ‫‪PID‬‬ ‫‪STAT‬‬ ‫‪TT‬‬ ‫‪TIME‬‬ ‫‪COMMAND‬‬ ‫892‬ ‫0‪P‬‬ ‫‪Ss‬‬ ‫01.10:0‬ ‫‪Tcsh‬‬ ‫8707‬ ‫0‪P‬‬ ‫‪S‬‬ ‫88.04:2‬ ‫‪xemacs mdoc.xsl‬‬ ‫)41.1.12-‪(xemacs‬‬ ‫39373‬ ‫0‪P‬‬ ‫‪I‬‬ ‫11.30:0‬ ‫‪xemacs freebsd.dsl‬‬ ‫)41.1.12-‪(xemacs‬‬ ‫03684‬ ‫0‪P‬‬ ‫‪S‬‬ ‫-‪2:50.89 /usr/local/lib/netscape‬‬ ‫-‪linux/navigator-linux‬‬ ‫‪4.77.bi‬‬ ‫03784‬ ‫0‪P‬‬ ‫‪Iw‬‬ ‫0.00:0‬ ‫)‪(dns helper‬‬ ‫)-‪(navigator-linux‬‬ ‫01227‬ ‫0‪P‬‬ ‫+‪R‬‬ ‫00.00:0‬ ‫‪Ps‬‬ ‫12‬
  • 390 P1 Is 0:01.14 Tcsh 7059 P2 Is+ 1:36.18 /usr/local/bin/mutt -y 6688 P3 Iws 1:36.18 Tcsh 10735 P4 Iws 0:00.00 Tcsh 20256 P5 Iws 0:00.00 Tcsh 262 V0 Iws 0:00.00 -tcsh (tcsh) 270 V0 Iws 0:00.00 /bin/sh /usr/X11R6/bin/startx - - -bpp 16 280 V0 Iw+ 0:00.00 xinit /home/nik/.xinitrc -- -bpp 16 284 V0 Iw+ 0:00.00 /bin/sh /home/nik/.xinitrc 285 V0 s 0:38.45 /usr/X11R6/bin/sawfish ٛ٘ . PID ‫ إٌٝ ػذد ِٓ ا٤ػّذح‬PS (1) ِٓ ‫وّب رشْٚ فٟ ٘زا اٌّضبي ، ٠زُ رٕظ١ُ ا٦خشاط‬ ،99999 ٌٝ‫ ثذءا ِٓ 1 ، رشرفغ إ‬PIDS ٓ١١‫ِ ؼشف ػٍّ١خ ثؾش فٟ ٚلذ عبثك . ٠زُ رؼ‬ TT ‫ إرا وبْ ثبٌفؼً ل١ذ ا٨عزخذاَ . اٌؼّٛد‬PIDS ‫ٚ٠ٍزف ؽٛي اٌؼٛدح إٌٝ ثذا٠خ ػٕذ ٔفبد‬ ‫ ٠ج١ٓ ؽبٌخ‬STAT . ٓ٘‫ اٌجشٔبِظ ٠ؼًّ ٚ ثأِبْ ٠ّىٓ رغبٍ٘ٙب فٟ اٌٛلذ اٌشا‬TTY ٓ١‫٠ج‬‫ ٘ٛ ِمذاس اٌٛلذ اٌزٞ رُ رشغ١ً اٌجشٔبِظ‬TIME ْ‫اٌجشٔبِظ، ِٚشح أخشٜ ،٠ّىٓ رغبٍ٘ٙب ثأِب‬ CPU --.ٟ‫ف‬ 22
  • : top ‫ِضً آخش ػٍٝ أِش‬% toplast pid: 72257; load averages: 0.13, 0.09, 0.03 up 0+13:38:33 22:39:1047 processes: 1 running, 46 sleepingCPU states: 12.6% user, 0.0% nice, 7.8% system, 0.0% interrupt, 79.7% idleMem: 36M Active, 5256K Inact, 13M Wired, 6312K Cache, 15M Buf, 408K FreeSwap: 256M Total, 38M Used, 217M Free, 15% InuseUSERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND PIDtop nik 28 0 1960K 1044K RUN 0:00 14.86% 1.42% 72257xemacs-21.1.14 nik 2 0 15280K 10960K select 2:54 0.88% 0.88% 7078XF86_SVGA nik 2 0 18636K 7112K select 5:36 0.73% 0.73% 281ً١‫ ِٓ ػٍّ١خ ِشبسوخ ٌزشغ‬PID ٓ١‫٠زُ رمغ١ُ ا٦ٔزبط إٌٝ لغّ١ٓ .أٚي خّغخ أعطش ٠ج‬ . َ‫ٚرؾّ١ً إٌظب‬ ‫اٌغضء اٌزٞ ٠ٍ١ٗ ٟ٘ عٍغٍخ ِٓ ا٤ػّذح اٌزٟ رؾزٛٞ ػٍٝ ِؼٍِٛبد ِشبثٙخ ٌّب خشط‬ PID, the username, the amount of CPU time ً‫ وّب وبْ ِٓ لجً ِض‬PS (1). ِٓ taken, and the command that was run 23
  • ‫‪1.7 Daemons, Signals, and Killing Processes‬‬ ‫ػٕذ رشغ١ً ِؾشسا ِٓ اٌغًٙ اٌغ١طشح ػٍٝ اٌّؾشس ، ٚ رغؼٍٗ رٌه ٌزؾّ١ً اٌٍّفبد ،‬ ‫ٍُٚ٘ عشا . ٠ّىٕه اٌم١بَ ثزٌه ٤ْ اٌّؾشس ٠مذَ رغٙ١٩د ٌٍم١بَ ثزٌه ، ٚ٤ْ اٌّؾشس ِشفك‬ ‫ػٍٝ ‪٠ ٌُ .terminal‬زُ رظّ١ُ ثؼغ اٌجشاِظ ٌ١زُ رشغ١ٍٙب ِغزّشح ِغ ِذخ٩د‬ ‫اٌّغزخذَ ، ٚؽزٝ أٔٙب رمطغ ا٦رظبي فٟ أٚي فشطخ .ػٍٝ عج١ً اٌّضبي ، خبدَ اٌٛ٠ت‬ ‫٠مؼٟ ؽٛي اٌ١َٛ ٌ ٩عزغبثخ ٌٍطٍجبد ػٍٝ شجىخ ا٦ٔزشٔذ ، فئٔٗ ػبدح ٨ ٠ؾزبط اٌٝ أٞ‬ ‫ِغبّ٘خ ِٕه . ثشاِظ اٌجش٠ذ ا٦ٌىزشٟٚٔ ٟ٘ ِضبي ػٍٝ ٘زا إٌٛع ِٓ اٌزطج١ك ا٠ؼب.‬ ‫ٔؾٓ ٔطٍك ػٍٝ ٘زٖ اٌجشاِظ ‪ٚ. daemons‬وبٔذ ‪ daemons‬ؽشفب فٟ ا٤عبؽ١ش اٌ١ٛٔبٔ١خ :‬ ‫رؼٕٟ ٨ خ١ش أٚ شش، ، إٌٝ ؽذ وج١ش ، ٚفؼٍذ اش١بء ِف١ذح ٌٍجشش٠خ ، ِضً اٌىض١ش ِٓ خٛادَ‬ ‫اٌٛ٠ت ٚخٛادَ اٌجش٠ذ ِٓ اٌ١َٛ رفؼً أش١بء ِف١ذح.‬ ‫فٟ ثؼغ ا٤ؽ١بْ عزؾزبط ٌ٧رظبي ثبي ‪ّ٠, daemon process‬ىٓ رٌه ػجش اْ رجؼش ٌٙب‬ ‫‪ٕ٘, signal‬بن اٌؼذ٠ذ ِٓ أٔٛاع اي ‪ّ٠ ٨ٚ, signals‬ىٕه اْ رجؼش ‪ signal‬إ٨ ًٌ ‪process‬اٌزٟ‬ ‫رٍّىٙب.‬‫ع١مَٛ ‪ FreeBSD‬ثجؼذ .‪ signals to apps‬فٟ ثؼغ اٌؾب٨د ,إرا وزت ثشٔبِظ ثطش٠مخ ع١ئخ‬ ‫, ٠مَٛ ‪ FreeBSD‬ثبسعبي )‪. segmentation violation signal (sigsegv‬‬ ‫ٕ٘بن ‪ two signals‬رغزخذَ ٦٠مبف اٌؼٍّ١ٗ, ‪ ٛ٘ SIGKILL. SIGTERM‬اوضش ؽش٠مخ إِٔٗ‬ ‫ٌٛلف اٌؼٍّ١ٗ ‪. Killing process‬ؽ١ش ٠ّىٓ ٌٍؼٍّ١ٗ اْ رٍزمؾ اي ‪ٚsignal‬رفُٙ أٔه رشد اْ‬ ‫رغٍك اٌؼًّ.‬ ‫‪ّ٠ ٨ SIGKILL‬ىٓ رغبٍ٘ٗ ثٛاعطخ اٌؼٍّ١ٗ ‪ , process‬إرا اسعٍذ ٘زٖ )‪signal (SIGKILL‬‬ ‫ع١مَٛ ‪ FreeBSD‬ثغٍك اٌؼٍّ١ٗ فٛسا.‬ ‫ثؼغ اي ‪ signals‬اٌزٟ ٠ّىٓ اْ رؾزبعٙب ا٠ؼب ٟ٘ 2‪SIGHUP ,SIGUSR1 and SIGUSR‬‬ ‫ؽ١ش ٠ّىٕه اعزخذاَ ‪ٌ SIGHUP‬غؼً اي ‪ process‬رؼ١ذ لشاءح ٍِف اٌزؼذ٠٩د ثذ٨ ِٓ‬ ‫ا٠مبف اٌخذِٗ ٚرشغ١ٍٙب ِٓ عذ٠ذ.‬ ‫42‬
  • :ً‫ وّب ثبٌّض‬signal to kill a process ‫٠ّىٕه اسعبي‬‫ ,ٚٔغؼً ٘زا اٌٍّف ٠مشا‬signal to (inetd configuration file) ً‫٘زا اٌّضبي ٠ظٙش و١ف رشع‬ . SIGHUP َ‫اٌزؼذ٠٩د ثبعزخذا‬ ‫ اٌزٞ ٠مَٛ ثبٌجؾش‬grep command ‫ ٚا٠ؼب‬PS command َ‫ ثبعزخذا‬PID ‫1-٠غت ِؼشفخ‬ .ٓ١‫ ِؼ‬string ٓ‫فٟ ِخشعبد ػ‬ % ps –ax | grep inetd 198 ?? IWs 0:00.00 inetd –Ww 198 ٛ٘ PID ْ‫إر‬ su َ‫ ٠غت اعزخذا‬root ‫ ٠غزخذَ ثٛاعطخ‬inetd ْ‫ ,ٚثغجت ا‬signal ‫ ٨سعبي‬kill َ‫2-اعزخذ‬ .٨ٚ‫ أ‬root ‫ٌ١ظجؼ‬ % su Password: # /bin/kill -s HUP 198 ‫ ٌؼٍّ١ٗ أذ‬KILL ‫ ٔبعؼ ٌٚىٓ إرا لّذ ثـ‬KILL ْ‫فٟ ِؼظُ ا٤ٔظّخ ٨ رظٙش ٌه أٞ سعبٌٗ ثب‬ :‫٨ رٍّىٙب ع١ؼشع‬ “kill: PID: Operation not permitted” :‫ٍِؾٛظخ‬: init ,process ID 1 ٟ‫ ثؼشٛائ١خ ٠ّىٓ اْ رىْٛ فىشٖ ع١ئخ خبطخ ف‬KILL signal َ‫اعزخذا‬ /bin/kill -s KILL 1 .ٖ‫٘زٖ ؽش٠مٗ عش٠ؼٗ ٌزغٍك ثٙب إٌظبَ وٍٗ ,ٌزٌه رأوذ ع١ذا ِٓ ِبرىزجٗ لجً رٕف١ز‬ 25
  • Shells 1.8.1ّٝ‫ ا٤ٚاِش ٠غ‬cmd ‫ ٠زُ اٌىض١ش ِٓ اٌؼًّ اٌ١ِٟٛ ثئعزخذاَ ٚاعٙخ عطٛس‬FreeBSD ٟ‫ف‬‫ اٌشئ١غ١خ رزّضً فٟ ارخبر ا٤ٚاِش ِٓ لٕبح اٌّذخ٩د ٚرٕف١ز٘ب .ٕٚ٘بن‬Shell ‫ ,ٚظ١فخ‬Shell ‫ لذ ثٕ١ذ أ٠ؼب فٟ ٚظبئف ٌٍّغبػذح فٟ اٌّٙبَ اٌ١ِٛ١خ ِضً إداسح‬Shells ِٓ ‫اٌىض١ش‬ .‫اٌٍّفبد‬ C-‫ ٠ّىٓ اعزخذاِٙب أفؼً فٕٙبن اٌىض١ش ِٓ ا٨ٔٛاع, ِض٩ إرا وٕذ‬Shell ٞ‫إرا وٕذ ِزؾ١ش أ‬ ‫ ٠ّىٕه‬Linix ِٟ‫ ,ٚارا وٕذ ِٓ ِغزخذ‬tcsh shell َ‫ ٠ّىٓ اعزخذا‬programmer . bash shell َ‫اعزخذا‬ tab ‫ ٟٚ٘ وزبثخ ِمذِخ اٌىٍّخ صُ ػغؾ‬intelligence sense ‫٠ّىٕه اعزخذاَ خذِخ‬ . rem [tab] ‫ رىزت‬remove ‫٨عزىّبي اٌىٍّٗ. ِض٩ ٌىزبثخ أِش‬ :ُ٘‫ٚ٘بٟ٘ لبئّٗ ثأُ٘ اٌّزغ١شاد ِٚؼٕب‬ variables Description USER Current logged in users name. PATH Colon-separated list of directories to search for binaries. DISPLAY Network name of the X11 display to connect to, if available. SHELL The current shell. TERM The name of the users type of terminal. Used to determine the capabilities of the terminal. TERMCAP Database entry of the terminal escape codes to perform various terminal functions. OSTYPE Type of operating system. e.g., FreeBSD.MACHTYPE The CPU architecture that the system is running on. EDITOR The users preferred text editor. PAGER The users preferred text pager. MANPATH Colon-separated list of directories to search for manual pages.26
  • Changing Your Shell 1.8.1 . chsh ‫ اٌّغزخذِخ ثبعزخذاَ أِش‬Shell ‫أعًٙ ؽش٠مٗ ٌزغ١ش‬ٟ‫ ثذْٚ اعجبسن ػٍٝ دخٛي ف‬Shell ‫– ,ٚ٘زا ع١مَٛ ثزغ١١ش‬s in the chsh ‫٠ّىٕه ا٠ؼب اػطبء‬ .‫اٌّؾشس‬ :ٟ‫ عزىزت ا٢ر‬bash ٌٝ‫ِض٩ إرا اسدد اٌزغ١١ش إ‬ % chsh -s /usr/local/bin/bash :‫ٍِؾٛظخ‬ :ٟ‫ ٠ذٚ٠ب عزؾزبط إٌٝ ػًّ ا٨ر‬Shell ً٠‫إرا لّذ ثزٕض‬ :ٟ‫/ عزؾزبط إٌٝ ا٨ر‬usr/local/bin ٟ‫ ٠ذٚ٠ب ف‬bash ‫ِض٩ إرا ٚػؼذ‬ # echo "/usr/local/bin/bash" >> /etc/shells Then return chsh 27
  • ‫‪1.9 Text Editor‬‬ ‫ٚ٠ؾذس اٌىض١ش ِٓ اٌزؼذ٠٩د فٟ ‪ FreeBSD‬ػٓ ؽش٠ك اٌزؼذ٠ً فٟ ٍِفبد ٔظ١خ .ٚثغجت‬ ‫٘زا، فئٔٗ ع١ىْٛ فىشح ع١ذح ٌزظجؼ ِأٌٛفب ِغ ِؾشس إٌض ‪.text editor‬‬ ‫ٚأثغؾ ِؾشس ٌٍزؼٍُ ٘ٛ ِؾشس ٠ذػٝ ‪ ،ee‬اٌزٟ ٟ٘ اخزظبس ‪ِ easy editor‬ؾشس‬ ‫أعًٙ‬ ‫عًٙ .ٌجذء ‪ّ٠ ،ee‬ىٓ ٤ؽذ أ ْ ٠ىزت أِش ‪ ee filename‬ؽ١ش ‪ ٛ٘ filename‬اعُ اٌٍّف‬‫اٌّشاد رؾش٠شٖ .ػٍٝ عج١ً اٌّضبي ، ٌزؾش٠ش ‪ ، /etc/rc.conf‬اوزت فٟ ‪ِ /etc/conf ee‬شح ٚاؽذح‬ ‫ِٓ داخً ‪٠ ، ee‬زُ عشد وبفخ ا٤ٚاِش ٌّؼبٌغخ ِٙبَ اٌزؾش٠ش فٟ أػٍٝ اٌشبشخ .اٌؾشف ^‬ ‫٠ّضً ِفزبػ ‪ ctrl‬ػٍٝ ٌٛؽخ اٌّفبر١ؼ، ثؾ١ش ‪ٛ٠ ^e‬عغ اٌغ١طشح ػٍٝ رشو١جخ اٌّفبر١ؼ.‬ ‫ٌّغبدسح ‪ ،ee‬اػغؾ ِفزبػ ‪ ،esc‬صُ اخز١بس ‪ٚ leave editor‬عٛف ٠طبٌجه اٌ ّؾشس ثـؾفع أ٠خ‬ ‫رغ١١شاد إرا رُ رؼذ٠ً اٌٍّف.‬ ‫وّب ٠ٛعذ ثبي ‪ِ FreeBSD‬ؾشساد ألٜٛ ِضً ‪ vi‬وغضء ِٓ إٌظبَ ا٤عبعٟ, فٟ ؽ١ٓ اْ‬ ‫ِؾشسح اخشٜ ِضً ‪ ُ٘ Emacs and vim‬عضء ِٓ اي ‪.Ports collection‬‬ ‫٘زٖ اٌّؾشساد رٛفش ٚظبئف أوضش ِٓ رٌه ثىض١ش، ٚاٌمٖٛ رغؼٍٙب أوضش رؼم١ذا ٌٍزؼٍُ .ٌٚىٓ إرا‬ ‫وٕذ رخطؾ ٌزفؼً اٌىض١ش ِٓ رؾش٠ش إٌض، ٚاٌزؼٍُ ِؾشس ألٜٛ ِضً ‪Emacs or vim‬ع١ٛفش‬ ‫ٌه ٚلزب أؽٛي ثىض١ش فٟ اٌّذٜ اٌطٛ٠ً.‬ ‫82‬
  • ‫‪1.10.1 Devices and Device Nodes‬‬‫رؼش٠ف ‪ّ٠ Device‬ىٓ اْ ٠ىْٛ ِظطٍؼ ٠غزخذَ فٟ اٌغبٌت ٤ٔشطخ راد اٌظٍخ ثـ ‪hardware‬‬‫فٟ ٘زا إٌظبَ ، ثّب فٟ رٌه ا٤لشاص، ٚاٌطبثؼبد، ٚثطبلبد اٌشعِٛبد ، ٌٚٛؽبد اٌّفبر١ؼ .‬ ‫ػٕذِب ٠ذخً ‪ FreeBSD‬فٟ ِشؽٍخ ‪ِ ،booting‬ؼظُ ِب ٠مَٛ ثٗ ‪ ٛ٘ FreeBSD‬اٌىشف ػٓ‬ ‫ا٤عٙضح اٌّٛطٌٛخ . ٠ّىٕه أْ رجؾش ِٓ خ٩ي سعبئً ‪ِ booting‬شح أخشٜ ػٓ ؽش٠ك وزبثخ‬ ‫‪/var/run/dmesg.boot‬‬ ‫‪1.10.2 Creating Device Nodes‬‬ ‫ػٕذ إػبفخ عٙبص عذ٠ذ إٌٝ إٌظبَ اٌخبص ثه، أٚ عّغ ٌ ذػُ أعٙضح إػبف١خ، ٠غت إٔشبء‬ ‫‪ Device Node‬عذ٠ذ.‬ ‫)‪1.10.2.1 DEVFS (DEVice File System‬‬ ‫رّذن ‪ DEVFS‬ثئِىبٔ١خ اٌذخٛي إٌٝ ‪ Kernels device namespace‬فٟ ‪global file system‬‬ ‫‪. namespace‬‬ ‫ثذ٨ ِٓ رىٛ٠ٓ أٚ رؼذ٠ً ‪٠, device node‬مَٛ ‪ DEVFS‬ثزؼذ٠ٍٙب خبطخ ٌه.‬ ‫92‬
  • ‫11.1 ‪Binary Formats‬‬ ‫٠غزخذَ ‪ FreeBSD‬اي ‪ٌٚ elf format‬ىٓ أٚ٨ ٠غت ِؼشفخ ص٩س ‪ formats‬اعبع١١ٓ فٟ‬ ‫‪UNIX‬‬ ‫1- ‪a.out‬‬ ‫ألذَ ‪٠ format‬غزخذِٗ ‪٠ . UNIX‬غزخذَ ‪ header‬لظ١ش ِٚؼغٛؽ ٚسلُ ِّ١ض ٌ١ّ١ض‬ ‫اي ‪٠ٚ, format‬غزخذَ ص٩س ‪ِ segment‬ؾٍّخ :‬ ‫‪Text ,data and .bss‬ثب٦ػبفخ إٌٝ عذٚي اٌشِض ٚ ‪.string table‬‬ ‫2- ‪coff‬‬‫‪٠ , SVR3 object format‬ؾزٛٞ اي ‪ header‬ػٍٝ ‪ section table‬ؽ١ش ٠ّىٕه ا٢ْ اْ رؾظً‬ ‫ػٍٝ اوضش ِٓ ‪. .text ,.data and .bss sections‬‬ ‫3- ‪elf‬‬ ‫‪ ٛ٘ ELF‬أوضش رؼج١شا ِٓ ‪٠ ٚ a.out‬غّؼ ٌّض٠ذ ِٓ اٌزّذد فٟ إٌظبَ ا٤عبعٟ .وّب اْ‬‫أدٚاد ‪ ELF‬أفؼً فٟ اٌظ١بٔخ ، ٚرمذ٠ُ اٌذػُ ، ٚ٘ٛ أِش ُِٙ ٌىض١ش ِٓ إٌبط. ‪ ELF‬لذ ٠ىْٛ‬‫أثطأ لٍ١٩ ِٓ ‪ٌٚ ،a.out‬ىٓ اٌّؾبٌٚخ ٌم١بط ٘زا ٠ّىٓ أْ رىْٛ طؼجخ .ٕ٘بن أ٠ؼب اٌؼذ٠ذ ِٓ‬ ‫اٌزفبط١ً اٌزٟ رخزٍف ث١ٓ اٌزٕغ١م١ٓ)‪ (two formats‬فٟ و١ف١خ رخط١ؾ اٌظفؾبد ،‬ ‫ٚاٌزؼبًِ ِغ ‪ ، INIT code‬اٌخ.‬ ‫٨ شٟء ِٓ ٘زا ُِٙ عذا، ٌىٕٙب أخز٩فبد.‬ ‫13‬