إعـــــــلان

تقليص
لا يوجد إعلان حتى الآن.

مساعدة فى الاجابة على بعض الاسئلة

تقليص
X
 
  • تصفية - فلترة
  • الوقت
  • عرض
إلغاء تحديد الكل
مشاركات جديدة

  • مساعدة فى الاجابة على بعض الاسئلة

    بسم الله الرحمن الرحيم

    السلام عليكم ورحمه الله وبركاته

    شخص لم اعرفة يقول عنده امتحان ومحتاج يذاكر بعض الاشياء وفى اسئلة مش موجودة اجابتها لدية وهى

    Use ln to create links and investigate the behaviour of the links in different situations:

    1. Change to the new directory and use ln -s to create a symbolic link to the file. Does the original file show any indication of the symbolic link?
    Do the same for the directory and see if there is any indication. Try to make a symbolic link to a file that does not exist, or make a symbolic link and then remove the file. What happens?
    2. Type ln -s blah blah. What happens when you try to read the file blah you just created? Explain.
    3. Now make a hard link to a file (i.e. ln without -s). What happens now?
    4. What happens when you change the permissions of the original file with chmod, or update its modification time with touch?
    5. Apart from the names, how can you tell which was the original file, and which is the link you just created?
    6. What happens if you remove the original?
    7. What happens if you try to make a hard link to a directory? To a non-existent file?


    ياريت اذا ممكن احد يجاوب عليها يكون فعل خير فيه وكمان نكون تعلمنا خصائص الامر ده

    بالتوفيق ان شاء الله

  • #2
    1- قم بعمل التالي:
    كود:
    touch file1
    ثم
    كود:
    ln -s file1 ALI
    ثم
    كود:
    ll
    سيظهر سهم في آخر المعلومات الخاصة بالملف ALI يؤشر الى file1 وأيضاً لو نظرت الى الصلاحيات، لرأيت بإنه المستخدم له صلاحية rwx والمجموعة الذي يعتبر الملف ALI تابع لها لديه صلاحيات rwx والآخرين لهم rwx. وأيضاً سترى بإنه نوع الملف هو l أي link.

    الآن قم بعمل
    كود:
    ls -li
    وأنظر الى الرقم (إسمه inode) الذي في أول معلومات الملف ALI وقارنه مع الملف file1، ستجدهم غير متشابهين وذلك ﻷنه soft link.
    الآن قم بتنفيذ التالي:
    كود:
    $ mkdir test
    $ ln -s test
    ln: creating symbolic link `./test' to `test': File exists
    أنظر، الجواب يفيد بإنه ﻻ يسمح بعمل soft link الى مجلد.

    الآن قم بحذف الملف file1 مثلاً ونفذ التالي:
    كود:
    ll
    ستجد الملف ALI يشير الى ملف file1 والذي هو غير موجود، لو حاولت فتح الملف لن تستطيع لعدم وجوده.


    2- قم بتنفيذ التالي:
    كود:
    ln -s blah blah
    ثم
    كود:
    cat blah
    الجواب سيكون هكذا:
    كود:
    cat: blah: Too many levels of symbolic links

    3- قم بعمل التالي:
    كود:
    ln file2 XYZ
    وبعد ذلك نفذ
    كود:
    ll
    لن تجد سهم يؤشر الى file2 ليش ؟ ﻷنه Hard Link. كيف تتأكد؟ نفذ التالي:
    كود:
    ls -li
    ستجد كلا الملفين لهم نفس الـ inode والذي هو الرقم الذي ببداية المعلومات الخاصة بالملف.

    4- قم بالتالي:
    كود:
    chmod 700 file2
    ثم
    كود:
    ll
    ستجد كل من file2 و ALI لهم نفس الصلاحيات بالضبط. بعدها نفذ مثلاً:
    touch ALI
    وبعدها نفذ:
    كود:
    ll
    ستجد كل من الملف ALI و file2 لهم نفس التوقيت الخاص بالتحديث. والسبب هو كونه Hard Link.


    5- ﻻ تستطيع ﻷنه كلاهما هو الملف الأصلي.

    6- لن يحدث شيء وتستطيع الوصول للبيانات التي كانت في الملف file2 مثلا من خلال ALI وذلك ﻷنهما Hard Link وكلاهما نفس الملف فعلياً.

    7- الجواب لن يسمح لك، كما في التالي:
    كود:
    ln test/ DODO
    ln: `test/': hard link not allowed for directory
    لو حاولت عمل link الى ملف لنقول إسمه nofile سيكون الجواب كالتالي:
    كود:
    ln nofile ABC
    ln: accessing `nofile': No such file or directory

    ملاحظة مهمة جداً: هذه عبارة عن تمارين !!!!!!!!!!!!!

    دمتم بود ...
    إِنَّمَـا الأُمَـمُ الأَخْـلاقُ مَا بَقِيَـتْ ... فَـإِنْ هُمُ ذَهَبَـتْ أَخْـلاقُهُمْ ذَهَبُـوا

    إذا المرء لا يرعاك إلا تكلفاً ... فدعه ولا تكثر عليه التأسفا
    ففي الناس أبدال وفي الترك راحة ... وفي القلب صبر للحبيب ولو جفا
    فما كل من تهواه يهواك قلبه ... ولا كل من صافيته لك قد صفا
    إذا لم يكن صفو الوداد طبيعة ... فلا خير في خل يجيء تكلفا
    ولا خير في خل يخون خليله ... ويلقاه من بعد المودة بالجفا
    وينكر عيشاً قد تقادم عهده ... ويظهر سراً كان بالأمس في خفا

    [ مواقع مفيدة: أروع موقع القرآن الكريم |مدونتي |Twitter |نظام طارق ]

    تعليق


    • #3
      بسم الله الرحمن الرحيم

      السلام عليكم ورحمه الله وبركاته

      عاجز عن الشكر يا بو محمد وفيت فى الاجابة وكفيت
      والله ما اعرف هذه تمارين ولا شنو بالضبط
      هو لشخص ربنا ييسر له الحال

      ولكن حصلت بعض المعلومات عن الموضوع برده احب اضيفها للشباب
      مع ان ما فى شىء يقال بعض ردك على الاجابات

      دى معلومات عامة باللغة الانجليزية قد حصلت عليها من بعض الكتب

      اتمنى تفيد الشباب وتفيدنى كمان

      Symbolic Links
      To set up a symbolic link, you use the ln command with the -s option and two arguments:
      The name of the original file and the new, added filename. The ls operation lists both
      Filenames, but only one physical file will exist.
      $ ln -s original-file-name added-file-name
      In the next example, the today file is given the additional name weather. It is just
      Another name for the today file.
      $ ls
      today
      $ ln -s today weather
      $ ls
      today weather
      You can give the same file several names by using the ln command on the same file
      many times. In the next example, the file today is given both the names weather and
      weekend:
      $ ln -s today weather
      $ ln -s today weekend
      $ ls
      today weather weekend
      If you list the full information about a symbolic link and its file, you will find the information
      displayed is different. In the next example, the user lists the full information for both lunch
      and /home/george/veglist using the ls command with the -l option. The first character in
      the line specifies the file type. Symbolic links have their own file type, represented by an l. The
      file type for lunch is l, indicating it is a symbolic link, not an ordinary file. The number after
      the term “group” is the size of the file. Notice the sizes differ. The size of the lunch file is only
      four bytes. This is because lunch is only a symbolic link—a file that holds the pathname of
      another file—and a pathname takes up only a few bytes. It is not a direct hard link to the
      veglist file.
      $ ls -l lunch /home/george/veglist
      lrw-rw-r-- 1 chris group 4 Feb 14 10:30 lunch
      -rw-rw-r-- 1 george group 793 Feb 14 10:30 veglist
      To erase a file, you need to remove only its original name (and any hard links to it). If
      any symbolic links are left over, they will be unable to access the file. In this case, a symbolic
      link would hold the pathname of a file that no longer exists.



      Hard Links
      You can give the same file several names by using the ln command on the same file many
      times. To set up a hard link, you use the ln command with no -s option and two arguments:
      the name of the original file and the new, added filename. The ls operation lists both filenames,
      but only one physical file will exist.
      $ ln original-file-name added-file-name
      In the next example, the monday file is given the additional name storm. It is just
      another name for the monday file.
      $ ls
      today
      $ ln monday storm
      $ ls
      monday storm
      To erase a file that has hard links, you need to remove all its hard links. The name of a
      file is actually considered a link to that file—hence the command rm that removes the link
      to the file. If you have several links to the file and remove only one of them, the others stay
      in place and you can reference the file through them. The same is true even if you remove
      the original link—the original name of the file. Any added links will work just as well. In
      the next example, the today file is removed with the rm command. However, a link to that
      same file exists, called weather. The file can then be referenced under the name weather.
      $ ln today weather
      $ rm today
      $ cat weather
      The storm broke today
      and the sun came out.
      $

      جزاك الله خيرا ا بو محمد

      بالتوفيق ان شاء الله

      تعليق

      يعمل...
      X