File size: 5,837 Bytes
1293db4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Linux Runlevels - DashMagic</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
</head>
<body class="bg-gray-50 min-h-screen">
    <div class="fixed inset-y-0 left-0 w-64 bg-white shadow-lg">
        <!-- Same sidebar as index.html -->
        <div class="flex items-center justify-center h-16 bg-primary-500 text-white">
            <i data-feather="zap" class="mr-2"></i>
            <span class="text-xl font-bold">DashMagic</span>
        </div>
        <nav class="mt-6">
            <a href="/" class="px-6 py-3 flex items-center text-gray-600 hover:bg-gray-100 hover:text-gray-800">
                <i data-feather="home" class="w-5 h-5"></i>
                <span class="mx-3 font-medium">Dashboard</span>
            </a>
            <a href="/linux-runlevels.html" class="px-6 py-3 flex items-center bg-primary-100 text-primary-700 border-l-4 border-primary-500">
                <i data-feather="terminal" class="w-5 h-5"></i>
                <span class="mx-3 font-medium">Linux Runlevels</span>
            </a>
        </nav>
    </div>

    <div class="ml-64 p-6">
        <header class="flex justify-between items-center mb-8">
            <h1 class="text-3xl font-bold text-gray-800">Linux Runlevels Guide</h1>
        </header>

        <div class="bg-white p-6 rounded-xl shadow-md mb-8">
            <h2 class="text-xl font-semibold mb-4">Changing Default Runlevel in Linux</h2>
            <p class="mb-4">This guide explains how to change default runlevels in systemd-based Linux distributions (Ubuntu, CentOS etc).</p>
            
            <div class="space-y-6">
                <div>
                    <h3 class="text-lg font-medium mb-2">1. Check Current Runlevel</h3>
                    <div class="bg-gray-100 p-4 rounded-md">
                        <code>runlevel</code><br>
                        <code>systemctl get-default</code>
                    </div>
                </div>

                <div>
                    <h3 class="text-lg font-medium mb-2">2. Change Default Runlevel (Permanent)</h3>
                    <p class="mb-2">Method 1: Using systemctl</p>
                    <div class="bg-gray-100 p-4 rounded-md mb-4">
                        <code>systemctl set-default multi-user.target # Text mode (runlevel 3)</code><br>
                        <code>systemctl set-default graphical.target # GUI mode (runlevel 5)</code>
                    </div>
                    <p class="mb-2">Method 2: Using symbolic links</p>
                    <div class="bg-gray-100 p-4 rounded-md">
                        <code>ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target</code>
                    </div>
                </div>

                <div>
                    <h3 class="text-lg font-medium mb-2">3. Temporary Runlevel Change</h3>
                    <div class="bg-gray-100 p-4 rounded-md">
                        <code>systemctl isolate graphical.target # Switch to GUI</code><br>
                        <code>systemctl isolate multi-user.target # Switch to text mode</code>
                    </div>
                </div>

                <div>
                    <h3 class="text-lg font-medium mb-2">Common Runlevels</h3>
                    <div class="overflow-x-auto">
                        <table class="min-w-full bg-white border">
                            <thead>
                                <tr class="bg-gray-100">
                                    <th class="py-2 px-4 border">Runlevel</th>
                                    <th class="py-2 px-4 border">Target</th>
                                    <th class="py-2 px-4 border">Description</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td class="py-2 px-4 border">0</td>
                                    <td class="py-2 px-4 border">runlevel0.target</td>
                                    <td class="py-2 px-4 border">Shutdown/Halt</td>
                                </tr>
                                <tr>
                                    <td class="py-2 px-4 border">1</td>
                                    <td class="py-2 px-4 border">runlevel1.target</td>
                                    <td class="py-2 px-4 border">Single-user mode</td>
                                </tr>
                                <tr>
                                    <td class="py-2 px-4 border">3</td>
                                    <td class="py-2 px-4 border">multi-user.target</td>
                                    <td class="py-2 px-4 border">Text multi-user</td>
                                </tr>
                                <tr>
                                    <td class="py-2 px-4 border">5</td>
                                    <td class="py-2 px-4 border">graphical.target</td>
                                    <td class="py-2 px-4 border">Graphical multi-user</td>
                                </tr>
                                <tr>
                                    <td class="py-2 px-4 border">6</td>
                                    <td class="py-2 px-4 border">runlevel6.target</td>
                                    <td class="py-2 px-4 border">Reboot</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        feather.replace();
    </script>
</body>
</html>