2.2 מנהל חבילות פתרון
תרגילים¶
תרגיל 1: עדכון רשימת החבילות¶
פתרון:¶
פלט לדוגמה:
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:3 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Fetched 229 kB in 2s (114 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
42 packages can be upgraded. Run 'apt list --upgradable' to see them.
הפקודה apt update מורידה מהאינטרנט את הרשימה העדכנית של כל החבילות הזמינות ואת הגרסאות שלהן. היא לא מתקינה ולא מעדכנת שום דבר - רק מעדכנת את הידע של apt לגבי מה קיים. הפקודה apt upgrade היא זו שמעדכנת את החבילות בפועל.
תרגיל 2: חיפוש חבילה¶
פתרון:¶
פלט לדוגמה (חלקי):
Sorting... Done
Full Text Search... Done
tree/jammy 2.0.2-1 amd64
displays an indented directory tree, in color
החבילה tree מציגה את מבנה התיקיות בצורה היררכית עם הזחות - כלומר תוכלו לראות את כל התיקיות והקבצים בצורה של עץ חזותי.
הצגת מידע מפורט על החבילה:
תרגיל 3: התקנה והרצה¶
פתרון:¶
התקנת tree:
פלט לדוגמה:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
tree
0 upgraded, 1 newly installed, 0 to remove and 42 not upgraded.
Need to get 47.9 kB of archives.
After this operation, 115 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
מעבר לתיקיית הבית והרצה:
פלט לדוגמה:
.
|-- Documents
| `-- notes.txt
|-- Downloads
|-- Pictures
`-- Desktop
`-- shortcut.txt
4 directories, 2 files
הפקודה tree שונה מ-ls כי היא מציגה את כל המבנה ההיררכי של התיקיות והתתי-תיקיות בבת אחת, בצורת עץ חזותי עם קווים שמחברים בין רמות.
תרגיל 4: הסרת חבילה וניקוי¶
פתרון:¶
הסרת tree:
פלט לדוגמה:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
tree
0 upgraded, 0 newly installed, 1 to remove and 42 not upgraded.
After this operation, 115 kB disk space will be freed.
Do you want to continue? [Y/n] y
Removing tree (2.0.2-1) ...
ניקוי חבילות יתומות:
פלט לדוגמה כשאין מה לנקות:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 42 not upgraded.
החבילה tree לא הביאה תלויות משלה, אז לא יהיה מה לנקות. בחבילות גדולות יותר apt autoremove מסיר תלויות שהותקנו אוטומטית ואינן נחוצות יותר.
ניסיון להריץ tree לאחר ההסרה:
פלט:
המערכת מודיעה שהפקודה לא קיימת, ואפילו מציעה איך להתקין אותה מחדש.