2. الفهرس
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 30
2
3. ِفزبػ اٌّظطٍؾبد
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
UFS
3
4. موجز عه الموضوع
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
12. 1.3.1 Directory Structure
The FreeBSD directory hierarchy is fundamental to obtaining an overall
understanding 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
13. 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
17. ِٓ ِغبؽخ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
18. ٍٝ ٌج١ئخ رطٛ٠ش ِزىبٍِخ اٌمشص ا٤ٚي رؼٍك ػ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 ٚ hierarchy
18
19. 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
20. 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 system's
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
26. 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 user's 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 user's 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 user's preferred text editor.
PAGER The user's preferred text pager.
MANPATH Colon-separated list of directories to search for manual pages.
26