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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>Slackware Linux Essentials</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
<link rel="STYLESHEET" type="text/css" href="docbook.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body class="BOOK" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
alink="#0000FF">
<div class="BOOK"><a id="AEN1" name="AEN1"></a>
<div class="TITLEPAGE">
<h1 class="TITLE"><a id="AEN2" name="AEN2">Slackware Linux Essentials</a></h1>
<p><img src="slackware_logo.png" align="CENTER" /></p>
<h3 class="AUTHOR"><a id="AEN30" name="AEN30"></a>Alan Hicks</h3>
<h3 class="AUTHOR"><a id="AEN43" name="AEN43"></a>Chris Lumens</h3>
<h3 class="AUTHOR"><a id="AEN47" name="AEN47"></a>David Cantrell</h3>
<h3 class="AUTHOR"><a id="AEN50" name="AEN50"></a>Logan Johnson</h3>
<p class="COPYRIGHT">Copyright © 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Slackware Linux, Inc.</p>
<div class="LEGALNOTICE"><a id="TRADEMARKS" name="TRADEMARKS"></a>
<p>Slackware Linux is a registered trademark of Patrick Volkerding and Slackware Linux,
Inc.</p>
<p>Linux is a registered trademark of Linus Torvalds.</p>
<p>America Online and AOL are registered trademarks of America Online, Inc. in the United
States and/or other countries.</p>
<p>Apple, FireWire, Mac, Macintosh, Mac OS, Quicktime, and TrueType are trademarks of
Apple Computer, Inc., registered in the United States and other countries.</p>
<p>IBM, AIX, EtherJet, Netfinity, OS/2, PowerPC, PS/2, S/390, and ThinkPad are trademarks
of International Business Machines Corporation in the United States, other countries, or
both.</p>
<p>IEEE, POSIX, and 802 are registered trademarks of Institute of Electrical and
Electronics Engineers, Inc. in the United States.</p>
<p>Intel, Celeron, EtherExpress, i386, i486, Itanium, Pentium, and Xeon are trademarks or
registered trademarks of Intel Corporation or its subsidiaries in the United States and
other countries.</p>
<p>Microsoft, IntelliMouse, MS-DOS, Outlook, Windows, Windows Media and Windows NT are
either registered trademarks or trademarks of Microsoft Corporation in the United States
and/or other countries.</p>
<p>Netscape and the Netscape Navigator are registered trademarks of Netscape
Communications Corporation in the U.S. and other countries.</p>
<p>Red Hat, RPM, are trademarks or registered trademarks of Red Hat, Inc. in the United
States and other countries.</p>
<p>XFree86 is a trademark of The XFree86 Project, Inc.</p>
<p>Many of the designations used by manufacturers and sellers to distinguish their
products are claimed as trademarks. Where those designations appear in this document, and
Slackware Linux, Inc. was aware of the trademark claim, the designations have been
followed by the “™” or the “®” symbol.</p>
</div>
<span class="ISBN">1-57176-338-4<br />
</span>
<div class="DOCFORAMTNAVI">[ <a href="./index.html">Split HTML</a> / <a
href="./book.html">Single HTML</a> ]</div>
<hr />
</div>
<div class="TOC">
<dl>
<dt><b>Table of Contents</b></dt>
<dt><a href="#BOOK-PREFACE">Preface</a></dt>
<dt>1 <a href="#INTRODUCTION">An Introduction to Slackware Linux</a></dt>
<dd>
<dl>
<dt>1.1 <a href="#INTRODUCTION-LINUX">What is Linux?</a></dt>
<dd>
<dl>
<dt>1.1.1 <a href="#INTRODUCTION-LINUX-GNU">A Word on GNU</a></dt>
</dl>
</dd>
<dt>1.2 <a href="#INTRODUCTION-SLACKWARE">What is Slackware?</a></dt>
<dt>1.3 <a href="#INTRODUCTION-OPENSOURCE">Open Source and Free Software</a></dt>
</dl>
</dd>
<dt>2 <a href="#HELP">Help</a></dt>
<dd>
<dl>
<dt>2.1 <a href="#HELP-SYSTEM">System Help</a></dt>
<dd>
<dl>
<dt>2.1.1 <a href="#HELP-SYSTEM-MAN"><tt class="COMMAND">man</tt></a></dt>
<dt>2.1.2 <a href="#HELP-SYSTEM-DOC">The <tt class="FILENAME">/usr/doc</tt>
Directory</a></dt>
<dt>2.1.3 <a href="#HELP-SYSTEM-HOWTO">HOWTOs and mini-HOWTOs</a></dt>
</dl>
</dd>
<dt>2.2 <a href="#HELP-ONLINE">Online Help</a></dt>
<dd>
<dl>
<dt>2.2.1 <a href="#HELP-ONLINE-OFFICIAL">The Official Website and Help Forums</a></dt>
<dt>2.2.2 <a href="#HELP-ONLINE-EMAIL">E-mail Support</a></dt>
<dt>2.2.3 <a href="#HELP-ONLINE-NONOFFICIAL">Non-Official Websites and Help
Forums</a></dt>
</dl>
</dd>
</dl>
</dd>
<dt>3 <a href="#INSTALLATION">Installation</a></dt>
<dd>
<dl>
<dt>3.1 <a href="#INSTALLATION-GETTING">Getting Slackware</a></dt>
<dd>
<dl>
<dt>3.1.1 <a href="#AEN641">The Official Disc and Box Sets</a></dt>
<dt>3.1.2 <a href="#AEN683">Via the Internet</a></dt>
</dl>
</dd>
<dt>3.2 <a href="#INSTALLATION-REQUIREMENTS">System Requirements</a></dt>
<dd>
<dl>
<dt>3.2.1 <a href="#INSTALLATION-SOFTWARE-SERIES">The Software Series</a></dt>
<dt>3.2.2 <a href="#INSTALLATION-METHODS">Installation Methods</a></dt>
<dt>3.2.3 <a href="#INSTALLATION-INSTALLATION-METHODS-BOOTDISK">Boot Disk</a></dt>
<dt>3.2.4 <a href="#INSTALLATION-INSTALLATION-METHODS-ROOTDISK">Root Disk</a></dt>
<dt>3.2.5 <a href="#INSTALLATION-SUPPLEMENTAL-DISK">Supplemental Disk</a></dt>
<dt>3.2.6 <a href="#INSTALLATION-MAKING-THE-DISKS">Making the Disks</a></dt>
</dl>
</dd>
<dt>3.3 <a href="#INSTALLATION-PARTITIONING">Partitioning</a></dt>
<dt>3.4 <a href="#INSTALLATION-SETUP">The <tt class="COMMAND">setup</tt> Program</a></dt>
<dd>
<dl>
<dt>3.4.1 <a href="#AEN993">HELP</a></dt>
<dt>3.4.2 <a href="#AEN1001">KEYMAP</a></dt>
<dt>3.4.3 <a href="#AEN1013">ADDSWAP</a></dt>
<dt>3.4.4 <a href="#AEN1023">TARGET</a></dt>
<dt>3.4.5 <a href="#AEN1035">SOURCE</a></dt>
<dt>3.4.6 <a href="#AEN1054">SELECT</a></dt>
<dt>3.4.7 <a href="#AEN1062">INSTALL</a></dt>
<dt>3.4.8 <a href="#AEN1100">CONFIGURE</a></dt>
</dl>
</dd>
</dl>
</dd>
<dt>4 <a href="#SYSTEM-CONFIGURATION">System Configuration</a></dt>
<dd>
<dl>
<dt>4.1 <a href="#SYSTEM-CONFIGURATION-OVERVIEW">System Overview</a></dt>
<dd>
<dl>
<dt>4.1.1 <a href="#SYSTEM-CONFIGURATION-LAYOUT">File System Layout</a></dt>
<dt>4.1.2 <a href="#SYSTEM-CONFIGURATION-FINDING">Finding Files</a></dt>
<dt>4.1.3 <a href="#SYSTEM-CONFIGURATION-RCD">The <tt class="FILENAME">/etc/rc.d</tt>
Directory</a></dt>
</dl>
</dd>
<dt>4.2 <a href="#SYSTEM-CONFIGURATION-KERNEL">Selecting a Kernel</a></dt>
<dd>
<dl>
<dt>4.2.1 <a href="#AEN1581">The <tt class="FILENAME">/kernels</tt> Directory on the
Slackware CD-ROM</a></dt>
<dt>4.2.2 <a href="#SYSTEM-CONFIGURATION-KERNEL-COMPILE">Compiling a Kernel from
Source</a></dt>
<dt>4.2.3 <a href="#SYSTEM-CONFIGURATION-KERNEL-MODULES">Using Kernel Modules</a></dt>
</dl>
</dd>
</dl>
</dd>
<dt>5 <a href="#NETWORK-CONFIGURATION">Network Configuration</a></dt>
<dd>
<dl>
<dt>5.1 <a href="#NETWORK-CONFIGURATION-NETCONFIG">Introduction: netconfig is your
friend.</a></dt>
<dt>5.2 <a href="#NETWORK-CONFIGURATION-HARDWARE">Network Hardware Configuration</a></dt>
<dd>
<dl>
<dt>5.2.1 <a href="#NETWORK-CONFIGURATION-HARDWARE-MODULES">Loading Network
Modules</a></dt>
<dt>5.2.2 <a href="#NETWORK-CONFIGURATION-HARDWARE-LAN">LAN (10/100/1000Base-T and
Base-2) cards</a></dt>
<dt>5.2.3 <a href="#NETWORK-CONFIGURATION-HARDWARE-MODEMS">Modems</a></dt>
<dt>5.2.4 <a href="#NETWORK-CONFIGURATION-HARDWARE-PCMCIA">PCMCIA</a></dt>
</dl>
</dd>
<dt>5.3 <a href="#NETWORK-CONFIGURATION-TCPIP">TCP/IP Configuration</a></dt>
<dd>
<dl>
<dt>5.3.1 <a href="#NETWORK-CONFIGURATION-TCPIP-DHCP">DHCP</a></dt>
<dt>5.3.2 <a href="#NETWORK-CONFIGURATION-TCPIP-STATIC">Static IP</a></dt>
<dt>5.3.3 <a href="#NETWORK-CONFIGURATION-TCPIP-CONF"><tt
class="FILENAME">/etc/rc.d/rc.inet1.conf</tt></a></dt>
<dt>5.3.4 <a href="#NETWORK-CONFIGURATION-TCPIP-RESOLVER"><tt
class="FILENAME">/etc/resolv.conf</tt></a></dt>
<dt>5.3.5 <a href="#NETWORK-CONFIGURATION-TCPIP-HOSTS"><tt
class="FILENAME">/etc/hosts</tt></a></dt>
</dl>
</dd>
<dt>5.4 <a href="#NETWORK-CONFIGURATION-PPP">PPP</a></dt>
<dd>
<dl>
<dt>5.4.1 <a href="#AEN1954"><tt class="COMMAND">pppsetup</tt></a></dt>
<dt>5.4.2 <a href="#AEN1969"><tt class="FILENAME">/etc/ppp</tt></a></dt>
</dl>
</dd>
<dt>5.5 <a href="#NETWORK-CONFIGURATION-WIRELESS">Wireless</a></dt>
<dd>
<dl>
<dt>5.5.1 <a href="#AEN2033">Hardware Support</a></dt>
<dt>5.5.2 <a href="#AEN2044">Configure the Wireless Settings</a></dt>
<dt>5.5.3 <a href="#AEN2101">Configure the Network</a></dt>
</dl>
</dd>
<dt>5.6 <a href="#NETWORK-CONFIGURATION-NFS">Network File Systems</a></dt>
<dd>
<dl>
<dt>5.6.1 <a href="#NETWORK-CONFIGURATION-NSF-SMB">SMB/Samba/CIFS</a></dt>
<dt>5.6.2 <a href="#NETWORK-CONFIGURATION-NFS-NFS">Network File System (NFS)</a></dt>
</dl>
</dd>
</dl>
</dd>
<dt>6 <a href="#X-WINDOW-SYSTEM">X Configuration</a></dt>
<dd>
<dl>
<dt>6.1 <a href="#X-WINDOW-SYSTEM-XORGCONFIG"><tt
class="COMMAND">xorgconfig</tt></a></dt>
<dt>6.2 <a href="#X-WINDOW-SYSTEM-XORGSETUP"><tt class="COMMAND">xorgsetup</tt></a></dt>
<dt>6.3 <a href="#X-WINDOW-SYSTEM-XINITRC">xinitrc</a></dt>
<dt>6.4 <a href="#X-WINDOW-SYSTEM-XWMCONFIG"><tt class="COMMAND">xwmconfig</tt></a></dt>
<dt>6.5 <a href="#X-WINDOW-SYSTEM-XDM"><tt class="COMMAND">xdm</tt></a></dt>
</dl>
</dd>
<dt>7 <a href="#BOOTING">Booting</a></dt>
<dd>
<dl>
<dt>7.1 <a href="#BOOTING-LILO">LILO</a></dt>
<dt>7.2 <a href="#BOOTING-LOADLIN">LOADLIN</a></dt>
<dt>7.3 <a href="#BOOTING-DUAL">Dual Booting</a></dt>
<dd>
<dl>
<dt>7.3.1 <a href="#BOOTING-DUAL-WINDOWS">Windows</a></dt>
<dt>7.3.2 <a href="#BOOTING-DUAL-LINUX">Linux</a></dt>
</dl>
</dd>
</dl>
</dd>
<dt>8 <a href="#SHELL">The Shell</a></dt>
<dd>
<dl>
<dt>8.1 <a href="#SHELL-USERS">Users</a></dt>
<dd>
<dl>
<dt>8.1.1 <a href="#AEN2678">Logging In</a></dt>
<dt>8.1.2 <a href="#AEN2693">Root: The Superuser</a></dt>
</dl>
</dd>
<dt>8.2 <a href="#SHELL-COMMAND-LINE">The Command Line</a></dt>
<dd>
<dl>
<dt>8.2.1 <a href="#SHELL-COMMAND-LINE-RUNNING">Running Programs</a></dt>
<dt>8.2.2 <a href="#SHELL-COMMAND-LINE-WILDCARD">Wildcard Matching</a></dt>
<dt>8.2.3 <a href="#SHELL-COMMAND-LINE-PIPING">Input/Output Redirection and
Piping</a></dt>
</dl>
</dd>
<dt>8.3 <a href="#SHELL-BASH">The Bourne Again Shell (bash)</a></dt>
<dd>
<dl>
<dt>8.3.1 <a href="#SHELL-BASH-ENVIRONMENT">Environment Variables</a></dt>
<dt>8.3.2 <a href="#SHELL-BASH-TAB">Tab Completion</a></dt>
</dl>
</dd>
<dt>8.4 <a href="#SHELL-VT">Virtual Terminals</a></dt>
<dd>
<dl>
<dt>8.4.1 <a href="#AEN3024">Screen</a></dt>
</dl>
</dd>
</dl>
</dd>
<dt>9 <a href="#FILESYSTEM-STRUCTURE">Filesystem Structure</a></dt>
<dd>
<dl>
<dt>9.1 <a href="#FILESYSTEM-STRUCTURE-OWNERSHIP">Ownership</a></dt>
<dt>9.2 <a href="#FILESYSTEM-STRUCTURE-PERMISSIONS">Permissions</a></dt>
<dt>9.3 <a href="#FILESYSTEM-STRUCTURE-LINKS">Links</a></dt>
<dt>9.4 <a href="#FILESYSTEM-STRUCTURE-MOUNTING">Mounting Devices</a></dt>
<dd>
<dl>
<dt>9.4.1 <a href="#AEN3319"><tt class="FILENAME">fstab</tt></a></dt>
<dt>9.4.2 <a href="#AEN3340"><tt class="COMMAND">mount</tt> and <tt
class="COMMAND">umount</tt></a></dt>
</dl>
</dd>
<dt>9.5 <a href="#FILESYSTEM-STRUCTURE-NFS">NFS Mounts</a></dt>
</dl>
</dd>
<dt>10 <a href="#FILE-COMMANDS">Handling Files and Directories</a></dt>
<dd>
<dl>
<dt>10.1 <a href="#FILE-COMMANDS-NAVIGATION">Navigation : <tt class="COMMAND">ls</tt>,
<tt class="COMMAND">cd</tt>, and <tt class="COMMAND">pwd</tt></a></dt>
<dd>
<dl>
<dt>10.1.1 <a href="#AEN3398"><tt class="COMMAND">ls</tt></a></dt>
<dt>10.1.2 <a href="#AEN3436"><tt class="COMMAND">cd</tt></a></dt>
<dt>10.1.3 <a href="#AEN3463"><tt class="COMMAND">pwd</tt></a></dt>
</dl>
</dd>
<dt>10.2 <a href="#FILE-COMMANDS-PAGERS">Pagers: <tt class="COMMAND">more</tt>, <tt
class="COMMAND">less</tt>, and <tt class="COMMAND">most</tt></a></dt>
<dd>
<dl>
<dt>10.2.1 <a href="#AEN3491"><tt class="COMMAND">more</tt></a></dt>
<dt>10.2.2 <a href="#AEN3518"><tt class="COMMAND">less</tt></a></dt>
<dt>10.2.3 <a href="#AEN3539"><tt class="COMMAND">most</tt></a></dt>
</dl>
</dd>
<dt>10.3 <a href="#FILE-COMMANDS-OUTPUT">Simple Output: <tt class="COMMAND">cat</tt> and
<tt class="COMMAND">echo</tt></a></dt>
<dd>
<dl>
<dt>10.3.1 <a href="#AEN3559"><tt class="COMMAND">cat</tt></a></dt>
<dt>10.3.2 <a href="#AEN3603"><tt class="COMMAND">echo</tt></a></dt>
</dl>
</dd>
<dt>10.4 <a href="#FILE-COMMANDS-CREATION">Creation: <tt class="COMMAND">touch</tt> and
<tt class="COMMAND">mkdir</tt></a></dt>
<dd>
<dl>
<dt>10.4.1 <a href="#AEN3619"><tt class="COMMAND">touch</tt></a></dt>
<dt>10.4.2 <a href="#AEN3639"><tt class="COMMAND">mkdir</tt></a></dt>
</dl>
</dd>
<dt>10.5 <a href="#FILE-COMMANDS-COPYMOVE">Copy and Move</a></dt>
<dd>
<dl>
<dt>10.5.1 <a href="#FILE-COMMANDS-COPYMOVE-CP"><tt class="COMMAND">cp</tt></a></dt>
<dt>10.5.2 <a href="#AEN3712"><tt class="COMMAND">mv</tt></a></dt>
</dl>
</dd>
<dt>10.6 <a href="#FILE-COMMANDS-DELETION">Deletion: <tt class="COMMAND">rm</tt> and <tt
class="COMMAND">rmdir</tt></a></dt>
<dd>
<dl>
<dt>10.6.1 <a href="#AEN3733"><tt class="COMMAND">rm</tt></a></dt>
<dt>10.6.2 <a href="#AEN3764"><tt class="COMMAND">rmdir</tt></a></dt>
</dl>
</dd>
<dt>10.7 <a href="#FILE-COMMANDS-LINK">Aliasing files with <tt
class="COMMAND">ln</tt></a></dt>
</dl>
</dd>
<dt>11 <a href="#PROCESS-CONTROL">Process Control</a></dt>
<dd>
<dl>
<dt>11.1 <a href="#PROCESS-CONTROL-BACKGROUNDING">Backgrounding</a></dt>
<dt>11.2 <a href="#PROCESS-CONTROL-FOREGROUNDING">Foregrounding</a></dt>
<dt>11.3 <a href="#PROCESS-CONTROL-PS"><tt class="COMMAND">ps</tt></a></dt>
<dt>11.4 <a href="#PROCESS-CONTROL-KILL"><tt class="COMMAND">kill</tt></a></dt>
<dt>11.5 <a href="#PROCESS-CONTROL-TOP"><tt class="COMMAND">top</tt></a></dt>
</dl>
</dd>
<dt>12 <a href="#ESSENTIAL-SYSADMIN">Essential System Administration</a></dt>
<dd>
<dl>
<dt>12.1 <a href="#ESSENTIAL-SYSADMIN-USERS">Users and Groups</a></dt>
<dd>
<dl>
<dt>12.1.1 <a href="#ESSENTIAL-SYSADMIN-USERS-SCRIPTS">Supplied Scripts</a></dt>
<dt>12.1.2 <a href="#ESSENTIAL-SYSADMIN-USERS-PASSWDS">Changing Passwords</a></dt>
<dt>12.1.3 <a href="#ESSENTIAL-SYSADMIN-USERS-CHANGING">Changing User
Information</a></dt>
</dl>
</dd>
<dt>12.2 <a href="#ESSENTIAL-SYSADMIN-HARDUSERS">Users and Groups, the Hard Way</a></dt>
<dt>12.3 <a href="#ESSENTIAL-SYSADMIN-SHUTDOWN">Shutting Down Properly</a></dt>
</dl>
</dd>
<dt>13 <a href="#BASIC-NETWORK-COMMANDS">Basic Network Commands</a></dt>
<dd>
<dl>
<dt>13.1 <a href="#BASIC-NETWORK-COMMANDS-PING"><tt class="COMMAND">ping</tt></a></dt>
<dt>13.2 <a href="#BASIC-NETWORK-COMMANDS-TRACEROUTE"><tt
class="COMMAND">traceroute</tt></a></dt>
<dt>13.3 <a href="#BASIC-NETWORK-COMMANDS-DNS">DNS Tools</a></dt>
<dd>
<dl>
<dt>13.3.1 <a href="#AEN4475"><tt class="COMMAND">host</tt></a></dt>
<dt>13.3.2 <a href="#AEN4487"><tt class="COMMAND">nslookup</tt></a></dt>
<dt>13.3.3 <a href="#AEN4496"><tt class="COMMAND">dig</tt></a></dt>
</dl>
</dd>
<dt>13.4 <a href="#BASIC-NETWORK-COMMANDS-FINGER"><tt
class="COMMAND">finger</tt></a></dt>
<dt>13.5 <a href="#BASIC-NETWORK-COMMANDS-TELNET"><tt
class="COMMAND">telnet</tt></a></dt>
<dd>
<dl>
<dt>13.5.1 <a href="#AEN4593">The other use of telnet</a></dt>
</dl>
</dd>
<dt>13.6 <a href="#BASIC-NETWORK-COMMANDS-SSH">The Secure shell</a></dt>
<dt>13.7 <a href="#BASIC-NETWORK-COMMANDS-EMAIL">email</a></dt>
<dd>
<dl>
<dt>13.7.1 <a href="#BASIC-NETWORK-COMMANDS-EMAIL-PINE"><tt
class="COMMAND">pine</tt></a></dt>
<dt>13.7.2 <a href="#BASIC-NETWORK-COMMANDS-EMAIL-ELM"><tt
class="COMMAND">elm</tt></a></dt>
<dt>13.7.3 <a href="#BASIC-NETWORK-COMMANDS-EMAIL-MUTT"><tt
class="COMMAND">mutt</tt></a></dt>
<dt>13.7.4 <a href="#BASIC-NETWORK-COMMANDS-EMAIL-NAIL"><tt
class="COMMAND">nail</tt></a></dt>
</dl>
</dd>
<dt>13.8 <a href="#BASIC-NETWORK-COMMANDS-WEB">Browsers</a></dt>
<dd>
<dl>
<dt>13.8.1 <a href="#AEN4776"><tt class="COMMAND">lynx</tt></a></dt>
<dt>13.8.2 <a href="#AEN4813"><tt class="COMMAND">links</tt></a></dt>
<dt>13.8.3 <a href="#AEN4831"><tt class="COMMAND">wget</tt></a></dt>
</dl>
</dd>
<dt>13.9 <a href="#BASIC-NETWORK-COMMANDS-FTP">FTP Clients</a></dt>
<dd>
<dl>
<dt>13.9.1 <a href="#AEN4871"><tt class="COMMAND">ftp</tt></a></dt>
<dt>13.9.2 <a href="#BASIC-NETWORK-COMMANDS-FTP-NCFTP"><tt
class="COMMAND">ncftp</tt></a></dt>
</dl>
</dd>
<dt>13.10 <a href="#BASIC-NETWORK-COMMANDS-TALK">Talking to Other People</a></dt>
<dd>
<dl>
<dt>13.10.1 <a href="#AEN4989"><tt class="COMMAND">wall</tt></a></dt>
<dt>13.10.2 <a href="#AEN5006"><tt class="COMMAND">talk</tt></a></dt>
<dt>13.10.3 <a href="#AEN5033"><tt class="COMMAND">ytalk</tt></a></dt>
</dl>
</dd>
</dl>
</dd>
<dt>14 <a href="#SECURITY">Security</a></dt>
<dd>
<dl>
<dt>14.1 <a href="#SECURITY-DISABLE">Disabling Services</a></dt>
<dd>
<dl>
<dt>14.1.1 <a href="#AEN5081">Services started from <tt
class="COMMAND">inetd</tt></a></dt>
<dt>14.1.2 <a href="#AEN5102">Services started from init scripts</a></dt>
</dl>
</dd>
<dt>14.2 <a href="#SECURITY-HOST">Host Access Control</a></dt>
<dd>
<dl>
<dt>14.2.1 <a href="#SECURITY-HOST-IPTABLES"><tt class="COMMAND">iptables</tt></a></dt>
<dt>14.2.2 <a href="#SECURITY-HOST-TCPWRAPPERS"><tt
class="COMMAND">tcpwrappers</tt></a></dt>
</dl>
</dd>
<dt>14.3 <a href="#SECURITY-CURRENT">Keeping Current</a></dt>
<dd>
<dl>
<dt>14.3.1 <a href="#SECURITY-CURRENT-LIST"><var class="LITERAL">slackware-security</var>
mailing list</a></dt>
<dt>14.3.2 <a href="#SECURITY-CURRENT-PATCHES">The <tt class="FILENAME">/patches</tt>
directory</a></dt>
</dl>
</dd>
</dl>
</dd>
<dt>15 <a href="#ARCHIVE-FILES">Archive Files</a></dt>
<dd>
<dl>
<dt>15.1 <a href="#ARCHIVE-FILES-GZIP"><tt class="COMMAND">gzip</tt></a></dt>
<dt>15.2 <a href="#ARCHIVE-FILES-BZIP2"><tt class="COMMAND">bzip2</tt></a></dt>
<dt>15.3 <a href="#ARCHIVE-FILES-TAR"><tt class="COMMAND">tar</tt></a></dt>
<dt>15.4 <a href="#ARCHIVE-FILES-ZIP"><tt class="COMMAND">zip</tt></a></dt>
</dl>
</dd>
<dt>16 <a href="#VI">Vi</a></dt>
<dd>
<dl>
<dt>16.1 <a href="#VI-STARTING">Starting vi</a></dt>
<dt>16.2 <a href="#VI-MODES">Modes</a></dt>
<dd>
<dl>
<dt>16.2.1 <a href="#VI-MODES-COMMAND-MODE">Command Mode</a></dt>
<dt>16.2.2 <a href="#VI-MODES-INSET-MODE">Insert Mode</a></dt>
</dl>
</dd>
<dt>16.3 <a href="#VI-OPENING-FILES">Opening Files</a></dt>
<dt>16.4 <a href="#VI-SAVING-FILES">Saving Files</a></dt>
<dt>16.5 <a href="#VI-QUITTING-VI">Quitting vi</a></dt>
<dt>16.6 <a href="#VI-CONFIGURATION">vi Configuration</a></dt>
<dt>16.7 <a href="#VI-KEYS">Vi Keys</a></dt>
</dl>
</dd>
<dt>17 <a href="#EMACS">Emacs</a></dt>
<dd>
<dl>
<dt>17.1 <a href="#EMACS-STARTING">Starting emacs</a></dt>
<dd>
<dl>
<dt>17.1.1 <a href="#EMACS-COMMAND-KEYS">Command Keys</a></dt>
</dl>
</dd>
<dt>17.2 <a href="#EMACS-BUFFERS">Buffers</a></dt>
<dt>17.3 <a href="#EMACS-MODES">Modes</a></dt>
<dd>
<dl>
<dt>17.3.1 <a href="#EMACS-OPENING-FILES">Opening files</a></dt>
</dl>
</dd>
<dt>17.4 <a href="#EMACS-BASIC-EDITING">Basic Editing</a></dt>
<dt>17.5 <a href="#EMACS-SAVING-FILES">Saving Files</a></dt>
<dd>
<dl>
<dt>17.5.1 <a href="#EMACS-QUITING">Quitting Emacs</a></dt>
</dl>
</dd>
</dl>
</dd>
<dt>18 <a href="#PACKAGE-MANAGEMENT">Slackware Package Management</a></dt>
<dd>
<dl>
<dt>18.1 <a href="#PACKAGE-MANAGEMENT-OVERVIEW">Overview of Package Format</a></dt>
<dt>18.2 <a href="#PACKAGE-MANAGEMENT-PACKAGE-UTILITIES">Package Utilities</a></dt>
<dd>
<dl>
<dt>18.2.1 <a href="#PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-PKGTOOL">pkgtool</a></dt>
<dt>18.2.2 <a href="#PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-INSTALLPKG">installpkg</a></dt>
<dt>18.2.3 <a href="#PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-REMOVEPKG">removepkg</a></dt>
<dt>18.2.4 <a href="#PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-UPGRADEPKG">upgradepkg</a></dt>
<dt>18.2.5 <a href="#PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-RPM"><tt
class="COMMAND">rpm2tgz</tt>/<tt class="COMMAND">rpm2targz</tt></a></dt>
</dl>
</dd>
<dt>18.3 <a href="#PACKAGE-MANAGEMENT-MAKING-PACKAGES">Making Packages</a></dt>
<dd>
<dl>
<dt>18.3.1 <a href="#PACKAGE-MANAGEMENT-EXPLODEPKG"><tt
class="COMMAND">explodepkg</tt></a></dt>
<dt>18.3.2 <a href="#PACKAGE-MANAGEMENT-MAKEPKG"><tt
class="COMMAND">makepkg</tt></a></dt>
<dt>18.3.3 <a href="#PACKAGE-MANAGEMENT-SLACKBUILD-SCRIPTS">SlackBuild Scripts</a></dt>
</dl>
</dd>
<dt>18.4 <a href="#PACKAGE-MANAGEMENT-MAKING-TAGS-AND-TAGFILES">Making Tags and Tagfiles
(for setup)</a></dt>
</dl>
</dd>
<dt>19 <a href="#ZIPSLACK">ZipSlack</a></dt>
<dd>
<dl>
<dt>19.1 <a href="#ZIPSLACK-WHAT">What is ZipSlack?</a></dt>
<dd>
<dl>
<dt>19.1.1 <a href="#ZIPSLACK-ADVANTAGES">Advantages</a></dt>
<dt>19.1.2 <a href="#ZIPSLACK-DISADVANTAGES">Disadvantages</a></dt>
</dl>
</dd>
<dt>19.2 <a href="#ZIPSLACK-GETTING">Getting ZipSlack</a></dt>
<dd>
<dl>
<dt>19.2.1 <a href="#ZIPSLACK-INSTALLATION">Installation</a></dt>
</dl>
</dd>
<dt>19.3 <a href="#ZIPSLACK-BOOTING">Booting ZipSlack</a></dt>
</dl>
</dd>
<dt><a href="#GLOSSARY">Glossary</a></dt>
<dt>A. <a href="#GPL">The GNU General Public License</a></dt>
<dd>
<dl>
<dt>A.1. <a href="#AEN7088">Preamble</a></dt>
<dt>A.2. <a href="#AEN7098">TERMS AND CONDITIONS</a></dt>
<dt>A.3. <a href="#AEN7162">How to Apply These Terms to Your New Programs</a></dt>
</dl>
</dd>
</dl>
</div>
<div class="LOT">
<dl class="LOT">
<dt><b>List of Tables</b></dt>
<dt>2-1. <a href="#AEN409">Man Page Sections</a></dt>
<dt>3-1. <a href="#AEN661">Slackware Linux, Inc. Contact Information</a></dt>
<dt>3-2. <a href="#AEN706">System Requirements</a></dt>
<dt>3-3. <a href="#AEN746">Software Series</a></dt>
<dt>9-1. <a href="#AEN3142">Octal Permission Values</a></dt>
<dt>13-1. <a href="#AEN4883"><tt class="COMMAND">ftp</tt> commands</a></dt>
<dt>16-1. <a href="#AEN5773">Movement</a></dt>
<dt>16-2. <a href="#AEN5808">Editing</a></dt>
<dt>16-3. <a href="#AEN5848">Searching</a></dt>
<dt>16-4. <a href="#AEN5882">Saving and Quitting</a></dt>
<dt>17-1. <a href="#TABLE-EMACS-BASIC-EDITING">Basic Emacs Editing Commands</a></dt>
<dt>18-1. <a href="#AEN6446"><tt class="COMMAND">installpkg</tt> Options</a></dt>
<dt>18-2. <a href="#AEN6491"><tt class="COMMAND">removepkg</tt> Options</a></dt>
<dt>18-3. <a href="#AEN6621">Tagfile Status Options</a></dt>
</dl>
</div>
<div class="LOT">
<dl class="LOT">
<dt><b>List of Figures</b></dt>
<dt>4-1. <a href="#SYSTEM-CONFIGURATION-MAKE-MENUCONFIG">Kernel Configuration
Menu</a></dt>
<dt>6-1. <a href="#X-WINDOW-SYSTEM-1"><tt class="COMMAND">xorgconfig</tt> Mouse
Configuration</a></dt>
<dt>6-2. <a href="#X-WINDOW-SYSTEM-2"><tt class="COMMAND">xorgconfig</tt> Horizontal
Sync</a></dt>
<dt>6-3. <a href="#X-WINDOW-SYSTEM-3"><tt class="COMMAND">xorgconfig</tt> Vertical
Sync</a></dt>
<dt>6-4. <a href="#X-WINDOW-SYSTEM-4"><tt class="COMMAND">xorgconfig</tt> Video
Card</a></dt>
<dt>6-5. <a href="#FIG-X-WINDOW-SYSTEM-XWMCONFIG">Desktop Configuration with <tt
class="COMMAND">xorgconfig</tt></a></dt>
<dt>7-1. <a href="#BOOTING-SETUP-LILO"><tt class="COMMAND">liloconfig</tt></a></dt>
<dt>7-2. <a href="#BOOTING-LILO-EXPERT"><tt class="COMMAND">liloconfig</tt> Expert
Menu</a></dt>
<dt>11-1. <a href="#FIG-PROCESS-CONTROL-PS-SHORT">Basic <tt class="COMMAND">ps</tt>
output</a></dt>
<dt>13-1. <a href="#FIG-BASIC-NETWORK-COMMANDS-TELNET-WEB">Telnetting to a
webserver</a></dt>
<dt>13-2. <a href="#FIG-BASIC-NETWORK-COMMANDS-EMAIL-PINE">The Pine main menu</a></dt>
<dt>13-3. <a href="#FIG-BASIC-NETWORK-COMMANDS-EMAIL-ELM">Elm main screen</a></dt>
<dt>13-4. <a href="#FIG-BASIC-NETWORK-COMMANDS-EMAIL-MUTT">Mutt main screen</a></dt>
<dt>13-5. <a href="#FIG-BASIC-NETWORK-COMMANDS-WEB-LYNX">Lynx default start page</a></dt>
<dt>13-6. <a href="#FIG-BASIC-NETWORK-COMMANDS-WEB-LINKS">Links, with the file menu
open</a></dt>
<dt>13-7. <a href="#FIG-BASIC-NETWORK-COMMANDS-TALK-TALK">Two users in a <tt
class="COMMAND">talk</tt> session</a></dt>
<dt>13-8. <a href="#FIG-BASIC-NETWORK-COMMANDS-TALK-YTALK">Two users in a <tt
class="COMMAND">ytalk</tt> session</a></dt>
<dt>16-1. <a href="#FIG-VI-VIM-SPLITEDIT">A vi session.</a></dt>
<dt>18-1. <a href="#PKGTOOL-MAIN-MENU">Pkgtool's main menu.</a></dt>
<dt>18-2. <a href="#PKGTOOL-VIEW-MODE">Pkgtool view mode</a></dt>
</dl>
</div>
<div class="LOT">
<dl class="LOT">
<dt><b>List of Examples</b></dt>
<dt>8-1. <a href="#EX-SHELL-BASH-ENVIRONMENT">Listing Environment Variables with <tt
class="COMMAND">set</tt></a></dt>
</dl>
</div>
<div class="PREFACE">
<hr />
<h1><a id="BOOK-PREFACE" name="BOOK-PREFACE"></a>Preface</h1>
<h2 class="BRIDGEHEAD"><a id="PREFACE-AUDIENCE" name="PREFACE-AUDIENCE"></a>Intended
Audience</h2>
<p>The Slackware Linux operating system is a powerful platform for Intel-based computers.
It is designed to be stable, secure, and functional as both a high-end server and
powerful workstation.</p>
<p>This book is designed to get you started with the Slackware Linux operating system.
It's not meant to cover every single aspect of the distribution, but rather to show what
it is capable of and give you a basic working knowledge of the system.</p>
<p>As you gain experience with Slackware Linux, we hope you find this book to be a handy
reference. We also hope you'll lend it to all of your friends when they come asking about
that cool Slackware Linux operating system you're running.</p>
<p>While this book may not an edge-of-your-seat novel, we certainly tried to make it as
entertaining as possible. With any luck, we'll get a movie deal. Of course, we also hope
you are able to learn from it and find it useful.</p>
<p>And now, on with the show.</p>
<h2 class="BRIDGEHEAD"><a id="PREFACE-CHANGES" name="PREFACE-CHANGES"></a>Changes from
the First Edition</h2>
<p>This second edition is the culmination of years of hard work by the dedicated members
of the Slackware Documentation Project. The following are the major changes in this new
edition:</p>
<ul>
<li>
<p><a href="#INSTALLATION">Chapter 3</a>, Installation, has been modified with new
screenshots of the installer, and reflects changes in disk-sets, and CD installation.</p>
</li>
<li>
<p><a href="#SYSTEM-CONFIGURATION">Chapter 4</a>, System Configuration, has been updated
with new information about Linux 2.6.x kernels.</p>
</li>
<li>
<p><a href="#NETWORK-CONFIGURATION">Chapter 5</a>, Network Configuration, has been
expanded with further explanation of Samba, NFS, and DHCP. A section on wireless
networking has also been added. This chapter now reflects major changes in how Slackware
handles network setup.</p>
</li>
<li>
<p><a href="#X-WINDOW-SYSTEM">Chapter 6</a>, X Window System, has been substantially
rewritten for Xorg based systems. This chapter now also covers the xdm graphical login
manager.</p>
</li>
<li>
<p><a href="#BASIC-NETWORK-COMMANDS">Chapter 13</a>, Basic Network Commands, has been
enhanced with information about additional network utilities.</p>
</li>
<li>
<p><a href="#SECURITY">Chapter 14</a>, Security, is a new chapter with this edition. It
explains how to keep a Slackware Linux system secure.</p>
</li>
<li>
<p><a href="#EMACS">Chapter 17</a>, Emacs, is a new chapter with this edition. It
describes how to use Emacs, a powerful editor for Unix.</p>
</li>
<li>
<p><a href="#PACKAGE-MANAGEMENT">Chapter 18</a>, Package Management, has been updated
with information about SlackBuild scripts.</p>
</li>
<li>
<p>There are many other changes, both minor and major, to reflect changes in Slackware as
it has matured.</p>
</li>
</ul>
<h2 class="BRIDGEHEAD"><a id="PREFACE-ORGANIZATION"
name="PREFACE-ORGANIZATION"></a>Organization of this Book</h2>
<div class="VARIABLELIST">
<dl>
<dt><a href="#INTRODUCTION">Chapter 1</a>, Introduction</dt>
<dd>
<p>Provides introductory material on Linux, Slackware, and the Open Source and Free
Software Movements.</p>
</dd>
<dt><a href="#HELP">Chapter 2</a>, Help</dt>
<dd>
<p>Describes the help resources available on a Slackware Linux system and online.</p>
</dd>
<dt><a href="#INSTALLATION">Chapter 3</a>, Installation</dt>
<dd>
<p>Describes the installation process step-by-step with screenshots to provide an
illustrative walk-through.</p>
</dd>
<dt><a href="#SYSTEM-CONFIGURATION">Chapter 4</a>, System Configuration</dt>
<dd>
<p>Describes the important configuration files and covers kernel recompilation.</p>
</dd>
<dt><a href="#NETWORK-CONFIGURATION">Chapter 5</a>, Network Configuration</dt>
<dd>
<p>Describes how to connect a Slackware Linux machine to a network. Covers TCP/IP,
PPP/dial-up, wireless networking, and more.</p>
</dd>
<dt><a href="#X-WINDOW-SYSTEM">Chapter 6</a>, The X Window System</dt>
<dd>
<p>Describes how to setup and use the graphical X Window System in Slackware.</p>
</dd>
<dt><a href="#BOOTING">Chapter 7</a>, Booting</dt>
<dd>
<p>Describes the process by which a computer boots into Slackware Linux. Also covers
dual-booting with Microsoft Windows operating systems.</p>
</dd>
<dt><a href="#SHELL">Chapter 8</a>, The Shell</dt>
<dd>
<p>Describes the powerful command line interface for Linux.</p>
</dd>
<dt><a href="#FILESYSTEM-STRUCTURE">Chapter 9</a>, Filesystem Structure</dt>
<dd>
<p>Describes the filesystem structure, including file ownership, permission, and
linking.</p>
</dd>
<dt><a href="#FILE-COMMANDS">Chapter 10</a>, Handling Files and Directories</dt>
<dd>
<p>Describes the commands used to manipulate files and directories from the command line
interface.</p>
</dd>
<dt><a href="#PROCESS-CONTROL">Chapter 11</a>, Process Control</dt>
<dd>
<p>Describes the powerful Linux process management commands used to manage multiple
running applications.</p>
</dd>
<dt><a href="#ESSENTIAL-SYSADMIN">Chapter 12</a>, Essential System Administration</dt>
<dd>
<p>Describes basic system administration tasks such as adding and removing users,
shutting down the system properly, and more.</p>
</dd>
<dt><a href="#BASIC-NETWORK-COMMANDS">Chapter 13</a>, Basic Network Commands</dt>
<dd>
<p>Describes the collection of network clients included with Slackware.</p>
</dd>
<dt><a href="#SECURITY">Chapter 14</a>, Security</dt>
<dd>
<p>Describes many different tools available to help keep your Slackware system secure,
including <tt class="COMMAND">iptables</tt> and <tt class="COMMAND">tcpwrappers</tt>.</p>
</dd>
<dt><a href="#ARCHIVE-FILES">Chapter 15</a>, Archive Files</dt>
<dd>
<p>Describes the different compression and archive utilities available for Linux.</p>
</dd>
<dt><a href="#VI">Chapter 16</a>, vi</dt>
<dd>
<p>Describes the powerful <tt class="COMMAND">vi</tt> text editor.</p>
</dd>
<dt><a href="#EMACS">Chapter 17</a>, Emacs</dt>
<dd>
<p>Describes the powerful <tt class="COMMAND">Emacs</tt> text editor.</p>
</dd>
<dt><a href="#PACKAGE-MANAGEMENT">Chapter 18</a>, Slackware Package Management</dt>
<dd>
<p>Describes the Slackware package utilities and the process used to create custom
packages and tagfiles.</p>
</dd>
<dt><a href="#ZIPSLACK">Chapter 19</a>, ZipSlack</dt>
<dd>
<p>Describes the ZipSlack version of Linux that can be used from Windows without
requiring an installation.</p>
</dd>
<dt><a href="#GPL">Appendix A</a>, The GNU General Public License</dt>
<dd>
<p>Describes the license terms under which Slackware Linux and this book can be copied
and distributed.</p>
</dd>
</dl>
</div>
<h2 class="BRIDGEHEAD"><a id="PREFACE-CONV" name="PREFACE-CONV"></a>Conventions used in
this book</h2>
<p>To provide a consistent and easy to read text, several conventions are followed
throughout the book.</p>
<h3 class="BRIDGEHEAD"><a id="PREFACE-CONV-TYPOGRAPHIC"
name="PREFACE-CONV-TYPOGRAPHIC"></a>Typographic Conventions</h3>
<div class="VARIABLELIST">
<dl>
<dt><span class="emphasis"><i class="EMPHASIS">Italic</i></span></dt>
<dd>
<p>An <span class="emphasis"><i class="EMPHASIS">italic</i></span> font is used for
commands, emphasized text, and the first usage of technical terms.</p>
</dd>
<dt><var class="VARNAME">Monospace</var></dt>
<dd>
<p>A <var class="VARNAME">monospaced</var> font is used for error messages, commands,
environment variables, names of ports, hostnames, user names, group names, device names,
variables, and code fragments.</p>
</dd>
<dt><b class="APPLICATION">Bold</b></dt>
<dd>
<p>A <b class="APPLICATION">bold</b> font is used for user input in examples.</p>
</dd>
</dl>
</div>
<h3 class="BRIDGEHEAD"><a id="PREFACE-CONV-COMMANDS"
name="PREFACE-CONV-COMMANDS"></a>User Input</h3>
<p>Keys are shown in <b class="KEYCAP">bold</b> to stand out from other text. Key
combinations that are meant to be typed simultaneously are shown with `<var
class="LITERAL">+</var>' between the keys, such as:</p>
<p><b class="KEYCAP">Ctrl</b>+<b class="KEYCAP">Alt</b>+<b class="KEYCAP">Del</b></p>
<p>Meaning the user should type the <b class="KEYCAP">Ctrl</b>, <b
class="KEYCAP">Alt</b>, and <b class="KEYCAP">Del</b> keys at the same time.</p>
<p>Keys that are meant to be typed in sequence will be separated with commas, for
example:</p>
<p><b class="KEYCAP">Ctrl</b>+<b class="KEYCAP">X</b>, <b class="KEYCAP">Ctrl</b>+<b
class="KEYCAP">S</b></p>
<p>Would mean that the user is expected to type the <b class="KEYCAP">Ctrl</b> and <b
class="KEYCAP">X</b> keys simultaneously and then to type the <b class="KEYCAP">Ctrl</b>
and <b class="KEYCAP">S</b> keys simultaneously.</p>
<h3 class="BRIDGEHEAD"><a id="PREFACE-CONV-EXAMPLES"
name="PREFACE-CONV-EXAMPLES"></a>Examples</h3>
<p>Examples starting with <tt class="DEVICENAME">E:\></tt> indicate a <span
class="TRADEMARK">MS-DOS</span>® command. Unless otherwise noted, these commands may
be executed from a “Command Prompt” window in a modern <span
class="TRADEMARK">Microsoft</span>® <span class="TRADEMARK">Windows</span>®
environment.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">D:\></samp> <kbd class="USERINPUT">rawrite a: bare.i</kbd>
</pre>
</td>
</tr>
</table>
<p>Examples starting with <samp class="PROMPT">#</samp> indicate a command that must be
invoked as the superuser in Slackware. You can login as <tt class="USERNAME">root</tt> to
type the command, or login as your normal account and use <span
class="CITEREFENTRY"><span class="REFENTRYTITLE">su</span>(1)</span> to gain superuser
privileges.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">dd if=bare.i of=/dev/fd0</kbd>
</pre>
</td>
</tr>
</table>
<p>Examples starting with <samp class="PROMPT">%</samp> indicate a command that should be
invoked from a normal user account. Unless otherwise noted, C-shell syntax is used for
setting environment variables and other shell commands.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">top</kbd>
</pre>
</td>
</tr>
</table>
<h2 class="BRIDGEHEAD"><a id="PREFACE-ACKNOWLEDGEMENTS"
name="PREFACE-ACKNOWLEDGEMENTS"></a>Acknowledgments</h2>
<p>This project is the accumulation of months of work by many dedicated individuals. It
would not have been possible for me to produce this work in a vacuum. Many people deserve
our thanks for their selfless acts: Keith Keller for his work on wireless networking,
Joost Kremers for his great work in single-handedly writing the emacs section, Simon
Williams for the security chapter, Jurgen Phillippaerts for basic networking commands,
Cibao Cu Ali G Colibri for the inspiration and a good kick in the pants. Countless others
have sent in suggestions and fixes. An incomplete list includes: Jacob Anhoej, John Yast,
Sally Welch, Morgan Landry, and Charlie Law. I'd also like to thank Keith Keller for
hosting the mailing list for this project, as well as Carl Inglis for the initial web
hosting. Last but not least, I'd like to thank Patrick J. Volkerding for Slackware Linux,
and David Cantrell, Logan Johnson, and Chris Lumens for Slackware Linux Essentials 1st
Edition. Without their initial framework, none of this would have ever happened. Many
others have contributed in small and large ways to this project and have not been listed.
I hope they will forgive me for a poor memory.</p>
<p>Alan Hicks, May 2005</p>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="INTRODUCTION" name="INTRODUCTION"></a>Chapter 1 An Introduction to Slackware
Linux</h1>
<div class="SECT1">
<h2 class="SECT1"><a id="INTRODUCTION-LINUX" name="INTRODUCTION-LINUX">1.1 What is
Linux?</a></h2>
<p>Linus Torvalds started Linux, an operating system kernel, as a personal project in
1991. He started the project because he wanted to run a Unix-based operating system
without spending a lot of money. In addition, he wanted to learn the ins and outs of the
386 processor. Linux was released free of charge to the public so that anyone could study
it and make improvements under the General Public License. (See <a
href="#INTRODUCTION-OPENSOURCE">Section 1.3</a> and <a href="#GPL">Appendix A</a> for an
explanation of the license.) Today, Linux has grown into a major player in the operating
system market. It has been ported to run on a variety of system architectures, including
HP/Compaq's Alpha, Sun's SPARC and UltraSPARC, and Motorola's PowerPC chips (through
Apple Macintosh and IBM RS/6000 computers.) Hundreds, if not thousands, of programmers
all over the world now develop Linux. It runs programs like Sendmail, Apache, and BIND,
which are very popular software used to run Internet servers. It's important to remember
that the term “Linux” really refers to the kernel - the core of the operating
system. This core is responsible for controlling your computer's processor, memory, hard
drives, and peripherals. That's all Linux really does: It controls the operations of your
computer and makes sure that all of its programs behave. Various companies and
individuals bundle the kernel and various programs together to make an operating system.
We call each bundle a Linux distribution.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="INTRODUCTION-LINUX-GNU" name="INTRODUCTION-LINUX-GNU">1.1.1 A
Word on GNU</a></h3>
<p>The Linux kernel project began as a solo endeavor by Linus Torvalds in 1991, but as
Isaac Newton once said, “If I have seen further, it is by standing on the shoulders
of giants.” When Linus Torvalds began the kernel the Free Software Foundation had
already established the idea of collaborative software. They entitled their effort GNU, a
recursive acronym that means simply “GNU's Not Unix”. GNU software ran atop
the Linux kernel from day 1. Their compiler <tt class="COMMAND">gcc</tt> was used to
compile the kernel. Today many GNU tools from <tt class="COMMAND">gcc</tt> to <tt
class="COMMAND">gnutar</tt> are still at the basis of every major Linux distribution. For
this reason many of the Free Software Foundation's proponents fervently state that their
work should be given the same credit as the Linux kernel. They strongly suggest that all
Linux distributions should refer to themselves as GNU/Linux distributions.</p>
<p>This is the topic of many flamewars, surpassed only by the ancient vi versus emacs
holy war. The purpose of this book is not to fan the fires of this heated discussion, but
rather to clarify the terminology for neophytes. When one sees GNU/Linux it means a Linux
distribution. When one sees Linux they can either be referring to the kernel, or to a
distribution. It can be rather confusing. Typically the term GNU/Linux isn't used because
it's a mouth full.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="INTRODUCTION-SLACKWARE" name="INTRODUCTION-SLACKWARE">1.2 What
is Slackware?</a></h2>
<p>Slackware, started by Patrick Volkerding in late 1992, and initially released to the
world on July 17, 1993, was the first Linux distribution to achieve widespread use.
Volkerding first learned of Linux when he needed an inexpensive LISP interpreter for a
project. One of the few distributions available at the time was SLS Linux from Soft
Landing Systems. Volkerding used SLS Linux, fixing bugs as he found them. Eventually, he
decided to merge all of these bugfixes into his own private distribution that he and his
friends could use. This private distribution quickly gained popularity, so Volkerding
decided to name it Slackware and make it publicly available. Along the way, Patrick added
new things to Slackware; a user friendly installation program based on a menuing system,
as well as the concept of package management, which allows users to easily add, remove,
or upgrade software packages on their systems.</p>
<p>There are many reasons why Slackware is Linux's oldest living distribution. It does
not try to emulate Windows, it tries to be as Unix-like as possible. It does not try to
cover up processes with fancy, point-and-click GUIs (Graphical User Interfaces). Instead,
it puts users in control by letting them see exactly what's going on. Its development is
not rushed to meet deadlines-each version comes out when it is ready.</p>
<p>Slackware is for people who enjoy learning and tweaking their system to do exactly
what they want. Slackware's stability and simplicity are why people will continue to use
it for years to come. Slackware currently enjoys a reputation as a solid server and a
no-nonsense workstation. You can find Slackware desktops running nearly any window
manager or desktop environment, or none at all. Slackware servers power businesses,
acting in every capacity that a server can be used in. Slackware users are among the most
satisfied Linux users. Of course, we'd say that. :^)</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="INTRODUCTION-OPENSOURCE" name="INTRODUCTION-OPENSOURCE">1.3 Open
Source and Free Software</a></h2>
<p>Within the Linux community, there are two major ideological movements at work. The
Free Software movement (which we'll get into in a moment) is working toward the goal of
making all software free of intellectual property restrictions. Followers of this
movement believe these restrictions hamper technical improvement and work against the
good of the community. The Open Source movement is working toward most of the same goals,
but takes a more pragmatic approach to them. Followers of this movement prefer to base
their arguments on the economic and technical merits of making source code freely
available, rather than the moral and ethical principles that drive the Free Software
Movement.</p>
<p>At the other end of the spectrum are groups that wish to maintain tighter controls
over their software.</p>
<p>The Free Software movement is headed by the Free Software Foundation, a fund-raising
organization for the GNU project. Free software is more of an ideology. The oft-used
expression is “free as in speech, not free as in beer”. In essence, free
software is an attempt to guarantee certain rights for both users and developers. These
freedoms include the freedom to run the program for any reason, to study and modify the
source code, to redistribute the source, and to share any modifications you make. In
order to guarantee these freedoms, the GNU General Public License (GPL) was created. The
GPL, in brief, provides that anyone distributing a compiled program which is licensed
under the GPL must also provide source code, and is free to make modifications to the
program as long as those modifications are also made available in source code form. This
guarantees that once a program is “opened” to the community, it cannot be
“closed” except by consent of every author of every piece of code (even the
modifications) within it. Most Linux programs are licensed under the GPL.</p>
<p>It is important to note that the GPL does not say anything about price. As odd as it
may sound, you can charge for free software. The “free” part is in the
liberties you have with the source code, not in the price you pay for the software.
(However, once someone has sold you, or even given you, a compiled program licensed under
the GPL they are obligated to provide its source code as well.)</p>
<p>Another popular license is the BSD license. In contrast to the GPL, the BSD license
gives no requirement for the release of a program's source code. Software released under
the BSD license allows redistribution in source or binary form provided only a few
conditions are met. The author's credentials cannot be used as a sort of advertisement
for the program. It also indemnifies the author from liability for damages that may arise
from the use of the software. Much of the software included in Slackware Linux is BSD
licensed.</p>
<p>At the forefront of the younger Open Source movement, the Open Source Initiative is an
organization that solely exists to gain support for open source software, that is,
software that has the source code available as well as the ready-to-run program. They do
not offer a specific license, but instead they support the various types of open source
licenses available.</p>
<p>The idea behind the OSI is to get more companies behind open source by allowing them
to write their own open source licenses and have those licenses certified by the Open
Source Initiative. Many companies want to release source code, but do not want to use the
GPL. Since they cannot radically change the GPL, they are offered the opportunity to
provide their own license and have it certified by this organization.</p>
<p>While the Free Software Foundation and the Open Source Initiative work to help each
other, they are not the same thing. The Free Software Foundation uses a specific license
and provides software under that license. The Open Source Initiative seeks support for
all open source licenses, including the one from the Free Software Foundation. The
grounds on which each argues for making source code freely available sometimes divides
the two movements, but the fact that two ideologically diverse groups are working toward
the same goal lends credence to the efforts of each.</p>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="HELP" name="HELP"></a>Chapter 2 Help</h1>
<p>Often there are times when you might need help with a specific command, setting up a
program, or getting a piece of hardware to work. Maybe you simply want to understand a
given command better, or see what other options are available to use with it. Luckily,
there are a variety of ways that you can get the help you're looking for. When you
install Slackware you have the option of installing packages from the “F”
series which includes FAQs and HOWTOs. Programs also come with help about their options,
configuration files, and usage.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="HELP-SYSTEM" name="HELP-SYSTEM">2.1 System Help</a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="HELP-SYSTEM-MAN" name="HELP-SYSTEM-MAN">2.1.1 <tt
class="COMMAND">man</tt></a></h3>
<p>The <tt class="COMMAND">man</tt> command (short for “manual”) is the
traditional form of online documentation in Unix and Linux operating systems. Comprised
of specially formatted files, the “man pages”, are written for the vast
majority of commands and are distributed with the software itself. Executing <tt
class="COMMAND">man somecommand</tt> will display the man page for (naturally) the
command specified, in our example this would be the imaginary program <tt
class="COMMAND">somecommand</tt>.</p>
<p>As you might imagine, the amount of man pages can quickly add up, becoming overly
confusing and seriously complicated, even for an advanced user. So, for this reason, man
pages are grouped into enumerated sections. This system has been around for a very long
time; enough so that you will often see commands, programs, and even programming library
functions referred to with their man section number.</p>
<p>For example:</p>
<p>You might see a reference to <tt class="COMMAND">man</tt>(1). The numbering tells you
that “<tt class="COMMAND">man</tt>” is documented in section 1 (user
commands); you can specify that you want the section 1 man page for “man”
with the command <tt class="COMMAND">man 1 man</tt>. Specifying the section that man
should look in is useful in the case of multiple items with the same name.</p>
<div class="TABLE"><a id="AEN409" name="AEN409"></a>
<p><b>Table 2-1. Man Page Sections</b></p>
<table border="0" frame="void" width="100%" class="CALSTABLE">
<col width="25%" />
<col width="75%" />
<thead>
<tr>
<th>Section</th>
<th>Contents</th>
</tr>
</thead>
<tbody>
<tr>
<td>Section 1</td>
<td>user commands (intro only)</td>
</tr>
<tr>
<td>Section 2</td>
<td>system calls</td>
</tr>
<tr>
<td>Section 3</td>
<td>C library calls</td>
</tr>
<tr>
<td>Section 4</td>
<td>devices (e.g., <tt class="FILENAME">hd</tt>, <tt class="FILENAME">sd</tt>)</td>
</tr>
<tr>
<td>Section 5</td>
<td>file formats and protocols (e.g., wtmp, <tt class="FILENAME">/etc/passwd</tt>,
nfs)</td>
</tr>
<tr>
<td>Section 6</td>
<td>games (intro only)</td>
</tr>
<tr>
<td>Section 7</td>
<td>conventions, macro packages, etc. (e.g., nroff, ascii)</td>
</tr>
<tr>
<td>Section 8</td>
<td>system administration (intro only)</td>
</tr>
</tbody>
</table>
</div>
<p>In addition to <tt class="COMMAND">man</tt>(1), there are the commands <tt
class="COMMAND">whatis</tt>(1) and <tt class="COMMAND">apropos</tt>(1) available to you,
whose shared purpose is to make it easier to find information in the man system.</p>
<p>The command <tt class="COMMAND">whatis</tt> gives a very brief description of system
commands, somewhat in the style of a pocket command reference.</p>
<p>Example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">whatis whatis</kbd>
whatis (1) - search the whatis database for complete words
</pre>
</td>
</tr>
</table>
<p>The command <tt class="COMMAND">apropos</tt> is used to search for a man page
containing a given keyword.</p>
<p>Example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">apropos wav</kbd>
cdda2wav (1) - a sampling utility that dumps CD audio data into wav sound files
netwave_cs (4) - Xircom Creditcard Netwave device driver
oggdec (1) - simple decoder, Ogg Vorbis file to PCM audio file (WAV or RAW)
wavelan (4) - AT&T GIS WaveLAN ISA device driver
wavelan_cs (4) - AT&T GIS WaveLAN PCMCIA device driver
wvlan_cs (4) - Lucent WaveLAN/IEEE 802.11 device driver
</pre>
</td>
</tr>
</table>
<p>If you'd like further information on any of these commands, read their man pages for
the details. ;)</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="HELP-SYSTEM-DOC" name="HELP-SYSTEM-DOC">2.1.2 The <tt
class="FILENAME">/usr/doc</tt> Directory</a></h3>
<p>The source for most packages that we build comes with some sort of documentation:
README files, usage instructions, license files, etc. Any sort of documentation that
comes with the source is included and installed on your system in the <tt
class="FILENAME">/usr/doc</tt> directory. Each program will (usually) install its own
documentation in the order of:</p>
<p><tt class="FILENAME">/usr/doc/<var
class="REPLACEABLE">$program-$version</var></tt></p>
<p>Where <var class="REPLACEABLE">$program</var> is the name of the program you are
wanting to read about, and <var class="REPLACEABLE">$version</var> is (obviously) the
appropriate version of software package installed on your system.</p>
<p>For example, to read the documentation for the command <tt class="COMMAND">man</tt>(1)
you would want to <tt class="COMMAND">cd</tt> to:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cd /usr/doc/man-<var
class="REPLACEABLE">$version</var></kbd>
</pre>
</td>
</tr>
</table>
<p>If reading the appropriate man page(s) doesn't provide you with enough information, or
address what you're looking for in particular, the <tt class="FILENAME">/usr/doc</tt>
directory should be your next stop.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="HELP-SYSTEM-HOWTO" name="HELP-SYSTEM-HOWTO">2.1.3 HOWTOs and
mini-HOWTOs</a></h3>
<p>It is in the truest spirit of the Open Source community that brings us to the
HOWTO/mini-HOWTO collection. These files are exactly what they sound like - documents and
guides describing how to do stuff. If you installed the HOWTO collection, the HOWTOs will
be installed to <tt class="FILENAME">/usr/doc/Linux-HOWTOs</tt> and the mini-HOWTOs to
<tt class="FILENAME">/usr/doc/Linux-mini-HOWTOs</tt>.</p>
<p>Also included in the same package series is a collection of FAQs, which is an acronym
which stands for</p>
<div class="INFORMALTABLE"><a id="AEN497" name="AEN497"></a>
<table border="0" frame="void" class="CALSTABLE">
<col />
<tbody>
<tr>
<td><span class="emphasis"><i class="EMPHASIS">F</i></span>requently</td>
</tr>
<tr>
<td><span class="emphasis"><i class="EMPHASIS">A</i></span>sked</td>
</tr>
<tr>
<td><span class="emphasis"><i class="EMPHASIS">Q</i></span>uestions</td>
</tr>
</tbody>
</table>
</div>
<p>These documents are written in a “Question and answer” style for
(surprise) Frequently Asked Questions. The FAQs can often be a very useful place to look
if you're just looking for a “Quick Fix” to something. If you decide to
install the FAQs during setup, you will find them installed to the <tt
class="FILENAME">/usr/doc/Linux-FAQs</tt> directory.</p>
<p>These files are well worth reading whenever you're not quite sure how to proceed with
something. They cover an amazing range of topics, more often than not in a surprisingly
detailed manner. Good stuff!</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="HELP-ONLINE" name="HELP-ONLINE">2.2 Online Help</a></h2>
<p>In addition to the documentation provided and installable with the Slackware Linux
Operating System, there are a vast multitude of online resources available for you to
learn from as well.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="HELP-ONLINE-OFFICIAL" name="HELP-ONLINE-OFFICIAL">2.2.1 The
Official Website and Help Forums</a></h3>
<p><a href="http://www.slackware.com" target="_top">The Official Slackware
Website</a></p>
<p>The Official Slackware Linux website is sometimes out of date, but still contains
information relevant to the latest Slackware versions. At one time an active help forum
existed there before a horde of trolls, troublemakers, and whiners descended on the
forum. Maintaining the forum was beginning to be too much work, and so Pat shut it down.
One can find that old forum back up and running complete with searchable archives of the
old data at <a href="http://www.userlocal.com/phorum/"
target="_top">http://www.userlocal.com/phorum/</a>.</p>
<p>After the forums were taken down on <a href="http://slackware.com"
target="_top">http://slackware.com</a>, several other sites sprang up that offered forum
support for Slackware. After much thought, Pat chose to endorse <a
href="www.linuxquestions.org" target="_top">www.linuxquestions.org</a> as the official
forum for Slackware Linux.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="HELP-ONLINE-EMAIL" name="HELP-ONLINE-EMAIL">2.2.2 E-mail
Support</a></h3>
<p>Everyone who purchases an official CD set is entitled to free installation support via
e-mail from the developer. That having been said, please keep in mind that we, the
developers, (and a vast majority of users) of Slackware are of “The Old
School”. That means that we prefer to help those who have a sincere interest and
are willing to help themselves in the process. We will always do our best to help
everyone who emails us with support questions. However, Please check your documentation
and the website (especially the FAQs and maybe some of the forums listed below) before
e-mailing. You may get a faster answer that way, and the less e-mail we have to answer,
obviously the sooner we will be of assistance to those that need it.</p>
<p>The e-mail address for technical support is: <var
class="LITERAL">support@slackware.com</var>. Other e-mail addresses and contact
information are listed on the website.</p>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN535" name="AEN535">2.2.2.1 Slackware Linux Project Mailing
Lists</a></h4>
<p>We have several mailing lists, available in digest and normal forms. Check the
instructions for how to subscribe.</p>
<p>To subscribe to a mailing list, email:</p>
<p><var class="LITERAL">majordomo@slackware.com</var></p>
<p>with the phrase “<var class="LITERAL">subscribe <var class="REPLACEABLE">[name
of list]</var></var>” in the body of the email. The list choices are described
below (use one the names below for the name of the list).</p>
<p>Archives of the mailing list can be found on Slackware's website at:</p>
<p><var class="LITERAL">http://slackware.com/lists/archive/</var></p>
<div class="VARIABLELIST">
<dl>
<dt><var class="LITERAL">slackware-announce</var></dt>
<dd>
<p>The <var class="LITERAL">slackware-announce</var> mailing list is for announcements of
new versions, major updates and other general information.</p>
</dd>
<dt><var class="LITERAL">slackware-security</var></dt>
<dd>
<p>The <var class="LITERAL">slackware-security</var> mailing list is for announcements
relating to security issues. Any exploits or other vulnerabilities directly pertaining to
Slackware will get posted to this list immediately.</p>
</dd>
</dl>
</div>
<p>These lists are also available in digest format. This means that you get one large
message per day instead of several messages throughout the day. Since the slackware
mailing lists do not allow users to post, and the lists are such low traffic, most users
find little advantage in the digest lists. Still, they are available if you want them by
subscribing to <var class="LITERAL">slackware-announce-digest</var> or <var
class="LITERAL">slackware-security-digest</var>.</p>
</div>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="HELP-ONLINE-NONOFFICIAL" name="HELP-ONLINE-NONOFFICIAL">2.2.3
Non-Official Websites and Help Forums</a></h3>
<div class="SECT3">
<h4 class="SECT3"><a id="AEN571" name="AEN571">2.2.3.1 Websites</a></h4>
<div class="VARIABLELIST">
<dl>
<dt><a href="http://www.google.com" target="_top">Google</a></dt>
<dd>
<p>The Kung-Fu Master of Search Engines. When you absolutely, positively gotta find every
last kernel of information on a subject: Accept no substitutes.</p>
</dd>
<dt><a href="http://www.google.com/linux" target="_top">Google:Linux</a></dt>
<dd>
<p>Linux-Specific searches</p>
</dd>
<dt><a href="http://www.google.com/bsd" target="_top">Google:BSD</a></dt>
<dd>
<p>BSD-Specific searches. Slackware is so generic as a Unix work-a-like operating system
that one can as often as not find very detailed information that is almost 100% relevant
to Slackware here. Many times a BSD search reveals far more technical information than
the often PR-related Linux searches.</p>
</dd>
<dt><a href="http://groups.google.com" target="_top">Google:Groups</a></dt>
<dd>
<p>Search through decades of Usenet posts for your pearls of wisdom.</p>
</dd>
<dt><a href="http://userlocal.com" target="_top">http://userlocal.com</a></dt>
<dd>
<p>A virtual treasure-trove of knowledge, good advice, first-hand experience and
interesting articles. Often the first place you'll hear about new developments in the
world of Slackware.</p>
</dd>
</dl>
</div>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN601" name="AEN601">2.2.3.2 Web-based Resources</a></h4>
<div class="VARIABLELIST">
<dl>
<dt><a href="http://www.linuxquestions.org/questions/forumdisplay.php?forumid=14"
target="_top">linuxquestions.org</a></dt>
<dd>
<p>The officially sanctioned web-forum for Slackware users.</p>
</dd>
<dt><a href="http://forums.linuxiso.org/viewforum.php?f=25" target="_top">LinuxISO.org
Slackware Forum</a></dt>
<dd>
<p>“A place to download and get help with Linux.”</p>
</dd>
<dt><a href="http://wombat.san-francisco.ca.us/perl/fom"
target="_top">alt.os.linux.slackware FAQ</a></dt>
<dd>
<p>Another FAQ</p>
</dd>
</dl>
</div>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN620" name="AEN620">2.2.3.3 Usenet Groups (NNTP)</a></h4>
<p>Usenet has long been a place for geeks to gather and help one another. There are few
newsgroups dedicated to Slackware Linux, but they tend to be filled with very
knowledgeable people.</p>
<p><var class="LITERAL">alt.os.linux.slackware</var></p>
<p><var class="LITERAL">alt.os.linux.slackware</var>, better known as aols (not to be
confused with <span class="TRADEMARK">AOL</span>®!) is one of the most active places
to find technical help with Slackware problems. Like every Usenet newsgroup, a few
unhelpful participants (“trolls”) can mar the experience with constant
arguing. Learning to ignore the trolls and identifying the truly helpful people is key to
making the most of this resource.</p>
</div>
</div>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="INSTALLATION" name="INSTALLATION"></a>Chapter 3 Installation</h1>
<p>Before you can use Slackware Linux, you'll have to obtain and install it. Getting
Slackware is as easy as purchasing it or downloading it for free over the Internet.
Installing it is also easy as long as you have some basic knowledge about your computer
and are willing to learn a few other things. The installation program itself is very much
a step-by-step process. Because of this, you can be up and running very quickly. In fact,
Slackware boasts one of the lowest installation times of any full-featured Linux
distribution.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="INSTALLATION-GETTING" name="INSTALLATION-GETTING">3.1 Getting
Slackware</a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="AEN641" name="AEN641">3.1.1 The Official Disc and Box
Sets</a></h3>
<p>The official Slackware Linux CD set is available from Slackware Linux, Inc. The CD set
consists of 4 discs. The first disk contains all the software needed for a basic server
install, and the X window system. The second cd is a “live” cd; that is, a
bootable cd that installs into RAM and gives you a temporary installation to play around
with or do a data or machine rescue. This cd also contains a few packages such as the KDE
and GNOME desktop environments. A few other goodies are included on the second cd
including many non-vital packages in the “extra” folder. The third and fourth
CDs contain the source code to all of Slackware, along with the original edition of this
book.</p>
<p>One may also purchase a boxed set that includes the 4 discs and a copy of this book,
as well as lots of neat Slackware gear to show off your geek pride. CD subscriptions are
available at a reduced rate also.</p>
<p>The preferred method for shopping for Slackware merchandise is online at the Slackware
store.</p>
<p><a href="http://store.slackware.com" target="_top">http://store.slackware.com</a></p>
<p>You can also call or e-mail your order in.</p>
<div class="TABLE"><a id="AEN661" name="AEN661"></a>
<p><b>Table 3-1. Slackware Linux, Inc. Contact Information</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col width="1*" />
<col width="2*" />
<thead>
<tr>
<th>Method</th>
<th>Contact Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>Telephone</td>
<td>1-(925) 674-0783</td>
</tr>
<tr>
<td>Website</td>
<td>http://store.slackware.com</td>
</tr>
<tr>
<td>Email</td>
<td>orders@slackware.com</td>
</tr>
<tr>
<td>Postal</td>
<td>1164 Claremont Drive, Brentwood, CA 94513</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN683" name="AEN683">3.1.2 Via the Internet</a></h3>
<p>Slackware Linux is also freely available over the Internet. You may email in your
support questions, but higher priority will be given to those who have purchased the
official CD set. With that said, we get a lot of e-mails and our time is rather limited.
Before e-mailing for support consider reading <a href="#HELP">Chapter 2</a> first.</p>
<p>The official Slackware Linux Project website is located at:</p>
<p><a href="http://www.slackware.com/" target="_top">http://www.slackware.com/</a></p>
<p>The primary FTP location for Slackware Linux is:</p>
<p><a href="ftp://ftp.slackware.com/pub/slackware/"
target="_top">ftp://ftp.slackware.com/pub/slackware/</a></p>
<p>Bear in mind that our ftp site, while open for general use, does not have unlimited
bandwidth. Please consider using a mirror near you to download Slackware. An incomplete
list of mirrors can be found on our site at <a href="http://www.slackware.com/getslack"
target="_top">http://www.slackware.com/getslack</a>.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="INSTALLATION-REQUIREMENTS" name="INSTALLATION-REQUIREMENTS">3.2
System Requirements</a></h2>
<p>An easy Slackware installation requires, at minimum, the following:</p>
<div class="TABLE"><a id="AEN706" name="AEN706"></a>
<p><b>Table 3-2. System Requirements</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col />
<col />
<thead>
<tr>
<th>Hardware</th>
<th>Requirement</th>
</tr>
</thead>
<tbody>
<tr>
<td>Processor</td>
<td>586</td>
</tr>
<tr>
<td>RAM</td>
<td>32 MB</td>
</tr>
<tr>
<td>Disk Space</td>
<td>1GB</td>
</tr>
<tr>
<td>Media Drive</td>
<td>4x CD-ROM</td>
</tr>
</tbody>
</table>
</div>
<p>If you have the bootable CD, you will probably not need a floppy drive. Of course, it
stands to reason that if you don't possess a CD-ROM drive, you will need a floppy drive
to do a network install. A network card is required for an NFS install. See the section
called NFS for more information.</p>
<p>The disk space requirement is somewhat tricky. The 1GB recommendation is usually safe
for a minimal install, but if you do a full install, you will need around two gigabytes
of available hard disk space plus additional space for personal files.. Most users don't
do a full install. In fact, many run Slackware on as little as 100MB of hard disk
space.</p>
<p>Slackware can be installed to systems with less RAM, smaller hard drives, and weaker
CPUs, but doing so will require a little elbow grease. If you're up for a little work,
take a look at the <tt class="FILENAME">LOWMEM.TXT</tt> file in the distribution tree for
a few helpful hints.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="INSTALLATION-SOFTWARE-SERIES"
name="INSTALLATION-SOFTWARE-SERIES">3.2.1 The Software Series</a></h3>
<p>For reasons of simplicity, Slackware has historically been divided into software
series. Once called “disk sets” because they were designed for floppy-based
installation, the software series are now used primarily to categorize the packages
included in Slackware. Today, floppy installation is no longer possible.</p>
<p>The following is a brief description of each software series.</p>
<div class="TABLE"><a id="AEN746" name="AEN746"></a>
<p><b>Table 3-3. Software Series</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col width="1*" />
<col width="4*" />
<thead>
<tr>
<th>Series</th>
<th>Contents</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>The base system. Contains enough software to get up and running and have a text
editor and basic communication program.</td>
</tr>
<tr>
<td>AP</td>
<td>Various applications that do not require the X Window System.</td>
</tr>
<tr>
<td>D</td>
<td>Program development tools. Compilers, debuggers, interpreters, and man pages are all
here.</td>
</tr>
<tr>
<td>E</td>
<td>GNU Emacs.</td>
</tr>
<tr>
<td>F</td>
<td>FAQs, HOWTOs, and other miscellaneous documentation.</td>
</tr>
<tr>
<td>GNOME</td>
<td>The GNOME desktop environment.</td>
</tr>
<tr>
<td>K</td>
<td>The source code for the Linux kernel.</td>
</tr>
<tr>
<td>KDE</td>
<td>The K Desktop Environment. An X environment which shares a lot of look-and-feel
features with MacOS and Windows. The Qt library, which KDE requires, is also in this
series.</td>
</tr>
<tr>
<td>KDEI</td>
<td>Internationalization packages for the KDE desktop.</td>
</tr>
<tr>
<td>L</td>
<td>Libraries. Dynamically linked libraries required by many other programs.</td>
</tr>
<tr>
<td>N</td>
<td>Networking programs. Daemons, mail programs, telnet, news readers, and so on.</td>
</tr>
<tr>
<td>T</td>
<td>teTeX document formatting system.</td>
</tr>
<tr>
<td>TCL</td>
<td>The Tool Command Language. Tk, TclX, and TkDesk.</td>
</tr>
<tr>
<td>X</td>
<td>The base X Window System.</td>
</tr>
<tr>
<td>XAP</td>
<td>X Applications that are not part of a major desktop environment (for example,
Ghostscript and Netscape).</td>
</tr>
<tr>
<td>Y</td>
<td>BSD Console games</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="INSTALLATION-METHODS" name="INSTALLATION-METHODS">3.2.2
Installation Methods</a></h3>
<div class="SECT3">
<h4 class="SECT3"><a id="INSTALLATION-INSTALLATION-METHODS-FLOPPY"
name="INSTALLATION-INSTALLATION-METHODS-FLOPPY">3.2.2.1 Floppy</a></h4>
<p>While it was once possible to install all of Slackware Linux from floppy disks, the
increasing size of software packages (indeed, of some individual programs) has forced the
abandonment of the floppy install. As late as Slackware version 7.1 a partial install was
possible using floppy disks. The A and N series could be nearly entirely installed,
providing a base system from which to install the rest of the distribution. If you are
considering a floppy install (typically on older hardware), it is typically recommended
to find another way, or use an older release. Slackware 4.0 is still very popular for
this reason, as is 7.0.</p>
<p>Please note that floppy disks are still required for a CD-ROM install if you do not
have a bootable CD, as well as for an NFS install.</p>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="INSTALLATION-INSTALLLATION-METHODS-CDROM"
name="INSTALLATION-INSTALLLATION-METHODS-CDROM">3.2.2.2 CD-ROM</a></h4>
<p>If you have the bootable CD, available in the official disc set published by Slackware
Linux, Inc. (see the section called Getting Slackware), a CD-based installation will be a
bit simpler for you. If not, you will need to boot from floppies. Also, if you have
special hardware that makes usage of the kernel on the bootable CD problematic, you may
need to use specialized floppies.</p>
<p>As of Slackware version 8.1, a new method is used for creating the bootable CDs, which
does not work as well with certain flaky BIOS chips (it is worth noting that most all
Linux CDs suffer from this these days). If that is the case, we recommend booting from a
floppy disk.</p>
<p><a href="#INSTALLATION-INSTALLATION-METHODS-BOOTDISK">Section 3.2.3</a> and <a
href="#INSTALLATION-SUPPLEMENTAL-DISK">Section 3.2.5</a> provide information on choosing
and creating floppies from which to boot, should this be necessary.</p>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN823" name="AEN823">3.2.2.3 NFS</a></h4>
<p>NFS (the Network File System) is a way of making filesystems available to remote
machines. An NFS install allows you to install Slackware from another computer on your
network. The machine from which you are installing needs to be configured to export the
Slackware distribution tree to the machine to which you're installing. This, of course,
involves some knowledge of NFS, which is covered in <a
href="#NETWORK-CONFIGURATION-NFS">Section 5.6</a>.</p>
<p>It is possible to perform an NFS install via such methods as PLIP (over a parallel
port), SLIP, and PPP (though not over a modem connection). However, we recommend the use
of a network card if available. After all, installing an operating system through your
printer port is going to be a very, very slow process.</p>
</div>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="INSTALLATION-INSTALLATION-METHODS-BOOTDISK"
name="INSTALLATION-INSTALLATION-METHODS-BOOTDISK">3.2.3 Boot Disk</a></h3>
<p>The boot disk is the floppy you actually boot from to begin the installation. It
contains a compressed kernel image which is used to control the hardware during
installation. Therefore, it is very much required (unless you're booting from CD, as is
discussed in the section called CD-ROM). The boot disks are located in the <tt
class="FILENAME">bootdisks/</tt> directory in the distribution tree.</p>
<p>There are more Slackware boot disks than you can shake a stick at (which is to say
about 16). A complete list of boot disks, with a description of each, is available in the
Slackware distribution tree in the file <tt class="FILENAME">bootdisks/README.TXT</tt>.
However, most people are able to use the <tt class="FILENAME">bare.i</tt> (for IDE
devices) or <tt class="FILENAME">scsi.s</tt> (for SCSI devices) boot disk image.</p>
<p>See <a href="#INSTALLATION-MAKING-THE-DISKS">Section 3.2.6</a> for instructions on
making a disk from an image.</p>
<p>After booting, you will be prompted to insert the root disk. We recommend that you
just humor the boot disk and play along.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="INSTALLATION-INSTALLATION-METHODS-ROOTDISK"
name="INSTALLATION-INSTALLATION-METHODS-ROOTDISK">3.2.4 Root Disk</a></h3>
<p>The root disks contain the setup program and a filesystem which is used during
installation. They are also required. The root disk images are located in the directory
rootdisks in the distribution tree. You'll have to make two root disks from the <tt
class="FILENAME">install.1</tt> and <tt class="FILENAME">install.2</tt> images. Here you
can also find the <tt class="FILENAME">network.dsk</tt>, <tt
class="FILENAME">pcmcia.dsk</tt>, <tt class="FILENAME">rescue.dsk</tt>, and <tt
class="FILENAME">sbootmgr.dsk</tt> disks.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="INSTALLATION-SUPPLEMENTAL-DISK"
name="INSTALLATION-SUPPLEMENTAL-DISK">3.2.5 Supplemental Disk</a></h3>
<p>A supplemental disk is needed if you are performing an NFS install or installing to a
system with PCMCIA devices. Supplemental disks are in the rootdsks directory in the
distribution tree, with the filenames <tt class="FILENAME">network.dsk</tt> and <tt
class="FILENAME">pcmcia.dsk</tt>. Recently other supplemental disks such as <tt
class="FILENAME">rescue.dsk</tt> and <tt class="FILENAME">sbootmgr.dsk</tt> have been
added. The rescue disk is a small floppy root image that runs in a 4MB RAM drive. It
includes some basic networking utilities and the vi editor for quick fixes on busted
machines. The <tt class="FILENAME">sbootmgr.dsk</tt> disk is used to boot other devices.
Boot off this disk if your bootable CD-ROM drive doesn't want to boot the Slackware CDs.
It will prompt you for different things to boot and may offer a convenient way to work
around a buggy BIOS.</p>
<p>The root disk will instruct you on the use of supplemental disks when it is
loaded.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="INSTALLATION-MAKING-THE-DISKS"
name="INSTALLATION-MAKING-THE-DISKS">3.2.6 Making the Disks</a></h3>
<p>Once you've selected a boot disk image, you need to put it on a floppy. The process is
slightly different depending on which operating system you're using to make the disks. If
you're running Linux (or pretty much any Unix-like OS) you'll need to use the <tt
class="COMMAND">dd</tt>(1) command. Assuming <tt class="FILENAME">bare.i</tt> is your
disk image file and your floppy drive is <tt class="FILENAME">/dev/fd0</tt>, the command
to make a <tt class="FILENAME">bare.i</tt> floppy is:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">dd if=bare.i of=/dev/fd0</kbd>
</pre>
</td>
</tr>
</table>
<p>If you're running a Microsoft OS, you'll need to use the <tt
class="FILENAME">RAWRITE.EXE</tt> program, which is included in the distribution tree in
the same directories as the floppy images. Again assuming that <tt
class="FILENAME">bare.i</tt> is your disk image file and your floppy drive is <tt
class="FILENAME">A:</tt>, open a DOS prompt and type the following:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
C:\ <kbd class="USERINPUT">rawrite a: bare.i</kbd>
</pre>
</td>
</tr>
</table>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="INSTALLATION-PARTITIONING" name="INSTALLATION-PARTITIONING">3.3
Partitioning</a></h2>
<p>After booting from your preferred media, you will need to partition your hard disk.
The disk partition is where the Linux filesystem will be created and is where Slackware
will be installed. At the very minimum we recommend creating two partitions; one for your
root filesystem (<tt class="FILENAME">/</tt>) and one for swap space.</p>
<p>After the root disk finishes loading, it will present you with a login prompt. Log in
as root (there is no password). At the shell prompt, run either <tt
class="COMMAND">cfdisk</tt>(8) or <tt class="COMMAND">fdisk</tt>(8). The <tt
class="COMMAND">cfdisk</tt> program provides a more user-friendly interface than the
regular <tt class="COMMAND">fdisk</tt> program, but does lack some features. We will
briefly explain the <tt class="COMMAND">fdisk</tt> program below.</p>
<p>Begin by running <tt class="COMMAND">fdisk</tt> for your hard disk. In Linux, the hard
disks do not have drive letters, but are represented by a file. The first IDE hard disk
(primary master) is <tt class="FILENAME">/dev/hda</tt>, the primary slave is <tt
class="FILENAME">/dev/hdb</tt>, and so on. SCSI disks follow the same type system, but
are in the form of <tt class="FILENAME">/dev/sd<var class="REPLACEABLE">X</var></tt>. You
will need to start <tt class="COMMAND">fdisk</tt> and pass it your hard disk:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">fdisk /dev/hda</kbd>
</pre>
</td>
</tr>
</table>
<p>Like all good Unix programs, <tt class="COMMAND">fdisk</tt> gives you a prompt
(thought you were getting a menu, right?). The first thing you should do is examine your
current partitions. We do that by typing <kbd class="USERINPUT">p</kbd> at the <tt
class="COMMAND">fdisk</tt> prompt:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Command (m for help): <kbd class="USERINPUT">p</kbd>
</pre>
</td>
</tr>
</table>
<p>This will display all sorts of information about your current partitions. Most people
pick a free drive to install to and then remove any existing partitions on it to create
room for the Linux partitions.</p>
<div class="WARNING">
<table class="WARNING" width="100%" border="0">
<tr>
<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/warning.png"
hspace="5" alt="Warning" /></td>
<td align="LEFT" valign="TOP">
<p>IT IS VERY IMPORTANT THAT YOU BACK UP ANY INFORMATION YOU WANT TO SAVE BEFORE
DESTROYING THE PARTITION IT LIVES ON.</p>
</td>
</tr>
</table>
</div>
<p>There is no easy way to recover from deleting a partition, so always back up before
playing with them.</p>
<p>Looking at the table of partition information you should see a partition number, the
size of the partition, and its type. There's more information, but don't worry about that
for now. We are going to delete all of the partitions on this drive to create the Linux
ones. We run the <kbd class="USERINPUT">d</kbd> command to delete those:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Command (m for help): <kbd class="USERINPUT">d</kbd>
Partition number (1-4): <kbd class="USERINPUT">1</kbd>
</pre>
</td>
</tr>
</table>
<p>This process should be continued for each of the partitions. After deleting the
partitions we are ready to create the Linux ones. We have decided to create one partition
for our root filesystem and one for swap. It is worth noting that Unix partitioning
schemes are the subject of many flame wars, and that most users will tell you the best
way to do it. At a minimum, you should create one partition for <tt
class="FILENAME">/</tt> and one for swap. Over time, you'll develop a method that works
well for you.</p>
<p>I use two basic partition schemes. The first is for a desktop. I make 4 partitions,
<tt class="FILENAME">/</tt>, <tt class="FILENAME">/home</tt>, <tt
class="FILENAME">/usr/local</tt>, and swap. This lets me re-install or upgrade the entire
installation under <tt class="FILENAME">/</tt> without wiping out my data files under
/home or my custom compiled applications under <tt class="FILENAME">/usr/local</tt>. For
servers, I often replace the <tt class="FILENAME">/usr/local</tt> partition with a <tt
class="FILENAME">/var</tt> partition. Many different servers store information on that
partition and having it kept separate from <tt class="FILENAME">/</tt> has certain
performance benefits. For now, we're sticking with just two partitions: <tt
class="FILENAME">/</tt> and swap.</p>
<p>Now we create the partitions with the <kbd class="USERINPUT">n</kbd> command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Command (m for help): <kbd class="USERINPUT">n</kbd>
Command action
e extended
p primary partition (1-4)
<kbd class="USERINPUT">p</kbd>
Partition number (1-4):<kbd class="USERINPUT">1</kbd>
First cylinder (0-1060, default 0):<kbd class="USERINPUT">0</kbd>
Last cylinder or +size or +sizeM or +sizeK (0-1060, default 1060):<kbd
class="USERINPUT">+64M</kbd>
</pre>
</td>
</tr>
</table>
<p>You need to make sure you create primary partitions. The first partition is going to
be our swap partition. We tell fdisk to make partition number 1 a primary partition. We
start it at cylinder 0 and for the ending cylinder we type +64M. This will give us a 64
megabyte partition for swap. (The size of the swap partition you need actually depends on
the amount of RAM you have. It is conventional wisdom that a swap space double the size
of your RAM should be created.) Then we define primary partition number 2 starting at the
first available cylinder and going all the way to the end of the drive.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Command (m for help):<kbd class="USERINPUT">n</kbd>
Command action
e extended
p primary partition (1-4)
<kbd class="USERINPUT">p</kbd>
Partition number (1-4):<kbd class="USERINPUT">2</kbd>
First cylinder (124-1060, default 124):<kbd class="USERINPUT">124</kbd>
Last cylinder or +size or +sizeM or +sizeK (124-1060, default 1060):<kbd
class="USERINPUT">1060</kbd>
</pre>
</td>
</tr>
</table>
<p>We are almost done. We need to change the type of the first partition to type 82
(Linux swap). Type <kbd class="USERINPUT">t</kbd> to change the type, select the first
partition, and type <var class="LITERAL">82</var>. Before writing your changes to the
disk, you should look at the new partition table one last time. Use the <kbd
class="USERINPUT">p</kbd> in <tt class="COMMAND">fdisk</tt> to display the partition
table. If everything looks good, type <kbd class="USERINPUT">w</kbd> to write your
changes to the disk and quit <tt class="COMMAND">fdisk</tt>.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="INSTALLATION-SETUP" name="INSTALLATION-SETUP">3.4 The <tt
class="COMMAND">setup</tt> Program</a></h2>
<p>Once you have created your partitions, you are ready to install Slackware. The next
step in the installation process is running the <tt class="COMMAND">setup</tt>(8)
program. To do so, simply type <tt class="COMMAND">setup</tt> at the shell prompt. <tt
class="COMMAND">setup</tt> is a menu-driven system for actually installing the Slackware
packages and configuring your system.</p>
<div class="INFORMALFIGURE"><a id="AEN981" name="AEN981"></a>
<p><img src="installation/setup-program-w.png" /></p>
</div>
<p>The setup process goes something like this: You step through each option in the <tt
class="COMMAND">setup</tt> program, in the order they are listed. (Of course, you are
free to do things in almost any order you choose, but chances are it isn't going to work
out very well.) Menu items are selected using the up and down arrow keys, and the
“Okay” and “Cancel” buttons can be chosen by using the left and
right arrow keys. Alternatively, each option has a corresponding key, which is
highlighted in the option name. Options which are flaggable (those indicated with a <var
class="LITERAL">[X]</var>) are toggled using the spacebar.</p>
<p>Of course, all of that is described in the “help” section of <tt
class="COMMAND">setup</tt>, but we believe in giving our readers their money's worth.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN993" name="AEN993">3.4.1 HELP</a></h3>
<p>If this is your first time installing Slackware, you might want to take a look at the
help screen. It will give a description of each part of <tt class="COMMAND">setup</tt>
(much like the one we're writing now, but less involved) and instructions for navigating
the rest of the install.</p>
<div class="INFORMALFIGURE"><a id="AEN997" name="AEN997"></a>
<p><img src="installation/setup-help-w.png" /></p>
</div>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN1001" name="AEN1001">3.4.2 KEYMAP</a></h3>
<p>If you require a keymap other than the United States “qwerty” layout, you
may want to take a look at this section. It offers a number of alternate layouts for your
keyboarding enjoyment.</p>
<div class="INFORMALFIGURE"><a id="AEN1009" name="AEN1009"></a>
<p><img src="installation/setup-keymap-w.png" /></p>
</div>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN1013" name="AEN1013">3.4.3 ADDSWAP</a></h3>
<div class="INFORMALFIGURE"><a id="AEN1015" name="AEN1015"></a>
<p><img src="installation/setup-swap-w.png" /></p>
</div>
<p>If you created a swap partition (back in <a href="#INSTALLATION-PARTITIONING">Section
3.3</a>), this section will allow you to enable it. It will autodetect and display the
swap partitions on your hard drive, allowing you to select one to format and enable.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN1023" name="AEN1023">3.4.4 TARGET</a></h3>
<div class="INFORMALFIGURE"><a id="AEN1025" name="AEN1025"></a>
<p><img src="installation/setup-target-w.png" /></p>
</div>
<p>The target section is where your other (non-swap) partitions are formatted and mapped
to filesystem mount points. A list of the partitions on your hard disk will be displayed.
For each partition, you will be given the option of whether to format that partition or
not. Depending on the kernel used, you can choose between reiserfs (the default), ext3,
ext2, jfs, and xfs. Most people use either reiserfs or ext3. In the near future we may
see support for reiserfs4 slip in.</p>
<p>The first option in the target section is the selection of a partition on which to
install your root (<tt class="FILENAME">/</tt>) filesystem. After that, you will be able
to map other partitions to filesystems as you choose. (For instance, you may want your
third partition, say <tt class="FILENAME">/dev/hda3</tt>, to be your home filesystem.
This is just an example; map the partitions as you see fit.)</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN1035" name="AEN1035">3.4.5 SOURCE</a></h3>
<p>The source section is where you select the source media from which you are installing
Slackware. Currently there are four sources to choose from. These are CD-ROM, NFS, or a
premounted directory.</p>
<div class="INFORMALFIGURE"><a id="AEN1038" name="AEN1038"></a>
<p><img src="installation/setup-source-w.png" /></p>
</div>
<p>The CD-ROM selection enables a CD-ROM based installation. It will offer the option of
scanning for a CD-ROM drive or displaying a list from which you can pick your drive type.
Make sure you have the Slackware CD in your drive before allowing it to scan.</p>
<p>The NFS selection prompts for your network information and the network information for
your NFS server. The NFS server must be set up in advance. Also note that you cannot use
hostnames, you must use the IP addresses for both your machine and the NFS server (there
is no name resolver on the setup disk). Naturally you must have used the <tt
class="FILENAME">network.dsk</tt> floppy to add support for your network controller.</p>
<p>The premounted directory offers the most flexibility. You can use this method to
install from things such as Jaz disks, NFS mounts over PLIP, and FAT filesystems. Mount
the filesystem to a location of your choosing before running setup, then specify that
location here.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN1054" name="AEN1054">3.4.6 SELECT</a></h3>
<p>The select option allows you to select the software series that you wish to install.
These series are described in <a href="#INSTALLATION-SOFTWARE-SERIES">Section 3.2.1</a>.
Please note that you must install the A series to have a working base system. All other
series are optional.</p>
<div class="INFORMALFIGURE"><a id="AEN1058" name="AEN1058"></a>
<p><img src="installation/setup-select-w.png" /></p>
</div>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN1062" name="AEN1062">3.4.7 INSTALL</a></h3>
<p>Assuming that you have gone through the “target”, “source”,
and “select” options, the <var class="OPTION">install</var> option will allow
you to select packages from your chosen software series. If not, it will prompt you to go
back and complete the other sections of the setup program. This option allows you to
select from six different installation methods: <var class="OPTION">full</var>, <var
class="OPTION">newbie</var>, <var class="OPTION">menu</var>, <var
class="OPTION">expert</var>, <var class="OPTION">custom</var>, and <var
class="OPTION">tag path</var>.</p>
<div class="INFORMALFIGURE"><a id="AEN1077" name="AEN1077"></a>
<p><img src="installation/setup-install-w.png" /></p>
</div>
<p>The <var class="OPTION">full</var> option will install every package from all the
software series that you chose in the “select” section. There is no further
prompting. This is the easiest installation method, since you do not need to make any
decisions on the actual packages to install. Of course, this option also takes up the
most hard drive space.</p>
<p>The next option is <var class="OPTION">newbie</var>. This option installs all of the
required packages in the selected series. For all other packages, it offers a prompt
where you can select “Yes”, “No”, or “Skip”. Yes and
No do the obvious, while Skip will go ahead to the next software series. Additionally,
you will see a description and size requirement for each package to help you decide if
you need it. We recommend this option for new users, as it ensures that you get all the
required packages installed. However, it is a little slow because of the prompting.</p>
<p><var class="OPTION">Menu</var> is a faster and more advanced version of the newbie
option. For each series, a menu is displayed, from which you can select all the
non-required packages you want to install. Required packages are not displayed on this
menu.</p>
<p>For the more advanced user, install offers the <var class="OPTION">expert</var>
option. This allows you complete control over what packages get installed. You can
deselect packages that are absolutely required, resulting in a broken system. On the
other hand, you can control exactly what goes onto your system. Simply select the
packages from each series that you want installed. This is not recommended for the new
user, as it is quite easy to shoot yourself in the foot.</p>
<p>The <var class="OPTION">custom</var> and <var class="OPTION">tag path</var> options
are also for advanced users. These options allow you to install based upon custom tag
files that you created in the distribution tree. This is useful for installing to large
numbers of machines fairly quickly. For more information on using tag files, see <a
href="#PACKAGE-MANAGEMENT-MAKING-TAGS-AND-TAGFILES">Section 18.4</a>.</p>
<p>After selecting your installation method, one of a few things will happen. If you
selected full or menu, a menu screen will appear, allowing you to select the packages to
be installed. If you selected full, packages will immediately start getting installed to
the target. If you selected newbie, packages will be installed until an optional package
is reached.</p>
<p>Note that it is possible to run out of space while installing. If you selected too
many packages for the amount of free space on the target device, you will have problems.
The safest thing to do is to select some software and add more later, if you need it.
This can easily be done using Slackware's package management tools. For this information,
see <a href="#PACKAGE-MANAGEMENT">Chapter 18</a>.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN1100" name="AEN1100">3.4.8 CONFIGURE</a></h3>
<p>The configure section allows you to do some basic system configuration, now that the
packages have been installed. What you see here depends in large part upon which software
you have installed. You will, however, always see the following:</p>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1103" name="AEN1103">3.4.8.1 Kernel selection</a></h4>
<p>Here you will be asked to select a kernel to install. You can install the kernel from
the boot disk you used to install, the Slackware CD-ROM, or from another floppy which you
(always thinking ahead) have prepared. Or you can elect to skip, in which case the
default kernel will be installed and play will continue to the dealer's left.</p>
<div class="INFORMALFIGURE"><a id="AEN1106" name="AEN1106"></a>
<p><img src="installation/setup-kernel-w.png" /></p>
</div>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1110" name="AEN1110">3.4.8.2 Make a boot disk</a></h4>
<p>Making a boot disk for future use is probably a good idea. You will have the option of
formatting a floppy and then creating one of two types of boot disk. The first type, <var
class="OPTION">simple</var>, simply (go figure) writes a kernel to the floppy. A more
flexible (and highly recommended) option is <var class="OPTION">lilo</var>, which will of
course create a lilo boot disk. See LILO in <a href="#BOOTING-LILO">Section 7.1</a> for
more information. Of course, you may also choose to simply <var
class="LITERAL">continue</var>, in which case no boot disk will be made.</p>
<div class="INFORMALFIGURE"><a id="AEN1119" name="AEN1119"></a>
<p><img src="installation/setup-bootdisk-w.png" /></p>
</div>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1123" name="AEN1123">3.4.8.3 Modem</a></h4>
<p>You will be prompted for modem information. More specifically, you will be asked
whether you have a modem, and if so, what serial port it is on.</p>
<div class="INFORMALFIGURE"><a id="AEN1128" name="AEN1128"></a>
<p><img src="installation/setup-modem-w.png" /></p>
</div>
<p>These next configuration subsections may or may not appear, depending on whether or
not you installed their corresponding packages.</p>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1133" name="AEN1133">3.4.8.4 Timezone</a></h4>
<p>This one's pretty straightforward: you will be asked what time zone you are in. If you
operate on Zulu time, we are very sorry; the (extremely long) list is alphabetically
ordered, and you're at the bottom.</p>
<div class="INFORMALFIGURE"><a id="AEN1138" name="AEN1138"></a>
<p><img src="installation/setup-timezone-w.png" /></p>
</div>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1142" name="AEN1142">3.4.8.5 Mouse</a></h4>
<p>This subsection simply asks what kind of mouse you have, and whether you want <tt
class="COMMAND">gpm</tt>(8) console mouse support enabled on bootup.</p>
<div class="INFORMALFIGURE"><a id="AEN1148" name="AEN1148"></a>
<p><img src="installation/setup-mouse-w.png" /></p>
</div>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1152" name="AEN1152">3.4.8.6 Hardware clock</a></h4>
<p>This subsection asks if your computer's hardware clock is set to Coordinated Universal
Time (UTC or GMT). Most PCs are not, so you should probably say no.</p>
<div class="INFORMALFIGURE"><a id="AEN1155" name="AEN1155"></a>
<p><img src="installation/setup-hardware-clock-w.png" /></p>
</div>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1159" name="AEN1159">3.4.8.7 Font</a></h4>
<p>The font subsection allows you to choose from a list of custom console fonts.</p>
<div class="INFORMALFIGURE"><a id="AEN1164" name="AEN1164"></a>
<p><img src="installation/setup-font-w.png" /></p>
</div>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1168" name="AEN1168">3.4.8.8 LILO</a></h4>
<p>Here you are prompted for installation of LILO (the LInux LOader; see <a
href="#BOOTING-LILO">Section 7.1</a> for more information).</p>
<div class="INFORMALFIGURE"><a id="AEN1174" name="AEN1174"></a>
<p><img src="installation/setup-lilo-w.png" /></p>
</div>
<p>If Slackware is to be the only operating system on your computer, <var
class="OPTION">simple</var> should work just fine for you. If you are dual-booting, the
<var class="OPTION">expert</var> option is a better choice. See <a
href="#BOOTING-DUAL">Section 7.3</a> for more information on dual-booting. The third
option, <var class="OPTION">do not install</var>, is not recommended unless you know what
you're doing and have a very good reason for not installing LILO. If you are performing
an expert install, you will be given a choice as to where LILO will be put. You may place
LILO in the MBR (Master Boot Record) of your hard drive, in the superblock of your root
Linux partition, or on a floppy disk.</p>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1183" name="AEN1183">3.4.8.9 Network</a></h4>
<p>The network configuration subsection is actually <tt class="COMMAND">netconfig</tt>.
See <a href="#NETWORK-CONFIGURATION-NETCONFIG">Section 5.1</a> for more information.</p>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1190" name="AEN1190">3.4.8.10 X Window Manager</a></h4>
<p>This subsection will allow you to choose a default window manager for X. See <a
href="#X-WINDOW-SYSTEM">Chapter 6</a> for more details on X and window managers.</p>
<div class="INFORMALFIGURE"><a id="AEN1198" name="AEN1198"></a>
<p><img src="installation/setup-xwmconfig-w.png" /></p>
</div>
<p>No matter which packages you installed, the last thing configure will do is ask you
whether you want to go ahead and set a <tt class="USERNAME">root</tt> password. For
security reasons, this is probably a good idea; however, like almost everything else in
Slackware, this is your call.</p>
</div>
</div>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="SYSTEM-CONFIGURATION" name="SYSTEM-CONFIGURATION"></a>Chapter 4 System
Configuration</h1>
<p>Before you can configure the more advanced parts of your system, it's a good idea to
learn how the system is organized and what commands can be used to search for files and
programs. It's also good to know if you need to compile a custom kernel and what the
steps for doing that are. This chapter will familiarize you with system organization and
configuration files. Then, you can move on to configuring the more advanced parts of the
system.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="SYSTEM-CONFIGURATION-OVERVIEW"
name="SYSTEM-CONFIGURATION-OVERVIEW">4.1 System Overview</a></h2>
<p>It's important to understand how a Linux system is put together before diving into the
various configuration aspects. A Linux system is significantly different from a DOS,
Windows, or Macintosh system (with the exception of the Unix-based Mac OS X), but these
sections will help you get acquainted with the layout so that you can easily configure
your system to meet your needs.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="SYSTEM-CONFIGURATION-LAYOUT"
name="SYSTEM-CONFIGURATION-LAYOUT">4.1.1 File System Layout</a></h3>
<p>The first noticeable difference between Slackware Linux and a DOS or Windows system is
the filesystem. For starters, we do not use drive letters to denote different partitions.
Under Linux, there is one main directory. You can relate this to the <tt
class="DEVICENAME">C:</tt> drive under DOS. Each partition on your system is mounted to a
directory on the main directory. It's kind of like an ever-expanding hard disk.</p>
<p>We call the main directory the root directory, and it's denoted with a single slash
(<tt class="FILENAME">/</tt>). This concept may seem strange, but it actually makes life
easy for you when you want to add more space. For example, let's say you run out of space
on the drive that has <tt class="FILENAME">/home</tt> on it. Most people install
Slackware and make one big root drive. Well, since a partition can be mounted to any
directory, you can simply go to the store and pick up a new hard drive and mount it to
<tt class="FILENAME">/home</tt>. You've now grafted on some more space to your system.
And all without having to move many things around.</p>
<p>Below, you will find descriptions of the major top level directories under
Slackware.</p>
<div class="VARIABLELIST">
<dl>
<dt><tt class="FILENAME">bin</tt></dt>
<dd>
<p>Essential user programs are stored here. These represent the bare minimum set of
programs required for a user to use the system. Things like the shell and the filesystem
commands (<tt class="COMMAND">ls</tt>, <tt class="COMMAND">cp</tt>, and so on) are stored
here. The <tt class="FILENAME">/bin</tt> directory usually doesn't receive modification
after installation. If it does, it's usually in the form of package upgrades that we
provide.</p>
</dd>
<dt><tt class="FILENAME">boot</tt></dt>
<dd>
<p>Files that are used by the Linux Loader (LILO). This directory also receives little
modification after an installation. The kernel is stored here as of Slackware 8.1. In
earlier releases of Slackware, the kernel was simply stored under <tt
class="FILENAME">/</tt> , but common practice is to put the kernel and related files here
to facilitate dual-booting.</p>
</dd>
<dt><tt class="FILENAME">dev</tt></dt>
<dd>
<p>Everything in Linux is treated as a file, even hardware devices like serial ports,
hard disks, and scanners. In order to access these devices, a special file called a
device node has to be present. All device nodes are stored in the <tt
class="FILENAME">/dev</tt> directory. You will find this to be true across many Unix-like
operating systems.</p>
</dd>
<dt><tt class="FILENAME">etc</tt></dt>
<dd>
<p>This directory holds system configuration files. Everything from the X Window
configuration file, the user database, to the system startup scripts. The system
administrator will become quite familiar with this directory over time.</p>
</dd>
<dt><tt class="FILENAME">home</tt></dt>
<dd>
<p>Linux is a multiuser operating system. Each user on the system is given an account and
a unique directory for personal files. This directory is called the user's home
directory. The <tt class="FILENAME">/home</tt> directory is provided as the default
location for user home directories.</p>
</dd>
<dt><tt class="FILENAME">lib</tt></dt>
<dd>
<p>System libraries that are required for basic operation are stored here. The C library,
the dynamic loader, the ncurses library, and kernel modules are among the things stored
here.</p>
</dd>
<dt><tt class="FILENAME">mnt</tt></dt>
<dd>
<p>This directory contains temporary mount points for working on hard disks or removable
drives. Here you'll find mount points for your CD-ROM and floppy drives.</p>
</dd>
<dt><tt class="FILENAME">opt</tt></dt>
<dd>
<p>Optional software packages. The idea behind <tt class="FILENAME">/opt</tt> is that
each software package installs to <tt class="FILENAME">/opt/<var
class="REPLACEABLE">software-package</var></tt>, which makes it easy to remove later.
Slackware distributes some things in <tt class="FILENAME">/opt</tt> (such as KDE in <tt
class="FILENAME">/opt/kde</tt>), but you are free to add anything you want to <tt
class="FILENAME">/opt</tt>.</p>
</dd>
<dt><tt class="FILENAME">proc</tt></dt>
<dd>
<p>This is a unique directory. It's not really part of the filesystem, but a virtual
filesystem that provides access to kernel information. Various pieces of information that
the kernel wants you to know are conveyed to you through files in the <tt
class="FILENAME">/proc</tt> directory. You can also send information to the kernel
through some of these files. Try doing <tt class="COMMAND">cat /proc/cpuinfo</tt>.</p>
</dd>
<dt><tt class="FILENAME">root</tt></dt>
<dd>
<p>The system administrator is known as <tt class="USERNAME">root</tt> on the system. <tt
class="USERNAME">root</tt>'s home directory is kept in <tt class="FILENAME">/root</tt>
instead of <tt class="FILENAME">/home/root</tt>. The reason is simple. What if <tt
class="FILENAME">/home</tt> was a different partition from <tt class="FILENAME">/</tt>
and it could not be mounted? <tt class="USERNAME">root</tt> would naturally want to log
in and repair the problem. If his home directory was on the damaged filesystem, it would
make it difficult for him to log in.</p>
</dd>
<dt><tt class="FILENAME">sbin</tt></dt>
<dd>
<p>Essential programs that are run by <tt class="USERNAME">root</tt> and during the
system bootup process are kept here. Normal users will not run programs in this
directory.</p>
</dd>
<dt><tt class="FILENAME">tmp</tt></dt>
<dd>
<p>The temporary storage location. All users have read and write access to this
directory.</p>
</dd>
<dt><tt class="FILENAME">usr</tt></dt>
<dd>
<p>This is the big directory on a Linux system. Everything else pretty much goes here,
programs, documentation, the kernel source code, and the X Window system. This is the
directory to which you will most likely be installing programs.</p>
</dd>
<dt><tt class="FILENAME">var</tt></dt>
<dd>
<p>System log files, cache data, and program lock files are stored here. This is the
directory for frequently-changing data.</p>
</dd>
</dl>
</div>
<p>You should now have a good feel for which directories contain what on the filesystem.
More detailed information about the filesystem layout is available in the hier(7) man
page. The next section will help you find specific files easily, so you don't have to do
it by hand.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="SYSTEM-CONFIGURATION-FINDING"
name="SYSTEM-CONFIGURATION-FINDING">4.1.2 Finding Files</a></h3>
<p>You now know what each major directory holds, but it still doesn't really help you
find things. I mean, you could go looking through directories, but there are quicker
ways. There are four main file search commands available in Slackware.</p>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1329" name="AEN1329">4.1.2.1 <tt
class="COMMAND">which</tt></a></h4>
<p>The first is the <tt class="COMMAND">which</tt>(1) command. <tt
class="COMMAND">which</tt> is usually used to locate a program quickly. It just searches
your <tt class="ENVAR">PATH</tt> and returns the first instance it finds and the
directory path to it. Take this example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">which bash</kbd>
/bin/bash
</pre>
</td>
</tr>
</table>
<p>From that you see that <tt class="COMMAND">bash</tt> is in the <tt
class="FILENAME">/bin</tt> directory. This is a very limited command for searching, since
it only searches your <tt class="ENVAR">PATH</tt>.</p>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1347" name="AEN1347">4.1.2.2 <tt
class="COMMAND">whereis</tt></a></h4>
<p>The <tt class="COMMAND">whereis</tt>(1) command works similar to <tt
class="COMMAND">which</tt>, but can also search for man pages and source files. A <tt
class="COMMAND">whereis</tt> search for <tt class="COMMAND">bash</tt> should return
this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">whereis bash</kbd>
bash: /bin/bash /usr/bin/bash /usr/man/man1/bash.1.gz
</pre>
</td>
</tr>
</table>
<p>This command not only told us where the actual program is located, but also where the
online documentation is stored. Still, this command is limited. What if you wanted to
search for a specific configuration file? You can't use <tt class="COMMAND">which</tt> or
<tt class="COMMAND">whereis</tt> for that.</p>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1363" name="AEN1363">4.1.2.3 <tt
class="COMMAND">find</tt></a></h4>
<p>The <tt class="COMMAND">find</tt>(1) command allows the user to search the filesystem
with a rich collection of search predicates. Users may specify a search with filename
wildcards, ranges of modification or creation times, or other advanced properties. For
example, to search for the default <tt class="FILENAME">xinitrc</tt> file on the system,
the following command could be used.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">find / -name xinitrc</kbd>
/var/X11R6/lib/xinit/xinitrc
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">find</tt> will take a while to run, since it has to traverse the
entire root directory tree. And if this command is run as a normal user, there will be
permission denied error messages for directories that only <tt class="USERNAME">root</tt>
can see. But <tt class="COMMAND">find</tt> found our file, so that's good. If only it
could be a bit faster...</p>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1378" name="AEN1378">4.1.2.4 <tt
class="COMMAND">slocate</tt></a></h4>
<p>The <tt class="COMMAND">slocate</tt>(1) command searches the entire filesystem, just
like the find command can do, but it searches a database instead of the actual
filesystem. The database is set to automatically update every morning, so you have a
somewhat fresh listing of files on your system. You can manually run <tt
class="COMMAND">updatedb</tt>(1) to update the slocate database (before running <tt
class="COMMAND">updatedb</tt> by hand, you must first <tt class="COMMAND">su</tt> to the
<tt class="USERNAME">root</tt> user). Here's an example of <tt
class="COMMAND">slocate</tt> in action:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">slocate xinitrc</kbd> # we don't have to go to the root
/var/X11R6/lib/xinit/xinitrc
/var/X11R6/lib/xinit/xinitrc.fvwm2
/var/X11R6/lib/xinit/xinitrc.openwin
/var/X11R6/lib/xinit/xinitrc.twm
</pre>
</td>
</tr>
</table>
<p>We got more than what we were looking for, and quickly too. With these commands, you
should be able to find whatever you're looking for on your Linux system.</p>
</div>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="SYSTEM-CONFIGURATION-RCD" name="SYSTEM-CONFIGURATION-RCD">4.1.3
The <tt class="FILENAME">/etc/rc.d</tt> Directory</a></h3>
<p>The system initialization files are stored in the <tt class="FILENAME">/etc/rc.d</tt>
directory. Slackware uses the BSD-style layout for its initialization files as opposed to
System V init scripts, which tend to make configuration changes much more difficult
without using a program specifically designed for that purpose. In BSD-init scripts, each
runlevel is given a single rc file. In System V, each runlevel is given its own
directory, each containing numerous init scripts. This provides an organized structure
that is easy to maintain.</p>
<p>There are several categories of initialization files. These are system startup,
runlevels, network initialization, and System V compatibility. As per tradition, we'll
lump everything else into another category.</p>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1406" name="AEN1406">4.1.3.1 System Startup</a></h4>
<p>The first program to run under Slackware besides the Linux kernel is <tt
class="COMMAND">init</tt>(8). This program reads the <tt
class="FILENAME">/etc/inittab</tt>(5) file to see how to run the system. It runs the <tt
class="FILENAME">/etc/rc.d/rc.S</tt> script to prepare the system before going into your
desired runlevel. The <tt class="FILENAME">rc.S</tt> file enables your virtual memory,
mounts your filesystems, cleans up certain log directories, initializes Plug and Play
devices, loads kernel modules, configures PCMCIA devices, sets up serial ports, and runs
System V init scripts (if found). Obviously <tt class="FILENAME">rc.S</tt> has a lot on
its plate, but here are some scripts in <tt class="FILENAME">/etc/rc.d</tt> that <tt
class="FILENAME">rc.S</tt> will call on to complete its work:</p>
<div class="VARIABLELIST">
<dl>
<dt><tt class="FILENAME">rc.S</tt></dt>
<dd>
<p>This is the actual system initialization script.</p>
</dd>
<dt><tt class="FILENAME">rc.modules</tt></dt>
<dd>
<p>Loads kernel modules. Things like your network card, PPP support, and other things are
loaded here. If this script finds <tt class="FILENAME">rc.netdevice</tt>, it will run
that as well.</p>
</dd>
<dt><tt class="FILENAME">rc.pcmcia</tt></dt>
<dd>
<p>Probes for and configures any PCMCIA devices that you might have on your system. This
is most useful for laptop users, who probably have a PCMCIA modem or network card.</p>
</dd>
<dt><tt class="FILENAME">rc.serial</tt></dt>
<dd>
<p>Configures your serial ports by running the appropriate <tt
class="COMMAND">setserial</tt> commands.</p>
</dd>
<dt><tt class="FILENAME">rc.sysvinit</tt></dt>
<dd>
<p>Looks for System V init scripts for the desired runlevel and runs them. This is
discussed in more detail below.</p>
</dd>
</dl>
</div>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1454" name="AEN1454">4.1.3.2 Runlevel Initialization
Scripts</a></h4>
<p>After system initialization is complete, <tt class="COMMAND">init</tt> moves on to
runlevel initialization. A runlevel describes the state that your machine will be running
in. Sound redundant? Well, the runlevel tells <tt class="COMMAND">init</tt> if you will
be accepting multiuser logins or just a single user, whether or not you want network
services, and if you will be using the X Window System or <tt
class="COMMAND">agetty</tt>(8) to handle logins. The files below define the different
runlevels in Slackware Linux.</p>
<div class="VARIABLELIST">
<dl>
<dt><tt class="FILENAME">rc.0</tt></dt>
<dd>
<p>Halt the system (runlevel 0). By default, this is symlinked to <tt
class="FILENAME">rc.6</tt>.</p>
</dd>
<dt><tt class="FILENAME">rc.4</tt></dt>
<dd>
<p>Multiuser startup (runlevel 4), but in X11 with KDM, GDM, or XDM as the login
manager.</p>
</dd>
<dt><tt class="FILENAME">rc.6</tt></dt>
<dd>
<p>Reboot the system (runlevel 6).</p>
</dd>
<dt><tt class="FILENAME">rc.K</tt></dt>
<dd>
<p>Startup in single user mode (runlevel 1).</p>
</dd>
<dt><tt class="FILENAME">rc.M</tt></dt>
<dd>
<p>Multiuser mode (runlevels 2 and 3), but with the standard text-based login. This is
the default runlevel in Slackware.</p>
</dd>
</dl>
</div>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1493" name="AEN1493">4.1.3.3 Network Initialization</a></h4>
<p>Runlevels 2, 3, and 4 will start up the network services. The following files are
responsible for the network initialization:</p>
<div class="VARIABLELIST">
<dl>
<dt><tt class="FILENAME">rc.inet1</tt></dt>
<dd>
<p>Created by <tt class="COMMAND">netconfig</tt>, this file is responsible for
configuring the actual network interface.</p>
</dd>
<dt><tt class="FILENAME">rc.inet2</tt></dt>
<dd>
<p>Runs after <tt class="FILENAME">rc.inet1</tt> and starts up basic network
services.</p>
</dd>
<dt><tt class="FILENAME">rc.atalk</tt></dt>
<dd>
<p>Starts up AppleTalk services.</p>
</dd>
<dt><tt class="FILENAME">rc.httpd</tt></dt>
<dd>
<p>Starts up the Apache web server. Like a few other rc scripts, this one can also be
used to stop and restart a service. <tt class="FILENAME">rc.httpd</tt> takes arguments of
stop, start, or restart. </p>
</dd>
<dt><tt class="FILENAME">rc.news</tt></dt>
<dd>
<p>Starts up the news server.</p>
</dd>
</dl>
</div>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1534" name="AEN1534">4.1.3.4 System V Compatibility</a></h4>
<p>System V init compatibility was introduced in Slackware 7.0. Many other Linux
distributions make use of this style instead of the BSD style. Basically each runlevel is
given a subdirectory for init scripts, whereas BSD style gives one init script to each
runlevel.</p>
<p>The <tt class="FILENAME">rc.sysvinit</tt> script will search for any System V init
scripts you have in <tt class="FILENAME">/etc/rc.d</tt> and run them, if the runlevel is
appropriate. This is useful for certain commercial software packages that install System
V init scripts</p>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1546" name="AEN1546">4.1.3.5 Other Files</a></h4>
<p>The scripts described below are the other system initialization scripts. They are
typically run from one of the major scripts above, so all you need to do is edit the
contents.</p>
<div class="VARIABLELIST">
<dl>
<dt><tt class="FILENAME">rc.gpm</tt></dt>
<dd>
<p>Starts up general purpose mouse services. Allows you to copy and paste at the Linux
console. Occasionally, gpm will cause problems with the mouse when it is used under X
windows. If you experience problems with the mouse under X, try taking away the
executable permission from this file and stopping the gpm server.</p>
</dd>
<dt><tt class="FILENAME">rc.font</tt></dt>
<dd>
<p>Loads the custom screen font for the console.</p>
</dd>
<dt><tt class="FILENAME">rc.local</tt></dt>
<dd>
<p>Contains any specific startup commands for your system. This is empty after a fresh
install, as it is reserved for local administrators. This script is run after all other
initialization has taken place.</p>
</dd>
</dl>
</div>
<p>To enable a script, all you need to do is add the execute permissions to it with the
<tt class="COMMAND">chmod</tt> command. To disable a script, remove the execute
permissions from it. For more information about <tt class="COMMAND">chmod</tt>, see <a
href="#FILESYSTEM-STRUCTURE-PERMISSIONS">Section 9.2</a>.</p>
</div>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="SYSTEM-CONFIGURATION-KERNEL"
name="SYSTEM-CONFIGURATION-KERNEL">4.2 Selecting a Kernel</a></h2>
<p>The kernel is the part of the operating system that provides hardware access, process
control, and overall system control. The kernel contains support for your hardware
devices, so picking one for your system is an important setup step.</p>
<p>Slackware provides more than a dozen precompiled kernels that you can pick from, each
with a standard set of drivers and additional specific drivers. You can run one of the
precompiled kernels or you can build your own kernel from source. Either way, you need to
make sure that your kernel has the hardware support your system needs.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN1581" name="AEN1581">4.2.1 The <tt
class="FILENAME">/kernels</tt> Directory on the Slackware CD-ROM</a></h3>
<p>The precompiled Slackware kernels are available in the <tt
class="FILENAME">/kernels</tt> directory on the Slackware CD-ROM or on the FTP site in
the main Slackware directory. The available kernels change as new releases are made, so
the documentation in that directory is always the authoritative source. The <tt
class="FILENAME">/kernels</tt> directory has subdirectories for each kernel available.
The subdirectories have the same name as their accompanying boot disk. In each
subdirectory you will find the following files:</p>
<div class="INFORMALTABLE"><a id="AEN1587" name="AEN1587"></a>
<table border="0" frame="void" width="100%" class="CALSTABLE">
<col width="33%" />
<col width="67%" />
<thead>
<tr>
<th>File</th>
<th>Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td><tt class="FILENAME">System.map</tt></td>
<td>The system map file for this kernel</td>
</tr>
<tr>
<td><tt class="FILENAME">bzImage</tt></td>
<td>The actual kernel image</td>
</tr>
<tr>
<td><tt class="FILENAME">config</tt></td>
<td>The source configuration file for this kernel</td>
</tr>
</tbody>
</table>
</div>
<p>To use a kernel, copy the <tt class="FILENAME">System.map</tt> and <tt
class="FILENAME">config</tt> files to your <tt class="FILENAME">/boot</tt> directory and
copy the kernel image to <tt class="FILENAME">/boot/vmlinuz</tt>. Run <tt
class="COMMAND">/sbin/lilo</tt>(8) to install LILO for the new kernel, and then reboot
your system. That's all there is to installing a new kernel.</p>
<p>The kernels that end with a .i are IDE kernels. That is, they include no SCSI support
in the base kernel. The kernels that end with .s are SCSI kernels. They include all the
IDE support in .i kernels, plus SCSI support.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="SYSTEM-CONFIGURATION-KERNEL-COMPILE"
name="SYSTEM-CONFIGURATION-KERNEL-COMPILE">4.2.2 Compiling a Kernel from Source</a></h3>
<p>The question “Should I compile a kernel for my system?” is often asked by
new users. The answer is a definite maybe. There are few instances where you will need to
compile a kernel specific to your system. Most users can use a precompiled kernel and the
loadable kernel modules to achieve a fully working system. You will want to compile a
kernel for your system if you are upgrading kernel versions to one that we do not
currently offer in Slackware, or if you have patched the kernel source to get special
device support that is not in the native kernel source. Anyone with an SMP system will
definitely want to compile a kernel with SMP support. Also, many users find a custom
compiled kernel runs much faster on their machine. You may find it useful to compile the
kernel with optimizations for the specific processor in your machine.</p>
<p>Building your own kernel is not that hard. The first step is to make sure you have the
kernel source installed on your system. Make sure that you installed the packages from
the K series during the installation. You will also want to make sure you have the D
series installed, specifically the C compiler, GNU make, and GNU binutils. In general,
it's a good idea to have the entire D series installed if you plan on doing any kind of
development. You can also download the latest kernel source from <a
href="http://www.kernel.org/mirrors" target="_top">http://www.kernel.org/mirrors</a>.</p>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1624" name="AEN1624">4.2.2.1 Linux Kernel version 2.4.x
Compilation</a></h4>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">su -</kbd>
Password:
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd /usr/src/linux</kbd>
</pre>
</td>
</tr>
</table>
<p>The first step is to bring the kernel source into its base state. We issue this
command to do that (note, you may wish to back-up the <tt class="FILENAME">.config</tt>
file as this command will delete it without warning):</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">make mrproper</kbd>
</pre>
</td>
</tr>
</table>
<p>Now you can configure the kernel for your system. The current kernel offers three ways
of doing this. The first is the original text-based question and answer system. It asks a
bunch of questions and then builds a configuration file. The problem with this method is
that if you mess up, you must start over. The method that most people prefer is the menu
driven one. Lastly, there is an X-based kernel configuration tool. Pick the one you want
and issue the appropriate command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">make config</kbd> (text-based Q&A version)
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">make menuconfig</kbd> (menu driven, text-based version)
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">make xconfig</kbd> (X-based version, make sure you are in X first)
</pre>
</td>
</tr>
</table>
<div class="FIGURE"><a id="SYSTEM-CONFIGURATION-MAKE-MENUCONFIG"
name="SYSTEM-CONFIGURATION-MAKE-MENUCONFIG"></a>
<p><b>Figure 4-1. Kernel Configuration Menu</b></p>
<p><img src="system-configuration/make-menuconfig-w.png" /></p>
</div>
<p>New users will probably find <tt class="COMMAND">menuconfig</tt> to be the easiest to
use. Help screens are provided that explain the various parts of the kernel. After
configuring your kernel, exit the configuration program. It will write the necessary
configuration files. Now we can prepare the source tree for a build:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">make dep</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">make clean</kbd>
</pre>
</td>
</tr>
</table>
<p>The next step is to compile the kernel. First try issuing the <tt
class="COMMAND">bzImage</tt> command below.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">make bzImage</kbd>
</pre>
</td>
</tr>
</table>
<p>This may take a while, depending on your CPU speed. During the build process, you will
see the compiler messages. After building the kernel image, you will want to build any
parts of the kernel that you flagged as modular.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">make modules</kbd>
</pre>
</td>
</tr>
</table>
<p>We can now install the kernel and modules that you compiled. To install the kernel on
a Slackware system, these commands should be issued:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">mv /boot/vmlinuz /boot/vmlinuz.old</kbd>
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">cat arch/i386/boot/bzImage > /vmlinuz</kbd>
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">mv /boot/System.map /boot/System.map.old</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">cp System.map /boot/System.map</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">make modules_install</kbd>
</pre>
</td>
</tr>
</table>
<p>You will want to edit <tt class="FILENAME">/etc/lilo.conf</tt> and add a section to
boot your old kernel in case your new one does not work. After doing that, run <tt
class="COMMAND">/sbin/lilo</tt> to install the new boot block. You can now reboot with
your new kernel.</p>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN1686" name="AEN1686">4.2.2.2 Linux Kernel Version
2.6.x</a></h4>
<p>The compilation of a 2.6 kernel is only slightly different from a 2.4 or a 2.2 kernel,
but it is important that you understand the differences before delving in. It's no longer
necessary to run <tt class="COMMAND">make dep</tt> and <tt class="COMMAND">make
clean</tt>. Also, the kernel compilation process is not as verbose in the 2.6 kernel
series. This results in a build process that is easier to understand, but has some short
comings as well. If you have trouble building the kernel, it's highly recommended that
you turn verbosity back up. You do this simply by appending <var class="OPTION">V=1</var>
to the build. This allows you to log more information that could help a kernel developer
or other friendly geek aid you in resolving the issue.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">make bzImage V=1</kbd>
</pre>
</td>
</tr>
</table>
</div>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="SYSTEM-CONFIGURATION-KERNEL-MODULES"
name="SYSTEM-CONFIGURATION-KERNEL-MODULES">4.2.3 Using Kernel Modules</a></h3>
<p>Kernel modules are another name for device drivers that can be inserted into a running
kernel. They allow you to extend the hardware supported by your kernel without needing to
pick another kernel or compile one yourself.</p>
<p>Modules can also be loaded and unloaded at any time, even when the system is running.
This makes upgrading specific drivers easy for system administrators. A new module can be
compiled, the old one removed, and the new one loaded, all without rebooting the
machine.</p>
<p>Modules are stored in the <tt class="FILENAME">/lib/modules/<var
class="REPLACEABLE">kernel version</var></tt> directory on your system. They can be
loaded at boot time through the <tt class="FILENAME">rc.modules</tt> file. This file is
very well commented and offers examples for major hardware components. To see a list of
modules that are currently active, use the <tt class="COMMAND">lsmod</tt>(1) command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">lsmod</kbd>
Module Size Used by
parport_pc 7220 0
parport 7844 0 [parport_pc]
</pre>
</td>
</tr>
</table>
<p>You can see here that I only have the parallel port module loaded. To remove a module,
you use the <tt class="COMMAND">rmmod</tt>(1) command. Modules can be loaded by the <tt
class="COMMAND">modprobe</tt>(1) or <tt class="COMMAND">insmod</tt>(1) command. <tt
class="COMMAND">modprobe</tt> is usually safer because it will load any modules that the
one you're trying to load depends on.</p>
<p>A lot of users never have to load or unload modules by hand. They use the kernel
autoloader for module management. By default, Slackware includes <var
class="OPTION">kmod</var> in its kernels. <var class="OPTION">kmod</var> is a kernel
option that enables the kernel to automatically load modules as they are requested. For
more information on <var class="OPTION">kmod</var> and how it is configured, see <tt
class="FILENAME">/usr/src/linux/Documentation/kmod.txt</tt>. You'll have needed to have
the kernel source package, or downloaded kernel source from <a href="http://kernel.org"
target="_top">http://kernel.org</a>.</p>
<p>More information can be found in the man pages for each of these commands, plus the
<tt class="FILENAME">rc.modules</tt> file.</p>
</div>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="NETWORK-CONFIGURATION" name="NETWORK-CONFIGURATION"></a>Chapter 5 Network
Configuration</h1>
<div class="SECT1">
<h2 class="SECT1"><a id="NETWORK-CONFIGURATION-NETCONFIG"
name="NETWORK-CONFIGURATION-NETCONFIG">5.1 Introduction: netconfig is your
friend.</a></h2>
<p>When you initially installed Slackware, the setup program invoked the <tt
class="COMMAND">netconfig</tt> program. <tt class="COMMAND">netconfig</tt> attempted to
perform the following functions for you:</p>
<ul>
<li>
<p>It asked you for the name of your computer, and the domain name for your computer.</p>
</li>
<li>
<p>It gave a brief explanation of the various types of addressing schemes, told when they
should be used, and asked you which IP addressing scheme you wished to use to configure
your network card:</p>
<ul>
<li>
<p>Static-IP</p>
</li>
<li>
<p>DHCP</p>
</li>
<li>
<p>Loopback</p>
</li>
</ul>
<br />
<br />
</li>
<li>
<p>It then offered to probe for a network card to configure.</p>
</li>
</ul>
<p><tt class="COMMAND">netconfig</tt> will generally take care of about 80% of the work
of configuring your LAN network connection if you will let it. Note that I would strongly
suggest that you review your config file for a couple of reasons:</p>
<ol type="1">
<li>
<p>You should never trust a setup program to properly configure your computer. If you use
a setup program, you should review the configuration yourself.</p>
</li>
<li>
<p>If you are still learning Slackware and Linux system management, viewing a working
configuration can be helpful. You'll at least know what the configuration should look
like. This will allow you to correct problems due to misconfiguration of the system at a
later date.</p>
</li>
</ol>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="NETWORK-CONFIGURATION-HARDWARE"
name="NETWORK-CONFIGURATION-HARDWARE">5.2 Network Hardware Configuration</a></h2>
<p>Having decided that you wish to bring your Slackware machine on to some form of
network, the first thing you'll need is a Linux-compatible network card. You will need to
take a little care to ensure that the card is truly Linux-compatible (please refer to the
Linux Documentation Project and/or the kernel documentation for information on the
current status of your proposed network card). As a general rule, you will most likely be
pleasantly surprised by the number of networking cards that are supported under the more
modern kernels. Having said that, I'd still suggest referring to any of the various Linux
hardware compatibility lists (such as <a
href="http://www.eskimo.com/%7Elo/linux/hardwarelinks.html" target="_top">The GNU/Linux
Beginners Group Hardware Compatibility Links</a> and <a
href="http://www.linux.org/docs/ldp/howto/Hardware-HOWTO/" target="_top">The Linux
Documentation Project Hardware HOWTO</a>) that are available on the Internet before
purchasing your card. A little extra time spent in research can save days or even weeks
trying to troubleshoot a card that isn't compatible with Linux at all.</p>
<p>When you visit the Linux Hardware Compatibility lists available on the Internet, or
when you refer to the kernel documentation installed on your machine, it would be wise to
note which kernel module you'll need to use to support your network card.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="NETWORK-CONFIGURATION-HARDWARE-MODULES"
name="NETWORK-CONFIGURATION-HARDWARE-MODULES">5.2.1 Loading Network Modules</a></h3>
<p>Kernel modules that are to be loaded on boot-up are loaded from the <tt
class="FILENAME">rc.modules</tt> file in <tt class="FILENAME">/etc/rc.d</tt> or by the
kernel's auto module loading started by <tt class="FILENAME">/etc/rc.d/rc.hotplug</tt>.
The default <tt class="FILENAME">rc.modules</tt> file includes a Network device support
section. If you open <tt class="FILENAME">rc.modules</tt> and look for that section,
you'll notice that it first checks for an executable <tt
class="FILENAME">rc.netdevice</tt> file in <tt class="FILENAME">/etc/rc.d/</tt>. This
script is created if <tt class="COMMAND">setup</tt> successfully autoprobes your network
device during installation.</p>
<p>Below that “if” block is a list of network devices and modprobe lines,
each commented out. Find your device and uncomment the corresponding modprobe line, then
save the file. Running <tt class="FILENAME">rc.modules</tt> as <tt
class="USERNAME">root</tt> should now load your network device driver (as well as any
other modules that are listed and uncommented). Note that some modules (such as the
ne2000 driver) require parameters; make sure you select the correct line.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="NETWORK-CONFIGURATION-HARDWARE-LAN"
name="NETWORK-CONFIGURATION-HARDWARE-LAN">5.2.2 LAN (10/100/1000Base-T and Base-2)
cards</a></h3>
<p>This heading encompasses all of the internal PCI and ISA networking cards. Drivers for
these cards are provided via loadable kernel modules as covered in the previous
paragraph. <tt class="FILENAME">/sbin/netconfig</tt> should have probed for your card and
successfully set up your <tt class="FILENAME">rc.netdevice</tt> file. If this did not
occur, the most likely problem would be that the module that you're attempting to load
for a given card is incorrect (it is not unheard of for different generations of the same
brand of card from the same manufacturer to require different modules). If you are
certain that the module that you're attempting to load is the correct one, your next best
bet would be to refer to the documentation for the module in an attempt to discover
whether or not specific parameters are required during when the module is
initialized.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="NETWORK-CONFIGURATION-HARDWARE-MODEMS"
name="NETWORK-CONFIGURATION-HARDWARE-MODEMS">5.2.3 Modems</a></h3>
<p>Like LAN cards, modems can come with various bus support options. Until recently, most
modems were 8 or 16 bit ISA cards. With the efforts of Intel and motherboard
manufacturers everywhere to finally kill off the ISA bus completely, it is common now to
find that most modems are either external modems that connect to a serial or USB port or
are internal PCI modems. If you wish for your modem to work with Linux, it is <span
class="emphasis"><i class="EMPHASIS">VITALLY</i></span> important to research your
prospective modem purchase, particularly if you are considering purchasing a PCI modem.
Many, if not most, PCI modems available on store shelves these days are WinModems.
WinModems lack some basic hardware on the modem card itself: the functions performed by
this hardware are typically offloaded onto the CPU by the modem driver and the Windows
operating system. This means that they do not have the standard serial interface that
PPPD will be expecting to see when you try to dial out to your Internet Service
Provider.</p>
<p>If you want to be absolutely sure that the modem you're purchasing will work with
Linux, purchase an external hardware modem that connects to the serial port on your PC.
These are guaranteed to work better and be less trouble to install and maintain, though
they require external power and tend to cost more.</p>
<p>There are several web sites that provide drivers and assistance for configuring
WinModem based devices. Some users have reported success configuring and installing
drivers for the various winmodems, including Lucent, Conexant, and Rockwell chipsets. As
the required software for these devices is not an included part of Slackware, and varies
from driver to driver, we will not go into detail on them.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="NETWORK-CONFIGURATION-HARDWARE-PCMCIA"
name="NETWORK-CONFIGURATION-HARDWARE-PCMCIA">5.2.4 PCMCIA</a></h3>
<p>As part of your Slackware install, you are given the opportunity to install the pcmcia
package (in the “A” series of packages). This package contains the
applications and setup files required to work with PCMCIA cards under Slackware. It is
important to note that the pcmcia package only installs the generic software required to
work with PCMCIA cards under Slackware. It does NOT install any drivers or modules. The
available modules and drivers will be in the <tt class="FILENAME">/lib/modules/`uname
-r`/pcmcia</tt> directory. You may need to do some experimentation to find a module that
will work with your network card.</p>
<p>You will need to edit <tt class="FILENAME">/etc/pcmcia/network.opts</tt> (for an
Ethernet card) or <tt class="FILENAME">/etc/pcmcia/wireless.opts</tt> (if you have a
wireless networking card). Like most Slackware configuration files, these two files are
very well commented and it should be easy to determine which modifications need to be
made.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="NETWORK-CONFIGURATION-TCPIP"
name="NETWORK-CONFIGURATION-TCPIP">5.3 TCP/IP Configuration</a></h2>
<p>At this point, your network card should be physically installed in your computer, and
the relevant kernel modules should be loaded. You will not yet be able to communicate
over your network card, but information about the network device can be obtained with <tt
class="COMMAND">ifconfig -a</tt>.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">ifconfig -a</kbd>
eth0 Link encap:Ethernet HWaddr 00:A0:CC:3C:60:A4
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:110081 errors:1 dropped:0 overruns:0 frame:0
TX packets:84931 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:114824506 (109.5 Mb) TX bytes:9337924 (8.9 Mb)
Interrupt:5 Base address:0x8400
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2234 errors:0 dropped:0 overruns:0 frame:0
TX packets:2234 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:168758 (164.8 Kb) TX bytes:168758 (164.8 Kb)
</pre>
</td>
</tr>
</table>
<p>If you just typed <tt class="COMMAND">/sbin/ifconfig</tt> without the <var
class="OPTION">-a</var> suffix, you would not see the <tt class="FILENAME">eth0</tt>
interface, as your network card does not yet have a valid IP address or route.</p>
<p>While there are many different ways to setup and subnet a network, all of them can be
broken down into two types: Static and Dynamic. Static networks are setup such that each
node (geek lingo for thing with an IP address) always has the same IP address. Dynamic
networks are setup in such a way that the IP addresses for the nodes are controlled by a
single server called the DHCP server.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="NETWORK-CONFIGURATION-TCPIP-DHCP"
name="NETWORK-CONFIGURATION-TCPIP-DHCP">5.3.1 DHCP</a></h3>
<p>DHCP (or Dynamic Host Configuration Protocol), is a means by which an IP address may
be assigned to a computer on boot. When the DHCP <span class="emphasis"><i
class="EMPHASIS">client</i></span> boots, it puts out a request on the Local Area Network
for a DHCP <span class="emphasis"><i class="EMPHASIS">server</i></span> to assign it an
IP address. The DHCP server has a pool (or <span class="emphasis"><i
class="EMPHASIS">scope</i></span>) of IP addresses available. The server will respond to
this request with an IP address from the pool, along with a <span class="emphasis"><i
class="EMPHASIS">lease time</i></span>. Once the lease time for a given IP address lease
has expired, the client must contact the server again and repeat the negotiation.</p>
<p>The client will then accept the IP address from the server and will configure the
requested interface with the IP address. There is one more handy trick that DHCP clients
use for negotiating the IP address that they will be assigned, however. The client will
remember it's last assigned IP address, and will request that the server re-assign that
IP address to the client again upon next negotiation. If possible, the server will do so,
but if not, a new address is assigned. So, the negotiation resembles the following:</p>
<p class="LITERALLAYOUT"> <span class="emphasis"><i
class="EMPHASIS">Client</i></span>: Is there a DHCP server available on the LAN?<br />
<span class="emphasis"><i
class="EMPHASIS">Server</i></span>: Yes, there is. Here I am.<br />
<span class="emphasis"><i
class="EMPHASIS">Client</i></span>: I need an IP address.<br />
<span class="emphasis"><i
class="EMPHASIS">Server</i></span>: You may take 192.168.10.10 for 19200 seconds.<br />
<span class="emphasis"><i
class="EMPHASIS">Client</i></span>: Thank you.</p>
<p class="LITERALLAYOUT"> <span class="emphasis"><i
class="EMPHASIS">Client</i></span>: Is there a DHCP server available on the LAN?<br />
<span class="emphasis"><i
class="EMPHASIS">Server</i></span>:Yes, there is. Here I am.<br />
<span class="emphasis"><i
class="EMPHASIS">Client</i></span>:I need an IP address. The last time we<br />
talked, I had 192.168.10.10;<br />
May I have it again?<br />
<span class="emphasis"><i
class="EMPHASIS">Server</i></span>:Yes, you may (or No, you may not: take 192.168.10.12 instead).<br />
<span class="emphasis"><i
class="EMPHASIS">Client</i></span>: Thank you.</p>
<p>The DHCP client in Linux is <tt class="COMMAND">/sbin/dhcpcd</tt>. If you load <tt
class="FILENAME">/etc/rc.d/rc.inet1</tt> in your favorite text editor, you will notice
that <tt class="COMMAND">/sbin/dhcpcd</tt> is called about midway through the script.
This will force the conversation shown above. <tt class="COMMAND">dhcpcd</tt> will also
track the amount of time left on the lease for the current IP address, and will
automatically contact the DHCP server with a request to renew the lease when necessary.
DHCP can also control related information, such as what ntp server to use, what route to
take, etc.</p>
<p>Setting up DHCP on Slackware is simple. Just run <tt class="COMMAND">netconfig</tt>
and select DHCP when offered. If you have more than one NIC and do not wish <tt
class="FILENAME">eth0</tt> to be configured by DHCP, just edit the <tt
class="FILENAME">/etc/rc.d/rc.inet1.conf</tt> file and change the related variable for
your NIC to “<var class="LITERAL">YES</var>”.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="NETWORK-CONFIGURATION-TCPIP-STATIC"
name="NETWORK-CONFIGURATION-TCPIP-STATIC">5.3.2 Static IP</a></h3>
<p>Static IP addresses are fixed addresses that only change if manually told to. These
are used in any case where an administrator doesn't want the IP information to change,
such for internal servers on a LAN, any server connected to the Internet, and networked
routers. With static IP addressing, you assign an address and leave it at that. Other
machines know that you are always at that certain IP address and can contact you at that
address always.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="NETWORK-CONFIGURATION-TCPIP-CONF"
name="NETWORK-CONFIGURATION-TCPIP-CONF">5.3.3 <tt
class="FILENAME">/etc/rc.d/rc.inet1.conf</tt></a></h3>
<p>If you plan on assigning an IP address to your new Slackware box, you may do so either
through the <tt class="FILENAME">netconfig</tt> script, or you may edit <tt
class="FILENAME">/etc/rc.d/rc.inet1.conf</tt>. In <tt
class="FILENAME">/etc/rc.d/rc.inet1.conf</tt> , you will notice:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# Primary network interface card (eth0)
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""
</pre>
</td>
</tr>
</table>
<p>Then further at the bottom:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
GATEWAY=""
</pre>
</td>
</tr>
</table>
<p>In this case, our task is merely to place the correct information between the
double-quotes. These variables are called by <tt class="FILENAME">/etc/rc.d/rc.inet1</tt>
at boot time to setup the nics. For each NIC, just enter the correct IP information, or
put “<var class="LITERAL">YES</var>” for <var class="LITERAL">USE_DHCP</var>.
Slackware will startup the interfaces with the information placed here in the order they
are found.</p>
<p>The <var class="LITERAL">DEFAULT_GW</var> variable sets up the default route for
Slackware. All communications between your computer and other computers on the Internet
must pass through that gateway if no other route is specified for them. If you are using
DHCP, you will usually not need to enter anything here, as the DHCP server will specify
what gateway to use.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="NETWORK-CONFIGURATION-TCPIP-RESOLVER"
name="NETWORK-CONFIGURATION-TCPIP-RESOLVER">5.3.4 <tt
class="FILENAME">/etc/resolv.conf</tt></a></h3>
<p>Ok, so you've got an IP address, you've got a default gateway, you may even have ten
million dollars (give us some), but what good is that if you can't resolve names to IP
addresses? No one wants to type in <tt class="HOSTID">72.9.234.112</tt> into their web
browser to reach <tt class="HOSTID">www.slackbook.org</tt>. After all, who other than the
authors would memorize that IP address? We need to setup DNS, but how? That's where <tt
class="FILENAME">/etc/resolv.conf</tt> comes into play.</p>
<p>Chances are you already have the proper options in <tt
class="FILENAME">/etc/resolv.conf</tt>. If you setup your network connection using DHCP,
the DHCP server should handle updating this file for you. (Technically the DHCP server
just tells <tt class="COMMAND">dhcpcd</tt> what to put here, and it obeys.) If you need
to manually update your DNS server list though, you'll need to hand edit <tt
class="FILENAME">/etc/resolv.conf</tt>. Below is an example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">cat /etc/resolv.conf</kbd>
nameserver 192.168.1.254
search lizella.net
</pre>
</td>
</tr>
</table>
<p>The first line is simple. The nameserver directive tells us what DNS servers to query.
By necessity these are always IP addresses. You may have as many listed there as you
like. Slackware will happily check one after the other until one returns a match.</p>
<p>The second line is a little more interesting. The search directive gives us a list of
domain names to assume whenever a DNS request is made. This allows you to contact a
machine by only the first part of its FQDN (Fully Qualified Domain Name). For example, if
“slackware.com” were in your search path, you could reach <tt
class="HOSTID">http://store.slackware.com</tt> by just pointing your web browser at <tt
class="HOSTID">http://store</tt>.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">ping -c 1 store</kbd>
PING store.slackware.com (69.50.233.153): 56 data bytes
64 bytes from 69.50.233.153 : icmp_seq=0 ttl=64 time=0.251 ms
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.251/0.251/0.251 ms
</pre>
</td>
</tr>
</table>
<br />
<br />
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="NETWORK-CONFIGURATION-TCPIP-HOSTS"
name="NETWORK-CONFIGURATION-TCPIP-HOSTS">5.3.5 <tt
class="FILENAME">/etc/hosts</tt></a></h3>
<p>Now that we've got DNS working fine, what if we want to bypass our DNS server, or add
a DNS entry for a machine that isn't in DNS? Slackware includes the oft-loved <tt
class="FILENAME">/etc/hosts</tt> file which contains a local list of DNS names and IP
addresses they should match to.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">cat /etc/hosts</kbd>
127.0.0.1 localhost locahost.localdomain
192.168.1.101 redtail
172.14.66.32 foobar.slackware.com
</pre>
</td>
</tr>
</table>
<p>Here you can see that localhost has an IP address of <tt class="HOSTID">127.0.0.1</tt>
(always reserved for localhost), redtail can be reached at <tt
class="HOSTID">192.168.1.101</tt>, and <tt class="HOSTID">foobar.slackware.com</tt> is
<tt class="HOSTID">172.14.66.32</tt>.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="NETWORK-CONFIGURATION-PPP" name="NETWORK-CONFIGURATION-PPP">5.4
PPP</a></h2>
<p>Many people still connect to the Internet through some kind of dialup connection. The
most common method is PPP, though SLIP is still occasionally used. Setting up your system
to speak PPP to a remote server is pretty easy. We've included a few tools to help you in
setting it up.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN1954" name="AEN1954">5.4.1 <tt
class="COMMAND">pppsetup</tt></a></h3>
<p>Slackware includes a program called <tt class="COMMAND">pppsetup</tt> to configure
your system to use your dialup account. It shares a look and feel similar to our <tt
class="COMMAND">netconfig</tt> program. To run the program, make sure you are logged in
as root. Then type <tt class="COMMAND">pppsetup</tt> to run it. You should see a screen
like this:</p>
<p>The program will present a series of questions, to which you will feed it appropriate
answers. Things like your modem device, the modem initialization string, and the ISP
phone number. Some items will have a default, which you can accept in most cases.</p>
<p>After the program runs, it will create a <tt class="COMMAND">ppp-go</tt> program and a
<tt class="COMMAND">ppp-off</tt> program. These are used to start and stop, respectively,
the PPP connection. The two programs are located in <tt class="FILENAME">/usr/sbin</tt>
and need root privileges to run.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN1969" name="AEN1969">5.4.2 <tt
class="FILENAME">/etc/ppp</tt></a></h3>
<p>For most users, running <tt class="COMMAND">pppsetup</tt> will be sufficient. However,
there may be an instance where you want to tweak some of the values used by the PPP
daemon. All of the configuration information is kept in <tt
class="FILENAME">/etc/ppp</tt>. Here is a list of what the different files are for:</p>
<div class="INFORMALTABLE"><a id="AEN1975" name="AEN1975"></a>
<table border="0" frame="void" class="CALSTABLE">
<col width="1*" />
<col width="3*" />
<tbody>
<tr>
<td><tt class="COMMAND">ip-down</tt></td>
<td>
<p>This script is run by <tt class="COMMAND">pppd</tt> after the PPP connection is
ended.</p>
</td>
</tr>
<tr>
<td><tt class="COMMAND">ip-up</tt></td>
<td>
<p>This script is run by <tt class="COMMAND">pppd</tt> when there's a successful ppp
connection. Put any commands you want run after a successful connection in this file.</p>
</td>
</tr>
<tr>
<td><tt class="FILENAME">options</tt></td>
<td>
<p>General configuration options for <tt class="COMMAND">pppd</tt>.</p>
</td>
</tr>
<tr>
<td><tt class="FILENAME">options.demand</tt></td>
<td>
<p>General configuration options for <tt class="COMMAND">pppd</tt> when run in demand
dialing mode.</p>
</td>
</tr>
<tr>
<td><tt class="COMMAND">pppscript</tt></td>
<td>
<p>The commands sent to the modem.</p>
</td>
</tr>
<tr>
<td><tt class="FILENAME">pppsetup.txt</tt></td>
<td>
<p>A log of what you entered when you ran <tt class="COMMAND">pppsetup</tt>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="NOTE">
<table class="NOTE" width="100%" border="0">
<tr>
<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/note.png"
hspace="5" alt="Note" /></td>
<td align="LEFT" valign="TOP">
<p>Most of these files won't be there until after you run <tt
class="COMMAND">pppsetup</tt>.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="NETWORK-CONFIGURATION-WIRELESS"
name="NETWORK-CONFIGURATION-WIRELESS">5.5 Wireless</a></h2>
<p>Wireless networking is still a relatively new thing in the world of computers, yet is
quickly catching on as more people begin to purchase laptops and want networking on the
go, without having to fool with some old twisted pair cable. This trend doesn't appear to
be slowing down. Unfortunately, wireless networking isn't yet as strongly supported in
Linux as traditional wired networking.</p>
<p>There are three basic steps to configuring an 802.11 wireless Ethernet card:</p>
<ol type="1">
<li>
<p>Hardware support for the wireless card</p>
</li>
<li>
<p>Configure the card to connect to a wireless access point</p>
</li>
<li>
<p>Configure the network</p>
</li>
</ol>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN2033" name="AEN2033">5.5.1 Hardware Support</a></h3>
<p>Hardware support for a wireless card is provided through the kernel, either with a
module or built in to the kernel. Generally, most newer Ethernet cards are provided
through kernel modules, so you'll want to determine the appropriate kernel module and
load it through <tt class="FILENAME">/etc/rc.d/rc.modules</tt>. <tt
class="COMMAND">netconfig</tt> may not detect your wireless card, so you'll probably need
to determine the card yourself. See <a
href="http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/"
target="_top">http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/</a> for more
information on kernel drivers for various wireless cards.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN2044" name="AEN2044">5.5.2 Configure the Wireless
Settings</a></h3>
<p>The vast majority of this work is done by <tt class="COMMAND">iwconfig</tt>, so as
always read the man page for <tt class="COMMAND">iwconfig</tt> if you need more
information.</p>
<p>First, you'll want to configure your wireless access point. Wireless access points
vary quite a bit in their terminology, and how to configure them, so you may need to
adjust a bit to accommodate your hardware. In general, you'll need at least the following
information:</p>
<ul>
<li>
<p>The domain ID, or name of the network (called the ESSID by <tt
class="COMMAND">iwconfig</tt>)</p>
</li>
<li>
<p>The channel the WAP uses</p>
</li>
<li>
<p>The encryption settings, including any keys used (preferably in hexadecimal)</p>
</li>
</ul>
<div class="WARNING">
<table class="WARNING" width="100%" border="0">
<tr>
<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/warning.png"
hspace="5" alt="Warning" /></td>
<td align="LEFT" valign="TOP">
<p>A NOTE ABOUT WEP. WEP is quit flawed, but it's much better than nothing. If you wish a
greater degree of security on your wireless network, you should investigate VPNs or
IPSec, both of which are beyond the scope of this document. You might also configure your
WAP not to advertise its domain ID/ ESSID. A thorough discussion of wireless policy is
beyond the scope of this section, but a quick Google search will turn up more than you
ever wanted to know.</p>
</td>
</tr>
</table>
</div>
<p>Once you've gathered the above information, and assuming you've used <tt
class="COMMAND">modprobe</tt> to load the appropriate kernel driver, you can edit <tt
class="FILENAME">rc.wireless.conf</tt> and add your settings. The <tt
class="FILENAME">rc.wireless.conf</tt> file is a bit untidy. The least effort is to
modify the generic section with your ESSID and KEY, and CHANNEL if required by your card.
(Try not setting CHANNEL, and if it works, great; if not, set the CHANNEL as
appropriate.) If you're daring, you can modify the file so that only the necessary
variables are set. The variable names in <tt class="FILENAME">rc.wireless.conf</tt>
correspond to the <tt class="COMMAND">iwconfig</tt> parameters, and are read by <tt
class="FILENAME">rc.wireless</tt> and used in the appropriate <tt
class="COMMAND">iwconfig</tt> commands.</p>
<p>If you have your key in hexadecimal, that's ideal, since you can be fairly confident
that your WAP and <tt class="COMMAND">iwconfig</tt> will agree on the key. If you only
have a string, you can't be sure how your WAP will translate that into a hexadecimal key,
so some guesswork may be needed (or get your WAP's key in hex).</p>
<p>Once you've modified <tt class="FILENAME">rc.wireless.conf</tt>, run <tt
class="FILENAME">rc.wireless</tt> as <tt class="USERNAME">root</tt>, then run <tt
class="FILENAME">rc.inet1</tt>, again as <tt class="USERNAME">root</tt>. You can test
your wireless networking with standard testing tools such as <tt
class="COMMAND">ping</tt>, along with <tt class="COMMAND">iwconfig</tt>. If you have a
wired interface you may wish to use <tt class="COMMAND">ifconfig</tt> to turn those
interfaces off while you test your wireless networking to ensure there's no interference.
You may also want to test your changes through a reboot.</p>
<p>Now that you've seen how to edit <tt class="FILENAME">/etc/rc.d/rc.wireless</tt> for
you default network, let's take a closer look at iwconfig and see how it all works. This
will teach you the quick and dirty way of setting up wifi for those times when you find
yourself at an Internet cafe, coffee shop, or any other wifi hot spot and wish to get
online.</p>
<p>The first step is to tell your wireless NIC what network to join. Make sure you
replace “<tt class="FILENAME">eth0</tt>” with whatever network interface your
wireless card uses and change “<var class="REPLACEABLE">mynetwork</var>” to
the essid you wish to use. Yes, we know you're smarter than that. Next you'll have to
specify the encryption key (if any) used on your wireless network. Finally specify the
channel to use (if needed).</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">iwconfig eth0 essid "<var
class="REPLACEABLE">mynetwork</var>"</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">iwconfig eth0 key <var
class="REPLACEABLE">XXXXXXXXXXXXXXXXXXXXXXXXXXX</var></kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">iwconfig eth0 channel n</kbd>
</pre>
</td>
</tr>
</table>
<p>That should be all on the wireless end of things.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN2101" name="AEN2101">5.5.3 Configure the Network</a></h3>
<p>This is done in the exact same way as wired networks. Simply refer to earlier sections
of this chapter.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="NETWORK-CONFIGURATION-NFS" name="NETWORK-CONFIGURATION-NFS">5.6
Network File Systems</a></h2>
<p>At this point, you should have a working TCP/IP connection to your network. You should
be able to ping other computers on your internal network and, if you have configured an
appropriate gateway, you should also be able to ping computers on the Internet itself. As
we know, the whole point in bringing a computer onto a network is to access information.
While some people might bring a computer up on a network just for the fun of it, most
people wish to be able to share files and printers. They wish to be able to access
documents on the Internet or play an online game. Having TCP/IP installed and functional
on your new Slackware system is a means to that end, but with just TCP/IP installed,
functionality will be very rudimentary. To share files, we will have to transfer them
back and forth using either FTP or SCP. We cannot browse files on our new Slackware
computer from the Network Neighborhood or My Network Places icons on Windows computers.
We'd like to be able to access files on other Unix machines seamlessly.</p>
<p>Ideally, we'd like to be able to use a <span class="emphasis"><i
class="EMPHASIS">network file system</i></span> to allow us transparent access to our
files on other computers. The programs that we use to interact with information stored on
our computers really do not need to know on what computer a given file is stored; they
just need to know that it exists and how to get to it. It is then the responsibility of
the operating system to manage access to that file through the available file systems and
network file systems. The two most commonly used network file systems are SMB (as
implemented by Samba) and NFS.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="NETWORK-CONFIGURATION-NSF-SMB"
name="NETWORK-CONFIGURATION-NSF-SMB">5.6.1 SMB/Samba/CIFS</a></h3>
<p>SMB (for Server Message Block) is a descendant of the older NetBIOS protocol that was
initially used by IBM in their LAN Manager product. Microsoft has always been fairly
interested in NetBIOS and it's successors (NetBEUI, SMB and CIFS). The Samba project has
existed since 1991, when it was originally written to link an IBM PC running NetBIOS with
a Unix server. These days, SMB is the preferred method for sharing file and print
services over a network for virtually the entire civilized world because Windows supports
it.</p>
<p>Samba's configuration file is <tt class="FILENAME">/etc/samba/smb.conf</tt>; one of
the most well commented and documented configuration files you will find anywhere. Sample
shares have been setup for you to view and modify for your needs. If you need even
tighter control the man page for smb.conf is indispensable. Since Samba is documented so
well in the places I've mentioned above, we will not rewrite the documentation here. We
will, however, quickly cover the basics.</p>
<p><tt class="FILENAME">smb.conf</tt> is broken down into multiple sections: one section
per share, and a global section for setting options that are to be used everywhere. Some
options are only valid in the global section; some are only valid outside the global
section. Remember that the global section can be over-ridden by any other section. Refer
to the man pages for more information.</p>
<p>You will most likely wish to edit your <tt class="FILENAME">smb.conf</tt> file to
reflect the network settings in your LAN. I would suggest modifying the items listed
below:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
[global]
# workgroup = NT-Domain-Name or Workgroup-Name, eg: LINUX2
workgroup = MYGROUP
</pre>
</td>
</tr>
</table>
<p>Change the workgroup name to reflect the workgroup or domain name that you are using
locally.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# server string is the equivalent of the NT Description field
server string = Samba Server
</pre>
</td>
</tr>
</table>
<p>This will be the name of your Slackware computer displayed in the Network Neighborhood
(or My Network Places) folder.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# Security mode. Most people will want user level security. See
# security_level.txt for details. NOTE: To get the behaviour of
# Samba-1.9.18, you'll need to use "security = share".
security = user
</pre>
</td>
</tr>
</table>
<p>You'll almost certainly wish to implement user level security on your Slackware
system.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# You may wish to use password encryption. Please read
# ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba
# documentation.
# Do not enable this option unless you have read those documents
encrypt passwords = yes
</pre>
</td>
</tr>
</table>
<p>If encrypt passwords is not enabled, you will not be able to use Samba with NT4.0,
Win2k, WinXP, and Win2003. Earlier Windows operating systems did not require encryption
to share files.</p>
<p>SMB is an authenticated protocol, meaning you must supply a correct username and
password in order to use this service. We tell the samba server what usernames and
passwords are valid with the <tt class="COMMAND">smbpasswd</tt> command. <tt
class="COMMAND">smbpasswd</tt> takes a couple of common switches to tell it to either add
traditional users, or add machine users (SMB requires that you add the computers' NETBIOS
names as machine users, restricting what computers one can authenticate from).</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Adding a user to the <tt class="FILENAME">/etc/samba/private/smbpasswd</tt> file.
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">smbpasswd -a user</kbd>
Adding a machine name to the /etc/samba/private/smbpasswd file.
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">smbpasswd -a -m machine</kbd>
</pre>
</td>
</tr>
</table>
<p>It's important to note that a given username or machine name must already exist in the
<tt class="FILENAME">/etc/passwd</tt> file. You can accomplish this simply with the <tt
class="COMMAND">adduser</tt> command. Note that when using the <tt
class="COMMAND">adduser</tt> command to add a machine name one must append a dollar sign
(“<var class="LITERAL">$</var>”) to the machine name. This should <span
class="emphasis"><i class="EMPHASIS">not</i></span> however, be done with <tt
class="COMMAND">smbpasswd</tt>. <tt class="COMMAND">smbpasswd</tt> appends the dollar
sign on its own. Failing to mangle the machine name this way with <tt
class="COMMAND">adduser</tt> will result in an error when adding the machine name to
samba.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">adduser machine$</kbd>
</pre>
</td>
</tr>
</table>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="NETWORK-CONFIGURATION-NFS-NFS"
name="NETWORK-CONFIGURATION-NFS-NFS">5.6.2 Network File System (NFS)</a></h3>
<p>NFS (or Network File System) was originally written by Sun for their Solaris
implementation of Unix. While it is significantly easier to get up and running when
compared to SMB, it is also significantly less secure. The primary insecurity in NFS is
that it is easy to spoof user and group id's from one machine to another. NFS is an
unauthenticated protocol. Future versions of the NFS protocol are being devised that
enhance security, but these are not common at the time of this writing.</p>
<p>NFS configuration is governed by the <tt class="FILENAME">/etc/exports</tt> file. When
you load the default <tt class="FILENAME">/etc/exports</tt> file into an editor, you'll
see a blank file with a two line comment on top. We'll need to add a line to the exports
file for each directory that we wish to export, with a listing of client workstations
that will be allowed to access that file. For instance, if we wished to export directory
<tt class="FILENAME">/home/foo</tt> to workstation Bar, we would simply add the line:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
/home/foo Bar(rw)
</pre>
</td>
</tr>
</table>
<p>to our <tt class="FILENAME">/etc/exports</tt>. Below, you'll find the example from the
man page for the <tt class="FILENAME">exports</tt> file:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# sample /etc/exports file
/ master(rw) trusty(rw,no_root_squash)
/projects proj*.local.domain(rw)
/usr *.local.domain(ro) @trusted(rw)
/home/joe pc001(rw,all_squash,anonuid=150,anongid=100)
/pub (ro,insecure,all_squash)
</pre>
</td>
</tr>
</table>
<p>As you can see, there are various options available, but most should be fairly clear
from this example.</p>
<p>NFS works under the assumption that a given user on one machine in a network has the
same user ID on all machines across the network. When an attempt is made to read or write
from a NFS client to an NFS server, a UID is passed as part of the read/write request.
This UID is treated the same as if the read/write request originated on the local
machine. As you can see, if one could arbitrarily specify a given UID when accessing
resources on a remote system, Bad Things (tm) could and would happen. As a partial hedge
against this, each directory is mounted with the <var class="OPTION">root_squash</var>
option. This maps the UID for any user claiming to be root to a different UID, thus
preventing root access to the files or folders in the exported directory. <var
class="OPTION">root_squash</var> seems to be enabled by default as a security measure,
but the authors recommend specifying it anyway in your <tt
class="FILENAME">/etc/exports</tt> file.</p>
<p>You can also export a directory directly from the command line on the server by using
the <tt class="COMMAND">exportfs</tt> command as follows:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">exportfs -o rw,no_root_squash Bar:/home/foo</kbd>
</pre>
</td>
</tr>
</table>
<p>This line exports the <tt class="FILENAME">/home/foo</tt> directory to the computer
“<tt class="HOSTID">Bar</tt>” and grants <tt class="HOSTID">Bar</tt>
read/write access. Additionally, the NFS server will not invoke <var
class="OPTION">root_squash</var>, which means any user on Bar with a UID of
“0” (root's UID) will have the same privileges as root on the server. The
syntax does look strange (usually when a directory is specified in <var
class="LITERAL">computer:/directory/file</var> syntax, you are referring to a file in a
directory on a given computer).</p>
<p>You'll find more information on the man page for the exports file.</p>
</div>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="X-WINDOW-SYSTEM" name="X-WINDOW-SYSTEM"></a>Chapter 6 X Configuration</h1>
<p>Starting with Slackware-10.0, the X Window environment in Slackware is provided by
Xorg. X is responsible for providing a graphical user interface. It is independent from
the operating system, unlike Windows or the MacOS.</p>
<p>The X Window System is implemented through many programs that run in userland. The two
main components are the server and the window manager. The server provides the lowlevel
functions for interacting with your video hardware, thus it is system specific. The
window manager sits on top of the server and provides the user interface. The advantage
to this is you can have many different graphical interfaces by simply changing the window
manager you use.</p>
<p>Configuring X can be a complex task. The reason for this is the vast numbers of video
cards available for the PC architecture, most of which use different programming
interfaces. Luckily, most cards today support basic video standards known as VESA, and if
your card is among them you'll be able to start X using the <tt
class="COMMAND">startx</tt> command right out of the box.</p>
<p>If this doesn't work with your card, or if you'd like to take advantage of the
high-performance features of your video card such as hardware acceleration or 3-D
hardware rendering, then you'll need to reconfigure X.</p>
<p>To configure X, you'll need to make an <tt class="FILENAME">/etc/X11/xorg.conf</tt>
file. This file contains lots of details about your video hardware, mouse, and monitor.
It's a very complex configuration file, but fortunately there are several programs to
help create one for you. We'll mention a few of them here.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="X-WINDOW-SYSTEM-XORGCONFIG"
name="X-WINDOW-SYSTEM-XORGCONFIG">6.1 <tt class="COMMAND">xorgconfig</tt></a></h2>
<p>This is a simple menu driven frontend that's similar in feel to the Slackware
installer. It simply tells the X server to take a look at the card, and then set up the
best initial configuration file it can make based on the information it gathers. The
generated <tt class="FILENAME">/etc/X11/xorg.conf</tt> file should be a good starting
point for most systems (and should work without modification).</p>
<p>This is a text-based X configuration program that's designed for the advanced system
administrator. Here's a sample walkthrough using <tt class="COMMAND">xorgconfig</tt>.
First, start the program:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">xorgconfig</kbd>
</pre>
</td>
</tr>
</table>
<p>This will present a screenful of information about <tt
class="COMMAND">xorgconfig</tt>. To continue, press <kbd class="USERINPUT">ENTER</kbd>.
<tt class="COMMAND">xorgconfig</tt> will ask you to verify you have set your <tt
class="ENVAR">PATH</tt> correctly. It should be fine, so go ahead and hit <kbd
class="USERINPUT">ENTER</kbd>.</p>
<div class="FIGURE"><a id="X-WINDOW-SYSTEM-1" name="X-WINDOW-SYSTEM-1"></a>
<p><b>Figure 6-1. <tt class="COMMAND">xorgconfig</tt> Mouse Configuration</b></p>
<p><img src="x-window-system/xorgconfig1-w.png" /></p>
</div>
<p>Select your mouse from the menu presented. If you don't see your serial mouse listed,
pick the Microsoft protocol -- it's the most common and will probably work. Next <tt
class="COMMAND">xorgconfig</tt> will ask you about using <var
class="OPTION">ChordMiddle</var> and <var class="OPTION">Emulate3Buttons</var>. You'll
see these options described in detail on the screen. Use them if the middle button on
your mouse doesn't work under X, or if your mouse only has two buttons (<var
class="OPTION">Emulate3Buttons</var> lets you simulate the middle button by pressing both
buttons simultaneously). Then, enter the name of your mouse device. The default choice,
<tt class="FILENAME">/dev/mouse</tt>, should work since the link was configured during
Slackware setup. If you're running GPM (the Linux mouse server) in repeater mode, you can
set your mouse type to <tt class="FILENAME">/dev/gpmdata</tt> to have X get information
about the mouse through <tt class="COMMAND">gpm</tt>. In some cases (with busmice
especially) this can work better, but most users shouldn't do this.</p>
<p><tt class="COMMAND">xorgconfig</tt> will ask you about enabling special key bindings.
If you need this say “<kbd class="USERINPUT">y</kbd>”. Most users can say
“<kbd class="USERINPUT">n</kbd>” -- enter this if you're not sure.</p>
<div class="FIGURE"><a id="X-WINDOW-SYSTEM-2" name="X-WINDOW-SYSTEM-2"></a>
<p><b>Figure 6-2. <tt class="COMMAND">xorgconfig</tt> Horizontal Sync</b></p>
<p><img src="x-window-system/xorgconfig2-w.png" /></p>
</div>
<p>In the next section you enter the sync range for your monitor. To start configuring
your monitor, press <kbd class="USERINPUT">ENTER</kbd>. You will see a list of monitor
types -- choose one of them. Be careful not to exceed the specifications of your monitor.
Doing so could damage your hardware.</p>
<div class="FIGURE"><a id="X-WINDOW-SYSTEM-3" name="X-WINDOW-SYSTEM-3"></a>
<p><b>Figure 6-3. <tt class="COMMAND">xorgconfig</tt> Vertical Sync</b></p>
<p><img src="x-window-system/xorgconfig3-w.png" /></p>
</div>
<p>Specify the vertical sync range for your monitor (you should find this in the manual
for the monitor). xorgconfig will ask you to enter strings to identify the monitor type
in the <tt class="FILENAME">xorg.conf</tt> file. Enter anything you like on these 3 lines
(including nothing at all).</p>
<div class="FIGURE"><a id="X-WINDOW-SYSTEM-4" name="X-WINDOW-SYSTEM-4"></a>
<p><b>Figure 6-4. <tt class="COMMAND">xorgconfig</tt> Video Card</b></p>
<p><img src="x-window-system/xorgconfig4-w.png" /></p>
</div>
<p>Now you have the opportunity to look at the database of video card types. You'll want
to do this, so say “<kbd class="USERINPUT">y</kbd>”, and select a card from
the list shown. If you don't see your exact card, try selecting one that uses the same
chipset and it will probably work fine.</p>
<p>Next, tell <tt class="COMMAND">xorgconfig</tt> how much RAM you have on your video
card. <tt class="COMMAND">xorgconfig</tt> will want you to enter some more descriptive
text about your video card. If you like, you can enter descriptions on these three
lines.</p>
<p>You'll then be asked which display resolutions you want to use. Again, going with the
provided defaults should be fine to start with. Later on, you can edit the <tt
class="FILENAME">/etc/X11/xorg.conf</tt> file and rearrange the modes so 1024x768 (or
whatever mode you like) is the default.</p>
<p>At this point, the <tt class="COMMAND">xorgconfig</tt> program will ask if you'd like
to save the current configuration file. Answer yes, and the X configuration file is
saved, completing the setup process. You can start X now with the <tt
class="COMMAND">startx</tt> command.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="X-WINDOW-SYSTEM-XORGSETUP" name="X-WINDOW-SYSTEM-XORGSETUP">6.2
<tt class="COMMAND">xorgsetup</tt></a></h2>
<p>The second way to configure X is to use <tt class="COMMAND">xorgsetup</tt>, an
automagical configuration program that comes with Slackware.</p>
<p>To run <tt class="COMMAND">xorgsetup</tt>, log in as root and type:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">xorgsetup</kbd>
</pre>
</td>
</tr>
</table>
<p>If you've already got an <tt class="FILENAME">/etc/X11/xorg.conf</tt> file (because
you've already configured X), you'll be asked if you want to backup the existing config
file before continuing. The original file will be renamed to <tt
class="FILENAME">/etc/X11/xorg.conf.backup</tt>.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="X-WINDOW-SYSTEM-XINITRC" name="X-WINDOW-SYSTEM-XINITRC">6.3
xinitrc</a></h2>
<p><tt class="COMMAND">xinit</tt>(1) is the program that actually starts X; it is called
by <tt class="COMMAND">startx</tt>(1), so you may not have noticed it (and probably don't
really need to). Its configuration file, however, determines which programs (including
and especially the window manager) are run when X starts up. <tt
class="COMMAND">xinit</tt> first checks your home directory for a <tt
class="FILENAME">.xinitrc</tt> file. If the file is found, it gets run; otherwise, <tt
class="FILENAME">/var/X11R6/lib/xinit/xinitrc</tt> (the systemwide default) is used.
Here's a simple <tt class="FILENAME">xinitrc</tt> file:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
xmodmap $usermodmap
fi
# start some nice programs
twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
exec xterm -geometry 80x66+0+0 -name login
</pre>
</td>
</tr>
</table>
<p>All of those “if” blocks are there to merge in various configuration
settings from other files. The interesting part of the file is toward the end, where
various programs are run. This X session will begin with the <tt
class="COMMAND">twm</tt>(1) window manager, a clock, and three terminals. Note the <tt
class="COMMAND">exec</tt> before the last <tt class="COMMAND">xterm</tt>. What that does
is replace the currently running shell (the one that's executing this <tt
class="FILENAME">xinitrc</tt> script) with that <tt class="COMMAND">xterm</tt>(1)
command. When the user quits that <tt class="COMMAND">xterm</tt>, the X session will
end.</p>
<p>To customize your X startup, copy the default <tt
class="FILENAME">/var/X11R6/lib/xinit/xinitrc</tt> to <tt
class="FILENAME">~/.xinitrc</tt> and edit it, replacing those program lines with whatever
you like. The end of mine is simply:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# Start the window manager:
exec startkde
</pre>
</td>
</tr>
</table>
<p>Note that there are several <tt class="FILENAME">xinitrc.*</tt> files in <tt
class="FILENAME">/var/X11R6/lib/xinit</tt> that correspond to various window managers and
GUIs. You can use any of those, if you like.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="X-WINDOW-SYSTEM-XWMCONFIG" name="X-WINDOW-SYSTEM-XWMCONFIG">6.4
<tt class="COMMAND">xwmconfig</tt></a></h2>
<p>For years, Unix was used almost exclusively as the operating system for servers, with
the exception of high-powered professional workstations. Only the technically inclined
were likely to use a Unix-like operating system, and the user interface reflected this
fact. GUIs tended to be fairly bare-bones, designed to run a few necessarily graphical
applications like CAD programs and image renderers. Most file and system management was
conducted at the command line. Various vendors (Sun Microsystems, Silicon Graphics, etc)
were selling workstations with an attempt to provide a cohesive “look and
feel”, but the wide variety of GUI toolkits in use by developers led inevitably to
the dissolution of the desktop's uniformity. A scrollbar might not look the same in two
different applications. Menus might appear in different places. Programs would have
different buttons and checkboxes. Colors ranged widely, and were generally hard-coded in
each toolkit. As long as the users were primarily technical professionals, none of this
mattered much.</p>
<p>With the advent of free Unix-like operating systems and the growing number and variety
of graphical applications, X has recently gained a wide desktop user base. Most users, of
course, are accustomed to the consistent look and feel provided by Microsoft's Windows or
Apple's MacOS; the lack of such consistency in X-based applications became a barrier to
its wider acceptance. In response, two open source projects have been undertaken: The K
Desktop Environment, or KDE, and the GNU Network Object Model Environment, known as
GNOME. Each has a wide variety of applications, from taskbars and file managers to games
and office suites, written with the same GUI toolkit and tightly integrated to provide a
uniform, consistent desktop.</p>
<p>The differences in KDE and GNOME are generally fairly subtle. They each look different
from the other, because each uses a different GUI toolkit. KDE is based on the Qt library
from Troll Tech AS, while GNOME uses GTK, a toolkit originally developed for The GNU
Image Manipulation Program (or The GIMP, for short). As separate projects, KDE and GNOME
each have their own designers and programmers, with different development styles and
philosophies. The result in each case, however, has been fundamentally the same: a
consistent, tightly integrated desktop environment and application collection. The
functionality, usability, and sheer prettiness of both KDE and GNOME rival anything
available on other operating systems.</p>
<p>The best part, though, is that these advanced desktops are free. This means you can
have either or both (yes, at the same time). The choice is yours.</p>
<p>In addition to the GNOME and KDE desktops, Slackware includes a large collection of
window managers. Some are designed to emulate other operating systems, some for
customization, others for speed. There's quite a variety. Of course you can install as
many as you want, play with them all, and decide which you like the most.</p>
<p>To make desktop selection easy, Slackware also includes a program called <tt
class="COMMAND">xwmconfig</tt> that can be used to select a desktop or window manager. It
is run like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">xwmconfig</kbd>
</pre>
</td>
</tr>
</table>
<div class="FIGURE"><a id="FIG-X-WINDOW-SYSTEM-XWMCONFIG"
name="FIG-X-WINDOW-SYSTEM-XWMCONFIG"></a>
<p><b>Figure 6-5. Desktop Configuration with <tt class="COMMAND">xorgconfig</tt></b></p>
<p><img src="x-window-system/xwmconfig-w.png" /></p>
</div>
<p>You'll be given a list of all the desktops and window managers installed. Just select
the one you want from the list. Each user on your system will need to run this program,
since different users can use different desktops, and not everyone will want the default
one you selected at installation.</p>
<p>Then just start up X, and you're good to go.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="X-WINDOW-SYSTEM-XDM" name="X-WINDOW-SYSTEM-XDM">6.5 <tt
class="COMMAND">xdm</tt></a></h2>
<p>As Linux becomes more and more useful as a desktop operating system, many users find
it desirable for the machine to boot straight into a graphical environment. For this, you
will need to tell Slackware to boot straight into X, and assign a graphical login
manager. Slackware ships with three graphical login tools, <tt
class="COMMAND">xdm</tt>(1), <tt class="COMMAND">kdm</tt>, and <tt
class="COMMAND">gdm</tt>(1).</p>
<p><tt class="COMMAND">xdm</tt> is the graphical login manager shipped with the X.org
system. It's ubiquitous, but not as fully features as alternatives. <tt
class="COMMAND">kdm</tt> is the graphical login manager shipped with KDE, The K Desktop
Environment. Finally, <tt class="COMMAND">gdm</tt> is the login manager shipped with
GNOME. Any of the choices will allow you to log in as any user, and choose what desktop
you wish to use.</p>
<p>Unfortunately, Slackware doesn't include a nice program like <tt
class="COMMAND">xwmconfig</tt> for choosing what login manager to use, so if all three
are installed you may have to do some editing to choose your preference. But first, we'll
discuss how to boot into a graphical environment.</p>
<p>In order to start X at boot, you need to boot into run-level 4. Run-levels are just a
way of telling <tt class="COMMAND">init</tt>(8) to do something different when it starts
the OS. We do this by editing the config file for <tt class="COMMAND">init</tt>, <tt
class="FILENAME">/etc/inittab</tt>.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# These are the default runlevels in Slackware:
# 0 = halt
# 1 = single user mode
# 2 = unused (but configured the same as runlevel 3)
# 3 = multiuser mode (default Slackware runlevel)
# 4 = X11 with KDM/GDM/XDM (session managers)
# 5 = unused (but configured the same as runlevel 3)
# 6 = reboot
# Default runlevel. (Do not set to 0 or 6)
id:3:initdefault:
</pre>
</td>
</tr>
</table>
<p>In order to make Slackware boot to a graphical environment, we just change the 3 to a
4.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# Default runlevel. (Do not set to 0 or 6)
id:4:initdefault:
</pre>
</td>
</tr>
</table>
<p>Now Slackware will boot into runlevel 4 and execute <tt
class="FILENAME">/etc/rc.d/rc.4</tt>. This file starts up X and calls whatever login
manager you've chosen. So, how do we choose login managers? There are a few ways to do
this, and I'll explain them after we look at <tt class="FILENAME">rc.4</tt>.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# Try to use GNOME's gdm session manager:
if [ -x /usr/bin/gdm ]; then
exec /usr/bin/gdm -nodaemon
fi
# Not there? OK, try to use KDE's kdm session manager:
if [ -x /opt/kde/bin/kdm ]; then
exec /opt/kde/bin/kdm -nodaemon
fi
# If all you have is XDM, I guess it will have to do:
if [ -x /usr/X11R6/bin/xdm ]; then
exec /usr/X11R6/bin/xdm -nodaemon
fi
</pre>
</td>
</tr>
</table>
<p>As you can see here, <tt class="FILENAME">rc.4</tt> first checks to see if <tt
class="COMMAND">gdm</tt> is executable, and if so runs it. Second on the list is <tt
class="COMMAND">kdm</tt>, and finally <tt class="COMMAND">xdm</tt>. One way of choosing a
login manager is to simply remove the ones you don't wish to use using <tt
class="COMMAND">removepkg</tt>. You can find out more about <tt
class="COMMAND">removepkg</tt> in <a href="#PACKAGE-MANAGEMENT">Chapter 18</a>.</p>
<p>Optionally, you can remove the executable permission from those files that you don't
want to use. We discuss <tt class="COMMAND">chmod</tt> in <a
href="#FILESYSTEM-STRUCTURE">Chapter 9</a>.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">chmod -x /usr/bin/gdm</kbd>
</pre>
</td>
</tr>
</table>
<p>Finally, you can just comment out the lines for the login manager you don't want to
use.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# Try to use GNOME's gdm session manager:
# if [ -x /usr/bin/gdm ]; then
# exec /usr/bin/gdm -nodaemon
# fi
# Not there? OK, try to use KDE's kdm session manager:
if [ -x /opt/kde/bin/kdm ]; then
exec /opt/kde/bin/kdm -nodaemon
fi
# If all you have is XDM, I guess it will have to do:
if [ -x /usr/X11R6/bin/xdm ]; then
exec /usr/X11R6/bin/xdm -nodaemon
fi
</pre>
</td>
</tr>
</table>
<p>Any lines preceded by the hash mark (<var class="LITERAL">#</var>) are considered
comments and the shell silently passes them. Thus, even if <tt class="COMMAND">gdm</tt>
is installed and executable, the shell (in this case <tt class="COMMAND">bash</tt>) won't
bother checking for it.</p>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="BOOTING" name="BOOTING"></a>Chapter 7 Booting</h1>
<p>The process of booting your Linux system can sometimes be easy and sometimes be
difficult. Many users install Slackware on their computer and that's it. They just turn
it on and it's ready to use. Othertimes, simply booting the machine can be a chore. For
most users, LILO works best. Slackware includes LILO and Loadlin for booting Slackware
Linux. LILO will work from a hard drive partition, a hard drive's master boot record, or
a floppy disk, making it a very versatile tool. Loadlin works from a DOS command line,
killing DOS and invoking Linux.</p>
<p>Another popular utility for booting Linux is GRUB. GRUB is not included or officially
supported by Slackware. Slackware holds to the “tried and true” standard for
what gets included inside the distribution. While GRUB works well and includes some
features that LILO does not, LILO handles all the essential tasks of a boot loader
reliably with a proven track record. Being younger, GRUB hasn't quite lived up to that
legacy yet. As it is not included with Slackware, we do not discuss it here. If you wish
to use GRUB (perhaps it came with another Linux OS and you want to use it to dual-boot)
consult GRUB's documentation.</p>
<p>This section covers using LILO and Loadlin, the two booters included with Slackware.
It also explains some typical dual booting scenarios and how you could go about setting
it up.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BOOTING-LILO" name="BOOTING-LILO">7.1 LILO</a></h2>
<p>The Linux Loader, or LILO, is the most popular booter in use on Linux systems. It is
quite configurable and can easily be used to boot other operating systems.</p>
<p>Slackware Linux comes with a menu-driven configuration utility called <tt
class="COMMAND">liloconfig</tt>. This program is first run during the setup process, but
you can invoke it later by typing <tt class="COMMAND">liloconfig</tt> at the prompt.</p>
<p>LILO reads its settings from the <tt class="COMMAND">/etc/lilo.conf</tt>(5) file. It
is not read each time you boot up, but instead is read each time you install LILO. LILO
must be reinstalled to the boot sector each time you make a configuration change. Many
LILO errors come from making changes to the <tt class="FILENAME">lilo.conf</tt> file, but
failing to re-run lilo to install these changes. <tt class="COMMAND">liloconfig</tt> will
help you build the configuration file so that you can install LILO for your system. If
you prefer to edit <tt class="FILENAME">/etc/lilo.conf</tt> by hand, then reinstalling
LILO just involves typing <tt class="COMMAND">/sbin/lilo</tt> (as <tt
class="USERNAME">root</tt>) at the prompt.</p>
<p>When you first invoke <tt class="COMMAND">liloconfig</tt>, it will look like this:</p>
<div class="FIGURE"><a id="BOOTING-SETUP-LILO" name="BOOTING-SETUP-LILO"></a>
<p><b>Figure 7-1. <tt class="COMMAND">liloconfig</tt></b></p>
<p><img src="booting/setup-lilo-w.png" /></p>
</div>
<p>If this is your first time setting up LILO, you should pick simple. Otherwise, you
might find expert to be faster if you are familiar with LILO and Linux. Selecting simple
will begin the LILO configuration.</p>
<p>If kernel frame buffer support is compiled into your kernel, <tt
class="COMMAND">liloconfig</tt> will ask which video resolution you would like to use.
This is the resolution that is also used by the XFree86 frame buffer server. If you do
not want the console to run in a special video mode, selecting normal will keep the
standard 80x25 text mode in use.</p>
<p>The next part of the LILO configuration is selecting where you want it installed. This
is probably the most important step. The list below explains the installation places:</p>
<div class="VARIABLELIST">
<dl>
<dt><var class="OPTION">Root</var></dt>
<dd>
<p>This option installs LILO to the beginning of your Linux root partition. This is the
safest option if you have other operating systems on your computer. It ensures that any
other booters are not overwritten. The disadvantage is that LILO will only load from here
if your Linux drive is the first drive on your system. This is why many people chose to
create a very small <tt class="FILENAME">/boot</tt> partition as the first drive on their
system. This allows the kernel and LILO to be installed at the beginning of the drive
where LILO can find them. Previous versions of LILO contained an infamous flaw known as
the “1024 cylinder limit”. LILO was unable to boot kernels on partitions past
the 1024th cylinder. Recent editions of LILO have eliminated this problem.</p>
</dd>
<dt><var class="OPTION">Floppy</var></dt>
<dd>
<p>This method is even safer than the previous one. It creates a boot floppy that you can
use to boot your Linux system. This keeps the booter off the hard disk entirely, so you
only boot this floppy when you want to use Slackware. The flaws with this method are
obvious. Floppies are notoriously fickle, prone to failures. Secondly, the boot loader is
no longer self-contained within the computer. If you loose your floppy disk, you'll have
to make another to boot your system.</p>
</dd>
<dt><var class="OPTION">MBR</var></dt>
<dd>
<p>You will want to use this method if Slackware is the only operating system on your
computer, or if you will be using LILO to choose between multiple operating systems on
your computer. This is the most preferred method for installing LILO and will work with
almost any computer system.</p>
<div class="WARNING">
<table class="WARNING" width="90%" border="0">
<tr>
<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/warning.png"
hspace="5" alt="Warning" /></td>
<td align="LEFT" valign="TOP">
<p>This option will overwrite any other booter you have in the MBR.</p>
</td>
</tr>
</table>
</div>
</dd>
</dl>
</div>
<p>After selecting the installation location, <tt class="COMMAND">liloconfig</tt> will
write the configuration file and install LILO. That's it. If you select the expert mode
you will receive a special menu. This menu allows you to tweak the <tt
class="FILENAME">/etc/lilo.conf</tt> file, add other operating systems to your boot menu,
and set LILO to pass special kernel parameters at boot time. The expert menu looks like
this:</p>
<div class="FIGURE"><a id="BOOTING-LILO-EXPERT" name="BOOTING-LILO-EXPERT"></a>
<p><b>Figure 7-2. <tt class="COMMAND">liloconfig</tt> Expert Menu</b></p>
<p><img src="booting/setup-lilo-expert-w.png" /></p>
</div>
<p>Whatever your system configuration is, setting up a working boot loader is easy. <tt
class="COMMAND">liloconfig</tt> makes setting it up a cinch.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BOOTING-LOADLIN" name="BOOTING-LOADLIN">7.2 LOADLIN</a></h2>
<p>The other booting option that comes with Slackware Linux is LOADLIN. LOADLIN is a DOS
executable that can be used to start Linux from a running DOS system. It requires the
Linux kernel to be on the DOS partition so that LOADLIN can load it and properly boot the
system.</p>
<p>During the installation process, LOADLIN will be copied to root's home directory as a
.ZIP file. There is no automatic setup process for LOADLIN. You will need to copy the
Linux kernel (typically <tt class="FILENAME">/boot/vmlinuz</tt>) and the LOADLIN file
from root's home directory to the DOS partition.</p>
<p>LOADLIN is useful if you would like to make a boot menu on your DOS partition. A menu
could be added to your <tt class="FILENAME">AUTOEXEC.BAT</tt> file that would allow you
to pick between Linux or DOS. A choice of Linux would run LOADLIN, thus booting your
Slackware system. This <tt class="FILENAME">AUTOEXEC.BAT</tt> file under Windows 95 will
provide a sufficient boot menu:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
@ECHO OFF
SET PROMPT=$P$G
SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\
CLS
ECHO Please Select Your Operating System:
ECHO.
ECHO [1] Slackware Linux
ECHO [2] Windows 95
ECHO.
CHOICE /C:12 "Selection? -> "
IF ERRORLEVEL 2 GOTO WIN
IF ERRORLEVEL 1 GOTO LINUX
:WIN
CLS
ECHO Starting Windows 95...
WIN
GOTO END
:LINUX
ECHO Starting Slackware Linux...
CD \LINUX
LOADLIN C:\LINUX\VMLINUZ ROOT=<root partition device> RO
GOTO END
:END
</pre>
</td>
</tr>
</table>
<p>You will want to specify your root partition as a Linux device name, like <tt
class="FILENAME">/dev/hda2</tt> or something else. You can always use LOADLIN at the
command line. You simply use it in the same manner as it is in the example above. The
LOADLIN documentation comes with many examples on how to use it.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BOOTING-DUAL" name="BOOTING-DUAL">7.3 Dual Booting</a></h2>
<p>Many users set up their computers to boot Slackware Linux and another operating
system. We've described several typical dual boot scenarios below, in case you are having
difficulty setting up your system.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="BOOTING-DUAL-WINDOWS" name="BOOTING-DUAL-WINDOWS">7.3.1
Windows</a></h3>
<p>Setting up a computer with both MS Windows and Linux is probably the most common dual
boot scenario. There are numerous ways you can setup the booting, but this section will
cover two.</p>
<p>Often times when setting up a dual boot system, a person will devise a perfect plan
for where everything should go but mess up the installation order. It is very important
to understand that operating systems need to be installed in a certain order for a dual
boot setup to work. Linux always offers control over what, if anything, gets written to
the Master Boot Record. Therefore, it's always advisable to install Linux last. Windows
should be installed first, since it will always write its booter to the Master Boot
Record, overwriting any entry Linux may have put there.</p>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN2577" name="AEN2577">7.3.1.1 Using LILO</a></h4>
<p>Most people will want to use LILO to chose between Linux and Windows. As stated above,
you should install Windows first, then Linux.</p>
<p>Let's say you have a 40GB IDE hard disk as the only drive in your system. Let's also
say that you want to give half of that space to Windows and half of that space to Linux.
This will present a problem when trying to boot Linux.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
20GB Windows boot (C:)
1GB Linux root (/)
19GB Linux /usr (/usr)
</pre>
</td>
</tr>
</table>
<p>You would also want to set aside an adequate amount of space for a Linux swap
partition. The unwritten rule is to use twice the amount of RAM you have in disk space. A
64MB system would have 128MB of swap, and so on. Adequate swap space is the discussion of
many flames on IRC and Usenet. There's no truly “right” way to do it, but
sticking with the rule above should be sufficient.</p>
<p>With your partitions laid out, you should proceed to install Windows. After that is
set up and working, you should install Linux. The LILO installation needs special
attention. You will want to select the expert mode for installing LILO.</p>
<p>Begin a new LILO configuration. You will want to install it to Master Boot Record so
that it can be used to choose between the two operating systems. From the menu, add your
Linux partition and add your Windows (or DOS) partition. Once that's complete, you can
install LILO.</p>
<p>Reboot the computer. LILO should load and will display a menu letting you select
between the operating systems you have installed. Select the name of the OS you wish to
load (these names were selected when you setup LILO).</p>
<p>LILO is quite a configurable boot loader. It's not just limited to booting Linux or
DOS. It can boot just about anything. The man pages for <tt class="COMMAND">lilo</tt>(8)
and <tt class="FILENAME">lilo.conf</tt>(5) provide more detailed information.</p>
<p>What if LILO doesn't work? There are instances where LILO just won't work on a
particular machine. Fortunately, there is another way to dual boot Linux and Windows.</p>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN2591" name="AEN2591">7.3.1.2 Using LOADLIN</a></h4>
<p>This method can be used if LILO doesn't work on your system, or if you just don't want
to set up LILO. This method is also ideal for the user that reinstalls Windows often.
Each time you reinstall Windows, it will overwrite the Master Boot Record, thus
destroying any LILO installation. With LOADLIN, you are not subject to that problem. The
biggest disadvantage is that you can only use LOADLIN to boot Linux.</p>
<p>With LOADLIN, you can install the operating systems in any order desired. Be careful
about installing things to the Master Boot Record, you do not want to do that. LOADLIN
relies on the Windows partition being bootable. So during the Slackware installation,
make sure you skip the LILO setup.</p>
<p>After installing the operating systems, copy the <tt class="FILENAME">loadlin<var
class="REPLACEABLE">X</var>.zip</tt> (where <var class="REPLACEABLE">X</var> is a version
number, such as <var class="LITERAL">16a</var>) file from root's home directory to your
Windows partition. Also copy your kernel image to the Windows partition. You will need to
be in Linux for this to work. This example shows how to do this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">mkdir /win</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">mount -t vfat /dev/hda1 /win</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">mkdir /win/linux</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd /root</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">cp loadlin* /win/linux</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">cp /boot/vmlinuz /win/linux</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">cd /win/linuz</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">unzip loadlin16a.zip</kbd>
</pre>
</td>
</tr>
</table>
<p>That will create a <tt class="FILENAME">C:\LINUX</tt> directory on your Windows
partition (assuming it's <tt class="FILENAME">/dev/hda1</tt>) and copy over the necessary
stuff for LOADLIN. After doing this, you will need to reboot into Windows to setup a boot
menu.</p>
<p>Once in Windows, get to a DOS prompt. First, we need to make sure the system is set to
not boot into the graphical interface.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
C:\> <kbd class="USERINPUT">cd \</kbd>
C:\> <kbd class="USERINPUT">attrib -r -a -s -h MSDOS.SYS</kbd>
C:\> <kbd class="USERINPUT">edit MSDOS.SYS</kbd>
</pre>
</td>
</tr>
</table>
<p>Add this line to the file:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
BootGUI=0
</pre>
</td>
</tr>
</table>
<p>Now save the file and exit the editor. Now edit <tt
class="FILENAME">C:\AUTOEXEC.BAT</tt> so we can add a boot menu. The following provides
an example of what a boot menu block in <tt class="FILENAME">AUTOEXEC.BAT</tt> would look
like:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
cls
echo System Boot Menu
echo.
echo 1 - Linux
echo 2 - Windows
echo.
choice /c:12 "Selection? -> "
if errorlevel 2 goto WIN
if errorlevel 1 goto LINUX
:LINUX
cls
echo "Starting Linux..."
cd \linux
loadlin c:\linux\vmlinuz root=/dev/hda2 ro
goto END
:WIN
cls
echo "Starting Windows..."
win
goto END
:END
</pre>
</td>
</tr>
</table>
<p>The key line is the one that runs LOADLIN. We tell it the kernel to load, the Linux
root partition, and that we want it mounted read-only initially.</p>
<p>The tools for these two methods are provided with Slackware Linux. There are numerous
other booters on the market, but these should work for most dual boot setups.</p>
</div>
<div class="SECT3">
<hr />
<h4 class="SECT3"><a id="AEN2633" name="AEN2633">7.3.1.3 Deprecated Windows NT
Hack</a></h4>
<p>This is the least common dual booting situation. In the days of old, LILO was unable
to boot Windows NT, requiring Linux users to hack NTLDR, which presented several more
problems than dual booting between Windows 9x and Linux. Understand that the following
instructions are deprecated. LILO has been able to boot Windows NT/2000/XP/2003 for many
years now. If you are using a legacy machine though, you may need to use just such a
hack.</p>
<ol type="1">
<li>
<p>Install Windows NT</p>
</li>
<li>
<p>Install Linux, making sure LILO is installed to the superblock of the Linux
partition</p>
</li>
<li>
<p>Get the first 512 bytes of the Linux root partition and store it on the Windows NT
partition</p>
</li>
<li>
<p>Edit <tt class="FILENAME">C:\BOOT.INI</tt> under Windows NT to add a Linux option</p>
</li>
</ol>
<p>Installing Windows NT should be fairly straightforward, as should installing Linux.
From there, it gets a little more tricky. Grabbing the first 512 bytes of the Linux
partition is easier than it sounds. You will need to be in Linux to accomplish this.
Assuming your Linux partition is <tt class="FILENAME">/dev/hda2</tt>, issue this
command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">dd if=/dev/hda2 of=/tmp/bootsect.lnx bs=1 count=512</kbd>
</pre>
</td>
</tr>
</table>
<p>That's it. Now you need to copy bootsect.lnx to the Windows NT partition. Here's where
we run into another problem. Linux does not have stable write support for the NTFS
filesystem. If you installed Windows NT and formatted your drive as NTFS, you will need
to copy this file to a FAT floppy and then read from it under Windows NT. If you
formatted the Windows NT drive as FAT, you can simply mount it under Linux and copy the
file over. Either way, you will want to get <tt class="FILENAME">/tmp/bootsect.lnx</tt>
from the Linux drive to <tt class="FILENAME">C:\BOOTSECT.LNX</tt> on the Windows NT
drive.</p>
<p>The last step is adding a menu option to the Windows NT boot menu. Under Windows NT
open a command prompt.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
C:\WINNT> <kbd class="USERINPUT">cd \</kbd>
C:\> <kbd class="USERINPUT">attrib -r -a -s -h boot.ini</kbd>
C:\> <kbd class="USERINPUT">edit boot.ini</kbd>
</pre>
</td>
</tr>
</table>
<p>Add this line to the end of the file:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
C:\bootsect.lnx="Slackware Linux"
</pre>
</td>
</tr>
</table>
<p>Save the changes and exit the editor. When you reboot Windows NT, you will have a
Linux option on the menu. Choosing it will boot into Linux.</p>
</div>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="BOOTING-DUAL-LINUX" name="BOOTING-DUAL-LINUX">7.3.2
Linux</a></h3>
<p>Yes, people really do this. This is definitely the easiest dual boot scenario. You can
simply use LILO and add more entries to the <tt class="FILENAME">/etc/lilo.conf</tt>
file. That's all there is to it.</p>
</div>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="SHELL" name="SHELL"></a>Chapter 8 The Shell</h1>
<p>In a graphical environment, the interface is provided by a program that creates
windows, scrollbars, menus, etc. In a commandline environment, the user interface is
provided by a shell, which interprets commands and generally makes things useable.
Immediately after logging in (which is covered in this chapter), users are put into a
shell and allowed to go about their business. This chapter serves as an introduction to
the shell, and to the most common shell among Linux users-- the Bourne Again Shell
(bash). For more detailed information on anything in this chapter, check out the <tt
class="COMMAND">bash</tt>(1) man page.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="SHELL-USERS" name="SHELL-USERS">8.1 Users</a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="AEN2678" name="AEN2678">8.1.1 Logging In</a></h3>
<p>So you've booted, and you're looking at something that looks like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Welcome to Linux 2.4.18
Last login: Wed Jan 1 15:59:14 -0500 2005 on tty6.
darkstar login:
</pre>
</td>
</tr>
</table>
<p>Hmm.. nobody said anything about a login. And what's a darkstar? Don't worry; you
probably didn't accidentally fire up a hyperspace comm-link to the Empire's artificial
moon. (I'm afraid the hyperspace comm-link protocol isn't currently supported by the
Linux kernel. Maybe the 2.8 kernel branch will at last provide this oft looked-for
support.) No, darkstar is just the name of one of our computers, and its name gets
stamped on as the default. If you specified a name for your computer during setup, you
should see it instead of darkstar.</p>
<p>As for the login... If this is your first time, you'll want to log in as <tt
class="USERNAME">root</tt>. You'll be prompted for a password; if you set one during the
setup process, that's what it's looking for. If not, just hit enter. That's it-- you're
in!</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN2693" name="AEN2693">8.1.2 Root: The Superuser</a></h3>
<p>Okay, who or <span class="emphasis"><i class="EMPHASIS">what</i></span> is <tt
class="USERNAME">root</tt>? And what's it doing with an account on <span
class="emphasis"><i class="EMPHASIS">your</i></span> system?</p>
<p>Well, in the world of Unix and similar operating systems (like Linux), there are users
and then there are users. We'll go into this in more detail later, but the important
thing to know now is that <tt class="USERNAME">root</tt> is the user above all users; <tt
class="USERNAME">root</tt> is all-powerful and all-knowing, and <span class="emphasis"><i
class="EMPHASIS">nobody</i></span> disobeys <tt class="USERNAME">root</tt>. It just isn't
allowed. <tt class="USERNAME">root</tt> is what we call a “superuser”, and
rightly so. And best of all, <tt class="USERNAME">root</tt> is <span class="emphasis"><i
class="EMPHASIS">you</i></span>.</p>
<p>Cool, huh?</p>
<p>If you're not sure: yes, that's very cool. The catch is, though, that root is
inherently allowed to break anything it so desires. You might want to skip ahead to <a
href="#ESSENTIAL-SYSADMIN-USERS-SCRIPTS">Section 12.1.1</a> and see about adding a user;
then login as that user and work from there. The traditional wisdom is that it's best to
only become the superuser when absolutely necessary, so as to minimize the possibility of
accidentally breaking something.</p>
<p>By the way, if you decide you want to be root while you're logged in as someone else,
no problem. Just use the <tt class="COMMAND">su</tt>(1) command. You'll be asked for <tt
class="USERNAME">root's</tt> password and then it will make you <tt
class="USERNAME">root</tt> until you <tt class="COMMAND">exit</tt> or <tt
class="COMMAND">logout</tt>. You can also become any other user using <tt
class="COMMAND">su</tt>, provided you know that user's password: <tt class="COMMAND">su
logan</tt>, for instance, would make you me.</p>
<div class="NOTE">
<table class="NOTE" width="100%" border="0">
<tr>
<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/note.png"
hspace="5" alt="Note" /></td>
<td align="LEFT" valign="TOP">
<p><tt class="USERNAME">root</tt> is allowed to su to any user, without requiring their
password.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="SHELL-COMMAND-LINE" name="SHELL-COMMAND-LINE">8.2 The Command
Line</a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="SHELL-COMMAND-LINE-RUNNING"
name="SHELL-COMMAND-LINE-RUNNING">8.2.1 Running Programs</a></h3>
<p>It's hard to get much accomplished without running a program; you might be able to
prop something up with your computer or hold a door open, and some will make the most
lovely humming noise when running, but that's really about it. And I think we can all
agree that its use as a humming doorstop isn't what brought the personal computer the
popularity it now enjoys.</p>
<p>So, remember how almost everything in Linux is a file? Well, that goes for programs,
too. Every command you run (that isn't built into the shell) resides as a file somewhere.
You run a program simply by specifying the full path to it.</p>
<p>For instance, remember that <tt class="COMMAND">su</tt> command from the last section?
Well, it's actually in the <tt class="FILENAME">/bin</tt> directory: <tt
class="COMMAND">/bin/su</tt> would run it nicely.</p>
<p>So why, then, does just typing <tt class="COMMAND">su</tt> work? After all, you didn't
say it was in <tt class="FILENAME">/bin</tt>. It could just as easily have been in <tt
class="FILENAME">/usr/local/share</tt>, right? How did it <span class="emphasis"><i
class="EMPHASIS">know</i></span>? The answer to that lies in the <tt
class="ENVAR">PATH</tt> environment variable; most shells have either <tt
class="ENVAR">PATH</tt> or something very much like <tt class="ENVAR">PATH</tt>. It
basically contains a list of directories to look in for programs you try to run. So when
you ran <tt class="COMMAND">su</tt>, your shell ran through its list of directories,
checking each one for an executable file called <tt class="COMMAND">su</tt> that it could
run; the first one it came to, it ran. This happens whenever you run a program without
specifying a full path to it; if you get a ““<tt class="ERRORNAME">Command
not found</tt>”” error, that only means that the program you tried to run
isn't in your <tt class="ENVAR">PATH</tt>. (Of course, this would be true if the program
doesn't exist at all...) We'll discuss environment variables in more depth in <a
href="#SHELL-BASH-ENVIRONMENT">Section 8.3.1</a>.</p>
<p>Remember also that “<tt class="FILENAME">.</tt>” is shorthand for the
current directory, so if you happened to be in <tt class="FILENAME">/bin</tt>, <tt
class="FILENAME">./su</tt> would have worked as an explicit full path.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="SHELL-COMMAND-LINE-WILDCARD"
name="SHELL-COMMAND-LINE-WILDCARD">8.2.2 Wildcard Matching</a></h3>
<p>Nearly every shell recognizes some characters as being substitutes or abbreviations
that mean anything goes here. Such characters are aptly named wildcards; the most common
are <var class="LITERAL">*</var> and <var class="LITERAL">?</var>. By convention, <var
class="LITERAL">?</var> usually matches any single character. For instance, suppose
you're in a directory with three files: <tt class="FILENAME">ex1.txt</tt>, <tt
class="FILENAME">ex2.txt</tt>, and <tt class="FILENAME">ex3.txt</tt>. You want to copy
all of those files (using the <tt class="COMMAND">cp</tt> command we cover in <a
href="#FILE-COMMANDS-COPYMOVE-CP">Section 10.5.1</a>) to another directory, say <tt
class="FILENAME">/tmp</tt>. Well, typing <tt class="COMMAND">cp ex1.txt ex2.txt ex3.txt
/tmp</tt> is entirely too much work. It's much easier to type <tt class="COMMAND">cp
ex?.txt /tmp</tt>; the <var class="LITERAL">?</var> will match each of the characters
“1”, “2”, and “3”, and each in turn will be
substituted in.</p>
<p>What's that you say? That's <span class="emphasis"><i
class="EMPHASIS">still</i></span> too much work? You're right. It's appalling; we have
labor laws to protect us from that sort of thing. Fortunately, we also have <var
class="LITERAL">*</var>. As was already mentioned, <var class="LITERAL">*</var> matches
“any number of characters”, including 0. So if those three files were the
only ones in the directory, we could have simply said <tt class="COMMAND">cp * /tmp</tt>
and gotten them all in one fell swoop. Suppose, though, that there is also a file called
<tt class="FILENAME">ex.txt</tt> and one called <tt class="FILENAME">hejaz.txt</tt>. We
want to copy <tt class="FILENAME">ex.txt</tt> but not <tt
class="FILENAME">hejaz.txt</tt>; <tt class="COMMAND">cp ex* /tmp</tt> will do that for
us.</p>
<p><tt class="COMMAND">cp ex?.txt /tmp</tt>, would, of course, only get our original
three files; there's no character in <tt class="FILENAME">ex.txt</tt> to match that <var
class="LITERAL">?</var>, so it would be left out.</p>
<p>Another common wildcard is the bracket pair <var class="LITERAL">[ ]</var>. Any
characters inside the brackets will be substituted in place of the <var class="LITERAL">[
]</var> to find matches. Sound confusing? It's not too bad. Suppose for instance, we have
a directory containing the following 8 files: <tt class="FILENAME">a1</tt>, <tt
class="FILENAME">a2</tt>, <tt class="FILENAME">a3</tt>, <tt class="FILENAME">a4</tt>, <tt
class="FILENAME">aA</tt>, <tt class="FILENAME">aB</tt>, <tt class="FILENAME">aC</tt>, and
<tt class="FILENAME">aD</tt> . We want to only find the files ending in numbers; <var
class="LITERAL">[ ]</var> will do this for us.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls a[1-4]</kbd>
a1 a2 a3 a4
</pre>
</td>
</tr>
</table>
<p>But what we really want is just <tt class="FILENAME">a1</tt>, <tt
class="FILENAME">a2</tt>, and <tt class="FILENAME">a4</tt>? In the previous example we
used - to mean all values between 1 and 4. We can also separate individual entries with
commas.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls a[1,2,4]</kbd>
a1 a2 a4
</pre>
</td>
</tr>
</table>
<p>I know what you're thinking now, “Well what about letters?” Linux is
case-sensitive, meaning that <var class="LITERAL">a</var> and <var
class="LITERAL">A</var> are different characters and are only related in your mind.
Capitals always come before lowercase letters, so <var class="LITERAL">A</var> and <var
class="LITERAL">B</var> come before <var class="LITERAL">a</var> and <var
class="LITERAL">b</var>. Continuing with our earlier example, if we wanted files <tt
class="FILENAME">a1</tt>, and <tt class="FILENAME">A1</tt>, we can find these quickly
with <var class="LITERAL">[ ]</var>.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls [A,a]1</kbd>
A1 a1
</pre>
</td>
</tr>
</table>
<p>Note, that if we had included a hyphen instead of a comma, we would have gotten
incorrect results.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls [A-a]1</kbd>
A1 B1 C1 D1 a1
</pre>
</td>
</tr>
</table>
<p>You can also combine hyphen and comma strings.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls [A,a-d]</kbd>
A1 a1 b1 c1 d1
</pre>
</td>
</tr>
</table>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="SHELL-COMMAND-LINE-PIPING"
name="SHELL-COMMAND-LINE-PIPING">8.2.3 Input/Output Redirection and Piping</a></h3>
<p>(Here comes something cool.)</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ps > blargh</kbd>
</pre>
</td>
</tr>
</table>
<p>Y'know what that is? That's me running <tt class="COMMAND">ps</tt> to see which
processes are running; <tt class="COMMAND">ps</tt> is covered in <a
href="#PROCESS-CONTROL-PS">Section 11.3</a>. That's not the cool part. The cool part is
<var class="LITERAL">> blargh</var>, which means, roughly, take the output from <tt
class="COMMAND">ps</tt> and write it to a file called <tt class="FILENAME">blargh</tt>.
But wait, it gets cooler.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ps | less</kbd>
</pre>
</td>
</tr>
</table>
<p>That one takes the output from <tt class="COMMAND">ps</tt> and pipes it through <tt
class="COMMAND">less</tt>, so I can scroll through it at my leisure.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ps >> blargh</kbd>
</pre>
</td>
</tr>
</table>
<p>This is the third most commonly used redirector; it does the same thing as
“>”, except that “>>” will append output from <tt
class="COMMAND">ps</tt> to the file <tt class="FILENAME">blargh</tt>, if said file
exists. If not, just like “>”, it will be created. (“>”
will obliterate the current contents of <tt class="FILENAME">blargh</tt>.)</p>
<p>There is also a “<” operator, which means take your input from the
following, but it's not used nearly so often.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">fromdos < dosfile.txt > unixfile.txt</kbd>
</pre>
</td>
</tr>
</table>
<p>Redirection gets really fun when you start piling it up:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ps | tac >> blargh</kbd>
</pre>
</td>
</tr>
</table>
<p>That will run <tt class="COMMAND">ps</tt>, reverse the lines of its output, and append
those to the file <tt class="FILENAME">blargh</tt>. You can stack as many of these up as
you want; just be careful to remember that they get interpreted from left to right.</p>
<p>See the <tt class="COMMAND">bash</tt>(1) man page for more detailed information on
redirection.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="SHELL-BASH" name="SHELL-BASH">8.3 The Bourne Again Shell
(bash)</a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="SHELL-BASH-ENVIRONMENT" name="SHELL-BASH-ENVIRONMENT">8.3.1
Environment Variables</a></h3>
<p>A Linux system is a complex beast, and there's a lot to keep track of, a lot of little
details that come into play in your normal interactions with various programs (some of
which you might not even need to be aware of). Nobody wants to pass a bunch of options to
every program that gets run, telling it what kind of terminal is being used, the hostname
of the computer, how their prompt should look...</p>
<p>So as a coping mechanism, users have what's called an environment. The environment
defines the conditions in which programs run, and some of this definition is variable;
the user can alter and play with it, as is only right in a Linux system. Pretty much any
shell will have environment variables (if not, it's probably not a very useable shell).
Here we will give an overview of the commands bash provides for manipulating its
environment variables.</p>
<p><tt class="COMMAND">set</tt> by itself will show you all of the environment variables
that are currently defined, as well as their values. Like most <tt
class="COMMAND">bash</tt> built-ins, it can also do several other things (with
parameters); we'll leave it to the <tt class="COMMAND">bash</tt>(1) man page to cover
that, though. <a href="#EX-SHELL-BASH-ENVIRONMENT">Example 8-1</a> shows an excerpt from
a <tt class="COMMAND">set</tt> command run on one of the author's computers. Notice in
this example the <tt class="ENVAR">PATH</tt> variable that was discussed earlier.
Programs in any of those directories can be run simply by typing the base filename.</p>
<div class="EXAMPLE"><a id="EX-SHELL-BASH-ENVIRONMENT"
name="EX-SHELL-BASH-ENVIRONMENT"></a>
<p><b>Example 8-1. Listing Environment Variables with <tt
class="COMMAND">set</tt></b></p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">set</kbd>
PATH=/usr/local/lib/qt/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:
/usr/openwin/bin:/usr/games:.:/usr/local/ssh2/bin:/usr/local/ssh1/bin:
/usr/share/texmf/bin:/usr/local/sbin:/usr/sbin:/home/logan/bin
PIPESTATUS=([0]="0")
PPID=4978
PS1='\h:\w\$ '
PS2='> '
PS4='+ '
PWD=/home/logan
QTDIR=/usr/local/lib/qt
REMOTEHOST=ninja.tdn
SHELL=/bin/bash
</pre>
</td>
</tr>
</table>
</div>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">unset <var
class="REPLACEABLE">VARIABLE</var></kbd>
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">unset</tt> will remove any variables that you give it, wiping out
both the variable and its value; <tt class="COMMAND">bash</tt> will forget that variable
ever existed. (Don't worry. Unless it's something you explicitly defined in that shell
session, it'll probably get redefined in any other session.)</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">export <var
class="REPLACEABLE">VARIABLE=some_value</var></kbd>
</pre>
</td>
</tr>
</table>
<p>Now, <tt class="COMMAND">export</tt> is truly handy. Using it, you give the
environment variable <tt class="ENVAR">VARIABLE</tt> the value “<var
class="LITERAL">some_value</var>”; if <tt class="ENVAR">VARIABLE</tt> didn't exist,
it does now. If <tt class="ENVAR">VARIABLE</tt> already had a value, well, it's gone.
That's not so good, if you're just trying to add a directory to your <tt
class="ENVAR">PATH</tt>. In that case, you probably want to do something like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">export PATH=$PATH:<var
class="REPLACEABLE">/some/new/directory</var></kbd>
</pre>
</td>
</tr>
</table>
<p>Note the use of <tt class="ENVAR">$PATH</tt> there: when you want <tt
class="COMMAND">bash</tt> to interpret a variable (replace it with its value), tack a
<var class="LITERAL">$</var> onto the beginning of the variable's name. For instance, <tt
class="COMMAND">echo $PATH</tt> will echo the value of <tt class="ENVAR">PATH</tt>, in my
case:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">echo $PATH</kbd>
/usr/local/lib/qt/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:
/usr/openwin/bin:/usr/games:.:/usr/local/ssh2/bin:/usr/local/ssh1/bin:
/usr/share/texmf/bin:/usr/local/sbin:/usr/sbin:/home/logan/bin
</pre>
</td>
</tr>
</table>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="SHELL-BASH-TAB" name="SHELL-BASH-TAB">8.3.2 Tab
Completion</a></h3>
<p>(Here comes something cool again.)</p>
<ol type="1">
<li>
<p>A commandline interface means lots of typing.</p>
</li>
<li>
<p>Typing is work.</p>
</li>
<li>
<p>Nobody likes work.</p>
</li>
</ol>
<p>From 3 and 2, we can determine that (4) nobody likes typing. Fortunately, <tt
class="COMMAND">bash</tt> saves us from (5) (nobody likes a commandline interface).</p>
<p>How does <tt class="COMMAND">bash</tt> accomplish this wonderful feat, you ask? In
addition to the wildcard expansion we discussed before, <tt class="COMMAND">bash</tt>
features tab completion.</p>
<p>Tab completion works something like this: You're typing the name of a file. Maybe it's
in your <tt class="ENVAR">PATH</tt>, maybe you're typing it out explicitly. All you have
to do is type enough of the filename to uniquely identify it. Then hit the tab key. <tt
class="COMMAND">bash</tt> will figure out what you want and finish typing it for you!</p>
<p>Example time. <tt class="FILENAME">/usr/src</tt> contains two subdirectories: <tt
class="FILENAME">/usr/src/linux</tt> and <tt class="FILENAME">/usr/src/sendmail</tt>. I
want to see what's in <tt class="FILENAME">/usr/src/linux</tt>. So I just type <tt
class="COMMAND">ls /usr/src/l</tt>, hit the <kbd class="USERINPUT">TAB</kbd> key, and <tt
class="COMMAND">bash</tt> gives me <tt class="COMMAND">ls /usr/src/linux</tt>.</p>
<p>Now, suppose there are two directories <tt class="FILENAME">/usr/src/linux</tt> and
<tt class="FILENAME">/usr/src/linux-old</tt>; If I type <tt
class="FILENAME">/usr/src/l</tt> and hit <kbd class="USERINPUT">TAB</kbd>, <tt
class="COMMAND">bash</tt> will fill in as much as it can, and I'll get <tt
class="FILENAME">/usr/src/linux</tt>. I can stop there, or I can hit <kbd
class="USERINPUT">TAB</kbd> again, and <tt class="COMMAND">bash</tt> will show a list of
directories that match what I've typed so far.</p>
<p>Hence, less typing (and hence, people can like commandline interfaces). I told you it
was cool.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="SHELL-VT" name="SHELL-VT">8.4 Virtual Terminals</a></h2>
<p>So you're in the middle of working on something and you decide you need to do
something else. You could just drop what you're doing and switch tasks, but this is a
multi-user system, right? And you can log in as many times simultaneously as you want,
right? So why should you have to do one thing at a time?</p>
<p>You don't. We can't all have multiple keyboards, mice, and monitors for one machine;
chances are most of us don't want them. Clearly, hardware isn't the solution. That leaves
software, and Linux steps up on this one, providing “virtual terminals”, or
“VTs”.</p>
<p>By pressing <kbd class="USERINPUT">Alt</kbd> and a function key, you can switch
between virtual terminals; each function key corresponds to one. Slackware has logins on
6 VTs by default. <b class="KEYCAP">Alt</b>+<b class="KEYCAP">F2</b> will take you to the
second one, <b class="KEYCAP">Alt</b>+<b class="KEYCAP">F3</b> to the third, etc.</p>
<p>The rest of the function keys are reserved for X sessions. Each X session uses its own
VT, beginning with the seventh (<b class="KEYCAP">Alt</b>+<b class="KEYCAP">F7</b>) and
going up. When in X, the <b class="KEYCAP">Alt</b>+<b class="KEYCAP">Function key</b>
combination is replaced with <b class="KEYCAP">Ctrl</b>+<b class="KEYCAP">Alt</b>+<b
class="KEYCAP">Function</b>; so if you are in X and want to get back to a text login
(without exiting your X session), <b class="KEYCAP">Ctrl</b>+<b class="KEYCAP">Alt</b>+<b
class="KEYCAP">F3</b> will take you to the third. (<b class="KEYCAP">Alt</b>+<b
class="KEYCAP">F7</b> will take you back, assuming you're using the first X session.)</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN3024" name="AEN3024">8.4.1 Screen</a></h3>
<p>But what about situations where there are no virtual terminals? What then?
Fortunately, slackware includes a beautiful screen manager aptly named <tt
class="COMMAND">screen</tt>. <tt class="COMMAND">screen</tt> is a terminal emulator that
has virtual terminal like capabilities. Executing <tt class="COMMAND">screen</tt> flashes
a brief introduction, then dumps to a terminal. Unlike the standard virtual terminals,
<tt class="COMMAND">screen</tt> has its own commands. All <tt class="COMMAND">screen</tt>
commands are prefixed with a <b class="KEYCAP">Crtl</b>+<b class="KEYCAP">A</b>
keystroke. For example, <b class="KEYCAP">Ctrl</b>+<b class="KEYCAP">A</b>+<b
class="KEYCAP">C</b> will create a new terminal session. <b class="KEYCAP">Ctrl</b>+<b
class="KEYCAP">A</b>+<b class="KEYCAP">N</b> will switch to the next terminal. <b
class="KEYCAP">Ctrl</b>+<b class="KEYCAP">A</b>+<b class="KEYCAP">P</b> switches to the
previous terminal.</p>
<p><tt class="COMMAND">screen</tt> also supports detaching and re-attaching to <tt
class="COMMAND">screen</tt> sessions which is particularly useful for remote sessions via
<tt class="COMMAND">ssh</tt> and <tt class="COMMAND">telnet</tt>, (more on those later).
<b class="KEYCAP">Ctrl</b>+<b class="KEYCAP">A</b>+<b class="KEYCAP">D</b> will detach
from the currently running screen. Executing <tt class="COMMAND">screen -r</tt> will list
all currently running screen sessions you may reattach to.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">screen -r</kbd>
There are several suitable screens on:
1212.pts-1.redtail (Detached)
1195.pts-1.redtail (Detached)
1225.pts-1.redtail (Detached)
17146.pts-1.sanctuary (Dead ???)
Remove dead screens with 'screen -wipe'.
Type "screen [-d] -r [pid.]tty.host" to resume one of them.
</pre>
</td>
</tr>
</table>
<p>Running <tt class="COMMAND">screen -r 1212</tt> would reattach to the first screen
listed. I mentioned earlier how useful this was for remote sessions. If I were to login
to a remote slackware server via <tt class="COMMAND">ssh</tt>, and my connection was
severed by some chance occurrence such as a local power failure, whatever I was doing at
that moment would instantly perish, which can be a horrible thing for your server. Using
<tt class="COMMAND">screen</tt> prevents this by detaching my session if my connection is
dropped. Once my connection is restored, I can reattach to my screen session and resume
right where I left off.</p>
</div>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="FILESYSTEM-STRUCTURE" name="FILESYSTEM-STRUCTURE"></a>Chapter 9 Filesystem
Structure</h1>
<p>We have already discussed the directory structure in Slackware Linux. By this point,
you should be able to find files and directories that you need. But there is more to the
filesystem than just the directory structure.</p>
<p>Linux is a multiuser operating system. Every aspect of the system is multiuser, even
the filesystem. The system stores information like who owns a file and who can read it.
There are other unique parts about the filesystems, such as links and NFS mounts. This
section explains these, as well as the multiuser aspects of the filesystem.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="FILESYSTEM-STRUCTURE-OWNERSHIP"
name="FILESYSTEM-STRUCTURE-OWNERSHIP">9.1 Ownership</a></h2>
<p>The filesystem stores ownership information for each file and directory on the system.
This includes what user and group own a particular file. The easiest way to see this
information is with the <tt class="COMMAND">ls</tt> command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l /usr/bin/wc</kbd>
-rwxr-xr-x 1 root bin 7368 Jul 30 1999 /usr/bin/wc
</pre>
</td>
</tr>
</table>
<p>We are interested in the third and fourth columns. These contain the username and
group name that owns this file. We see that the user “<tt
class="USERNAME">root</tt>” and the group “<tt
class="USERNAME">bin</tt>” own this file.</p>
<p>We can easily change the file owners with the <tt class="COMMAND">chown</tt>(1) (which
means “change owner”) and <tt class="COMMAND">chgrp</tt>(1) (which means
“change group”) commands. To change the file owner to <tt
class="USERNAME">daemon</tt>, we would use <tt class="COMMAND">chown</tt>:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">chown daemon /usr/bin/wc</kbd>
</pre>
</td>
</tr>
</table>
<p>To change the group owner to “<tt class="USERNAME">root</tt>”, we would
use <tt class="COMMAND">chgrp</tt>:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">chgrp root /usr/bin/wc</kbd>
</pre>
</td>
</tr>
</table>
<p>We can also use <tt class="COMMAND">chown</tt> to specify the user and group owners
for a file:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">chown daemon:root /usr/bin/wc</kbd>
</pre>
</td>
</tr>
</table>
<p>In the above example, the user could have used a period instead of a colon. The result
would have been the same; however, the colon is considered better form. Use of the period
is deprecated and may be removed from future versions of <tt class="COMMAND">chown</tt>
to allow usernames with periods in them. These usernames tend to be very popular with
Windows Exchange Servers and are encountered most commonly in email addresses such as:
<var class="LITERAL">mr.jones@example.com</var>. In slackware, administrators are advised
to stay away from such usernames because some scripts still use the period to indicate
the user and group of a file or directory. In our example, <tt class="COMMAND">chmod</tt>
would interpret <var class="LITERAL">mr.jones</var> as user “mr” and group
“jones”.</p>
<p>File ownership is a very important part of using a Linux system, even if you are the
only user. You sometimes need to fix ownerships on files and device nodes.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="FILESYSTEM-STRUCTURE-PERMISSIONS"
name="FILESYSTEM-STRUCTURE-PERMISSIONS">9.2 Permissions</a></h2>
<p>Permissions are the other important part of the multiuser aspects of the filesystem.
With these, you can change who can read, write, and execute files.</p>
<p>The permission information is stored as four octal digits, each specifying a different
set of permissions. There are owner permissions, group permissions, and world
permissions. The fourth octal digit is used to store special information such as set user
ID, set group ID, and the sticky bit. The octal values assigned to the permission modes
are (they also have letters associated with them that are displayed by programs such as
<tt class="COMMAND">ls</tt> and can be used by <tt class="COMMAND">chmod</tt>):</p>
<div class="TABLE"><a id="AEN3142" name="AEN3142"></a>
<p><b>Table 9-1. Octal Permission Values</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col width="3*" />
<col width="1*" align="CENTER" />
<col width="1*" align="CENTER" />
<thead>
<tr>
<th>Permission Type</th>
<th>Octal Value</th>
<th>Letter Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>“sticky” bit</td>
<td>1</td>
<td>t</td>
</tr>
<tr>
<td>set user ID</td>
<td>4</td>
<td>s</td>
</tr>
<tr>
<td>set group ID</td>
<td>2</td>
<td>s</td>
</tr>
<tr>
<td>read</td>
<td>4</td>
<td>r</td>
</tr>
<tr>
<td>write</td>
<td>2</td>
<td>w</td>
</tr>
<tr>
<td>execute</td>
<td>1</td>
<td>x</td>
</tr>
</tbody>
</table>
</div>
<p>You add the octal values for each permission group. For example, if you want the group
permissions to be “read” and “write”, you would use
“6” in the group portion of the permission information.</p>
<p><tt class="COMMAND">bash</tt>'s default permissions are:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l /bin/bash</kbd>
-rwxr-xr-x 1 root bin 477692 Mar 21 19:57 /bin/bash
</pre>
</td>
</tr>
</table>
<p>The first dash would be replaced with a “d” if this was a directory. The
three permission groups (owner, group, and world) are displayed next. We see that the
owner has read, write, and execute permissions (<var class="LITERAL">rwx</var>). The
group has only read and execute (<var class="LITERAL">r-x</var>). And everyone else has
only read and execute (<var class="LITERAL">r-x</var>).</p>
<p>How would we set permissions on another file to resemble <tt
class="COMMAND">bash</tt>'s? First, let's make an example file:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">touch /tmp/example</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l /tmp/example</kbd>
-rw-rw-r--- 1 david users 0 Apr 19 11:21 /tmp/example
</pre>
</td>
</tr>
</table>
<p>We will use <tt class="COMMAND">chmod</tt>(1) (which means “change mode”)
to set the permissions on the example file. Add the octal numbers for the permissions you
want. For the owner to have read, write, and execute, we would have a value of <var
class="LITERAL">7</var>. Read and execute would have <var class="LITERAL">5</var>. Run
those together and pass them to <tt class="COMMAND">chmod</tt> like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">chmod 755 /tmp/example</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l /tmp/example</kbd>
-rwxr-xr-x 1 david users 0 Apr 19 11:21 /tmp/example
</pre>
</td>
</tr>
</table>
<p>Now you may be thinking, “Why didn't it just create a file with those
permissions in the first place?” Well the answer is simple. <tt
class="COMMAND">bash</tt> includes a nice little built-in called <tt
class="COMMAND">umask</tt>. This is included with most Unix shells as well, and controls
what file permissions are assigned to newly created files. We discussed <tt
class="COMMAND">bash</tt> built-ins to some degree in <a
href="#SHELL-BASH-ENVIRONMENT">Section 8.3.1</a>. <tt class="COMMAND">umask</tt> takes a
little getting used to. It works very similar to <tt class="COMMAND">chmod</tt>, only in
reverse. You specify the octal values you do not wish to have present in newly created
files. The default umask value is <var class="LITERAL">0022</var>.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">umask</kbd>
0022
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">umask 0077</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">touch tempfile</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l tempfile</kbd>
-rw-------- 1 david users 0 Apr 19 11:21 tempfile
</pre>
</td>
</tr>
</table>
<p>See the man page for <tt class="COMMAND">bash</tt> for more information.</p>
<p>To set special permissions with <tt class="COMMAND">chmod</tt>, add the numbers
together and place them in the first column. For example, to make it set user ID and set
group ID, we use 6 as the first column:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">chmod 6755 /tmp/example</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l /tmp/example</kbd>
-rwsr-sr-x 1 david users 0 Apr 19 11:21 /tmp/example
</pre>
</td>
</tr>
</table>
<p>If the octal values confuse you, you can use letters with <tt
class="COMMAND">chmod</tt>. The permission groups are represented as:</p>
<div class="INFORMALTABLE"><a id="AEN3246" name="AEN3246"></a>
<table border="0" frame="void" class="CALSTABLE">
<col />
<col />
<tbody>
<tr>
<td>Owner</td>
<td>u</td>
</tr>
<tr>
<td>Group</td>
<td>g</td>
</tr>
<tr>
<td>World</td>
<td>o</td>
</tr>
<tr>
<td>All of the above</td>
<td>a</td>
</tr>
</tbody>
</table>
</div>
<p>To do the above, we would have to use several command lines:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">chmod a+rx /tmp/example</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">chmod u+w /tmp/example</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">chmod ug+s /tmp/example</kbd>
</pre>
</td>
</tr>
</table>
<p>Some people prefer the letters over the numbers. Either way will result in the same
set of permissions.</p>
<p>The octal format is often faster, and the one you see most often used in shell
scripts. Sometimes the letters are more powerful however. For example, there's no easy
way to change one group of permissions while preserving the other groups on files and
directories when using the octal format. This is trivial with the letters.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l /tmp/</kbd>
-rwxr-xr-x 1 alan users 0 Apr 19 11:21 /tmp/example0
-rwxr-x--- 1 alan users 0 Apr 19 11:21 /tmp/example1
----r-xr-x 1 alan users 0 Apr 19 11:21 /tmp/example2
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">chmod g-rwx /tmp/example?</kbd>
-rwx---r-x 1 alan users 0 Apr 19 11:21 /tmp/example0
-rwx------ 1 alan users 0 Apr 19 11:21 /tmp/example1
-------r-x 1 alan users 0 Apr 19 11:21 /tmp/example2
</pre>
</td>
</tr>
</table>
<p>We mentioned set user ID and set group ID permissions in several places above. You may
be wondering what this is. Normally when you run a program, it is operating under your
user account. That is, it has all the permissions that you as a user have. The same is
true for the group. When you run a program, it executes under your current group. With
set user ID permissions, you can force the program to always run as the program owner
(such as “root”). Set group ID is the same, but for the group.</p>
<p>Be careful with this, set user ID and set group ID programs can open major security
holes on your system. If you frequently set user ID programs that are owned by <tt
class="USERNAME">root</tt>, you are allowing anyone to run that program and run it as <tt
class="USERNAME">root</tt>. Since <tt class="USERNAME">root</tt> has no restrictions on
the system, you can see how this would pose a major security problem. In short, it's not
bad to use set user ID and set group ID permissions, just use common sense.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="FILESYSTEM-STRUCTURE-LINKS"
name="FILESYSTEM-STRUCTURE-LINKS">9.3 Links</a></h2>
<p>Links are pointers between files. With links, you can have files exist in many
locations and be accessible by many names. There are two types of links: hard and
soft.</p>
<p>Hard links are names for a particular file. They can only exist within a single
filesystem and are only removed when the real name is removed from the system. These are
useful in some cases, but many users find the soft link to be more versatile.</p>
<p>The soft link, also called a symbolic link, can point to a file outside of its
filesystem. It is actually a small file containing the information it needs. You can add
and remove soft links without affecting the actual file. And since a symbolic link is
actually a small file containing its own information, they can even point at a directory.
It's rather common to have <tt class="FILENAME">/var/tmp</tt> actually be a symbolic link
to <tt class="FILENAME">/tmp</tt> for example.</p>
<p>Links do not have their own set of permissions or ownerships, but instead reflect
those of the file they point to. Slackware uses mostly soft links. Here is a common
example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l /bin/sh</kbd>
lrwxrwxrwx 1 root root 4 Apr 6 12:34 /bin/sh -> bash
</pre>
</td>
</tr>
</table>
<p>The <tt class="COMMAND">sh</tt> shell under Slackware is actually <tt
class="COMMAND">bash</tt>. Removing links is done using <tt class="COMMAND">rm</tt>. The
<tt class="COMMAND">ln</tt> command is used to create links. These commands will be
discussed in more depth in <a href="#FILE-COMMANDS">Chapter 10</a>.</p>
<p>It's very important to be careful about symlinks in particular. Once, I was working on
a machine that was consistently failing to back-up to tape each night. Two symlinks had
been made to directories beneath each other. The back-up software kept appending those
same directories to the tape until it was out of space. Normally, a set of checks will
prevent creating a symlink in this situation, but ours was a special case.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="FILESYSTEM-STRUCTURE-MOUNTING"
name="FILESYSTEM-STRUCTURE-MOUNTING">9.4 Mounting Devices</a></h2>
<p>As was previously discussed in <a href="#SYSTEM-CONFIGURATION-LAYOUT">Section
4.1.1</a>, all the drives and devices in your computer are one big filesystem. Various
hard drive partitions, CD-ROMs, and floppies are all placed in the same tree. In order to
attach these drives to the filesystem so that you can access them, you have to use the
<tt class="COMMAND">mount</tt>(1) and <tt class="COMMAND">umount</tt>(1) commands.</p>
<p>Some devices are automatically mounted when you boot up your computer. These are
listed in the <tt class="FILENAME">/etc/fstab</tt> file. Anything that you want to be
mounted automatically gets an entry in that file. For other devices, you'll have to issue
a command every time you want to use the device.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN3319" name="AEN3319">9.4.1 <tt
class="FILENAME">fstab</tt></a></h3>
<p>Let's look at an example of the <tt class="FILENAME">/etc/fstab</tt> file:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cat /etc/fstab</kbd>
/dev/sda1 / ext2 defaults 1 1
/dev/sda2 /usr/local ext2 defaults 1 1
/dev/sda4 /home ext2 defaults 1 1
/dev/sdb1 swap swap defaults 0 0
/dev/sdb3 /export ext2 defaults 1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
/dev/fd0 /mnt ext2 defaults 0 0
/dev/cdrom /mnt/cdrom iso9660 ro 0 0
</pre>
</td>
</tr>
</table>
<p>The first column is the device name. In this case, the devices are five partitions
spread out across two SCSI hard drives, two special filesystems that don't need a device,
a floppy, and a CD-ROM drive. The second column is where the device will be mounted. This
needs to be a directory name, except in the case of a swap partition. The third column is
the filesystem type of the device. For normal Linux filesystems, this will be <var
class="LITERAL">ext2</var> (second extended filesystem). CD-ROM drives are <var
class="LITERAL">iso9660</var>, and Windows-based devices will either be <var
class="LITERAL">msdos</var> or <var class="LITERAL">vfat</var>.</p>
<p>The fourth column is a listing of options that apply to the mounted filesystem.
defaults is fine for just about everything. However, read-only devices should be given
the <var class="LITERAL">ro</var> flag. There are a lot of options that can be used.
Check the <tt class="FILENAME">fstab</tt>(5) man page for more information. The last two
columns are used by <tt class="COMMAND">fsck</tt> and other commands that need to
manipulate the devices. Check the man page for that information as well.</p>
<p>When you install Slackware Linux, the setup program will build much of the <tt
class="FILENAME">fstab</tt> file.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN3340" name="AEN3340">9.4.2 <tt class="COMMAND">mount</tt> and
<tt class="COMMAND">umount</tt></a></h3>
<p>Attaching another device to your filesystem is easy. All you have to do is use the <tt
class="COMMAND">mount</tt> command, along with a few options. Using <tt
class="COMMAND">mount</tt> can simplified if the device has an entry in the <tt
class="FILENAME">/etc/fstab</tt> file. For example, let's say that I wanted to mount my
CD-ROM drive and that my <tt class="COMMAND">fstab</tt> file looked like the example from
the previous section. I would call <tt class="COMMAND">mount</tt> like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">mount /cdrom</kbd>
</pre>
</td>
</tr>
</table>
<p>Since there is an entry in <tt class="FILENAME">fstab</tt> for that mount point, <tt
class="COMMAND">mount</tt> knows what options to use. If there wasn't an entry for that
device, I would have to use several options for <tt class="COMMAND">mount</tt>:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">mount -t iso9660 -o ro /dev/cdrom /cdrom</kbd>
</pre>
</td>
</tr>
</table>
<p>That command line includes the same information as the example <tt
class="FILENAME">fstab</tt> did, but we'll go over all the parts anyways. The <var
class="OPTION">-t iso9660</var> is the filesystem type of the device to mount. In this
case, it would be the iso9660 filesystem which is what CD-ROM drives most commonly use.
The <var class="OPTION">-o ro</var> tells mount to mount the device read-only. The <tt
class="FILENAME">/dev/cdrom</tt> is the name of the device to mount, and <tt
class="FILENAME">/cdrom</tt> is the location on the filesystem to mount the drive.</p>
<p>Before you can remove a floppy, CD-ROM, or other removable device that is currently
mounted, you'll have to unmount it. That is done using the <tt
class="COMMAND">umount</tt> command. Don't ask where the “n” went because we
couldn't tell you. You can use either the mounted device or the mount point as the
argument to <tt class="COMMAND">umount</tt>. For example, if you wanted to unmount the
CD-ROM from the previous example, either of these commands would work:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">umount /dev/cdrom</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">umount /cdrom</kbd>
</pre>
</td>
</tr>
</table>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="FILESYSTEM-STRUCTURE-NFS" name="FILESYSTEM-STRUCTURE-NFS">9.5
NFS Mounts</a></h2>
<p>NFS stands for the Network Filesystem. It is not really part of the real filesystem,
but can be used to add parts to the mounted filesystem.</p>
<p>Large Unix environments often times share the same programs, sets of home directories,
and mail spool. The problem of getting the same copy to each machine is solved with NFS.
We can use NFS to share one set of home directories between all of the workstations. The
workstations then mount that NFS share as if it were on their own machines.</p>
<p>See <a href="#NETWORK-CONFIGURATION-NFS-NFS">Section 5.6.2</a> and the man pages for
<tt class="FILENAME">exports</tt>(5), <tt class="COMMAND">nfsd</tt>(8), and <tt
class="COMMAND">mountd</tt>(8) for more information.</p>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="FILE-COMMANDS" name="FILE-COMMANDS"></a>Chapter 10 Handling Files and
Directories</h1>
<p>Linux aims to the most Unix-like it can be. Traditionally, Unix operating systems have
been command-line oriented. We do have a graphical user interface in Slackware, but the
command-line is still the main level of control for the system. Therefore, it is
important to understand some of the basic file management commands.</p>
<p>The following sections explain the common file management commands and provide
examples of how they are used. There are many other commands, but these will help you get
started. Also, the commands are only briefly discussed here. You will find more detail in
the accompanying man pages for each command.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="FILE-COMMANDS-NAVIGATION" name="FILE-COMMANDS-NAVIGATION">10.1
Navigation : <tt class="COMMAND">ls</tt>, <tt class="COMMAND">cd</tt>, and <tt
class="COMMAND">pwd</tt></a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="AEN3398" name="AEN3398">10.1.1 <tt
class="COMMAND">ls</tt></a></h3>
<p>This command lists files in a directory. Windows and DOS users will notice its
similarity to the <tt class="COMMAND">dir</tt> command. By itself, <tt
class="COMMAND">ls</tt>(1) will list the files in the current directory. To see what's in
your root directory, you could issue these commands:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cd /</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls</kbd>
bin cdr dev home lost+found proc sbin tmp var
boot cdrom etc lib mnt root suncd usr vmlinuz
</pre>
</td>
</tr>
</table>
<p>The problem a lot of people have with that output is that you cannot easily tell what
is a directory and what is a file. Some users prefer that <tt class="COMMAND">ls</tt> add
a type identifier to each listing, like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -FC</kbd>
bin/ cdr/ dev/ home/ lost+found/ proc/ sbin/ tmp/ var/
boot/ cdrom/ etc/ lib/ mnt/ root/ suncd/ usr/ vmlinuz
</pre>
</td>
</tr>
</table>
<p>Directories get a slash at the end of the name, executable files get an asterisk at
the end of the name, and so on.</p>
<p><tt class="COMMAND">ls</tt> can also be used to get other statistics on files. For
example, to see the creation dates, owners, and permissions, you would look at a long
listing:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l</kbd>
drwxr-xr-x 2 root bin 4096 May 7 09:11 bin/
drwxr-xr-x 2 root root 4096 Feb 24 03:55 boot/
drwxr-xr-x 2 root root 4096 Feb 18 01:10 cdr/
drwxr-xr-x 14 root root 6144 Oct 23 18:37 cdrom/
drwxr-xr-x 4 root root 28672 Mar 5 18:01 dev/
drwxr-xr-x 10 root root 4096 Mar 8 03:32 etc/
drwxr-xr-x 8 root root 4096 Mar 8 03:31 home/
drwxr-xr-x 3 root root 4096 Jan 23 21:29 lib/
drwxr-xr-x 2 root root 16384 Nov 1 08:53 lost+found/
drwxr-xr-x 2 root root 4096 Oct 6 12:47 mnt/
dr-xr-xr-x 62 root root 0 Mar 4 15:32 proc/
drwxr-x--x 12 root root 4096 Feb 26 02:06 root/
drwxr-xr-x 2 root bin 4096 Feb 17 02:02 sbin/
drwxr-xr-x 5 root root 2048 Oct 25 10:51 suncd/
drwxrwxrwt 4 root root 487424 Mar 7 20:42 tmp/
drwxr-xr-x 21 root root 4096 Aug 24 03:04 usr/
drwxr-xr-x 18 root root 4096 Mar 8 03:32 var/
</pre>
</td>
</tr>
</table>
<p>Suppose you want to get a listing of the hidden files in the current directory. This
command will do just that:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -a</kbd>
. bin cdrom home mnt sbin usr
.. boot dev lib proc suncd var
.pwrchute_tmp cdr etc lost+found root tmp vmlinuz
</pre>
</td>
</tr>
</table>
<p>Files beginning with a period (called dot files) are hidden when you run <tt
class="COMMAND">ls</tt>. You will only see them if you pass the <var
class="OPTION">-a</var> option.</p>
<p>There are many more options that can be found in the online manual page. Don't forget
that you can combine options that you pass to <tt class="COMMAND">ls</tt>.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN3436" name="AEN3436">10.1.2 <tt
class="COMMAND">cd</tt></a></h3>
<p>The <tt class="COMMAND">cd</tt> command is used to change working directories. You
simply type <tt class="COMMAND">cd</tt> followed by the path name to change to. Here are
some examples:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
darkstar:~$ <kbd class="USERINPUT">cd /bin</kbd>
darkstar:/bin$ <kbd class="USERINPUT">cd usr</kbd>
bash: cd: usr: No such file or directory
darkstar:/bin$ <kbd class="USERINPUT">cd /usr</kbd>
darkstar:/usr$ <kbd class="USERINPUT">ls</kbd>
bin
darkstar:/usr$ <kbd class="USERINPUT">cd bin</kbd>
darkstar:/usr/bin$
</pre>
</td>
</tr>
</table>
<p>Notice that without the preceding slash, it tries to change to a directory in the
current directory. Also executing <tt class="COMMAND">cd</tt> with no options will move
you to your home directory.</p>
<p>The <tt class="COMMAND">cd</tt> command is not like the other commands. It is a
builtin shell command. Shell builtins are discussed in <a
href="#SHELL-BASH-ENVIRONMENT">Section 8.3.1</a>. This may not make any sense to you
right now. Basically it means there is no man page for this command. Instead, you have to
use the shell help. Like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">help cd</kbd>
</pre>
</td>
</tr>
</table>
<p>It will display the options for <tt class="COMMAND">cd</tt> and how to use them.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN3463" name="AEN3463">10.1.3 <tt
class="COMMAND">pwd</tt></a></h3>
<p>The <tt class="COMMAND">pwd</tt> command is used to show your current location. To use
the <tt class="COMMAND">pwd</tt> command just type <tt class="COMMAND">pwd</tt>. For
example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cd /bin</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">pwd</kbd>
/bin
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cd /usr</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cd bin</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">pwd</kbd>
/usr/bin
</pre>
</td>
</tr>
</table>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="FILE-COMMANDS-PAGERS" name="FILE-COMMANDS-PAGERS">10.2 Pagers:
<tt class="COMMAND">more</tt>, <tt class="COMMAND">less</tt>, and <tt
class="COMMAND">most</tt></a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="AEN3491" name="AEN3491">10.2.1 <tt
class="COMMAND">more</tt></a></h3>
<p><tt class="COMMAND">more</tt>(1) is what we call a pager utility. Oftentimes the
output of a particular command is too big to fit on one screen. The individual commands
do not know how to fit their output to separate screens. They leave this job to the pager
utility.</p>
<p>The <tt class="COMMAND">more</tt> command breaks the output into individual screens
and waits for you to press the space bar before continuing on to the next screen.
Pressing the enter key will advance the output one line. Here is a good example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cd /usr/bin</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l</kbd>
</pre>
</td>
</tr>
</table>
<p>That should scroll for a while. To break up the output screen by screen, just pipe it
through more:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l | more</kbd>
</pre>
</td>
</tr>
</table>
<p>That is the pipe character (shift backslash). The pipe is short for saying take the
output of <tt class="COMMAND">ls</tt> and feed it into <tt class="COMMAND">more</tt>. You
can pipe just about anything through the <tt class="COMMAND">more</tt> command, not just
<tt class="COMMAND">ls</tt>. Piping is also covered in <a
href="#SHELL-COMMAND-LINE-PIPING">Section 8.2.3</a>.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN3518" name="AEN3518">10.2.2 <tt
class="COMMAND">less</tt></a></h3>
<p>The <tt class="COMMAND">more</tt> command is quite handy, but often you will find that
you have advanced past the screen you wanted. more does not provide a way to go back. The
<tt class="COMMAND">less</tt>(1) command provides this functionality. It is used in the
same way as the <tt class="COMMAND">more</tt> command, so the previous examples apply
here too. So, <tt class="COMMAND">less</tt> is more than <tt class="COMMAND">more</tt>.
Joost Kremers puts it this way:</p>
<a id="AEN3530" name="AEN3530"></a>
<blockquote class="BLOCKQUOTE">
<p><tt class="COMMAND">less</tt> is more, but more <tt class="COMMAND">more</tt> than <tt
class="COMMAND">more</tt> is, so <tt class="COMMAND">more</tt> is less <tt
class="COMMAND">less</tt>, so use more <tt class="COMMAND">less</tt> if you want less <tt
class="COMMAND">more</tt>.</p>
</blockquote>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN3539" name="AEN3539">10.2.3 <tt
class="COMMAND">most</tt></a></h3>
<p>Where <tt class="COMMAND">more</tt> and <tt class="COMMAND">less</tt> leave off, <tt
class="COMMAND">most</tt>(1) picks back up. If <tt class="COMMAND">less</tt> is more than
<tt class="COMMAND">more</tt>, <tt class="COMMAND">most</tt> is more than <tt
class="COMMAND">less</tt>. Whereas the other pagers can only display one file at a time,
<tt class="COMMAND">most</tt> is capable of viewing any number of files, as long as each
file's window is at least 2 lines long. <tt class="COMMAND">most</tt> has a lot of
options, check the man page for full details.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="FILE-COMMANDS-OUTPUT" name="FILE-COMMANDS-OUTPUT">10.3 Simple
Output: <tt class="COMMAND">cat</tt> and <tt class="COMMAND">echo</tt></a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="AEN3559" name="AEN3559">10.3.1 <tt
class="COMMAND">cat</tt></a></h3>
<p><tt class="COMMAND">cat</tt>(1) is short for “concatenate”. It was
originally designed to merge text files into one, but can be used for many other
purposes.</p>
<p>To merge two or more files into one, you simply list the files after the <tt
class="COMMAND">cat</tt> command and then redirect the new output to a file. <tt
class="COMMAND">cat</tt> works with standard input and standard output, so you have to
use the shell redirection characters. For example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">cat file1 file2 file3 > bigfile</kbd>
</pre>
</td>
</tr>
</table>
<p>This command takes the contents of <tt class="FILENAME">file1</tt>, <tt
class="FILENAME">file2</tt>, and <tt class="FILENAME">file3</tt> and merges it all
together. The new output is sent to standard out.</p>
<p>One can also use <tt class="COMMAND">cat</tt> to display files. Many people <tt
class="COMMAND">cat</tt> text files through the <tt class="COMMAND">more</tt> or <tt
class="COMMAND">less</tt> commands, like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cat file1 | more</kbd>
</pre>
</td>
</tr>
</table>
<p>That will display the <tt class="FILENAME">file1</tt> file and pipe it through the <tt
class="COMMAND">more</tt> command so that you only get one screen at a time.</p>
<p>Another common use for <tt class="COMMAND">cat</tt> is copying files. You can copy any
file around with <tt class="COMMAND">cat</tt>, like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cat /bin/bash > ~/mybash</kbd>
</pre>
</td>
</tr>
</table>
<p>The <tt class="COMMAND">/bin/bash</tt> program is copied to your home directory and
named <tt class="FILENAME">mybash</tt>.</p>
<p><tt class="COMMAND">cat</tt> has many uses and the ones discussed here are just a few.
Since <tt class="COMMAND">cat</tt> makes extensive use of standard input and standard
output, it is ideal for use in shell scripts or part of other complex commands.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN3603" name="AEN3603">10.3.2 <tt
class="COMMAND">echo</tt></a></h3>
<p>The <tt class="COMMAND">echo</tt>(1) command displays the specified text on the
screen. You specify the string to display after the <tt class="COMMAND">echo</tt>
command. By default <tt class="COMMAND">echo</tt> will display the string and print a
newline character after it. You can pass the <var class="OPTION">-n</var> option to
suppress the printing of the newline. The <var class="OPTION">-e</var> option will cause
<tt class="COMMAND">echo</tt> to search for escape characters in the string and execute
them.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="FILE-COMMANDS-CREATION" name="FILE-COMMANDS-CREATION">10.4
Creation: <tt class="COMMAND">touch</tt> and <tt class="COMMAND">mkdir</tt></a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="AEN3619" name="AEN3619">10.4.1 <tt
class="COMMAND">touch</tt></a></h3>
<p><tt class="COMMAND">touch</tt>(1) is used to change the timestamp on a file. You can
change access timestamps and modification timestamps with this command. If the file
specified does not exist, <tt class="COMMAND">touch</tt> will create a zero length file
with the name specified. To mark a file with the current system time, you would issue
this command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -al file1</kbd>
-rw-r--r-- 1 root root 9779 Feb 7 21:41 file1
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">touch file1</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -al file1</kbd>
-rw-r--r-- 1 root root 9779 Feb 8 09:17 file1
</pre>
</td>
</tr>
</table>
<p>There are several options for <tt class="COMMAND">touch</tt>, including options to
specify which timestamp to modify, the time to use, and many more. The online manual page
discusses these in detail.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN3639" name="AEN3639">10.4.2 <tt
class="COMMAND">mkdir</tt></a></h3>
<p><tt class="COMMAND">mkdir</tt>(1) will create a new directory. You simply specify the
directory to create when you run mkdir. This example creates the <tt
class="FILENAME">hejaz</tt> directory in the current directory:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">mkdir hejaz</kbd>
</pre>
</td>
</tr>
</table>
<p>You can also specify a path, like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">mkdir /usr/local/hejaz</kbd>
</pre>
</td>
</tr>
</table>
<p>The <var class="OPTION">-p</var> option will tell <tt class="COMMAND">mkdir</tt> to
make any parent directories. The above example will fail if <tt
class="COMMAND">/usr/local</tt> does not exist. The <var class="OPTION">-p</var> option
will create <tt class="FILENAME">/usr/local</tt> and <tt
class="FILENAME">/usr/local/hejaz</tt>:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">mkdir -p /usr/local/hejaz</kbd>
</pre>
</td>
</tr>
</table>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="FILE-COMMANDS-COPYMOVE" name="FILE-COMMANDS-COPYMOVE">10.5 Copy
and Move</a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="FILE-COMMANDS-COPYMOVE-CP"
name="FILE-COMMANDS-COPYMOVE-CP">10.5.1 <tt class="COMMAND">cp</tt></a></h3>
<p><tt class="COMMAND">cp</tt>(1) copies files. DOS users will notice its similarity to
the <tt class="COMMAND">copy</tt> command. There are many options for <tt
class="COMMAND">cp</tt> , so you should have a look at the man page before using it.</p>
<p>A common use is to use <tt class="COMMAND">cp</tt> to copy a file from one location to
another. For example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cp hejaz /tmp</kbd>
</pre>
</td>
</tr>
</table>
<p>This copies the <tt class="FILENAME">hejaz</tt> file from the current directory to the
<tt class="FILENAME">/tmp</tt> directory.</p>
<p>Many users prefer to keep the timestamps preserved, as in this example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cp -a hejaz /tmp</kbd>
</pre>
</td>
</tr>
</table>
<p>This ensures that the timestamps are not modified in the copy.</p>
<p>To recursively copy the contents of a directory to another directory, you would issue
this command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cp -R <var
class="REPLACEABLE">mydir</var> /tmp</kbd>
</pre>
</td>
</tr>
</table>
<p>That will copy the <var class="REPLACEABLE">mydir</var> directory to the <tt
class="FILENAME">/tmp</tt> directory.</p>
<p>Also if you wish to copy a directory or a file and keep all it's old permissions and
time stamps and keep it exactly the same use <tt class="COMMAND">cp -p</tt>.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l file</kbd>
-rw-r--r-- 1 root vlad 4 Jan 1 15:27 file
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cp -p file /tmp</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l /tmp/file</kbd>
-rw-r--r-- 1 root vlad 4 Jan 1 15:27 file
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">cp</tt> has many more options that are discussed in detail in the
online manual page.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN3712" name="AEN3712">10.5.2 <tt
class="COMMAND">mv</tt></a></h3>
<p><tt class="COMMAND">mv</tt>(1) moves files from one place to another. Sounds simple
enough doesn't it?</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">mv oldfile /tmp/newfile</kbd>
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">mv</tt> has a few useful command line options that are detailed in
the man page. In practice, <tt class="COMMAND">mv</tt> is almost never used with
commandline options.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="FILE-COMMANDS-DELETION" name="FILE-COMMANDS-DELETION">10.6
Deletion: <tt class="COMMAND">rm</tt> and <tt class="COMMAND">rmdir</tt></a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="AEN3733" name="AEN3733">10.6.1 <tt
class="COMMAND">rm</tt></a></h3>
<p><tt class="COMMAND">rm</tt>(1) removes files and directory trees. DOS users will
notice the similarity to both the <tt class="COMMAND">del</tt> and <tt
class="COMMAND">deltree</tt> commands. <tt class="COMMAND">rm</tt> can be very dangerous
if you do not watch yourself. While it is sometimes possible to retrieve a recently
deleted file, it can be complicated (and potentially costly) and is beyond the scope of
this book.</p>
<p>To remove a single file, specify its name when you run rm:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">rm file1</kbd>
</pre>
</td>
</tr>
</table>
<p>If the file has write permissions removed, you may get a permission denied error
message. To force removal of the file no matter what, pass the <tt
class="COMMAND">-f</tt> option, like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">rm -f file1</kbd>
</pre>
</td>
</tr>
</table>
<p>To remove an entire directory, you use the <var class="OPTION">-r</var> and <var
class="OPTION">-f</var> options together. This is a good example of how to delete the
entire contents of your hard drive. You really don't want to do this. But here's the
command anyway:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">rm -rf /</kbd>
</pre>
</td>
</tr>
</table>
<p>Be very careful with <tt class="COMMAND">rm</tt>; you can shoot yourself in the foot.
There are several command line options, which are discussed in detail in the online
manual page.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN3764" name="AEN3764">10.6.2 <tt
class="COMMAND">rmdir</tt></a></h3>
<p><tt class="COMMAND">rmdir</tt>(1) removes directories from the filesystem. The
directory must be empty before it can be removed. The syntax is simply:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">rmdir <<var
class="REPLACEABLE">directory</var>></kbd>
</pre>
</td>
</tr>
</table>
<p>This example will remove the <tt class="FILENAME">hejaz</tt> subdirectory in the
current working directory:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">rmdir hejaz</kbd>
</pre>
</td>
</tr>
</table>
<p>If that directory does not exist, <tt class="COMMAND">rmdir</tt> will tell you. You
can also specify a full path to a directory to remove, as this example shows:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">rmdir /tmp/hejaz</kbd>
</pre>
</td>
</tr>
</table>
<p>That example will try to remove the <tt class="FILENAME">hejaz</tt> directory inside
the <tt class="FILENAME">/tmp</tt> directory.</p>
<p>You can also remove a directory and all of its parent directories by passing the <var
class="OPTION">-p</var> option.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">rmdir -p /tmp/hejaz</kbd>
</pre>
</td>
</tr>
</table>
<p>This will first try to remove the <tt class="FILENAME">hejaz</tt> directory inside <tt
class="FILENAME">/tmp</tt>. If that is successful, it will try to remove <tt
class="FILENAME">/tmp</tt>. <tt class="COMMAND">rmdir</tt> will continue this until an
error is encountered or the entire tree specified is removed.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="FILE-COMMANDS-LINK" name="FILE-COMMANDS-LINK">10.7 Aliasing
files with <tt class="COMMAND">ln</tt></a></h2>
<p><tt class="COMMAND">ln</tt>(1) is used to create links between files. These links can
be either hard links or soft (symbolic) links. The differences between the two kinds of
links were discussed in <a href="#FILESYSTEM-STRUCTURE-LINKS">Section 9.3</a>. If you
wanted to make a symbolic link to the directory <tt class="FILENAME">/var/media/mp3</tt>
and place the link in your home directory, you would do this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ln -s /var/media/mp3 ~/mp3</kbd>
</pre>
</td>
</tr>
</table>
<p>The <var class="OPTION">-s</var> option tells <tt class="COMMAND">ln</tt> to make a
symbolic link. The next option is the target of the link, and the final option is what to
call the link. In this case, it will just make a file called <tt
class="FILENAME">mp3</tt> in your home directory that points to <tt
class="FILENAME">/var/media/mp3</tt>. You can call the link itself whatever you want by
just changing the last option.</p>
<p>Making a hard link is just as simple. All you have to do is leave off the <var
class="OPTION">-s</var> option. Hard links may not normally refer to directories or span
file systems, however. To create a hard link <tt class="FILENAME">/usr/bin/email</tt> to
<tt class="FILENAME">/usr/bin/mutt</tt>, simply type the following:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">ln /usr/bin/mutt /usr/bin/email</kbd>
</pre>
</td>
</tr>
</table>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="PROCESS-CONTROL" name="PROCESS-CONTROL"></a>Chapter 11 Process Control</h1>
<p>Every program that is running is called a process. These processes range from things
like the X Window System to system programs (daemons) that are started when the computer
boots. Every process runs as a particular user. Processes that are started at boot time
usually run as <tt class="USERNAME">root</tt> or <tt class="USERNAME">nobody</tt>.
Processes that you start will run as you. Processes started as other users will run as
those users.</p>
<p>You have control over all the processes that you start. Additionally, <tt
class="USERNAME">root</tt> has control over all processes on the system, including those
started by other users. Processes can be controlled and monitored through several
programs, as well as some shell commands.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="PROCESS-CONTROL-BACKGROUNDING"
name="PROCESS-CONTROL-BACKGROUNDING">11.1 Backgrounding</a></h2>
<p>Programs started from the command line start up in the foreground. This allows you to
see all the output of the program and interact with it. However, there are several
occasions when you'd like the program to run without taking up your terminal. This is
called running the program in the background, and there are a few ways to do it.</p>
<p>The first way to background a process is by adding an ampersand to the command line
when you start the program. For example, assume you wanted to use the command line mp3
player <tt class="COMMAND">amp</tt> to play a directory full of mp3s, but you needed to
do something else on the same terminal. The following command line would start up amp in
the background:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">amp *.mp3 &</kbd>
</pre>
</td>
</tr>
</table>
<p>The program will run as normal, and you are returned to a prompt.</p>
<p>The other way to background a process is to do so while it is running. First, start up
a program. While it is running, hit <b class="KEYCAP">Control</b>+<b
class="KEYCAP">z</b>. This suspends the process. A suspended process is basically paused.
It momentarily stops running, but can be started up again at any time. Once you have
suspended a process, you are returned to a prompt. You can background the process by
typing:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">bg</kbd>
</pre>
</td>
</tr>
</table>
<p>Now the suspended process is running in the background.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="PROCESS-CONTROL-FOREGROUNDING"
name="PROCESS-CONTROL-FOREGROUNDING">11.2 Foregrounding</a></h2>
<p>If you need to interact with a backgrounded process, you can bring it back into the
foreground. If you've only got one backgrounded process, you can bring it back by
typing:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">fg</kbd>
</pre>
</td>
</tr>
</table>
<p>If the program is not done running, the program will take control over you terminal
and you will not be returned to a prompt. Sometimes, the program will finish running
while backgrounded. In this instance, you'll get a message like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
[1]+ Done /bin/ls $LS_OPTIONS
</pre>
</td>
</tr>
</table>
<p>That tells you that the backgrounded process (in this case <tt class="COMMAND">ls</tt>
- not terribly interesting) has completed.</p>
<p>It is possible to have several processes backgrounded at once. When this happens,
you'll need to know which process you want to bring back to the foreground. Just typing
<tt class="COMMAND">fg</tt> will foreground the process that was last backgrounded. What
if you had a whole list of processes in the background? Luckily, bash includes a command
to list all the processes. It's called <tt class="COMMAND">jobs</tt> and gives output
like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">jobs</kbd>
[1] Stopped vim
[2]- Stopped amp
[3]+ Stopped man ps
</pre>
</td>
</tr>
</table>
<p>This shows you a list of all the processes that are backgrounded. As you can see, they
are all stopped. This means that the processes are suspended. The number is a sort of ID
for all the backgrounded processes. The ID with a plus sign beside it (<var
class="LITERAL">man ps</var>) is the process that will be foregrounded if you just type
<tt class="COMMAND">fg</tt>.</p>
<p>If you wanted to foreground <tt class="COMMAND">vim</tt>, you would type:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">fg 1</kbd>
</pre>
</td>
</tr>
</table>
<p>and <tt class="COMMAND">vim</tt> would spring back up to the console. Backgrounding
processes can be very useful if you only have one terminal open over a dialup connection.
You can have several programs running on that one terminal, periodically switching back
and forth between them.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="PROCESS-CONTROL-PS" name="PROCESS-CONTROL-PS">11.3 <tt
class="COMMAND">ps</tt></a></h2>
<p>So now you know how to switch back and forth between several processes that you've
started from the command line. And you also know that there are lots of processes running
all the time. So how do you list all of these programs? Well, you make use of the <tt
class="COMMAND">ps</tt>(1) command. This command has a lot of options, so we'll only
cover the most important ones here. For a complete listing, see the man page for ps. Man
pages are covered in-depth in <a href="#HELP-SYSTEM-MAN">Section 2.1.1</a>.</p>
<p>Simply typing <tt class="COMMAND">ps</tt> will get you a listing of the programs
running on your terminal. This incudes the foreground processes (which include whatever
shell you are using, and of course, <tt class="COMMAND">ps</tt> itself). Also listed are
backgrounded processes you may have running. Many times, that will be a very short
listing:</p>
<div class="FIGURE"><a id="FIG-PROCESS-CONTROL-PS-SHORT"
name="FIG-PROCESS-CONTROL-PS-SHORT"></a>
<p><b>Figure 11-1. Basic <tt class="COMMAND">ps</tt> output</b></p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ps</kbd>
PID TTY TIME CMD
7923 ttyp0 00:00:00 bash
8059 ttyp0 00:00:00 ps
</pre>
</td>
</tr>
</table>
</div>
<p>Even though this is not a lot of processes, the information is very typical. You'll
get the same columns using regular ps no matter how many processes are running. So what
does it all mean?</p>
<p>Well, the <var class="LITERAL">PID</var> is the <span class="emphasis"><i
class="EMPHASIS">process ID</i></span>. All running processes are given a unique
identifier which ranges between 1 and 32767. Each process is assigned the next free PID.
When a process quits (or is killed, as you will see in the next section), it gives up its
PID. When the max PID is reached, the next free one will wrap back around to the lowest
free one.</p>
<p>The <var class="LITERAL">TTY</var> column indicates which terminal the process is
running on. Doing a plain <tt class="COMMAND">ps</tt> will only list all the programs
running on the current terminal, so all the processes give the same information in the
TTY column. As you can see, both processes listed are running on <tt
class="FILENAME">ttyp0</tt>. This indicates that they are either running remotely or from
an X terminal of some variety.</p>
<p>The <var class="LITERAL">TIME</var> column indicated how much CPU time the process has
been running. This is different from the actual amount of time that a process runs.
Remember that Linux is a multitasking operating system. There are many processes running
all the time, and these processes each get a small portion of the processor's time. So,
the TIME column should show much less time for each process than it actually takes to
run. If you see more than several minutes in the TIME column, it could mean that
something is wrong.</p>
<p>Finally, the <var class="LITERAL">CMD</var> column shows what the program actually is.
It only lists the base name of the program, not any command line options or similar
information. To get that information, you'll need to use one of the many options to <tt
class="COMMAND">ps</tt>. We'll discuss that shortly.</p>
<p>You can get a complete listing of the processes running on your system using the right
combination of options. This will probably result in a long listing of processes
(fifty-five on my laptop as I write this sentence), so I'll abbreviate the output:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ps -ax</kbd>
PID TTY STAT TIME COMMAND
1 ? S 0:03 init [3]
2 ? SW 0:13 [kflushd]
3 ? SW 0:14 [kupdate]
4 ? SW 0:00 [kpiod]
5 ? SW 0:17 [kswapd]
11 ? S 0:00 /sbin/kerneld
30 ? SW 0:01 [cardmgr]
50 ? S 0:00 /sbin/rpc.portmap
54 ? S 0:00 /usr/sbin/syslogd
57 ? S 0:00 /usr/sbin/klogd -c 3
59 ? S 0:00 /usr/sbin/inetd
61 ? S 0:04 /usr/local/sbin/sshd
63 ? S 0:00 /usr/sbin/rpc.mountd
65 ? S 0:00 /usr/sbin/rpc.nfsd
67 ? S 0:00 /usr/sbin/crond -l10
69 ? S 0:00 /usr/sbin/atd -b 15 -l 1
77 ? S 0:00 /usr/sbin/apmd
79 ? S 0:01 gpm -m /dev/mouse -t ps2
94 ? S 0:00 /usr/sbin/automount /auto file /etc/auto.misc
106 tty1 S 0:08 -bash
108 tty3 SW 0:00 [agetty]
109 tty4 SW 0:00 [agetty]
110 tty5 SW 0:00 [agetty]
111 tty6 SW 0:00 [agetty]
[output cut]
</pre>
</td>
</tr>
</table>
<p>Most of these processes are started at boot time on most systems. I've made a few
modifications to my system, so your mileage will most likely vary. However, you will see
most of these processes on your system too. As you can see, these options display command
line options to the running processes. Recently, a kernel vulnerability in <tt
class="COMMAND">ptrace</tt> facilitated a fix which no longer shows command line options
for many running processes. These are now listed in brackets like PIDs 108 through 110.
It also brings up a few more columns and some other interesting output.</p>
<p>First, you'll notice that most of these processes are listed as running on tty
“?”. Those are not attached to any particular terminal. This is most common
with daemons, which are processes which run without attaching to any particular terminal.
Common daemons are sendmail, BIND, apache, and NFS. They typically listen for some
request from a client, and return information to it upon request.</p>
<p>Second, there is a new column: <var class="LITERAL">STAT</var>. It shows the status of
the process. <var class="LITERAL">S</var> stands for sleeping: the process is waiting for
something to happen. <var class="LITERAL">Z</var> stands for a zombied process. A zombied
processes is one whose parent has died, leaving the child processes behind. This is not a
good thing. <var class="LITERAL">D</var> stands for a process that has entered an
uninterruptible sleep. Often, these processes refuse to die even when passed a SIGKILL.
You can read more about SIGKILL later in the next section on <tt
class="COMMAND">kill</tt> . W stands for paging. A dead process is marked with an <var
class="LITERAL">X</var>. A process marked <var class="LITERAL">T</var> is traced, or
stopped. <var class="LITERAL">R</var> means that the process is runable.</p>
<p>If you want to see even more information about the running processes, try this
out:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ps -aux</kbd>
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 344 80 ? S Mar02 0:03 init [3]
root 2 0.0 0.0 0 0 ? SW Mar02 0:13 [kflushd]
root 3 0.0 0.0 0 0 ? SW Mar02 0:14 [kupdate]
root 4 0.0 0.0 0 0 ? SW Mar02 0:00 [kpiod]
root 5 0.0 0.0 0 0 ? SW Mar02 0:17 [kswapd]
root 11 0.0 0.0 1044 44 ? S Mar02 0:00 /sbin/kerneld
root 30 0.0 0.0 1160 0 ? SW Mar02 0:01 [cardmgr]
bin 50 0.0 0.0 1076 120 ? S Mar02 0:00 /sbin/rpc.port
root 54 0.0 0.1 1360 192 ? S Mar02 0:00 /usr/sbin/sysl
root 57 0.0 0.1 1276 152 ? S Mar02 0:00 /usr/sbin/klog
root 59 0.0 0.0 1332 60 ? S Mar02 0:00 /usr/sbin/inet
root 61 0.0 0.2 1540 312 ? S Mar02 0:04 /usr/local/sbi
root 63 0.0 0.0 1796 72 ? S Mar02 0:00 /usr/sbin/rpc.
root 65 0.0 0.0 1812 68 ? S Mar02 0:00 /usr/sbin/rpc.
root 67 0.0 0.2 1172 260 ? S Mar02 0:00 /usr/sbin/cron
root 77 0.0 0.2 1048 316 ? S Mar02 0:00 /usr/sbin/apmd
root 79 0.0 0.1 1100 152 ? S Mar02 0:01 gpm
root 94 0.0 0.2 1396 280 ? S Mar02 0:00 /usr/sbin/auto
chris 106 0.0 0.5 1820 680 tty1 S Mar02 0:08 -bash
root 108 0.0 0.0 1048 0 tty3 SW Mar02 0:00 [agetty]
root 109 0.0 0.0 1048 0 tty4 SW Mar02 0:00 [agetty]
root 110 0.0 0.0 1048 0 tty5 SW Mar02 0:00 [agetty]
root 111 0.0 0.0 1048 0 tty6 SW Mar02 0:00 [agetty]
[output cut]
</pre>
</td>
</tr>
</table>
<p>That's a whole lot of information. Basically, it adds information including what user
started the process, how much of the system resources the process is using (the %CPU,
%MEM, VSZ, and RSS columns), and on what date the process was started. Obviously, that's
a lot of information that could come in handy for a system administrator. It also brings
up another point: the information now goes off the edge of the screen so that you cannot
see it all. The <var class="OPTION">-w</var> option will force <tt
class="COMMAND">ps</tt> to wrap long lines.</p>
<p>It's not terribly pretty, but it does the job. You've now got the complete listings
for each process. There's even more information that you can display about each process.
Check out the very in-depth man page for <tt class="COMMAND">ps</tt>. However, the
options shown above are the most popular ones and will be the ones you need to use the
most often.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="PROCESS-CONTROL-KILL" name="PROCESS-CONTROL-KILL">11.4 <tt
class="COMMAND">kill</tt></a></h2>
<p>On occasion, programs misbehave and you'll need to put them back in line. The program
for this kind of administration is called <tt class="COMMAND">kill</tt>(1), and it can be
used for manipulating processes in several ways. The most obvious use of <tt
class="COMMAND">kill</tt> is to kill off a process. You'll need to do this if a program
has run away and is using up lots of system resources, or if you're just sick of it
running.</p>
<p>In order to kill off a process, you'll need to know its PID or its name. To get the
PID, use the <tt class="COMMAND">ps</tt> command as was discussed in the last section.
For example, to kill off process 4747, you'd issue the following:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">kill 4747</kbd>
</pre>
</td>
</tr>
</table>
<p>Note that you'll have to be the owner of the process in order to kill it. This is a
security feature. If you were allowed to kill off processes started by other users, it
would be possible to do all sorts of malicious things. Of course, <tt
class="USERNAME">root</tt> can kill off any process on the system.</p>
<p>There's another variety of the <tt class="COMMAND">kill</tt> command called <tt
class="COMMAND">killall</tt>(1). This program does exactly what it says: it kills all the
running processes that have a certain name. If you wanted to kill off all the running <tt
class="COMMAND">vim</tt> processes, you could type the following command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">killall vim</kbd>
</pre>
</td>
</tr>
</table>
<p>Any and all <tt class="COMMAND">vim</tt> processes you have running will die off.
Doing this as <tt class="USERNAME">root</tt> would kill off all the <tt
class="COMMAND">vim</tt> processes running for all users. This brings up an interesting
way to kick everyone (including yourself) off the system:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">killall bash</kbd>
</pre>
</td>
</tr>
</table>
<p>Sometimes a regular kill doesn't get the job done. Certain processes will not die with
a kill. You'll need to use a more potent form. If that pesky PID 4747 wasn't responding
to your kill request, you could do the following:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">kill -9 4747</kbd>
</pre>
</td>
</tr>
</table>
<p>That will almost certainly cause process 4747 to die. You can do the same thing with
<tt class="COMMAND">killall</tt>. What this is doing is sending a different signal to the
process. A regular <tt class="COMMAND">kill</tt> sends a <var
class="LITERAL">SIGTERM</var> (terminate) signal to the process, which tells it to finish
what it's doing, clean up, and exit. <tt class="COMMAND">kill -9</tt> sends a <var
class="LITERAL">SIGKILL</var> (kill) signal to the process, which essentially drops it.
The process is not allowed to clean-up, and sometimes bad things like data corruption
could occur by killing something with a <var class="LITERAL">SIGKILL</var>. There's a
whole list of signals at your disposal. You can get a listing of signals by typing the
following:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">kill -l</kbd>
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL
5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE
9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2
13) SIGPIPE 14) SIGALRM 15) SIGTERM 17) SIGCHLD
18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN
22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO
30) SIGPWR
</pre>
</td>
</tr>
</table>
<p>The number must be used for <tt class="COMMAND">kill</tt>, while the name minus the
leading “SIG” can be used with <tt class="COMMAND">killall</tt>. Here's
another example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">killall -KILL vim</kbd>
</pre>
</td>
</tr>
</table>
<p>A final use of <tt class="COMMAND">kill</tt> is to restart a process. Sending a <var
class="LITERAL">SIGHUP</var> will cause most processes to re-read their configuration
files. This is especially helpful for telling system processes to re-read their config
files after editing.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="PROCESS-CONTROL-TOP" name="PROCESS-CONTROL-TOP">11.5 <tt
class="COMMAND">top</tt></a></h2>
<p>Finally, there's a command you can use to display updating information about the
processes running on the system. This command is called <tt class="COMMAND">top</tt>(1),
and is started like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">top</kbd>
</pre>
</td>
</tr>
</table>
<p>This will display a full screen of information about the processes running on the
system, as well as some overall information about the system. This includes load average,
number of processes, the CPU status, free memory information, and details about processes
including PID, user, priority, CPU and memory usage information, running time, and
program name.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
6:47pm up 1 day, 18:01, 1 user, load average: 0.02, 0.07, 0.02
61 processes: 59 sleeping, 2 running, 0 zombie, 0 stopped
CPU states: 2.8% user, 3.1% system, 0.0% nice, 93.9% idle
Mem: 257992K av, 249672K used, 8320K free, 51628K shrd, 78248K buff
Swap: 32764K av, 136K used, 32628K free, 82600K cached
<span class="emphasis"><i
class="EMPHASIS">PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND</i></span>
112 root 12 0 19376 18M 2468 R 0 3.7 7.5 55:53 X
4947 david 15 0 2136 2136 1748 S 0 2.3 0.8 0:00 screenshot
3398 david 7 0 20544 20M 3000 S 0 1.5 7.9 0:14 gimp
4946 root 12 0 1040 1040 836 R 0 1.5 0.4 0:00 top
121 david 4 0 796 796 644 S 0 1.1 0.3 25:37 wmSMPmon
115 david 3 0 2180 2180 1452 S 0 0.3 0.8 1:35 wmaker
4948 david 16 0 776 776 648 S 0 0.3 0.3 0:00 xwd
1 root 1 0 176 176 148 S 0 0.1 0.0 0:13 init
189 david 1 0 6256 6156 4352 S 0 0.1 2.4 3:16 licq
4734 david 0 0 1164 1164 916 S 0 0.1 0.4 0:00 rxvt
2 root 0 0 0 0 0 SW 0 0.0 0.0 0:08 kflushd
3 root 0 0 0 0 0 SW 0 0.0 0.0 0:06 kupdate
4 root 0 0 0 0 0 SW 0 0.0 0.0 0:00 kpiod
5 root 0 0 0 0 0 SW 0 0.0 0.0 0:04 kswapd
31 root 0 0 340 340 248 S 0 0.0 0.1 0:00 kerneld
51 root 0 0 48 48 32 S 0 0.0 0.0 0:00 dhcpcd
53 bin 0 0 316 316 236 S 0 0.0 0.1 0:00 rpc.portmap
57 root 0 0 588 588 488 S 0 0.0 0.2 0:01 syslogd
</pre>
</td>
</tr>
</table>
<p>It's called <tt class="COMMAND">top</tt> because the most CPU intensive programs will
be listed at the top. An interesting note is that top will be listed first on most
inactive (and some active) systems because of its CPU utilization. However, <tt
class="COMMAND">top</tt> is quite useful for determining what program is misbehaving and
needs to be killed off.</p>
<p>But suppose you only want a list of your own processes, or the processes of some other
user. The processes you want to see might not be among the most CPU intensive programs
currently running. The <var class="OPTION">-u</var> option allows you to specify a
username or UID and monitor only those processes owned by that UID.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">top -u alan</kbd>
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3622 alan 13 0 11012 10m 6956 S 1.0 2.1 0:03.66 gnome-terminal
3739 alan 13 0 1012 1012 804 R 0.3 0.2 0:00.06 top
3518 alan 9 0 1312 1312 1032 S 0.0 0.3 0:00.09 bash
3529 alan 9 0 984 984 848 S 0.0 0.2 0:00.00 startx
3544 alan 9 0 640 640 568 S 0.0 0.1 0:00.00 xinit
3548 alan 9 0 8324 8320 6044 S 0.0 1.6 0:00.30 gnome-session
3551 alan 9 0 7084 7084 1968 S 0.0 1.4 0:00.50 gconfd-2
3553 alan 9 0 2232 2232 380 S 0.0 0.4 0:00.05 esd
3555 alan 9 0 2552 2552 1948 S 0.0 0.5 0:00.10 bonobo-activati
3557 alan 9 0 2740 2740 2224 S 0.0 0.5 0:00.05 gnome-smproxy
3559 alan 9 0 6496 6492 5004 S 0.0 1.3 0:00.31 gnome-settings-
3565 alan 9 0 1740 1740 1440 S 0.0 0.3 0:00.28 xscreensaver
3568 alan 9 0 7052 7052 4960 S 0.0 1.4 0:02.28 metacity
3572 alan 9 0 11412 11m 7992 S 0.0 2.2 0:01.58 gnome-panel
3574 alan 9 0 12148 11m 8780 S 0.0 2.4 0:00.64 nautilus
3575 alan 9 0 12148 11m 8780 S 0.0 2.4 0:00.00 nautilus
3576 alan 9 0 12148 11m 8780 S 0.0 2.4 0:00.00 nautilus
</pre>
</td>
</tr>
</table>
<p>As you can see, I'm currently running <tt class="COMMAND">X</tt>, <tt
class="COMMAND">top</tt>, a <tt class="COMMAND">gnome-terminal</tt> (in which I'm writing
this) and many other X-related processes which take up the most CPU time for me. This is
a good way to monitor how hard your users are working your system.</p>
<p><tt class="COMMAND">top</tt> also supports monitoring processes by their PID, ignoring
idle and zombied processes, and many other options. The best place to get a handle on
these options is the man page for <tt class="COMMAND">top</tt>.</p>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="ESSENTIAL-SYSADMIN" name="ESSENTIAL-SYSADMIN"></a>Chapter 12 Essential System
Administration</h1>
<p>Whoa whoa whoa whoa whoa.... I know what you're thinking. “I'm not a system
administrator! I don't even want to be a system administrator!”</p>
<p>Fact is, you are the administrator of any computers for which you have the <tt
class="USERNAME">root</tt> password. This might be your desktop box with one or two
users, or it might be a big server with several hundred. Regardless, you'll need to know
how to manage users, and how to shut down the system safely. These tasks seem simple, but
they have some quirks to keep in mind.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="ESSENTIAL-SYSADMIN-USERS" name="ESSENTIAL-SYSADMIN-USERS">12.1
Users and Groups</a></h2>
<p>As mentioned in <a href="#SHELL">Chapter 8</a>, you shouldn't normally use your system
logged in as <tt class="USERNAME">root</tt>. Instead, you should create a normal user
account for everyday use, and use the root account only for system administration tasks.
To create a user, you can either use the tools supplied with Slackware, or you can edit
the password files by hand.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="ESSENTIAL-SYSADMIN-USERS-SCRIPTS"
name="ESSENTIAL-SYSADMIN-USERS-SCRIPTS">12.1.1 Supplied Scripts</a></h3>
<p>The easiest way to manage users and groups is with the supplied scripts and programs.
Slackware includes the programs <tt class="COMMAND">adduser</tt>, <tt
class="COMMAND">userdel</tt>(8), <tt class="COMMAND">chfn</tt>(1), <tt
class="COMMAND">chsh</tt>(1), and <tt class="COMMAND">passwd</tt>(1) for dealing with
users. The commands <tt class="COMMAND">groupadd</tt>(8), <tt
class="COMMAND">groupdel</tt>(8), and <tt class="COMMAND">groupmod</tt>(8) are for
dealing with groups. With the exception of <tt class="COMMAND">chfn</tt>, <tt
class="COMMAND">chsh</tt>, and <tt class="COMMAND">passwd</tt>, these programs are
generally only run as <tt class="USERNAME">root</tt>, and are therefore located in <tt
class="FILENAME">/usr/sbin</tt>. <tt class="COMMAND">chfn</tt>, <tt
class="COMMAND">chsh</tt>, and <tt class="COMMAND">passwd</tt> can be run by anyone, and
are located in <tt class="FILENAME">/usr/bin</tt>.</p>
<p>Users can be added with the <tt class="COMMAND">adduser</tt> program. We'll start out
by going through the whole procedure, showing all the questions that are asked and a
brief description of what everything means. The default answer is in the brackets, and
can be chosen for almost all the questions, unless you really want to change
something.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">adduser</kbd>
Login name for new user []: jellyd
</pre>
</td>
</tr>
</table>
<p>This is the name that the user will use to login. Traditionally, login names are eight
characters or fewer, and all lowercase characters. (You may use more than eight
characters, or use digits, but avoid doing so unless you have a fairly important
reason.)</p>
<p>You can also provide the login name as an argument on the command line:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">adduser jellyd</kbd>
</pre>
</td>
</tr>
</table>
<p>In either case, after providing the login name, adduser will prompt for the user
ID:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
User ID ('UID') [ defaults to next available ]:
</pre>
</td>
</tr>
</table>
<p>The user ID (UID) is how ownerships are really determined in Linux. Each user has a
unique number, starting at 1000 in Slackware. You can pick a UID for the new user, or you
can just let adduser assign the user the next free one.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Initial group [users]:
</pre>
</td>
</tr>
</table>
<p>All users are placed into the <tt class="USERNAME">users</tt> group by default. You
might want to place the new user into a different group, but it is not recommended unless
you know what you're doing.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Additional groups (comma separated) []:
</pre>
</td>
</tr>
</table>
<p>This question allows you to place the new user into additional groups. It is possible
for a user to be in several groups at the same time. This is useful if you have
established groups for things like modifying web site files, playing games, and so on.
For example, some sites define group <tt class="USERNAME">wheel</tt> as the only group
that can use the <tt class="COMMAND">su</tt> command. Or, a default Slackware
installation uses the <tt class="USERNAME">sys</tt> group for users authorized to play
sounds through the internal sound card.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Home directory [/home/jellyd]
</pre>
</td>
</tr>
</table>
<p>Home directories default to being placed under <tt class="FILENAME">/home</tt>. If you
run a very large system, it's possible that you have moved the home directories to a
different location (or to many locations). This step allows you to specify where the
user's home directory will be.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Shell [ /bin/bash ]
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">bash</tt> is the default shell for Slackware Linux, and will be
fine for most people. If your new user comes from a Unix background, they may be familiar
with a different shell. You can change their shell now, or they can change it themselves
later using the <tt class="COMMAND">chsh</tt> command.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Expiry date (YYYY-MM-DD) []:
</pre>
</td>
</tr>
</table>
<p>Accounts can be set up to expire on a specified date. By default, there is no
expiration date. You can change that, if you'd like. This option might be useful for
people running an ISP who might want to make an account expire upon a certain date,
unless they receive the next year's payment.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
New account will be created as follows:
---------------------------------------
Login name: jellyd
UID: [ Next available ]
Initial group: users
Additional groups: [ None ]
Home directory: /home/jellyd
Shell: /bin/bash
Expiry date: [ Never ]
</pre>
</td>
</tr>
</table>
<p>This is it... if you want to bail out, hit <b class="KEYCAP">Control</b>+<b
class="KEYCAP">C</b>. Otherwise, press <kbd class="USERINPUT">ENTER</kbd> to go ahead and
make the account.</p>
<p>You now see all the information that you've entered about the new account and are
given the opportunity to abort the account creation. If you entered something
incorrectly, you should hit <b class="KEYCAP">Control</b>+<b class="KEYCAP">C</b> and
start over. Otherwise, you can hit <kbd class="USERINPUT">enter</kbd> and the account
will be made.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Creating new account...
Changing the user information for jellyd
Enter the new value, or press return for the default
Full Name []: Jeremy
Room Number []: Smith 130
Work Phone []:
Home Phone []:
Other []:
</pre>
</td>
</tr>
</table>
<p>All of this information is optional. You don't have to enter any of this if you don't
want to, and the user can change it at any time using <tt class="COMMAND">chfn</tt>.
However, you might find it helpful to enter at least the full name and a phone number, in
case you need to get in touch with the person later.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Changing password for jellyd
Enter the new password (minimum of 5, maximum of 127 characters)
Please use a combination of upper and lower case letters and numbers.
New password:
Re-enter new password:
Password changed.
Account setup complete.
</pre>
</td>
</tr>
</table>
<p>You'll have to enter a password for the new user. Generally, if the new user is not
physically present at this point, you'll just pick some default password and tell the
user to change it to something more secure.</p>
<div class="NOTE">
<table class="NOTE" width="100%" border="0">
<tr>
<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/note.png"
hspace="5" alt="Note" /></td>
<td align="LEFT" valign="TOP">
<p><span class="emphasis"><i class="EMPHASIS">Choosing a Password</i></span>: Having a
secure password is the first line of defense against getting cracked. You do not want to
have an easily guessed password, because that makes it easier for someone to break into
your system. Ideally, a secure password would be a random string of characters, including
upper and lowercase letters, numbers, and random characters. (A tab character might not
be a wise choice, depending on what kinds of computers you'll be logging in from.) There
are many software packages that can generate random passwords for you; search the
Internet for these utilities.</p>
<p>In general, just use common sense: don't pick a password that is someone's birthday, a
common phrase, something found on your desk, or anything that is easily associated with
you. A password like “secure1” or any other password you see in print or
online is also bad.</p>
</td>
</tr>
</table>
</div>
<p>Removing users is not difficult at all. Just run <tt class="COMMAND">userdel</tt> with
the name of the account to remove. You should verify that the user is not logged in, and
that no processes are running as that user. Also, remember that once you've deleted the
user, all of that user's password information is gone permanently.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">userdel jellyd</kbd>
</pre>
</td>
</tr>
</table>
<p>This command removes that annoying <tt class="USERNAME">jellyd</tt> user from your
system. Good riddance! :) The user is removed from the <tt
class="FILENAME">/etc/passwd</tt>, <tt class="FILENAME">/etc/shadow</tt>, and <tt
class="FILENAME">/etc/group</tt> files, but doesn't remove the user's home directory.</p>
<p>If you'd wanted to remove the home directory as well, you would instead use this
command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">userdel -r jellyd</kbd>
</pre>
</td>
</tr>
</table>
<p>Temporarily disabling an account will be covered in the next section on passwords,
since a temporary change involves changing the user's password. Changing other account
information is covered in <a href="#ESSENTIAL-SYSADMIN-USERS-CHANGING">Section
12.1.3</a>.</p>
<p>The programs to add and remove groups are very simple. <tt
class="COMMAND">groupadd</tt> will just add another entry to the <tt
class="FILENAME">/etc/group</tt> file with a unique group ID, while <tt
class="COMMAND">groupdel</tt> will remove the specified group. It is up to you to edit
<tt class="FILENAME">/etc/group</tt> to add users to a specific group. For example, to
add a group called <tt class="USERNAME">cvs</tt>:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">groupadd cvs</kbd>
</pre>
</td>
</tr>
</table>
<p>And to remove it:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">groupdel cvs</kbd>
</pre>
</td>
</tr>
</table>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="ESSENTIAL-SYSADMIN-USERS-PASSWDS"
name="ESSENTIAL-SYSADMIN-USERS-PASSWDS">12.1.2 Changing Passwords</a></h3>
<p>The <tt class="COMMAND">passwd</tt> program changes passwords by modifying the <tt
class="FILENAME">/etc/shadow</tt> file. This file holds all the passwords for the system
in an encrypted format. In order to change your own password, you would type:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">passwd</kbd>
Changing password for chris
Old password:
Enter the new password (minumum of 5, maximum of 127 characters)
Please use a combination of upper and lower case letters and numbers.
New password:
</pre>
</td>
</tr>
</table>
<p>As you can see, you are prompted to enter your old password. It won't appear on the
screen as you type it, just like when you log in. Then, you are prompted to enter the new
password. <tt class="COMMAND">passwd</tt> performs a lot of checks on your new password,
and it will complain if your new password doesn't pass its checks. You can ignore its
warnings if you want. You will be prompted to enter your new password a second time for
confirmation.</p>
<p>If you are <tt class="USERNAME">root</tt>, you can also change another user's
password:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">passwd ted</kbd>
</pre>
</td>
</tr>
</table>
<p>You will then have to go through the same procedure as above, except that you won't
have to enter the user's old password. (One of the many benefits of being <tt
class="USERNAME">root</tt>...)</p>
<p>If needed, you can also temporarily disable an account, and reenable it at a later
time if needed. Both disabling an account and reenabling an account can be done with <tt
class="COMMAND">passwd</tt>. To disable an account, do the following as <tt
class="USERNAME">root</tt>:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">passwd -l david</kbd>
</pre>
</td>
</tr>
</table>
<p>This will change david's password to something that can never match any encrypted
value. You would reenable the account by using:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">passwd -u david</kbd>
</pre>
</td>
</tr>
</table>
<p>Now, david's account is back to normal. Disabling an account might be useful if the
user doesn't play by the rules you've set up on your system, or if they've exported a
very large copy of <tt class="COMMAND">xeyes</tt>(1) to your X desktop.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="ESSENTIAL-SYSADMIN-USERS-CHANGING"
name="ESSENTIAL-SYSADMIN-USERS-CHANGING">12.1.3 Changing User Information</a></h3>
<p>There are two pieces of information that users can change at any time: their shell and
their finger information. Slackware Linux uses <tt class="COMMAND">chsh</tt> (change
shell) and <tt class="COMMAND">chfn</tt> (change finger) to modify these values.</p>
<p>A user can pick any shell that is listed in the <tt class="FILENAME">/etc/shells</tt>
file. For most people, <tt class="COMMAND">/bin/bash</tt> will do just fine. Others might
be familiar with a shell found on their system at work or school and want to use what
they already know. To change your shell, use <tt class="COMMAND">chsh</tt>:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">chsh</kbd>
Password:
Changing the login shell for chris
Enter the new value, or press return for the default
Login Shell [/bin/bash]:
</pre>
</td>
</tr>
</table>
<p>After entering your password, enter the full path to the new shell. Make sure that
it's listed in the <tt class="FILENAME">/etc/shells</tt>(5) file first. The <tt
class="USERNAME">root</tt> user can also change any user's shell by running <tt
class="COMMAND">chsh</tt> with a username as the argument.</p>
<p>The finger information is the optional information such as your full name, phone
numbers, and room number. This can be changed using <tt class="COMMAND">chfn</tt>, and
follows the same procedure as it did during account creation. As usual, <tt
class="USERNAME">root</tt> can change anyone's finger information.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="ESSENTIAL-SYSADMIN-HARDUSERS"
name="ESSENTIAL-SYSADMIN-HARDUSERS">12.2 Users and Groups, the Hard Way</a></h2>
<p>Of course, it is possible to add, modify, and remove users and groups without using
the scripts and programs that come with Slackware. It's not really difficult, although
after reading this process, you'll probably find it much easier to use the scripts.
However, it's important to know how your password information is actually stored, in case
you ever need to recover this information and don't have the Slackware tools
available.</p>
<p>First, we'll add a new user to the <tt class="FILENAME">/etc/passwd</tt>(5), <tt
class="FILENAME">/etc/shadow</tt>(5), and <tt class="FILENAME">/etc/group</tt>(5) files.
The <tt class="FILENAME">passwd</tt> file holds some information about the users on your
system, but (strangely enough) not their passwords. This was once the case, but was
halted long ago for security reasons. The passwd file must be readable by all users, but
you don't want encrypted passwords world-readable, as would-be intruders can use the
encrypted passwords as a starting point for decrypting a user's password. Instead, the
encrypted passwords are kept in the shadow file, which is only readable by root, and
everyone's password is entered into the <tt class="FILENAME">passwd</tt> file simply as
“<var class="LITERAL">x</var>”. The <tt class="FILENAME">group</tt> file
lists all the groups and who is in each.</p>
<p>You can use the <tt class="COMMAND">vipw</tt> command to edit the <tt
class="FILENAME">/etc/passwd</tt> file safely, and the <tt class="COMMAND">vigr</tt>
command to edit the <tt class="FILENAME">/etc/group</tt> file safely. Use <tt
class="COMMAND">vipw -s</tt> to edit the <tt class="FILENAME">/etc/shadow</tt> file
safely. (“Safely” in this context means someone else won't be able to modify
the file you're editing at the moment. If you're the only administrator of your system,
you're probably safe, but it's best to get into good habits from the start.)</p>
<p>Let's examine the <tt class="FILENAME">/etc/passwd</tt> file and look at how to add a
new user. A typical entry in <tt class="FILENAME">passwd</tt> looks like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
chris:x:1000:100:Chris Lumens,Room 2,,:/home/chris:/bin/bash
</pre>
</td>
</tr>
</table>
<p>Each line is an entry for one user, and fields on each line are separated by a colon.
The fields are the login name, encrypted password (“<var
class="LITERAL">x</var>” for everyone on a Slackware system, since Slackware uses
shadow passwords), user ID, group ID, the optional finger information (separated by
commas), home directory, and shell. To add a new user by hand, add a new line at the end
of the file, filling in the appropriate information.</p>
<p>The information you add needs to meet some requirements, or your new user may have
problems logging in. First, make sure that the password field is an <var
class="LITERAL">x</var>, and that both the user name and user ID is unique. Assign the
user a group, either 100 (the “users” group in Slackware) or your default
group (use its number, not its name). Give the user a valid home directory (which you'll
create later) and shell (remember, valid shells are listed in <tt
class="FILENAME">/etc/shells</tt>).</p>
<p>Next, we'll need to add an entry in the /etc/shadow file, which holds the encrypted
passwords. A typical entry looks like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
chris:$1$w9bsw/N9$uwLr2bRER6YyBS.CAEp7R.:11055:0:99999:7:::
</pre>
</td>
</tr>
</table>
<p>Again, each line is an entry for one person, with each field delimited by a colon. The
fields are (in order) login name, encrypted password, days since the Epoch (January 1,
1970) that the password was last changed, days before the password may be changed, days
after which the password must be changed, days before password expiration that the user
is notified, days after expiration that the account is disabled, days since the Epoch
that the account is disabled, and a reserved field.</p>
<p>As you can see, most of that is for account expiration information. If you aren't
using expiration information, you only need to fill in a few fields with some special
values. Otherwise, you'll need to do some calculations and decision making before you can
fill those fields in. For a new user, just put some random garbage in the password field.
Don't worry about what the password is right now, because you're going to change it in a
minute. The only character you cannot include in the password field is a colon. Leave the
“days since password was changed” field blank as well. Fill in <var
class="LITERAL">0</var>, <var class="LITERAL">99999</var>, and <var
class="LITERAL">7</var> just as you see in the example entry, and leave the other fields
blank.</p>
<p>(For those of you who think you see my encrypted password above and believe you've got
a leg up on breaking into my system, go right ahead. If you can crack that password,
you'll know the password to a firewalled test system. Now that's useful :) )</p>
<p>All normal users are members of the “<tt class="USERNAME">users</tt>”
group on a typical Slackware system. However, if you want to create a new group, or add
the new user to additional groups, you'll need to modify the <tt
class="FILENAME">/etc/group</tt> file. Here is a typical entry:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
cvs::102:chris,logan,david,root
</pre>
</td>
</tr>
</table>
<p>The fields are group name, group password, group ID, and group members, separated by
commas. Creating a new group is a simple matter of adding a new line with a unique group
ID, and listing all the users you want to be in the group. Any users that are in this new
group and are logged in will have to log out and log back in for those changes to take
effect.</p>
<p>At this point, it might be a good idea to use the <tt class="COMMAND">pwck</tt> and
<tt class="COMMAND">grpck</tt> commands to verify that the changes you've made are
consistent. First, use <tt class="COMMAND">pwck -r</tt> and <tt class="COMMAND">grpck
-r</tt>: the <var class="OPTION">-r</var> switch makes no changes, but lists the changes
you would be asked to make if you ran the command without the switch. You can use this
output to decide whether you need to further modify any files, to run <tt
class="COMMAND">pwck</tt> or <tt class="COMMAND">grpck</tt> without the <var
class="OPTION">-r</var> switch, or to simply leave your changes as they are.</p>
<p>At this point, you should use the <tt class="COMMAND">passwd</tt> command to create a
proper password for the user. Then, use <tt class="COMMAND">mkdir</tt> to create the new
user's home directory in the location you entered into the <tt
class="FILENAME">/etc/passwd</tt> file, and use <tt class="COMMAND">chown</tt> to change
the owner of the new directory to the new user.</p>
<p>Removing a user is a simple matter of deleting all of the entries that exist for that
user. Remove the user's entry from <tt class="FILENAME">/etc/passwd</tt> and <tt
class="FILENAME">/etc/shadow</tt>, and remove the login name from any groups in the <tt
class="FILENAME">/etc/group</tt> file. If you wish, delete the user's home directory, the
mail spool file, and his crontab entry (if they exist).</p>
<p>Removing groups is similar: remove the group's entry from <tt
class="FILENAME">/etc/group</tt>.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="ESSENTIAL-SYSADMIN-SHUTDOWN"
name="ESSENTIAL-SYSADMIN-SHUTDOWN">12.3 Shutting Down Properly</a></h2>
<p>It is very important that you shut down your system properly. Simply turning the power
off with the power switch can cause serious filesystem damage. While the system is on,
files are in use even if you aren't doing anything. Remember that there are many
processes running in the background all the time. These processes are managing the system
and keep a lot of files open. When the system's power is switched off, these files are
not closed properly and may become corrupted. Depending on what files become damaged, the
system might be rendered completely unusable! In any case, you'll have to go through a
long filesystem check procedure on the next reboot.</p>
<div class="NOTE">
<table class="NOTE" width="100%" border="0">
<tr>
<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/note.png"
hspace="5" alt="Note" /></td>
<td align="LEFT" valign="TOP">
<p>If you configured your system with a journalling filesystem, like ext3 or reiserfs,
you'll be partially protected from filesystem damage, and your filesystem check on reboot
will be shorter than if you had used a filesystem without journalling, like ext2.
However, this safety net is no excuse for improperly shutting down your system! A
journalling FS is meant to protect your files from events beyond your control, not from
your own laziness.</p>
</td>
</tr>
</table>
</div>
<p>In any case, when you want to reboot or power down your computer, it is important to
do so properly. There are several ways of doing so; you can pick whichever one you think
is the most fun (or least amount of work). Since a shutdown and a reboot are similar
procedures, most of the ways for powering off the system can also be applied to
rebooting.</p>
<p>The first method is through the <tt class="COMMAND">shutdown</tt>(8) program, and it
is probably the most popular. <tt class="COMMAND">shutdown</tt> can be used to reboot or
turn off the system at a given time, and can display a message to all the logged-in users
of the system telling them that the system is going down.</p>
<p>The most basic use of shutdown to power down the computer is:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">shutdown -h now</kbd>
</pre>
</td>
</tr>
</table>
<p>In this case, we are not going to send a custom message to the users; they will see
<tt class="COMMAND">shutdown</tt>'s default message. “<var
class="OPTION">now</var>” is the time that we want to shutdown, and the “<var
class="OPTION">-h</var>” means to halt the system. This is not a very friendly way
to run a multi-user system, but it works just fine on your home computer. A better method
on a multiuser system would be to give everyone a little advance warning:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">shutdown -h +60</kbd>
</pre>
</td>
</tr>
</table>
<p>This would shutdown the system in one hour (60 minutes), which would be just fine on a
normal multiuser system. Vital systems should have their downtime scheduled far in
advance, and you should post warnings about the downtime in any appropriate locations
used for system notifications (email, bulletin board, <tt
class="FILENAME">/etc/motd</tt>, whatever).</p>
<p>Rebooting the system uses the same command, but substitutes “<var
class="OPTION">-r</var>” for “<var class="OPTION">-h</var>”:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">shutdown -r now</kbd>
</pre>
</td>
</tr>
</table>
<p>You can use same time notation with <tt class="COMMAND">shutdown -r</tt> that you
could with <tt class="COMMAND">shutdown -h</tt>. There are a lot of other things that you
can do with <tt class="COMMAND">shutdown</tt> to control when to halt or reboot the
machine; see the man page for more details.</p>
<p>The second way of shutting down or powering off the computer is to use the <tt
class="COMMAND">halt</tt>(8) and <tt class="COMMAND">reboot</tt>(8) commands. As the
names indicate, <tt class="COMMAND">halt</tt> will immediately halt the operating system,
and <tt class="COMMAND">reboot</tt> will reboot the system. (<tt
class="COMMAND">reboot</tt> is actually just a symbolic link to <tt
class="COMMAND">halt</tt>.) They are invoked like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">halt</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">reboot</kbd>
</pre>
</td>
</tr>
</table>
<p>A lower-level way to reboot or shutdown the system is to talk directly to <tt
class="COMMAND">init</tt>. All the other methods are simply convenient ways to talk to
<tt class="COMMAND">init</tt>, but you can directly tell it what to do using <tt
class="COMMAND">telinit</tt>(8) (note that it only has one “l”). Using <tt
class="COMMAND">telinit</tt> will tell <tt class="COMMAND">init</tt> what runlevel to
drop into, which will cause a special script to be run. This script will kill or spawn
processes as needed for that runlevel. This works for rebooting and shutting down because
both of those are special runlevels.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">telinit 0</kbd>
</pre>
</td>
</tr>
</table>
<p>Runlevel 0 is halt mode. Telling <tt class="COMMAND">init</tt> to enter runlevel 0
will cause all processes to be killed off, the filesystems unmounted, and the machine to
be halted. This is a perfectly acceptable way to bring down the system. On many laptops
and modern desktop computers, this will also cause the machine to be turned off.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">telinit 6</kbd>
</pre>
</td>
</tr>
</table>
<p>Runlevel 6 is reboot mode. All processes will be killed off, the filesystems will be
unmounted, and the machine will be rebooted. This is a perfectly acceptable method of
rebooting the system.</p>
<p>For the curious, when switching to runlevel 0 or 6, whether by using <tt
class="COMMAND">shutdown</tt>, <tt class="COMMAND">halt</tt>, or <tt
class="COMMAND">reboot</tt>, the script <tt class="FILENAME">/etc/rc.d/rc.6</tt> is run.
(The script <tt class="FILENAME">/etc/rc.d/rc.0</tt> is another symbolic link, to <tt
class="FILENAME">/etc/rc.d/rc.6</tt>.) You can customize this file to your tastes--but be
sure to test your changes carefully!</p>
<p>There is one last method of rebooting the system. All the other methods require you to
be logged in as <tt class="USERNAME">root</tt>. However, it is possible to reboot the
machine even if you aren't root, provided that you have physical access to the keyboard.
Using <b class="KEYCAP">Control</b>+<b class="KEYCAP">Alt</b>+<b
class="KEYCAP">Delete</b> (the "three-fingered salute") will cause the machine to
immediately reboot. (Behind the scenes, the <tt class="COMMAND">shutdown</tt> command is
called for you when you use <b class="KEYCAP">Control</b>+<b class="KEYCAP">Alt</b>+<b
class="KEYCAP">Delete</b>.) The salute doesn't always work when using X Windows--you may
need to use <b class="KEYCAP">Control</b>+<b class="KEYCAP">Alt</b>+<b
class="KEYCAP">F1</b> (or another Function key) to switch to a non-X Windows terminal
before using it.</p>
<p>Finally, the file that ultimately controls every aspect of startup and shutdown is the
<tt class="FILENAME">/etc/inittab</tt>(5) file. In general, you should not need to modify
this file, but it may give you insight into why some things work the way they do. As
always, see the man pages for further details.</p>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="BASIC-NETWORK-COMMANDS" name="BASIC-NETWORK-COMMANDS"></a>Chapter 13 Basic
Network Commands</h1>
<p>A network consists of several computers connected together. The network can be as
simple as a few computers connected in your home or office, or as complicated as a large
university network or even the entire Internet. When your computer is part of a network,
you have access to those systems either directly or through services like mail and the
web.</p>
<p>There are a variety of networking programs that you can use. Some are handy for
performing diagnostics to see if everything is working properly. Others (like mail
readers and web browsers) are useful for getting your work done and staying in contact
with other people.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BASIC-NETWORK-COMMANDS-PING"
name="BASIC-NETWORK-COMMANDS-PING">13.1 <tt class="COMMAND">ping</tt></a></h2>
<p><tt class="COMMAND">ping</tt>(8) sends an ICMP <var class="LITERAL">ECHO_REQUEST</var>
packet to the specified host. If the host responds, you get an ICMP packet back. Sound
strange? Well, you can “ping” an IP address to see if a machine is alive. If
there is no response, you know something is wrong. Here is an example conversation
between two Linux users:</p>
<a id="AEN4428" name="AEN4428"></a>
<blockquote class="BLOCKQUOTE">
<p class="LITERALLAYOUT"><span class="emphasis"><i class="EMPHASIS">User
A</i></span>: Loki's down again.<br />
<span class="emphasis"><i class="EMPHASIS">User
B</i></span>: Are you sure?<br />
<span class="emphasis"><i class="EMPHASIS">User
A</i></span>: Yeah, I tried pinging it, but there's no response.</p>
</blockquote>
<p>It's instances like these that make <tt class="COMMAND">ping</tt> a very useful
day-to-day command. It provides a very quick way to see if a machine is up and connected
to the network. The basic syntax is:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ping www.slackware.com</kbd>
</pre>
</td>
</tr>
</table>
<p>There are, of course, several options that can be specified. Check the <tt
class="COMMAND">ping</tt>(1) man page for more information.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BASIC-NETWORK-COMMANDS-TRACEROUTE"
name="BASIC-NETWORK-COMMANDS-TRACEROUTE">13.2 <tt
class="COMMAND">traceroute</tt></a></h2>
<p>Slackware's <tt class="COMMAND">traceroute</tt>(8) command is a very useful network
diagnostic tool. <tt class="COMMAND">traceroute</tt> displays each host that a packet
travels through as it tries to reach its destination. You can see how many
“hops” from the Slackware web site you are with this command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">traceroute www.slackware.com</kbd>
</pre>
</td>
</tr>
</table>
<p>Each host will be displayed, along with the response times at each host. Here is an
example output:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">traceroute www.slackware.com</kbd>
traceroute to www.slackware.com (204.216.27.13), 30 hops max, 40 byte packets
1 zuul.tdn (192.168.1.1) 0.409 ms 1.032 ms 0.303 ms
2 207.171.227.254 (207.171.227.254) 18.218 ms 32.873 ms 32.433 ms
3 border-sf-2-0-4.sirius.com (205.134.230.254) 15.662 ms 15.731 ms 16.142 ms
4 pb-nap.crl.net (198.32.128.20) 20.741 ms 23.672 ms 21.378 ms
5 E0-CRL-SFO-03-E0X0.US.CRL.NET (165.113.55.3) 22.293 ms 21.532 ms 21.29 ms
6 T1-CDROM-00-EX.US.CRL.NET (165.113.118.2) 24.544 ms 42.955 ms 58.443 ms
7 www.slackware.com (204.216.27.13) 38.115 ms 53.033 ms 48.328 ms
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">traceroute</tt> is similar to <tt class="COMMAND">ping</tt> in
that it uses ICMP packets. There are several options that you can specify with <tt
class="COMMAND">traceroute</tt>. These options are explained in detail in the man
page.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BASIC-NETWORK-COMMANDS-DNS"
name="BASIC-NETWORK-COMMANDS-DNS">13.3 DNS Tools</a></h2>
<p>Domain Name Service (DNS for short) is that magical protocol that allows your computer
to turn meaningless domain names like www.slackware.com into meaningful IP address like
<tt class="HOSTID">64.57.102.34</tt>. Computers can't route packets to www.slackware.com,
but they can route packets to that domain name's IP address. This gives us a convenient
way to remember machines. Without DNS we'd have to keep a mental database of just what IP
address belongs to what computer, and that's assuming the IP address doesn't change.
Clearly using names for computers is better, but how do we map names to IP addresses?</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN4475" name="AEN4475">13.3.1 <tt
class="COMMAND">host</tt></a></h3>
<p><tt class="COMMAND">host</tt>(1) can do this for us. <tt class="COMMAND">host</tt> is
used to map names to IP addresses. It is a very quick and simple utility without a lot of
functions.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">host www.slackware.com</kbd>
www.slackware.com is an alias for slackware.com.
slackware.com has address 64.57.102.34
</pre>
</td>
</tr>
</table>
<p>But let's say for some reason we want to map an IP address to a domain name; what
then?</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN4487" name="AEN4487">13.3.2 <tt
class="COMMAND">nslookup</tt></a></h3>
<p><tt class="COMMAND">nslookup</tt> is a tried and true program that has weathered the
ages. <tt class="COMMAND">nslookup</tt> has been deprecated and may be removed from
future releases. There is not even a man page for this program.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">nslookup 64.57.102.34</kbd>
Note: nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead. Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
Server: 192.168.1.254
Address: 192.168.1.254#53
Non-authoritative answer:
www.slackware.com canonical name = slackware.com.
Name: slackware.com
Address: 64.57.102.34
</pre>
</td>
</tr>
</table>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN4496" name="AEN4496">13.3.3 <tt
class="COMMAND">dig</tt></a></h3>
<p>The meanest dog in the pound, the domain information groper, <tt
class="COMMAND">dig</tt>(1) for short, is the go-to program for finding DNS information.
<tt class="COMMAND">dig</tt> can grab just about anything from a DNS server including
reverse lookups, A, CNAME, MX, SP, and TXT records. <tt class="COMMAND">dig</tt> has many
command line options and if you're not familiar with it you should read through it's
extensive man page.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">dig @192.168.1.254 www.slackware.com mx</kbd>
; <<>> DiG 9.2.2 <<>> @192.168.1.254 www.slackware.com mx
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26362
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 2
;; QUESTION SECTION:
;www.slackware.com. IN MX
;; ANSWER SECTION:
www.slackware.com. 76634 IN CNAME slackware.com.
slackware.com. 86400 IN MX 1 mail.slackware.com.
;; AUTHORITY SECTION:
slackware.com. 86400 IN NS ns1.cwo.com.
slackware.com. 86400 IN NS ns2.cwo.com.
;; ADDITIONAL SECTION:
ns1.cwo.com. 163033 IN A 64.57.100.2
ns2.cwo.com. 163033 IN A 64.57.100.3
;; Query time: 149 msec
;; SERVER: 192.168.1.254#53(192.168.1.254)
;; WHEN: Sat Nov 6 16:59:31 2004
;; MSG SIZE rcvd: 159
</pre>
</td>
</tr>
</table>
<p>This should give you an idea how <tt class="COMMAND">dig</tt> works.
“@192.168.1.254” specifies the dns server to use.
“www.slackware.com” is the domain name I am performing a lookup on, and
“mx” is the type of lookup I am performing. The above query tells me that
e-mail to <tt class="HOSTID">www.slackware.com</tt> will instead be sent to <tt
class="HOSTID">mail.slackware.com</tt> for delivery.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BASIC-NETWORK-COMMANDS-FINGER"
name="BASIC-NETWORK-COMMANDS-FINGER">13.4 <tt class="COMMAND">finger</tt></a></h2>
<p><tt class="COMMAND">finger</tt>(1) will retrieve information about the specified user.
You give finger a username or an email address and it will try to contact the necessary
server and retrieve the username, office, telephone number, and other pieces of
information. Here is an example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">finger johnc@idsoftware.com</kbd>
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">finger</tt> can return the username, mail status, phone numbers,
and files referred to as “dot plan” and “dot project”. Of course,
the information returned varies with each <tt class="COMMAND">finger</tt> server. The one
included with Slackware returns the following information by default:</p>
<ul>
<li>
<p>Username</p>
</li>
<li>
<p>Room number</p>
</li>
<li>
<p>Home phone number</p>
</li>
<li>
<p>Work phone number</p>
</li>
<li>
<p>Login status</p>
</li>
<li>
<p>Email status</p>
</li>
<li>
<p>Contents of the <tt class="FILENAME">.plan</tt> file in the user's home directory</p>
</li>
<li>
<p>Contents of the <tt class="FILENAME">.project</tt> file in the user's home
directory</p>
</li>
</ul>
<p>The first four items can be set with the <tt class="COMMAND">chfn</tt> command. It
stores those values in the <tt class="FILENAME">/etc/passwd</tt> file. To change the
information in your <tt class="FILENAME">.plan</tt> or <tt class="FILENAME">.project</tt>
file, just edit them with your favorite text editor. They must reside in your home
directory and must be called <tt class="FILENAME">.plan</tt> and <tt
class="FILENAME">.project</tt>.</p>
<p>Many users <tt class="COMMAND">finger</tt> their own account from a remote machine to
quickly see if they have new email. Or, you can see a user's plan or current project.</p>
<p>Like many commands, <tt class="COMMAND">finger</tt> has options. Check the man page
for more information on what special options you can use.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BASIC-NETWORK-COMMANDS-TELNET"
name="BASIC-NETWORK-COMMANDS-TELNET">13.5 <tt class="COMMAND">telnet</tt></a></h2>
<p>Someone once stated that <tt class="COMMAND">telnet</tt>(1) was the coolest thing he
had ever seen on computers. The ability to remotely log in and do stuff on another
computer is what separates Unix and Unix-like operating systems from other operating
systems.</p>
<p><tt class="COMMAND">telnet</tt> allows you to log in to a computer, just as if you
were sitting at the terminal. Once your username and password are verified, you are given
a shell prompt. From here, you can do anything requiring a text console. Compose email,
read newsgroups, move files around, and so on. If you are running X and you <tt
class="COMMAND">telnet</tt> to another machine, you can run X programs on the remote
computer and display them on yours.</p>
<p>To login to a remote machine, use this syntax:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">telnet <<var
class="REPLACEABLE">hostname</var>></kbd>
</pre>
</td>
</tr>
</table>
<p>If the host responds, you will receive a login prompt. Give it your username and
password. That's it. You are now at a shell. To quit your telnet session, use either the
<tt class="COMMAND">exit</tt> command or the <tt class="COMMAND">logout</tt> command.</p>
<div class="WARNING">
<table class="WARNING" width="100%" border="0">
<tr>
<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/warning.png"
hspace="5" alt="Warning" /></td>
<td align="LEFT" valign="TOP">
<p><tt class="COMMAND">telnet</tt> does not encrypt the information it sends. Everything
is sent in plain text, even passwords. It is not advisable to use <tt
class="COMMAND">telnet</tt> over the Internet. Instead, consider the <tt
class="COMMAND">Secure Shell</tt>. It encrypts all traffic and is available for free.</p>
</td>
</tr>
</table>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN4593" name="AEN4593">13.5.1 The other use of telnet</a></h3>
<p>Now that we have convinced you not to use the telnet protocol anymore to log into a
remote machine, we'll show you a couple of useful ways to use <tt
class="COMMAND">telnet</tt>.</p>
<p>You can also use the <tt class="COMMAND">telnet</tt> command to connect to a host on a
certain port.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">telnet <<var
class="REPLACEABLE">hostname</var>> [port]</kbd>
</pre>
</td>
</tr>
</table>
<p>This can be quite handy when you quickly need to test a certain service, and you need
full control over the commands, and you need to see what exactly is going on. You can
interactively test or use an SMTP server, a POP3 server, an HTTP server, etc. this
way.</p>
<p>In the next figure you'll see how you can <tt class="COMMAND">telnet</tt> to a HTTP
server on port 80, and get some basic information from it.</p>
<div class="FIGURE"><a id="FIG-BASIC-NETWORK-COMMANDS-TELNET-WEB"
name="FIG-BASIC-NETWORK-COMMANDS-TELNET-WEB"></a>
<p><b>Figure 13-1. Telnetting to a webserver</b></p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">telnet store.slackware.com 80</kbd>
Trying 69.50.233.153...
Connected to store.slackware.com.
Escape character is '^]'.
HEAD / HTTP/1.0
HTTP/1.1 200 OK
Date: Mon, 25 Apr 2005 20:47:01 GMT
Server: Apache/1.3.33 (Unix) mod_ssl/2.8.22 OpenSSL/0.9.7d
Last-Modified: Fri, 18 Apr 2003 10:58:54 GMT
ETag: "193424-c0-3e9fda6e"
Accept-Ranges: bytes
Content-Length: 192
Connection: close
Content-Type: text/html
Connection closed by foreign host.
<samp class="PROMPT">%</samp>
</pre>
</td>
</tr>
</table>
</div>
<p>You can do the same for other plain-text protocols, as long as you know what port to
connect to, and what the commands are.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BASIC-NETWORK-COMMANDS-SSH"
name="BASIC-NETWORK-COMMANDS-SSH">13.6 The Secure shell</a></h2>
<p>Today, secure shell basks in the adoration that <tt class="COMMAND">telnet</tt> once
enjoyed. <tt class="COMMAND">ssh</tt>(1) allows one to make a connection to a remote
machine and execute programs as if one were physically present; however, <tt
class="COMMAND">ssh</tt> encrypts all the data travelling between the two computers so
even if others intercept the conversation, they are unable to understand it. A typical
secure shell connection follows.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">ssh carrier.lizella.net -l alan</kbd>
The authenticity of host 'carrier.lizella.net (192.168.1.253)' can't be
established.
RSA key fingerprint is 0b:e2:5d:43:4c:39:4f:8c:b9:85:db:b2:fa:25:e9:9d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'carrier.lizella.net' (RSA) to the list of
known hosts.
Password: <kbd class="USERINPUT">password</kbd>
Last login: Sat Nov 6 16:32:19 2004 from 192.168.1.102
Linux 2.4.26-smp.
alan@carrier:~$ <kbd class="USERINPUT">ls -l MANIFEST</kbd>
-rw-r--r-- 1 alan users 23545276 2004-10-28 20:04 MANIFEST
alan@carrier:~$ <kbd class="USERINPUT">exit</kbd>
logout
Connection to carrier.lizella.net closed.
</pre>
</td>
</tr>
</table>
<p>There you see me making an ssh connection to <tt
class="HOSTID">carrier.lizella.net</tt>, and checking the permissions on the <tt
class="FILENAME">MANIFEST</tt> file.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BASIC-NETWORK-COMMANDS-EMAIL"
name="BASIC-NETWORK-COMMANDS-EMAIL">13.7 email</a></h2>
<p>Electronic mail is one of the most popular things one can do on the Internet. In 1998,
it was reported that more electronic mail was sent than regular mail. It is indeed common
and useful.</p>
<p>Under Slackware, we provide a standard mail server, and several mail clients. All of
the clients discussed below are text-based. A lot of Windows users may be against this,
but you will find that a text based client is very convenient, especially when checking
mail remotely. Fear not, there are many graphical e-mail clients such as KDE's Kmail. If
you wish to use one of those check its help menu.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="BASIC-NETWORK-COMMANDS-EMAIL-PINE"
name="BASIC-NETWORK-COMMANDS-EMAIL-PINE">13.7.1 <tt class="COMMAND">pine</tt></a></h3>
<p><tt class="COMMAND">pine</tt>(1) is not <tt class="COMMAND">elm</tt>. Or so the saying
goes. The University of Washington created their program for Internet news and email out
of a need for an easy mail reader for their students. <tt class="COMMAND">pine</tt> is
one of the most popular email clients in use today and is available for nearly every
flavor of Unix and even Windows.</p>
<div class="FIGURE"><a id="FIG-BASIC-NETWORK-COMMANDS-EMAIL-PINE"
name="FIG-BASIC-NETWORK-COMMANDS-EMAIL-PINE"></a>
<p><b>Figure 13-2. The Pine main menu</b></p>
<p><img src="basic-network-commands/pine.png" /></p>
</div>
<p>You will see a menu of commands and a row of command keys at the bottom. <tt
class="COMMAND">pine</tt> is indeed a complex program, so we will not discuss every
feature about it here.</p>
<p>To see what's in your inbox, type <kbd class="USERINPUT">i</kbd>. Your messages are
listed with their date, author, and subject. Highlight the message you want and press
<kbd class="USERINPUT">enter</kbd> to view it. Pressing <kbd class="USERINPUT">r</kbd>
will start a reply to the message. Once you have written the response, type <b
class="KEYCAP">Ctrl</b>+<b class="KEYCAP">X</b> to send it. You can press <kbd
class="USERINPUT">i</kbd> to get back to the message listing.</p>
<p>If you want to delete a message, press <kbd class="USERINPUT">d</kbd>. It will mark
the highlighted message for deletion. <tt class="COMMAND">pine</tt> deletes the mail when
you exit the program. <tt class="COMMAND">pine</tt> also lets you store your mail in
folders. You can get a listing of folders by pressing <kbd class="USERINPUT">l</kbd>. At
the message listing, press <kbd class="USERINPUT">s</kbd> to save it to another folder.
It will ask for the folder name to write the message to.</p>
<p><tt class="COMMAND">pine</tt> offers many, many features; you should definitely have a
look at the man page for more information. It will contain the latest information about
the program.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="BASIC-NETWORK-COMMANDS-EMAIL-ELM"
name="BASIC-NETWORK-COMMANDS-EMAIL-ELM">13.7.2 <tt class="COMMAND">elm</tt></a></h3>
<p><tt class="COMMAND">elm</tt>(1) is another popular text-based email client. Though not
quite as user friendly as <tt class="COMMAND">pine</tt>, it's definitely been around a
lot longer.</p>
<div class="FIGURE"><a id="FIG-BASIC-NETWORK-COMMANDS-EMAIL-ELM"
name="FIG-BASIC-NETWORK-COMMANDS-EMAIL-ELM"></a>
<p><b>Figure 13-3. Elm main screen</b></p>
<p><img src="basic-network-commands/elm.png" /></p>
</div>
<p>By default, you are placed in your inbox. The messages are listed with the message
number, date, sender, and subject. Use the arrow keys to highlight the message you want.
Press <kbd class="USERINPUT">Enter</kbd> to read the message.</p>
<p>To compose a new message, type <kbd class="USERINPUT">m</kbd> at the main screen. The
<kbd class="USERINPUT">d</kbd> key will flag a message for deletion. And the <kbd
class="USERINPUT">r</kbd> key will reply to the current message you are reading. All of
these keys are displayed at the bottom of the screen with a prompt.</p>
<p>The man page discusses <tt class="COMMAND">elm</tt> in more detail, so you will
probably want to consult that before using <tt class="COMMAND">elm</tt>.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="BASIC-NETWORK-COMMANDS-EMAIL-MUTT"
name="BASIC-NETWORK-COMMANDS-EMAIL-MUTT">13.7.3 <tt class="COMMAND">mutt</tt></a></h3>
<p>“All mail clients suck. This one just sucks less.” <tt
class="COMMAND">mutt</tt>'s original interface was based on <tt class="COMMAND">elm</tt>
with added features found in other popular mailclients, resulting in a hybrid mutt.</p>
<p>Some of <tt class="COMMAND">mutt</tt>'s features include:</p>
<ul>
<li>
<p>color support</p>
</li>
<li>
<p>message threading</p>
</li>
<li>
<p>MIME and PGP/MIME support</p>
</li>
<li>
<p>pop3 and imap support</p>
</li>
<li>
<p>support for multiple mailbox formats (mbox, MMDF, MH, maildir)</p>
</li>
<li>
<p><span class="emphasis"><i class="EMPHASIS">highly</i></span> customizable</p>
</li>
</ul>
<div class="FIGURE"><a id="FIG-BASIC-NETWORK-COMMANDS-EMAIL-MUTT"
name="FIG-BASIC-NETWORK-COMMANDS-EMAIL-MUTT"></a>
<p><b>Figure 13-4. Mutt main screen</b></p>
<p><img src="basic-network-commands/mutt.png" /></p>
</div>
<p>if you're looking for a mail client that will let you be in total control over
everything, then you will like <tt class="COMMAND">mutt</tt>. all the default settings
can be customized, keybindings can be changed. if you like to add a macro, you can.</p>
<p>you probably want to take a look at the <tt class="FILENAME">muttrc</tt> manpage,
which will tell you how to configure everything. or take a look at the included example
<tt class="FILENAME">muttrc</tt> file.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="BASIC-NETWORK-COMMANDS-EMAIL-NAIL"
name="BASIC-NETWORK-COMMANDS-EMAIL-NAIL">13.7.4 <tt class="COMMAND">nail</tt></a></h3>
<p><tt class="COMMAND">nail</tt>(1) is a command line driven mail client. It is very
primitive and offers pretty much nothing in the way of user interfaces. However, mailx is
handy for times when you need to quickly mail something, scripting a bulk mailer, testing
your MTA installation or something similar. Note that Slackware creates symbolic links to
<tt class="COMMAND">nail</tt> at <tt class="FILENAME">/usr/bin/mail</tt> and <tt
class="FILENAME">/usr/bin/mailx</tt>. Any of these three commands executes the same
program. In fact, you will most likely see <tt class="COMMAND">nail</tt> referred to as
<tt class="COMMAND">mail</tt>.</p>
<p>The basic command line is:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">mailx <subject> <to-addr></kbd>
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">mailx</tt> reads the message body from standard input. So you can
cat a file into this command to mail it, or you can just type text and hit <b
class="KEYCAP">Ctrl</b>+<b class="KEYCAP">D</b> when finished with the message.</p>
<p>Here is an example of mailing a program source file to another person.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">cat randomfunc.c | mail -s "Here's that function" asdf@example.net</kbd>
</pre>
</td>
</tr>
</table>
<p>The man page explains more of what <tt class="COMMAND">nail</tt> can do, so you will
probably want to have a look at that before using it.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BASIC-NETWORK-COMMANDS-WEB"
name="BASIC-NETWORK-COMMANDS-WEB">13.8 Browsers</a></h2>
<p>The first thing that people think about when they hear the word Internet is
“surfing the net”. Or looking at websites using a web browser. This is
probably by far the most popular use of the Internet for the average user.</p>
<p>Slackware provides popular graphical web browsers in the “XAP” series, as
well as text mode browsers in the “N” series. We'll take a quick look at some
of the most common options below.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN4776" name="AEN4776">13.8.1 <tt
class="COMMAND">lynx</tt></a></h3>
<p><tt class="COMMAND">lynx</tt>(1) is a text-based web browser. It is a very quick way
of looking up something on the Internet. Sometimes graphics just get in the way if you
know exactly what you're after.</p>
<p>To start <tt class="COMMAND">lynx</tt>, just type <tt class="COMMAND">lynx</tt> at the
prompt:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">lynx</kbd>
</pre>
</td>
</tr>
</table>
<div class="FIGURE"><a id="FIG-BASIC-NETWORK-COMMANDS-WEB-LYNX"
name="FIG-BASIC-NETWORK-COMMANDS-WEB-LYNX"></a>
<p><b>Figure 13-5. Lynx default start page</b></p>
<p><img src="basic-network-commands/lynx.png" /></p>
</div>
<p>You may want to specify a site for <tt class="COMMAND">lynx</tt> to open to:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">lynx http://www.slackware.com</kbd>
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">lynx</tt> prints the command keys and what they do at the bottom
of the screen. The up and down arrow keys move around the document, <kbd
class="USERINPUT">Enter</kbd> selects the highlighted link, and the <kbd
class="USERINPUT">left arrow</kbd> goes back to the previous page. Typing <kbd
class="USERINPUT">d</kbd> will download the currently selected file. The <kbd
class="USERINPUT">g</kbd> command brings up the Go prompt, where you can give <tt
class="COMMAND">lynx</tt> a URL to open.</p>
<p>There are many other commands in <tt class="COMMAND">lynx</tt>. You can either consult
the man page, or type <kbd class="USERINPUT">h</kbd> to get the help screen for more
information.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN4813" name="AEN4813">13.8.2 <tt
class="COMMAND">links</tt></a></h3>
<p>Just like <tt class="COMMAND">lynx</tt>, <tt class="COMMAND">links</tt> is a textmode
web browser, where you do all the navigation using the keyboard. However, when you press
the <kbd class="USERINPUT">Esc</kbd> key, it will activate a very convenient pulldown
menu on the top of the screen. This makes it very easy to use, without having to learn
all the keyboard shortcuts. People who do not use a text browser every day will
appreciate this feature.</p>
<p><tt class="COMMAND">links</tt> seems to have better support for both frames and
tables, when compared to <tt class="COMMAND">lynx</tt>.</p>
<div class="FIGURE"><a id="FIG-BASIC-NETWORK-COMMANDS-WEB-LINKS"
name="FIG-BASIC-NETWORK-COMMANDS-WEB-LINKS"></a>
<p><b>Figure 13-6. Links, with the file menu open</b></p>
<p><img src="basic-network-commands/links.png" /></p>
</div>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN4831" name="AEN4831">13.8.3 <tt
class="COMMAND">wget</tt></a></h3>
<p><tt class="COMMAND">wget</tt>(1) is a command line utility that will download files
from a specified URL. While not an actual web-browser, <tt class="COMMAND">wget</tt> is
used primarily to grab whole or partial web sites for offline viewing, or for fast
download of single files from HTTP or FTP servers instead. The basic syntax is:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">wget <url></kbd>
</pre>
</td>
</tr>
</table>
<p>You can also pass options. For example, this will download the Slackware web site:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">wget --recursive http://www.slackware.com</kbd>
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">wget</tt> will create a <tt
class="FILENAME">www.slackware.com</tt> directory and store the files in there, just as
the site does.</p>
<p><tt class="COMMAND">wget</tt> can also download files from FTP sites; just specify an
FTP URL instead of an HTTP one.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">wget ftp://ftp.gnu.org/gnu/wget/wget-1.8.2.tar.gz</kbd>
--12:18:16-- ftp://ftp.gnu.org/gnu/wget/wget-1.8.2.tar.gz
=> `wget-1.8.2.tar.gz'
Resolving ftp.gnu.org... done.
Connecting to ftp.gnu.org[199.232.41.7]:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD /gnu/wget ... done.
==> PORT ... done. ==> RETR wget-1.8.2.tar.gz ... done.
Length: 1,154,648 (unauthoritative)
100%[==================================>] 1,154,648 209.55K/s ETA 00:00
12:18:23 (209.55KB/s) - `wget-1.8.2.tar.gz' saved [1154648]
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">wget</tt> has many more options, which make it nice for site
specific scripts (web site mirroring and so forth). The man page should be consulted for
more information.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BASIC-NETWORK-COMMANDS-FTP"
name="BASIC-NETWORK-COMMANDS-FTP">13.9 FTP Clients</a></h2>
<p>FTP stands for the File Transfer Protocol. It allows you to send and receive files
between two computers. There is the FTP server and the FTP client. We discuss the client
in this section.</p>
<p>For the curious, the “client” is you. The “server” is the
computer that answers your FTP request and lets you login. You will download files from
and upload files to the server. The client cannot accept FTP connections, it can only
connect to servers.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN4871" name="AEN4871">13.9.1 <tt
class="COMMAND">ftp</tt></a></h3>
<p>To connect to an FTP server, simply run the <tt class="COMMAND">ftp</tt>(1) command
and specify the host:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ftp <hostname> [port]</kbd>
</pre>
</td>
</tr>
</table>
<p>If the host is running an FTP server, it will ask for a username and password. You can
log in as yourself or as “anonymous”. Anonymous FTP sites are very popular
for software archives. For example, to get Slackware Linux via FTP, you must use
anonymous FTP.</p>
<p>Once connected, you will be at the <var class="LITERAL">ftp></var> prompt. There
are special commands for FTP, but they are similar to other standard commands. The
following shows some of the basic commands and what they do:</p>
<div class="TABLE"><a id="AEN4883" name="AEN4883"></a>
<p><b>Table 13-1. <tt class="COMMAND">ftp</tt> commands</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col width="1*" />
<col width="3*" />
<thead>
<tr>
<th>Command</th>
<th>Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td><tt class="COMMAND">ls</tt></td>
<td>List files</td>
</tr>
<tr>
<td><tt class="COMMAND">cd <dirname></tt></td>
<td>Change directory</td>
</tr>
<tr>
<td><tt class="COMMAND">bin</tt></td>
<td>Set binary transfer mode</td>
</tr>
<tr>
<td><tt class="COMMAND">ascii</tt></td>
<td>Set ASCII transfer mode</td>
</tr>
<tr>
<td><tt class="COMMAND">get <filename></tt></td>
<td>Download a file</td>
</tr>
<tr>
<td><tt class="COMMAND">put <filename></tt></td>
<td>Upload a file</td>
</tr>
<tr>
<td><tt class="COMMAND">hash</tt></td>
<td>Toggle hash mark stats indicator</td>
</tr>
<tr>
<td><tt class="COMMAND">tick</tt></td>
<td>Toggle byte counter indicator</td>
</tr>
<tr>
<td><tt class="COMMAND">prom</tt></td>
<td>Toggle interactive mode for downloads</td>
</tr>
<tr>
<td><tt class="COMMAND">mget <mask></tt></td>
<td>Download a file or group of files; wildcards are allowed</td>
</tr>
<tr>
<td><tt class="COMMAND">mput <mask></tt></td>
<td>Upload a file or group of files; wildcards are allowed</td>
</tr>
<tr>
<td><tt class="COMMAND">quit</tt></td>
<td>Log off the FTP server</td>
</tr>
</tbody>
</table>
</div>
<p>You can also use some of the following commands which are quite self-explanatory: <tt
class="COMMAND">chmod</tt>, <tt class="COMMAND">delete</tt>, <tt
class="COMMAND">rename</tt>, <tt class="COMMAND">rmdir</tt>. For a complete list of all
commands and their meaning, just type <kbd class="USERINPUT">help</kbd> or <kbd
class="USERINPUT">?</kbd> and you'll see a complete listing on screen.</p>
<p>FTP is a fairly simple program to use, but lacks the user interface that many of us
are used to nowadays. The man page discusses some of the command line options for <tt
class="COMMAND">ftp</tt>(1).</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
ftp> <kbd class="USERINPUT">ls *.TXT</kbd>
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
-rw-r--r-- 1 root 100 18606 Apr 6 2002 BOOTING.TXT
-rw-r--r-- 1 root 100 10518 Jun 13 2002 COPYRIGHT.TXT
-rw-r--r-- 1 root 100 602 Apr 6 2002 CRYPTO_NOTICE.TXT
-rw-r--r-- 1 root 100 32431 Sep 29 02:56 FAQ.TXT
-rw-r--r-- 1 root 100 499784 Mar 3 19:29 FILELIST.TXT
-rw-r--r-- 1 root 100 241099 Mar 3 19:12 PACKAGES.TXT
-rw-r--r-- 1 root 100 12339 Jun 19 2002 README81.TXT
-rw-r--r-- 1 root 100 14826 Jun 17 2002 SPEAKUP_DOCS.TXT
-rw-r--r-- 1 root 100 15434 Jun 17 2002 SPEAK_INSTALL.TXT
-rw-r--r-- 1 root 100 2876 Jun 17 2002 UPGRADE.TXT
226 Transfer complete.
ftp> <kbd class="USERINPUT">tick</kbd>
Tick counter printing on (10240 bytes/tick increment).
ftp> <kbd class="USERINPUT">get README81.TXT</kbd>
local: README81.TXT remote: README81.TXT
200 PORT command successful.
150 Opening BINARY mode data connection for README81.TXT (12339 bytes).
Bytes transferred: 12339
226 Transfer complete.
12339 bytes received in 0.208 secs (58 Kbytes/sec)
</pre>
</td>
</tr>
</table>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="BASIC-NETWORK-COMMANDS-FTP-NCFTP"
name="BASIC-NETWORK-COMMANDS-FTP-NCFTP">13.9.2 <tt class="COMMAND">ncftp</tt></a></h3>
<p><tt class="COMMAND">ncftp</tt>(1) (pronounced "Nik-F-T-P") is an alternative to the
traditional ftp client that comes with Slackware. It is still a text-based program, but
offers many advantages over <tt class="COMMAND">ftp</tt>, including:</p>
<ul>
<li>
<p>Tab completion</p>
</li>
<li>
<p>Bookmarks file</p>
</li>
<li>
<p>More liberal wildcard uses</p>
</li>
<li>
<p>Command history</p>
</li>
</ul>
<p>By default, <tt class="COMMAND">ncftp</tt> will try to log in anonymously to the
server you specify. You can force <tt class="COMMAND">ncftp</tt> to present a login
prompt with the “<var class="OPTION">-u</var>” option. Once logged in, you
can use the same commands as in <tt class="COMMAND">ftp</tt>, only you'll notice a nicer
interface, one that works more like <tt class="COMMAND">bash</tt>.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
ncftp /pub/linux/slackware > <kbd class="USERINPUT">cd slackware-current/</kbd>
Please read the file README81.TXT
it was last modified on Wed Jun 19 16:24:21 2002 - 258 days ago
CWD command successful.
ncftp ...ware/slackware-current > <kbd class="USERINPUT">ls</kbd>
BOOTING.TXT FAQ.TXT bootdisks/
CHECKSUMS FILELIST.TXT extra/
CHECKSUMS.asc GPG-KEY isolinux/
CHECKSUMS.md5 PACKAGES.TXT kernels/
CHECKSUMS.md5.asc PRERELEASE_NOTES pasture/
COPYING README81.TXT rootdisks/
COPYRIGHT.TXT SPEEKUP_DOCS.TXT slackware/
CRYPTO_NOTICE.TXT SPEEK_INSTALL.TXT source/
CURRENT.WARNING Slackware-HOWTO
ChangeLog.txt UPGRADE.TXT
ncftp ...ware/slackware-current > <kbd class="USERINPUT">get README81.TXT</kbd>
README81.TXT: 12.29 kB 307.07 kB/s
</pre>
</td>
</tr>
</table>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="BASIC-NETWORK-COMMANDS-TALK"
name="BASIC-NETWORK-COMMANDS-TALK">13.10 Talking to Other People</a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="AEN4989" name="AEN4989">13.10.1 <tt
class="COMMAND">wall</tt></a></h3>
<p><tt class="COMMAND">wall</tt>(1) is a quick way to write a message to the users on a
system. The basic syntax is:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">wall [file]</kbd>
</pre>
</td>
</tr>
</table>
<p>This will result in the contents of [file] being displayed on the terminals of all
currently logged in users. If you don't specify a file, wall will read from standard
input, so you can just type your message, and end with <b class="KEYCAP">Ctrl</b>+<b
class="KEYCAP">d</b>.</p>
<p><tt class="COMMAND">wall</tt> doesn't have many features, and apart from letting your
users know that you're about to do some serious maintenance to the system, or even reboot
it, so they have time to save their work and log off :)</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN5006" name="AEN5006">13.10.2 <tt
class="COMMAND">talk</tt></a></h3>
<p><tt class="COMMAND">talk</tt>(1) allows two users to chat. It splits the screen in
half, horizontally. To request a chat with another user, use this command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">talk <person> [ttyname]</kbd>
</pre>
</td>
</tr>
</table>
<div class="FIGURE"><a id="FIG-BASIC-NETWORK-COMMANDS-TALK-TALK"
name="FIG-BASIC-NETWORK-COMMANDS-TALK-TALK"></a>
<p><b>Figure 13-7. Two users in a <tt class="COMMAND">talk</tt> session</b></p>
<p><img src="basic-network-commands/talk.png" /></p>
</div>
<p>If you specify just a username, the chat request is assumed to be local, so only local
users are queried. The ttyname is required if you want to ring a user on a specific
terminal (if the user is logged in more than once). The required information for <tt
class="COMMAND">talk</tt> can be obtained from the <tt class="COMMAND">w</tt>(1)
command.</p>
<p><tt class="COMMAND">talk</tt> can also ring users on remote hosts. For the username
you simply specify an email address. <tt class="COMMAND">talk</tt> will try to contact
that remote user on that host.</p>
<p><tt class="COMMAND">talk</tt> is somewhat limited. It only supports two users and is
half-duplex.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN5033" name="AEN5033">13.10.3 <tt
class="COMMAND">ytalk</tt></a></h3>
<p><tt class="COMMAND">ytalk</tt>(1) is a backwards compatible replacement for <tt
class="COMMAND">talk</tt>. It comes with Slackware as the <tt class="COMMAND">ytalk</tt>
command. The syntax is similar, but has a few differences:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">ytalk <username>[#ttyname]</kbd>
</pre>
</td>
</tr>
</table>
<div class="FIGURE"><a id="FIG-BASIC-NETWORK-COMMANDS-TALK-YTALK"
name="FIG-BASIC-NETWORK-COMMANDS-TALK-YTALK"></a>
<p><b>Figure 13-8. Two users in a <tt class="COMMAND">ytalk</tt> session</b></p>
<p><img src="basic-network-commands/ytalk.png" /></p>
</div>
<p>The username and terminal are specified the same as under talk, except you must put
them together with the hash mark (#).</p>
<p>ytalk offers several advantages:</p>
<ul>
<li>
<p>It supports more than two users.</p>
</li>
<li>
<p>A menu of options that can be brought up anytime with <kbd
class="USERINPUT">Esc</kbd>.</p>
</li>
<li>
<p>You can shell out while still in the talk session.</p>
</li>
<li>
<p>Plus more...</p>
</li>
</ul>
<p>If you're a server administrator, you'll want to make sure that the <tt
class="COMMAND">ntalk</tt> port is enabled in <tt class="FILENAME">/etc/inetd.conf</tt>.
<tt class="COMMAND">ytalk</tt> needs that to work properly.</p>
</div>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="SECURITY" name="SECURITY"></a>Chapter 14 Security</h1>
<p>Security on any system is important; it can prevent people launching attacks from your
machine, as well as protect sensitive data. This chapter is all about how to start
securing your Slackware box against script kiddies, crackers and rogue hamsters alike.
Bear in mind that this is only the start of securing a system; security is a process, not
a state.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="SECURITY-DISABLE" name="SECURITY-DISABLE">14.1 Disabling
Services</a></h2>
<p>The first step after installing Slackware should be to disable any services you don't
need. Any services could potentially pose a security risk, so it is important to run as
few services as possible (i.e. only those that are needed). Services are started from two
main places - <tt class="COMMAND">inetd</tt> and init scripts.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN5081" name="AEN5081">14.1.1 Services started from <tt
class="COMMAND">inetd</tt></a></h3>
<p>A lot of the daemons that come with Slackware are run from <tt
class="COMMAND">inetd</tt>(8). <tt class="COMMAND">inetd</tt> is a daemon that listens on
all of the ports used by services configured to be started by it and spawns an instance
of the relevant daemon when a connection attempt is made. Daemons started from <tt
class="COMMAND">inetd</tt> can be disabled by commenting out the relevant lines in <tt
class="FILENAME">/etc/inetd.conf</tt>. To do this, open this file in your favorite editor
(e.g. <tt class="COMMAND">vi</tt>) and you should see lines similar to this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd
</pre>
</td>
</tr>
</table>
<p>You can disable this service, and any others you don't need, by commenting them out
(i.e. adding a <var class="LITERAL">#</var> (hash) symbol to the beginning of the line).
The above line would then become:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
#telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd
</pre>
</td>
</tr>
</table>
<p>After <tt class="COMMAND">inetd</tt> has been restarted, this service will be
disabled. You can restart <tt class="COMMAND">inetd</tt> with the command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">kill -HUP $(cat /var/run/inetd.pid)</kbd>
</pre>
</td>
</tr>
</table>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="AEN5102" name="AEN5102">14.1.2 Services started from init
scripts</a></h3>
<p>The rest of the services started when the machine starts are started from the init
scripts in <tt class="FILENAME">/etc/rc.d/</tt>. These can be disabled in two different
ways, the first being to remove the execute permissions on the relevant init script and
the second being to comment out the relevant lines in the init scripts.</p>
<p>For example, SSH is started by its own init script at <tt
class="FILENAME">/etc/rc.d/rc.sshd</tt>. You can disable this using:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">chmod -x /etc/rc.d/rc.sshd</kbd>
</pre>
</td>
</tr>
</table>
<p>For services that don't have their own init script, you will need to comment out the
relevant lines in the init scripts to disable them. For example, the portmap daemon is
started by the following lines in <tt class="FILENAME">/etc/rc.d/rc.inet2</tt>:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# This must be running in order to mount NFS volumes.
# Start the RPC portmapper:
if [ -x /sbin/rpc.portmap ]; then
echo "Starting RPC portmapper: /sbin/rpc.portmap"
/sbin/rpc.portmap
fi
# Done starting the RPC portmapper.
</pre>
</td>
</tr>
</table>
<p>This can be disabled by adding <var class="LITERAL">#</var> symbols to the beginnings
of the lines that don't already start with them, like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# This must be running in order to mount NFS volumes.
# Start the RPC portmapper:
#if [ -x /sbin/rpc.portmap ]; then
# echo "Starting RPC portmapper: /sbin/rpc.portmap"
# /sbin/rpc.portmap
#fi
# Done starting the RPC portmapper.
</pre>
</td>
</tr>
</table>
<p>These changes will only take effect after either a reboot or changing from and back to
runlevel 3 or 4. You can do this by typing the following on the console (you will need to
log in again after changing to runlevel 1):</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">telinit 1</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">telinit 3</kbd>
</pre>
</td>
</tr>
</table>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="SECURITY-HOST" name="SECURITY-HOST">14.2 Host Access
Control</a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="SECURITY-HOST-IPTABLES" name="SECURITY-HOST-IPTABLES">14.2.1 <tt
class="COMMAND">iptables</tt></a></h3>
<p><tt class="COMMAND">iptables</tt> is the packet filtering configuration program for
Linux 2.4 and above. The 2.4 kernel (2.4.5, to be exact) was first introduced into
Slackware (as an option) in version 8.0 and was made the default in Slackware 8.1. This
section only covers the basics of its usage and you should check <a
href="http://www.netfilter.org/" target="_top">http://www.netfilter.org/</a> for more
details. These commands can be entered into <tt
class="FILENAME">/etc/rc.d/rc.firewall</tt>, which has to be set as executable for these
rules to take effect at startup. Note that incorrect <tt class="COMMAND">iptables</tt>
commands can essentially lock you out of your own machine. Unless you are 100% confident
in your skills, always ensure you have local access to the machine.</p>
<p>The first thing most people should do is set the default policy for each inbound chain
to DROP:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">iptables -P INPUT DROP</kbd>
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">iptables -P FORWARD DROP</kbd>
</pre>
</td>
</tr>
</table>
<p>When everything is denied, you can start allowing things. The first thing to allow is
any traffic for sessions which are already established:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</kbd>
</pre>
</td>
</tr>
</table>
<p>So as not to break any applications that communicate using the loopback address, it is
usually wise to add a rule like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">iptables -A INPUT -s 127.0.0.0/8 -d 127.0.0.0/8 -i lo -j ACCEPT</kbd>
</pre>
</td>
</tr>
</table>
<p>This rules allows any traffic to and from 127.0.0.0/8 (127.0.0.0 - 127.255.255.255) on
the loopback (<tt class="FILENAME">lo</tt>) interface. When creating rules, it is a good
idea to be as specific as possible, to make sure that your rules do not inadvertently
allow anything evil. That said, rules that allow too little mean more rules and more
typing.</p>
<p>The next thing to do would be to allow access to specific services running on your
machine. If, for example, you wanted to run a web server on your machine, you would use a
rule similar to this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">iptables -A INPUT -p tcp --dport 80 -i ppp0 -j ACCEPT</kbd>
</pre>
</td>
</tr>
</table>
<p>This will allow access from any machine to port 80 on your machine via the <tt
class="FILENAME">ppp0</tt> interface. You may want to restrict access to this service so
that only certain machines can access it. This rule allows access to your web service
from <tt class="HOSTID">64.57.102.34</tt>:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">iptables -A INPUT -p tcp -s 64.57.102.34 --dport 80 -i ppp0 -j ACCEPT</kbd>
</pre>
</td>
</tr>
</table>
<p>Allowing ICMP traffic can be useful for diagnostic purposes. To do this, you would use
a rule like this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">iptables -A INPUT -p icmp -j ACCEPT</kbd>
</pre>
</td>
</tr>
</table>
<p>Most people will also want to set up Network Address Translation (NAT) on their
gateway machine, so that other machines on their network can access the Internet through
it. You would use the following rule to do this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE</kbd>
</pre>
</td>
</tr>
</table>
<p>You will also need to enable IP forwarding. You can do this temporarily, using the
following command:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">echo 1 > /proc/sys/net/ipv4/ip_forward</kbd>
</pre>
</td>
</tr>
</table>
<p>To enable IP forwarding on a more permanent basis (i.e. so that the change is kept
after a reboot), you will need to open the file <tt
class="FILENAME">/etc/rc.d/rc.inet2</tt> in your favorite editor and change the following
line:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
IPV4_FORWARD=0
</pre>
</td>
</tr>
</table>
<p>...to this:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
IPV4_FORWARD=1
</pre>
</td>
</tr>
</table>
<p>For more information on NAT, see the <a
href="http://www.netfilter.org/documentation/HOWTO/NAT-HOWTO.txt" target="_top">NAT
HOWTO</a>.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="SECURITY-HOST-TCPWRAPPERS"
name="SECURITY-HOST-TCPWRAPPERS">14.2.2 <tt class="COMMAND">tcpwrappers</tt></a></h3>
<p><tt class="COMMAND">tcpwrappers</tt> controls access to daemons at the application
level, rather than at the IP level. This can provide an extra layer of security at times
when IP-level access controls (e.g. Netfilter) are not functioning correctly. For
example, if you recompile the kernel but forget to include iptables support, your IP
level protection will fail but tcpwrappers will still help protect your system.</p>
<p>Access to services protected by tcpwrappers can be controlled using <tt
class="FILENAME">/etc/hosts.allow</tt> and <tt class="FILENAME">/etc/hosts.deny</tt>.</p>
<p>The majority of people would have a single line in their <tt
class="FILENAME">/etc/hosts.deny</tt> file to deny access to all daemons by default. This
line would be:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
ALL : ALL
</pre>
</td>
</tr>
</table>
<p>When this is done, you can concentrate on allowing access to services for specified
hosts, domains, or IP ranges. This can be done in the <tt
class="FILENAME">/etc/hosts.allow</tt> file, which follows the same format.</p>
<p>A lot of people would start by accepting all connections from <tt
class="HOSTID">localhost</tt>. This can be achieved using:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
ALL : 127.0.0.1
</pre>
</td>
</tr>
</table>
<p>To allow access to SSHd from <tt class="HOSTID">192.168.0.0/24</tt>, you could use
either of the following rules:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
sshd : 192.168.0.0/24
sshd : 192.168.0.
</pre>
</td>
</tr>
</table>
<p>It is also possible to restrict access to hosts in certain domains. This can be done
using the following rule (note that this relies on the reverse DNS entry for the
connecting host being trustworthy, so I would recommand against its use on
Internet-connected hosts):</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
sshd : .slackware.com
</pre>
</td>
</tr>
</table>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="SECURITY-CURRENT" name="SECURITY-CURRENT">14.3 Keeping
Current</a></h2>
<div class="SECT2">
<h3 class="SECT2"><a id="SECURITY-CURRENT-LIST" name="SECURITY-CURRENT-LIST">14.3.1 <var
class="LITERAL">slackware-security</var> mailing list</a></h3>
<p>Whenever a security problem affects Slackware, an email is sent to all subscribers to
the <var class="LITERAL">slackware-security@slackware.com</var> mailing list. Reports are
sent out for vulnerabilities of any part of Slackware, apart from the software in <tt
class="FILENAME">/extra</tt> or <tt class="FILENAME">/pasture</tt>. These security
announcement emails include details on obtaining updated versions of Slackware packages
or work-arounds, if any.</p>
<p>Subscribing to Slackware mailing lists is covered in <a
href="#HELP-ONLINE-EMAIL">Section 2.2.2</a>.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="SECURITY-CURRENT-PATCHES" name="SECURITY-CURRENT-PATCHES">14.3.2
The <tt class="FILENAME">/patches</tt> directory</a></h3>
<p>Whenever updated packages are released for a version of Slackware (usually only to fix
a security problem, in the case of already released Slackware versions), they are placed
in the <tt class="FILENAME">/patches</tt> directory. The full path to these patches will
depend on the mirror you are using, but will take the form <tt
class="FILENAME">/path/to/slackware-x.x/patches/</tt>.</p>
<p>Before installing these packages, it is a good idea to verify the <tt
class="COMMAND">md5sum</tt> of the package. <tt class="COMMAND">md5sum</tt>(1) is a
commandline utility that creates a “unique” mathematical hash of the file. If
a single bit of the file has been changed, it will generate a different md5sum value.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">md5sum package-<ver>-<arch>-<rev>.tgz</kbd>
6341417aa1c025448b53073a1f1d287d package-<ver>-<arch>-<rev>.tgz
</pre>
</td>
</tr>
</table>
<p>You should then check this against the line for the new package in the <tt
class="FILENAME">CHECKSUMS.md5</tt> file in the root of the <tt
class="FILENAME">slackware-<var class="REPLACEABLE">$VERSION</var></tt> directory (also
in the <tt class="FILENAME">/patches</tt> directory for patches) or in the email to the
<var class="LITERAL">slackware-security</var> mailing list.</p>
<p>If you have a file with the md5sum values in it, you can source it instead with the
<var class="OPTION">-c</var> option to <tt class="COMMAND">md5sum</tt>.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">md5sum -c CHECKSUMS.md5</kbd>
./ANNOUNCE.10_0: OK
./BOOTING.TXT: OK
./COPYING: OK
./COPYRIGHT.TXT: OK
./CRYPTO_NOTICE.TXT: OK
./ChangeLog.txt: OK
./FAQ.TXT: FAILED
</pre>
</td>
</tr>
</table>
<p>As you can see, any files that <tt class="COMMAND">md5sum</tt> evaluates as correct
are listed “<var class="LITERAL">OK</var>” while files that fail are labelled
“<var class="LITERAL">FAILED</var>”. (Yes, this was an insult to your
intelligence. Why do you put up with me?)</p>
</div>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="ARCHIVE-FILES" name="ARCHIVE-FILES"></a>Chapter 15 Archive Files</h1>
<div class="SECT1">
<h2 class="SECT1"><a id="ARCHIVE-FILES-GZIP" name="ARCHIVE-FILES-GZIP">15.1 <tt
class="COMMAND">gzip</tt></a></h2>
<p><tt class="COMMAND">gzip</tt>(1) is the GNU compression program. It takes a single
file and compresses it. The basic usage is as follows:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">gzip <var
class="REPLACEABLE">filename</var></kbd>
</pre>
</td>
</tr>
</table>
<p>The resulting file will be named <tt class="FILENAME"><var
class="REPLACEABLE">filename</var>.gz</tt> and will usually be smaller than the input
file. Note that <tt class="FILENAME">filename.gz</tt> will replace <tt
class="FILENAME">filename</tt>. This means that <tt class="FILENAME">filename</tt> will
no longer exist, even though a gzipped copy will. Regular text files will compress
nicely, while jpeg images, mp3s, and other such files will not compress too well as they
are already compressed. This basic usage is a balance of final file size and compression
time. The maximum compression can be achieved like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">gzip -9 <var
class="REPLACEABLE">filename</var></kbd>
</pre>
</td>
</tr>
</table>
<p>This will take a longer time to compress the file, but the result will be as small as
<tt class="COMMAND">gzip</tt> can make it. Using lower values for the command line option
will cause it to compress faster, but the file will not be as compressed.</p>
<p>Decompressing gzipped files can be done using two commands, which are really just the
same program. <tt class="COMMAND">gzip</tt> will decompress any file with a recognized
file extension. A recognized extension can be any of the following: <tt
class="FILENAME">.gz</tt>, <tt class="FILENAME">-gz</tt>, <tt class="FILENAME">.z</tt>,
<tt class="FILENAME">-z</tt>, <tt class="FILENAME">.Z</tt>, or <tt
class="FILENAME">-Z</tt>. The first method is to call <tt class="COMMAND">gunzip</tt>(1)
on a file, like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">gunzip <var
class="REPLACEABLE">filename.gz</var></kbd>
</pre>
</td>
</tr>
</table>
<p>This will leave a decompressed version of infile in the current directory, and the <tt
class="FILENAME">.gz</tt> extension will be stripped from the filename. <tt
class="COMMAND">gunzip</tt> is really part of <tt class="COMMAND">gzip</tt> and is
identical to <tt class="COMMAND">gzip -d</tt>. As such, <tt class="COMMAND">gzip</tt> is
often pronounced <tt class="COMMAND">gunzip</tt>, as that name just sounds cooler.
:^)</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="ARCHIVE-FILES-BZIP2" name="ARCHIVE-FILES-BZIP2">15.2 <tt
class="COMMAND">bzip2</tt></a></h2>
<p><tt class="COMMAND">bzip2</tt>(1) is an alternative compression program installed on
Slackware Linux. It uses a different compression algorithm from <tt
class="COMMAND">gzip</tt>, which results in some advantages and some disadvantages. The
main advantage for <tt class="COMMAND">bzip2</tt> is the compressed file size. <tt
class="COMMAND">bzip2</tt> will almost always compress better than <tt
class="COMMAND">gzip</tt>. In some instances, this can result in dramatically smaller
files. This can be a great advantage for people on slower modem connections. Also
remember, when downloading software from a public ftp server, it's generally good
netiquette to download the <tt class="FILENAME">.bz2</tt> files instead of the <tt
class="FILENAME">.gz</tt> files, as this results in less overhead for the generous people
hosting the server.</p>
<p>The disadvantage to <tt class="COMMAND">bzip2</tt> is that it is more CPU intensive
than <tt class="COMMAND">gzip</tt>. This means that bzipping a file will generally take
longer and will use more of the CPU than gzipping the file would. When considering which
compression program to use, you must weigh this speed vs. compressed size and determine
which is more important.</p>
<p>The usage of <tt class="COMMAND">bzip2</tt> is nearly identical to <tt
class="COMMAND">gzip</tt>, so not much time will be spent discussing it. Like <tt
class="COMMAND">gunzip</tt>, <tt class="COMMAND">bunzip2</tt> is identical to <tt
class="COMMAND">bzip2 -d</tt>. The primary difference in practical usage is that <tt
class="COMMAND">bzip2</tt> uses the <tt class="FILENAME">.bz2</tt> extension.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">bzip2 <var
class="REPLACEABLE">filename</var></kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">bunzip2 <var
class="REPLACEABLE">filename.bz2</var></kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">bzip2 -9 <var
class="REPLACEABLE">filename</var></kbd>
</pre>
</td>
</tr>
</table>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="ARCHIVE-FILES-TAR" name="ARCHIVE-FILES-TAR">15.3 <tt
class="COMMAND">tar</tt></a></h2>
<p><tt class="COMMAND">tar</tt>(1) is the GNU tape archiver. It takes several files or
directories and creates one large file. This allows you to compress an entire directory
tree, which is impossible by just using <tt class="COMMAND">gzip</tt> or <tt
class="COMMAND">bzip2</tt>. <tt class="COMMAND">tar</tt> has many command line options,
which are explained in its man page. This section will just cover the most common uses of
<tt class="COMMAND">tar</tt>.</p>
<p>The most common use for <tt class="COMMAND">tar</tt> is to decompress and unarchive a
package that you've downloaded from a web site or ftp site. Most files will come with a
<tt class="FILENAME">.tar.gz</tt> extension. This is commonly known as a
“tarball”. It means that several files were archived using <tt
class="COMMAND">tar</tt> and then compressed using <tt class="COMMAND">gzip</tt>. You
might also see this listed as a <tt class="FILENAME">.tar.Z</tt> file. It means the same
thing, but this is usually encountered on older Unix systems.</p>
<p>Alternatively, you might find a <tt class="FILENAME">.tar.bz2</tt> file somewhere.
Kernel source is distributed as such because it is a smaller download. As you might have
guessed, this is several files archived with <tt class="COMMAND">tar</tt> and then
bzipped.</p>
<p>You can get to all the files in this archive by making use of <tt
class="COMMAND">tar</tt> and some command line arguments. Unarchiving a tarball makes use
of the <var class="OPTION">-z</var> flag, which means to first run the file through <tt
class="COMMAND">gunzip</tt> and decompress it. The most common way to decompress a
tarball is like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">tar -xvzf filename.tar.gz</kbd>
</pre>
</td>
</tr>
</table>
<p>That's quite a few options. So what do they all mean? The <var class="OPTION">-x</var>
means to extract. This is important, as it tells <tt class="COMMAND">tar</tt> exactly
what to do with the input file. In this case, we'll be splitting it back up into all the
files that it came from. <var class="OPTION">-v</var> means to be verbose. This will list
all the files that are being unarchived. It is perfectly acceptable to leave this option
off, if somewhat boring. Alternatively, you could use <var class="OPTION">-vv</var> to be
very verbose and list even more information about each file being unarchived. The <var
class="OPTION">-z</var> option tells <tt class="COMMAND">tar</tt> to run <tt
class="FILENAME">filename.tar.gz</tt> through <tt class="COMMAND">gunzip</tt> first. And
finally, the <var class="OPTION">-f</var> option tells <tt class="COMMAND">tar</tt> that
the next string on the command line is the file to operate on.</p>
<p>There are a few other ways to write this same command. On older systems lacking a
decent copy of GNU <tt class="COMMAND">tar</tt>, you might see it written like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">gunzip filename.tar.gz | tar -xvf -</kbd>
</pre>
</td>
</tr>
</table>
<p>This command line will uncompress the file and send the output to <tt
class="COMMAND">tar</tt>. Since <tt class="COMMAND">gzip</tt> will write its output to
standard out if told to do so, this command will write the decompressed file to standard
out. The pipe then sends it to <tt class="COMMAND">tar</tt> for unarchiving. The
“-” means to operate on standard input. It will unarchive the stream of data
that it gets from <tt class="COMMAND">gzip</tt> and write that to the disk.</p>
<p>Another way to write the first command line is to leave off the dash before the
options, like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">tar xvzf filename.tar.gz</kbd>
</pre>
</td>
</tr>
</table>
<p>You might also encounter a bzipped archive. The version of <tt
class="COMMAND">tar</tt> that comes with Slackware Linux can handle these the same as
gzipped archives. Instead of the <var class="OPTION">-z</var> command line option, you'd
use <var class="OPTION">-j</var>:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">tar -xvjf filename.tar.bz2</kbd>
</pre>
</td>
</tr>
</table>
<p>It is important to note that <tt class="COMMAND">tar</tt> will place the unarchived
files in the current directory. So, if you had an archive in <tt
class="FILENAME">/tmp</tt> that you wanted to decompress into your home directory, there
are a few options. First, the archive could be moved into your home directory and then
run through <tt class="COMMAND">tar</tt>. Second, you could specify the path to the
archive file on the command line. Third, you can use the <var class="OPTION">-C</var>
option to “explode” the tarball in a specified directory.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cd $HOME</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cp /tmp/filename.tar.gz .</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">tar -xvzf filename.tar.gz</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cd $HOME</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">tar -xvzf /tmp/filename.tar.gz</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cd /</kbd>
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">tar -xvzf /tmp/filename.tar.gz -C $HOME</kbd>
</pre>
</td>
</tr>
</table>
<p>All the above statements are equivalent. In each case, the archive is unpacked inside
your home directory and the original uncompressed archive is left in place.</p>
<p>So what good is being able to uncompress these archives if you can't make them? Well,
<tt class="COMMAND">tar</tt> handles that too. In most cases it's as easy as removing the
“<var class="OPTION">-x</var>” option and replacing it with the “<var
class="OPTION">-c</var>” option.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">tar -cvzf filename.tar.gz .</kbd>
</pre>
</td>
</tr>
</table>
<p>In this command line, the <var class="OPTION">-c</var> option tells <tt
class="COMMAND">tar</tt> to create an archive, while the <var class="OPTION">-z</var>
option runs the resulting archive file through <tt class="COMMAND">gzip</tt> to compress
it. <tt class="FILENAME">filename.tar.gz</tt> is the file that you want to create.</p>
<p>Specifying the “<var class="OPTION">-f</var>” option isn't always
necessary, but is typically good practice anyway. Without it, <tt
class="COMMAND">tar</tt> writes to standard output, which is usually desired for piping
<tt class="COMMAND">tar</tt>'s output to another program, like so.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">tar -cv filename.tar . | gpg --encrypt</kbd>
</pre>
</td>
</tr>
</table>
<p>That command creates an non-compressed tar archive of the current directory, pipes the
tarball through <tt class="COMMAND">gpg</tt> which encrypts and compresses the tarball,
making it realistically impossible to read by anyone other than the person knowing the
secret key.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="ARCHIVE-FILES-ZIP" name="ARCHIVE-FILES-ZIP">15.4 <tt
class="COMMAND">zip</tt></a></h2>
<p>Finally, there are two utilities that can be used on zip files. These are very common
in the Windows world, so Linux has programs to deal with them. The compression program is
called <tt class="COMMAND">zip</tt>(1), and the decompression program is called <tt
class="COMMAND">unzip</tt>(1).</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">zip foo *</kbd>
</pre>
</td>
</tr>
</table>
<p>This will create the file <tt class="FILENAME">foo.zip</tt>, which will contain all
the files in the current directory. <tt class="COMMAND">zip</tt> will add the <tt
class="FILENAME">.zip</tt> extension automatically, so there's no need to include that in
the file name. You can also recurse through the current directory, zipping up any
directories that are also laying around:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">zip -r foo *</kbd>
</pre>
</td>
</tr>
</table>
<p>Decompressing files is easy, as well.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">unzip foo.zip</kbd>
</pre>
</td>
</tr>
</table>
<p>This will extract all the files in the file <tt class="FILENAME">foo.zip</tt>,
including any directories in the archive.</p>
<p>The <tt class="COMMAND">zip</tt> utilities have several advanced options for creating
self-extracting archives, leaving out files, controlling compressed file size, printing
out what will happen, and much more. See the man pages for <tt class="COMMAND">zip</tt>
and <tt class="COMMAND">unzip</tt> to find out how to use these options.</p>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="VI" name="VI"></a>Chapter 16 Vi</h1>
<p><tt class="COMMAND">vi</tt>(1) is the standard Unix text editing program, and while
mastering it is not as essential as it once was, is still a very rewarding goal. There
are several versions (or clones) of <tt class="COMMAND">vi</tt> available, including <tt
class="COMMAND">vi</tt>, <tt class="COMMAND">elvis</tt>, <tt class="COMMAND">vile</tt>,
and <tt class="COMMAND">vim</tt>. One of these is available on just about any version of
Unix, as well as on Linux. All of these versions include the same basic feature set and
commands, so learning one clone should make it easy to learn another. With the variety of
text editors included with Linux distributions and Unix variants these days, many people
no longer use <tt class="COMMAND">vi</tt>. Still, it remains the most universal text
editor across Unix and Unix work-alikes. Mastering <tt class="COMMAND">vi</tt> means you
should never be sitting at a Unix machine and not be comfortable with at least one
powerful text editor.</p>
<p><tt class="COMMAND">vi</tt> includes a number of powerful features including syntax
highlighting, code formatting, a powerful search-and-replace mechanism, macros, and more.
These features make it especially attractive to programmers, web developers, and the
like. System administrators will appreciate the automation and integration with the shell
that is possible.</p>
<p>On Slackware Linux, the default version of <tt class="COMMAND">vi</tt> available is
<tt class="COMMAND">elvis</tt>. Other versions - including <tt class="COMMAND">vim</tt>
and <tt class="COMMAND">gvim</tt> - are available if you've installed the proper
packages. <tt class="COMMAND">gvim</tt> is an X Window version of <tt
class="COMMAND">vim</tt> that includes toolbars, detachable menus, and dialog boxes.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="VI-STARTING" name="VI-STARTING">16.1 Starting vi</a></h2>
<p><tt class="COMMAND">vi</tt> can be started from the command line in a variety of ways.
The simplest form is just:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">vi</kbd>
</pre>
</td>
</tr>
</table>
<div class="FIGURE"><a id="FIG-VI-VIM-SPLITEDIT" name="FIG-VI-VIM-SPLITEDIT"></a>
<p><b>Figure 16-1. A vi session.</b></p>
<p><img src="vi/vim-splitedit.png" /></p>
</div>
<p>This will start up <tt class="COMMAND">vi</tt> with an empty buffer. At this point,
you'll see a mostly blank screen. It is now in “command mode”, waiting for
you to do something. For a discussion of the various <tt class="COMMAND">vi</tt> modes,
see the <a href="#VI-MODES">Section 16.2</a>. In order to quit out of <tt
class="COMMAND">vi</tt>, type the following:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<kbd class="USERINPUT">:q</kbd>
</pre>
</td>
</tr>
</table>
<p>Assuming that there have been no changes to the file, this will cause <tt
class="COMMAND">vi</tt> to quit. If there have been changes made, it will warn you that
there have been changes and tell you how to disregard them. Disregarding changes usually
means appending an exclamation point after the “<b class="KEYCAP">q</b>” like
so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<kbd class="USERINPUT">:q!</kbd>
</pre>
</td>
</tr>
</table>
<p>The exclamation point usually means to force some action. We'll discuss it and other
key combinations in further details later.</p>
<p>You can also start <tt class="COMMAND">vi</tt> with a pre-existing file. For example,
the file <tt class="FILENAME">/etc/resolv.conf</tt> would be opened like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">vi /etc/resolv.conf</kbd>
</pre>
</td>
</tr>
</table>
<p>Finally, <tt class="COMMAND">vi</tt> can be started on a particular line of a file.
This is especially useful for programmers when an error message includes the line their
program bombed on. For example, you could start up <tt class="COMMAND">vi</tt> on line 47
of <tt class="FILENAME">/usr/src/linux/init/main.c</tt> like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd
class="USERINPUT">vi +47 /usr/src/linux/init/main.c</kbd>
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">vi</tt> will display the given file and will place the cursor at
the specified line. In the case where you specify a line that is after the end of the
file, <tt class="COMMAND">vi</tt> will place the cursor on the last line. This is
especially helpful for programmers, as they can jump straight to the location in the file
that an error occurred, without having to search for it.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="VI-MODES" name="VI-MODES">16.2 Modes</a></h2>
<p><tt class="COMMAND">vi</tt> operates in various modes, which are used to accomplish
various tasks. When you first start <tt class="COMMAND">vi</tt>, you are placed into
command mode. From this point, you can issue various commands to manipulate text, move
around in the file, save, quit, and change modes. Editing the text is done in insert
mode. You can quickly move between modes with a variety of keystrokes, which are
explained below.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="VI-MODES-COMMAND-MODE" name="VI-MODES-COMMAND-MODE">16.2.1
Command Mode</a></h3>
<p>You are first placed into command mode. From this mode, you cannot directly enter text
or edit what is already there. However, you can manipulate the text, search, quit, save,
load new files, and more. This is intended only to be an introduction to the command
mode. For a description of the various commands, see <a href="#VI-KEYS">Section
16.7</a>.</p>
<p>Probably the most often used command in command mode is changing to insert mode. This
is accomplished by hitting the <b class="KEYCAP">i</b> key. The cursor changes shapes,
and <span class="emphasis"><i class="EMPHASIS">-- INSERT --</i></span> is displayed at
the bottom of the screen (note that this does not happen in all clones of <tt
class="COMMAND">vi</tt>). From there, all your keystrokes are entered into the current
buffer and are displayed to the screen. To get back into command mode, hit the <b
class="KEYCAP">ESCAPE</b> key.</p>
<p>Command mode is also where you move around in the file. On some systems, you can use
the arrow keys to move around. On other systems, you may need to use the more traditional
keys of “<b class="KEYCAP">hjkl</b>”. Here is a simple listing of how these
keys are used to move around:</p>
<div class="INFORMALTABLE"><a id="AEN5604" name="AEN5604"></a>
<table border="0" frame="void" width="100%" class="CALSTABLE">
<col width="25%" />
<col width="75%" />
<tbody>
<tr>
<td><b class="KEYCAP">h</b></td>
<td>move left one character</td>
</tr>
<tr>
<td><b class="KEYCAP">j</b></td>
<td>move down one character</td>
</tr>
<tr>
<td><b class="KEYCAP">k</b></td>
<td>move up one character</td>
</tr>
<tr>
<td><b class="KEYCAP">l</b></td>
<td>move right one character</td>
</tr>
</tbody>
</table>
</div>
<p>Simply press a key to move. As you will see later, these keys can be combined with a
number to move much more efficiently.</p>
<p>Many of the commands that you will use in command mode begin with a colon. For
example, quitting is <b class="KEYCAP">:q</b>, as discussed earlier. The colon simply
indicates that it is a command, while the “<b class="KEYCAP">q</b>” tells <tt
class="COMMAND">vi</tt> to quit. Other commands are an optional number, followed by a
letter. These commands do not have a colon before them, and are generally used to
manipulate the text.</p>
<p>For example, deleting one line from a file is accomplished by hitting <b
class="KEYCAP">dd</b>. This will remove the line that the cursor is on. Issuing the
command <b class="KEYCAP">4dd</b> would tell <tt class="COMMAND">vi</tt> to remove the
line that the cursor is on and the three after that. In general, the number tells <tt
class="COMMAND">vi</tt> how many times to perform the command.</p>
<p>You can combine a number with the movement keys to move around several characters at a
time. For example, <b class="KEYCAP">10k</b> would move up ten lines on the screen.</p>
<p>Command mode can also be used to cut and paste, insert text, and read other files into
the current buffer. Copying text is accomplished with the <b class="KEYCAP">y</b> key (<b
class="KEYCAP">y</b> stands for yank). Copying the current line is done by typing <b
class="KEYCAP">yy</b>, and this can be prefixed with a number to yank more lines. Then,
move to the location for the copy and hit <b class="KEYCAP">p</b>. The text is pasted on
the line after the current one.</p>
<p>Cutting text is done by typing <b class="KEYCAP">dd</b>, and <b class="KEYCAP">p</b>
can be used to paste the cut text back into the file. Reading in text from another file
is a simple procedure. Just type <b class="KEYCAP">:r</b>, followed by a space and the
file name that contains the text to be inserted. The file's contents will be pasted into
the current buffer on the line after the cursor. More sophisticated <tt
class="COMMAND">vi</tt> clones even contain filename completion similar to the
shell's.</p>
<p>The final use that will be covered is searching. Command mode allows for simple
searching, as well as complicated search-and-replace commands that make use of a powerful
version of regular expressions. A complete discussion of regular expressions is beyond
the scope of this chapter, so this section will only cover simple means of searching.</p>
<p>A simple search is accomplished by hitting the <b class="KEYCAP">/</b> key, followed
by the text that you are searching for. <tt class="COMMAND">vi</tt> will search forward
from the cursor to the end of the file for a match, stopping when it finds one. Note that
inexact matches will cause <tt class="COMMAND">vi</tt> to stop as well. For example, a
search for “<span class="emphasis"><i class="EMPHASIS">the</i></span>” will
cause <tt class="COMMAND">vi</tt> to stop on “<span class="emphasis"><i
class="EMPHASIS">then</i></span>”, “<span class="emphasis"><i
class="EMPHASIS">therefore</i></span>”, and so on. This is because all of those
words do match “<span class="emphasis"><i
class="EMPHASIS">the</i></span>”.</p>
<p>After <tt class="COMMAND">vi</tt> has found the first match, you can continue on to
the next match simply by hitting the <b class="KEYCAP">/</b> key followed by enter. You
can also search backwards through the file by replacing the slash with the <b
class="KEYCAP">?</b> key. For example, searching backwards through the file for
“<span class="emphasis"><i class="EMPHASIS">the</i></span>” would be
accomplished by typing <b class="KEYCAP">?the</b>.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="VI-MODES-INSET-MODE" name="VI-MODES-INSET-MODE">16.2.2 Insert
Mode</a></h3>
<p>Inserting and replacing text is accomplished in insert mode. As previously discussed,
you can get into insert mode by hitting <b class="KEYCAP">i</b> from command mode. Then,
all text that you type is entered into the current buffer. Hitting the <b
class="KEYCAP">ESCAPE</b> key takes you back into command mode.</p>
<p>Replacing text is accomplished in several ways. From command mode, hitting <b
class="KEYCAP">r</b> will allow you to replace the one character underneath the cursor.
Just type the new character and it will replace the one under the cursor. You will then
be immediately placed back into command mode. Hitting <b class="KEYCAP">R</b> allows you
to replace as many characters as you'd like. To get out of this replacement mode, just
hit <b class="KEYCAP">ESCAPE</b> to go back into command mode.</p>
<p>There is yet another way to toggle between insertion and replacement. Hitting the <b
class="KEYCAP">INSERT</b> key from command mode will take you into insert mode. Once you
are in insert mode, the keyboard's <b class="KEYCAP">INSERT</b> key serves as a toggle
between insert and replace. Hitting it once will allow you to replace. Hitting it once
more will once again allow you to insert text.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="VI-OPENING-FILES" name="VI-OPENING-FILES">16.3 Opening
Files</a></h2>
<p><tt class="COMMAND">vi</tt> allows you to open files from command mode as well as
specifying a file on the command line to open. To open the file <tt
class="FILENAME">/etc/lilo.conf</tt>:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<kbd class="USERINPUT">:e /etc/lilo.conf</kbd>
</pre>
</td>
</tr>
</table>
<p>If you have made changes to the current buffer without saving, <tt
class="COMMAND">vi</tt> will complain. You can still open the file without saving the
current buffer by typing <b class="KEYCAP">:e!</b>, followed by a space and the filename.
In general, <tt class="COMMAND">vi</tt>'s warnings can be suppressed by following the
command with an exclamation mark.</p>
<p>If you want to reopen the current file, you can do so simply by typing <b
class="KEYCAP">e!</b>. This is particularly useful if you have somehow messed up the file
and want to reopen it.</p>
<p>Some <tt class="COMMAND">vi</tt> clones (for example, <tt class="COMMAND">vim</tt>)
allow for multiple buffers to be open at the same time. For example, to open up the file
<tt class="FILENAME">09-vi.sgml</tt> in my home directory while another file was open, I
would type:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<kbd class="USERINPUT">:split ~/09-vi.sgml</kbd>
</pre>
</td>
</tr>
</table>
<p>The new file is displayed on the top half of the screen, and the old file is displayed
in the bottom half of the screen. There are a lot of commands that manipulate the split
screen, and many of these commands start to resemble something out of <tt
class="COMMAND">Emacs</tt> The best place to look up these commands would be the man page
for your vi clone. Note that many clones do not support the split-screen idea, so you
might not be able to use it at all.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="VI-SAVING-FILES" name="VI-SAVING-FILES">16.4 Saving
Files</a></h2>
<p>There are several ways to save files in <tt class="COMMAND">vi</tt>. If you want to
save the current buffer to the file <tt class="FILENAME">randomness</tt>, you would
type:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<kbd class="USERINPUT">:w randomness</kbd>
</pre>
</td>
</tr>
</table>
<p>Once you've saved the file once, saving it again is as simple as typing <b
class="KEYCAP">:w</b>. Any changes will be written out to the file. After you've saved
the file, you are dumped back into command mode. If you want to save the file and quit
<tt class="COMMAND">vi</tt> (a very common operation), you would type <b
class="KEYCAP">:wq</b>. That tells <tt class="COMMAND">vi</tt> to save the current file
and quit back to the shell.</p>
<p>On occasion, you want to save a file that is marked as read-only. You can do this by
adding an exclamation point after the write command, like so:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<kbd class="USERINPUT">:w!</kbd>
</pre>
</td>
</tr>
</table>
<p>However, there will still be instances where you cannot write the file (for example,
you are attempting to edit a file that is owned by another user). When this happens, <tt
class="COMMAND">vi</tt> will tell you that it cannot save the file. If you really want to
edit the file, you'll have to come back and edit it as <tt class="USERNAME">root</tt> or
(preferably) the owner of that file.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="VI-QUITTING-VI" name="VI-QUITTING-VI">16.5 Quitting vi</a></h2>
<p>One way to quit <tt class="COMMAND">vi</tt> is through <b class="KEYCAP">:wq</b>,
which will save the current buffer before quitting. You can also quit without saving with
<b class="KEYCAP">:q</b> or (more commonly) <b class="KEYCAP">:q!</b>. The latter is used
when you've modified the file but do not wish to save any changes to it.</p>
<p>On occasion, your machine might crash or <tt class="COMMAND">vi</tt> might crash.
However, both <tt class="COMMAND">elvis</tt> and <tt class="COMMAND">vim</tt> will take
steps to minimize the damage to any open buffers. Both editors save the open buffers to a
temporary file on occasion. This file is usually named similarly to the open file, but
with a dot at the beginning. This makes the file hidden.</p>
<p>This temporary file gets removed once the editor quits under normal conditions. This
means that the temporary copy will still be around if something crashes. When you go back
to edit the file again, you will be prompted for what action to take. In most cases, a
large amount of your unsaved work can be recovered. <tt class="COMMAND">elvis</tt> will
also send you a mail (from Graceland, oddly enough :) telling you that a backup copy
exists.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="VI-CONFIGURATION" name="VI-CONFIGURATION">16.6 vi
Configuration</a></h2>
<p>Your <tt class="COMMAND">vi</tt> clone of choice can be configured in several
ways.</p>
<p>A variety of commands can be entered while in command mode to set up <tt
class="COMMAND">vi</tt> just how you like it. Depending on your editor, you can enable
features to make programming easier (like syntax hilighting, auto-indenting, and more),
set up macros to automake tasks, enable textual substitutions, and more.</p>
<p>Almost all of these commands can be put into a configuration file in your home
directory. <tt class="COMMAND">elvis</tt> expects a <tt class="FILENAME">.exrc</tt> file,
while <tt class="COMMAND">vim</tt> expects a <tt class="FILENAME">.vimrc</tt> file. Most
of the setup commands that can be entered in command mode can be placed in the
configuration file. This includes setup information, textual substitutions, macros, and
more.</p>
<p>Discussing all these options and the differences between the editors is quite an
involved subject. For more information, check out the man page or web site for your
preferred <tt class="COMMAND">vi</tt> editor. Some editors (like <tt
class="COMMAND">vim</tt>) have extensive help within the editor that can be accessed with
the <b class="KEYCAP">:help</b> command, or something similar. You can also check out the
O'Reilly book <i class="CITETITLE">Learning the <tt class="COMMAND">vi</tt> Editor</i> by
Lamb and Robbins.</p>
<p>Many common programs in Linux will load up a text file in <tt class="COMMAND">vi</tt>
by default. For example, editing your crontabs will start up <tt class="COMMAND">vi</tt>
by default. If you do not like <tt class="COMMAND">vi</tt> and would like another editor
to be started instead, all you need to do is set the <tt class="ENVAR">VISUAL</tt>
environment variable to the editor you prefer. For information on setting environment
variables, see the section called Environment Variables in Chapter 8. If you want to make
sure that your editor will be the default every time you login, add the VISUAL setting to
your <tt class="FILENAME">.bash_profile</tt> or <tt class="FILENAME">.bashrc</tt>
files.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="VI-KEYS" name="VI-KEYS">16.7 Vi Keys</a></h2>
<p>This section is a quick reference of many common <tt class="COMMAND">vi</tt> commands.
Some of these were discussed earlier in the chapter, while many will be new.</p>
<div class="TABLE"><a id="AEN5773" name="AEN5773"></a>
<p><b>Table 16-1. Movement</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col />
<col />
<thead>
<tr>
<th align="CENTER">Operation</th>
<th align="CENTER">Key</th>
</tr>
</thead>
<tbody>
<tr>
<td>left, down, up, right</td>
<td align="CENTER"><b class="KEYCAP">h</b>, <b class="KEYCAP">j</b>, <b
class="KEYCAP">k</b>, <b class="KEYCAP">l</b></td>
</tr>
<tr>
<td>To the end of the line</td>
<td align="CENTER"><b class="KEYCAP">$</b></td>
</tr>
<tr>
<td>To the beginning of the line</td>
<td align="CENTER"><b class="KEYCAP">^</b></td>
</tr>
<tr>
<td>To the end of the file</td>
<td align="CENTER"><b class="KEYCAP">G</b></td>
</tr>
<tr>
<td>To the beginning of the file</td>
<td align="CENTER"><b class="KEYCAP">:1</b></td>
</tr>
<tr>
<td>To line 47</td>
<td align="CENTER"><b class="KEYCAP">:47</b></td>
</tr>
</tbody>
</table>
</div>
<div class="TABLE"><a id="AEN5808" name="AEN5808"></a>
<p><b>Table 16-2. Editing</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col />
<col />
<thead>
<tr>
<th align="CENTER">Operation</th>
<th align="CENTER">Key</th>
</tr>
</thead>
<tbody>
<tr>
<td>Removing a line</td>
<td align="CENTER"><b class="KEYCAP">dd</b></td>
</tr>
<tr>
<td>Removing five lines</td>
<td align="CENTER"><b class="KEYCAP">5dd</b></td>
</tr>
<tr>
<td>Replacing a character</td>
<td align="CENTER"><b class="KEYCAP">r</b></td>
</tr>
<tr>
<td>Removing a character</td>
<td align="CENTER"><b class="KEYCAP">x</b></td>
</tr>
<tr>
<td>Removing ten characters</td>
<td align="CENTER"><b class="KEYCAP">10x</b></td>
</tr>
<tr>
<td>Undo last action</td>
<td align="CENTER"><b class="KEYCAP">u</b></td>
</tr>
<tr>
<td>Join current and next lines</td>
<td align="CENTER"><b class="KEYCAP">J</b></td>
</tr>
<tr>
<td>Replace old with new, globally</td>
<td align="CENTER"><b class="KEYCAP">%s'old'new'g</b></td>
</tr>
</tbody>
</table>
</div>
<div class="TABLE"><a id="AEN5848" name="AEN5848"></a>
<p><b>Table 16-3. Searching</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col />
<col />
<thead>
<tr>
<th align="CENTER">Operation</th>
<th align="CENTER">Key</th>
</tr>
</thead>
<tbody>
<tr>
<td>Search for “asdf”</td>
<td align="CENTER"><b class="KEYCAP">/asdf</b></td>
</tr>
<tr>
<td>Search backwards for “asdf”</td>
<td align="CENTER"><b class="KEYCAP">?asdf</b></td>
</tr>
<tr>
<td>Repeat last search forwards</td>
<td align="CENTER"><b class="KEYCAP">/</b></td>
</tr>
<tr>
<td>Repeat last search backwards</td>
<td align="CENTER"><b class="KEYCAP">?</b></td>
</tr>
<tr>
<td>Repeat last search, same direction</td>
<td align="CENTER"><b class="KEYCAP">n</b></td>
</tr>
<tr>
<td>Repeat last search, opposite direction</td>
<td align="CENTER"><b class="KEYCAP">N</b></td>
</tr>
</tbody>
</table>
</div>
<div class="TABLE"><a id="AEN5882" name="AEN5882"></a>
<p><b>Table 16-4. Saving and Quitting</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col />
<col />
<thead>
<tr>
<th align="CENTER">Operation</th>
<th align="CENTER">Key</th>
</tr>
</thead>
<tbody>
<tr>
<td>Quit</td>
<td align="CENTER"><b class="KEYCAP">:q</b></td>
</tr>
<tr>
<td>Quit without saving</td>
<td align="CENTER"><b class="KEYCAP">:q!</b></td>
</tr>
<tr>
<td>Write and quit</td>
<td align="CENTER"><b class="KEYCAP">:wq</b></td>
</tr>
<tr>
<td>Write, without quitting</td>
<td align="CENTER"><b class="KEYCAP">:w</b></td>
</tr>
<tr>
<td>Reload currently open file</td>
<td align="CENTER"><b class="KEYCAP">:e!</b></td>
</tr>
<tr>
<td>Write buffer to file <tt class="FILENAME">asdf</tt></td>
<td align="CENTER"><b class="KEYCAP">:w asdf</b></td>
</tr>
<tr>
<td>Open file <tt class="FILENAME">hejaz</tt></td>
<td align="CENTER"><b class="KEYCAP">:e hejaz</b></td>
</tr>
<tr>
<td>Read file <tt class="FILENAME">asdf</tt> into buffer</td>
<td align="CENTER"><b class="KEYCAP">:r asdf</b></td>
</tr>
<tr>
<td>Read output of <tt class="COMMAND">ls</tt> into buffer</td>
<td align="CENTER"><b class="KEYCAP">:r !ls</b></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="EMACS" name="EMACS"></a>Chapter 17 Emacs</h1>
<p>While <tt class="COMMAND">vi</tt> (with its clones) is without a doubt the most
ubiquitous editor on Unix-like systems, Emacs comes in a good second. Instead of using
different “modes”, like <tt class="COMMAND">vi</tt> does, it uses <b
class="KEYCAP">Control</b> and <b class="KEYCAP">Alt</b> key combinations to enter
commands, in much the same way that you can use <b class="KEYCAP">Control</b> and <b
class="KEYCAP">Alt</b> key combinations in a word processor and indeed in many other
applications to execute certain functions. (Though it should be noted that the commands
rarely correspond; so while many modern applications use <b class="KEYCAP">Ctrl</b>-<b
class="KEYCAP">C</b>/ <b class="KEYCAP">X</b>/ <b class="KEYCAP">V</b> for copying,
cutting and pasting, Emacs uses different keys and actually a somewhat different
mechanism for this.)</p>
<p>Also unlike <tt class="COMMAND">vi</tt>, which is an (excellent) editor and nothing
more, Emacs is a program with near endless capabilities. Emacs is (for the most part)
written in Lisp, which is a very powerful programming language that has the peculiar
property that every program written in it is automatically a Lisp compiler of its own.
This means that the user can extend Emacs, and in fact write completely new programs
“in Emacs”.</p>
<p>As a result, Emacs is not just an editor anymore. There are many add-on packages for
Emacs available (many come with the program's source) that provide all sorts of
functionality. Many of these are related to text editing, which is after all Emacs' basic
task, but it doesn't stop there. There are for example several spreadsheet programs for
Emacs, there are databases, games, mail and news clients (the top one being Gnus),
etc.</p>
<p>There are two main versions of Emacs: GNU Emacs (which is the version that comes with
Slackware) and XEmacs. The latter is <span class="emphasis"><i
class="EMPHASIS">not</i></span> a version for Emacs running under X. In fact, both Emacs
and XEmacs run on the console as well as under X. XEmacs was once started as a project to
tidy up the Emacs code. Currently, both versions are being actively developed, and there
is in fact much interaction between the two development teams. For the present chapter,
it is immaterial whether you use Emacs or XEmacs, the differences between them are not
relevant to the normal user.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="EMACS-STARTING" name="EMACS-STARTING">17.1 Starting
emacs</a></h2>
<p>Emacs can be started from the shell by simply typing <tt class="COMMAND">emacs</tt>.
When you are running X, Emacs will (normally) come up with its own X window, usually with
a menu bar at the top, where you can find the most important functions. On startup, Emacs
will first show a welcome message, and then after a few seconds will drop you in the
*scratch* buffer. (See <a href="#EMACS-BUFFERS">Section 17.2</a>.)</p>
<div class="INFORMALFIGURE"><a id="AEN5971" name="AEN5971"></a>
<p><img src="emacs/emacs.png" /></p>
</div>
<p>You can also start Emacs on an existing file by typing</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">emacs /etc/resolv.conf</kbd>
</pre>
</td>
</tr>
</table>
<p>This will cause Emacs to load the specified file when it starts up, skipping the
welcome message.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="EMACS-COMMAND-KEYS" name="EMACS-COMMAND-KEYS">17.1.1 Command
Keys</a></h3>
<p>As mentioned above, Emacs uses <b class="KEYCAP">Control</b> and <b
class="KEYCAP">Alt</b> combinations for commands. The usual convention is to write these
with <b class="KEYCAP">C</b>-<b class="KEYCAP">letter</b> and <b class="KEYCAP">M</b>-<b
class="KEYCAP">letter</b>, respectively. So <b class="KEYCAP">C</b>-<b
class="KEYCAP">x</b> means <b class="KEYCAP">Control</b>+<b class="KEYCAP">x</b>, and <b
class="KEYCAP">M</b>-<b class="KEYCAP">x</b> means <b class="KEYCAP">Alt</b>+<b
class="KEYCAP">x</b>. (The letter <b class="KEYCAP">M</b> is used instead of A because
originally the key was not the <b class="KEYCAP">Alt</b> key but the <b
class="KEYCAP">Meta</b> key. The <b class="KEYCAP">Meta</b> key has all but disappeared
from computer keyboards, and in Emacs the <b class="KEYCAP">Alt</b> key has taken over
its function.)</p>
<p>Many Emacs commands consist of sequences of keys and key combinations. For example, <b
class="KEYCAP">C</b>-<b class="KEYCAP">x</b> <b class="KEYCAP">C</b>-<b
class="KEYCAP">c</b> (that is <b class="KEYCAP">Control</b>-<b class="KEYCAP">x</b>
followed by <b class="KEYCAP">Control</b>-<b class="KEYCAP">c</b> ) quits Emacs, <b
class="KEYCAP">C</b>-<b class="KEYCAP">x</b> <b class="KEYCAP">C</b>-<b
class="KEYCAP">s</b> saves the current file. Keep in mind that <b class="KEYCAP">C</b>-<b
class="KEYCAP">x</b> <b class="KEYCAP">C</b>-<b class="KEYCAP">b</b> is <span
class="emphasis"><i class="EMPHASIS">not</i></span> the same as <b
class="KEYCAP">C</b>-<b class="KEYCAP">x</b> <b class="KEYCAP">b</b>. The former means <b
class="KEYCAP">Control</b>-<b class="KEYCAP">x</b> followed by <b
class="KEYCAP">Control</b>-<b class="KEYCAP">b</b>, while the latter means <b
class="KEYCAP">Control</b>-<b class="KEYCAP">x</b> followed by just '<b
class="KEYCAP">b</b>'.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="EMACS-BUFFERS" name="EMACS-BUFFERS">17.2 Buffers</a></h2>
<p>In Emacs, the concept of “buffers” is essential. Every file that you open
is loaded into its own buffer. Furthermore, Emacs has several special buffers, which do
not contain a file but are used for other things. Such special buffers usually have a
name that starts and ends with an asterisk. For example, the buffer that Emacs shows when
it is first started, is the so-called *scratch* buffer. In the *scratch* buffer, you can
type text in the normal way, but text that is typed there is not saved when Emacs is
closed.</p>
<p>There is one other special buffer you need to know about, and that is the minibuffer.
This buffer consists of only one line, and is always on the screen: it is the very last
line of the Emacs window, below the status bar for the current buffer. The minibuffer is
where Emacs shows messages for the user, and it is also the place where commands that
require some user input are executed. For example, when you open a file, Emacs will ask
for its name in the minibuffer.</p>
<p>Switching from one buffer to another can be done with the command <b
class="KEYCAP">C</b>-<b class="KEYCAP">x</b> <b class="KEYCAP">b</b>. This will prompt
you for the name of a buffer (a buffer's name is usually the name of the file you are
editing in it), and it gives a default choice, which is normally the buffer that you were
in before you switched to or created the current buffer. Just hitting <span
class="emphasis"><i class="EMPHASIS">Enter</i></span> will switch to that default
buffer.</p>
<p>If you want to switch to another buffer than the default offered by Emacs, just type
its name. Note that you can use so-called <b class="KEYCAP">Tab</b>-completion here: type
the first few letters of the buffer's name and hit <b class="KEYCAP">Tab</b>; Emacs will
then complete the name of the buffer. <b class="KEYCAP">Tab</b> completion works
everywhere in Emacs where it makes sense.</p>
<p>You can get a list of open buffers by hitting <b class="KEYCAP">C</b>-<b
class="KEYCAP">x</b> <b class="KEYCAP">C</b>-<b class="KEYCAP">b</b>. This command will
usually split the screen in two, displaying the buffer you were working in in the top
half, and a new buffer called *Buffer List* in the bottom half. This buffer contains a
list of all the buffers, their sizes and modes, and the files, if any, that those buffers
are visiting (as it is called in Emacs). You can get rid of this split screen by typing
<b class="KEYCAP">C</b>-<b class="KEYCAP">x</b> <b class="KEYCAP">1</b>.</p>
<div class="NOTE">
<table class="NOTE" width="100%" border="0">
<tr>
<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/note.png"
hspace="5" alt="Note" /></td>
<td align="LEFT" valign="TOP">
<p>Under X, the list of buffers is also available in the Buffer menu in the menu bar.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="EMACS-MODES" name="EMACS-MODES">17.3 Modes</a></h2>
<p>Every buffer in Emacs has an associated mode. This mode is very different from the
idea of modes in <tt class="COMMAND">vi</tt>: a mode tells you what kind of buffer you
are in. For example, there is text-mode for normal text files, but there are also modes
such as c-mode for editing C programs, sh-mode for editing shell scripts, latex-mode for
editing <b class="APPLICATION">LaTeX</b> files, mail-mode for editing email and news
messages, etc. A mode provides special customizations and functionality that is useful
for the kind of file you are editing. It is even possible for a mode to redefine keys and
key commands. For example, in Text mode, the Tab key simply jumps to the next tab stop,
but in many programming language modes, the <b class="KEYCAP">Tab</b> key indents the
current line according to the depth of the block that line is in.</p>
<p>The modes mentioned above are called major modes. Each buffer has exactly one major
mode. Additionally, a buffer can have one or more minor modes. A minor mode provides
additional features that may be useful for certain editing tasks. For example, if you hit
the <b class="KEYCAP">INSERT</b> key, you invoke overwrite-mode, which does what you'd
expect. There is also an auto-fill-mode, which is handy in combination with text-mode or
latex-mode: it causes each line that you type to be automatically wrapped once the line
reaches a certain number of characters. Without auto-fill-mode, you have to type <b
class="KEYCAP">M</b>-<b class="KEYCAP">q</b> to fill out a paragraph. (Which you can also
use to reformat a paragraph after you've edited some text in it and it is no longer
nicely filled out.)</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="EMACS-OPENING-FILES" name="EMACS-OPENING-FILES">17.3.1 Opening
files</a></h3>
<p>To open a file in Emacs, type</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<kbd class="USERINPUT">C-x C-f</kbd>
</pre>
</td>
</tr>
</table>
<p>Emacs will ask you for the name of the file, filling in some default path for you
(which is usually <tt class="FILENAME">~/</tt> ). After you type the filename (you can
use <b class="KEYCAP">Tab</b> completion) and hit <b class="KEYCAP">ENTER</b> , Emacs
will open the file in a new buffer and display that buffer on the screen.</p>
<div class="NOTE">
<table class="NOTE" width="100%" border="0">
<tr>
<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/note.png"
hspace="5" alt="Note" /></td>
<td align="LEFT" valign="TOP">
<p>Emacs will automatically create a new buffer, it will not load the file into the
current buffer.</p>
</td>
</tr>
</table>
</div>
<p>In order to create a new file in emacs, you cannot just go typing right away. You
first have to create a buffer for it, and come up with a filename. You do this by typing
<b class="KEYCAP">C</b>-<b class="KEYCAP">x</b> <b class="KEYCAP">C</b>-<b
class="KEYCAP">f</b> and typing a filename, just as if you were opening an existing file.
Emacs will notice that the file you typed doesn't exist, and will create a new buffer and
report “(New file)” in the minibuffer.</p>
<p>When you type <b class="KEYCAP">C</b>-<b class="KEYCAP">x</b> <b
class="KEYCAP">C</b>-<b class="KEYCAP">f</b> and then enter a directory name instead of a
filename, Emacs will create a new buffer in which you will find a list of all the files
in that directory. You can move the cursor to the file that you are looking for and type
, and Emacs will open it. (There are in fact a lot more actions you can perform here,
such as deleting, renaming and moving files, etc. Emacs is now in dired-mode, which is
basically a simple file manager.)</p>
<p>When you have typed <b class="KEYCAP">C</b>-<b class="KEYCAP">x</b> <b
class="KEYCAP">C</b>-<b class="KEYCAP">f</b> and suddenly change your mind, you can type
<b class="KEYCAP">C</b>-<b class="KEYCAP">g</b> to cancel the action. <b
class="KEYCAP">C</b>-<b class="KEYCAP">g</b> works almost everywhere where you want to
cancel an action or command that you've started but don't want to finish.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="EMACS-BASIC-EDITING" name="EMACS-BASIC-EDITING">17.4 Basic
Editing</a></h2>
<p>When you have opened a file, you can of course move around in it with the cursor. The
<b class="KEYCAP">cursor keys</b> and <b class="KEYCAP">PgUp</b>, <b
class="KEYCAP">PgDn</b> do what you'd expect. <b class="KEYCAP">Home</b> and <b
class="KEYCAP">End</b> jump to the beginning and end of the line. (In older versions,
they would actually jump to the beginning and end of the buffer.) However, there are also
<b class="KEYCAP">Control</b> and <b class="KEYCAP">Meta</b> (<b class="KEYCAP">Alt</b>)
key combos that move the cursor around. Because you do not need to move your hands to
another part of the keyboard for these, they are much quicker once you get used to them.
The most important such commands are listed in <a href="#TABLE-EMACS-BASIC-EDITING">Table
17-1</a>.</p>
<div class="TABLE"><a id="TABLE-EMACS-BASIC-EDITING"
name="TABLE-EMACS-BASIC-EDITING"></a>
<p><b>Table 17-1. Basic Emacs Editing Commands</b></p>
<table border="0" frame="void" width="100%" class="CALSTABLE">
<col width="25%" />
<col width="75%" />
<thead>
<tr>
<th>Command</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">b</b> </td>
<td>go one character back</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">f</b> </td>
<td>go one character forward</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">n</b> </td>
<td>go one line down</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">p</b> </td>
<td>go one line up</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">a</b> </td>
<td>go to the beginning of the line</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">e</b> </td>
<td>go to the end of the line</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">b</b> </td>
<td>go one word back</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">f</b> </td>
<td>go one word forward</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">}</b> </td>
<td>go one paragraph forward</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">{</b> </td>
<td>go one paragraph backward</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">a</b> </td>
<td>go one sentence backward</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">e</b> </td>
<td>go one sentence forward</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">d</b> </td>
<td>delete the character under the cursor</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">d</b> </td>
<td>delete until the end of the current word</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">v</b> </td>
<td>go down one screen (i.e., PgDn)</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">v</b> </td>
<td>go up one screen (i.e., PgUp)</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP"><</b> </td>
<td>go to the beginning of the buffer</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">></b> </td>
<td>go to the end of the buffer</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">_</b> </td>
<td>undo the last change (can be repeated); note that you actually have to type <b
class="KEYCAP">Shift</b>+<b class="KEYCAP">Control</b>+<b class="KEYCAP">hyphen</b> for
this.</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">k</b> </td>
<td>delete to end of line</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">s</b> </td>
<td>forward search</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">r</b> </td>
<td>backward search</td>
</tr>
</tbody>
</table>
</div>
<p>Note that many <b class="KEYCAP">Meta</b> commands are parallel to the <b
class="KEYCAP">Control</b> commands except that they operate on larger units: while <b
class="KEYCAP">C</b>-<b class="KEYCAP">f</b> goes forward one character, <b
class="KEYCAP">M</b>-<b class="KEYCAP">f</b> goes forward an entire word, etc.</p>
<p>Also note that <b class="KEYCAP">M</b>-<b class="KEYCAP"><</b> and <b
class="KEYCAP">M</b>-<b class="KEYCAP">></b> require you to type <b
class="KEYCAP">Shift</b>+<b class="KEYCAP">Alt</b>+<b class="KEYCAP">comma</b> and <b
class="KEYCAP">Shift</b>+<b class="KEYCAP">Alt</b>+<b class="KEYCAP">dot</b>
respectively, since <b class="KEYCAP"><</b> and <b class="KEYCAP">></b> are on <b
class="KEYCAP">Shift</b>+<b class="KEYCAP">comma</b> and <b class="KEYCAP">Shift</b>+<b
class="KEYCAP">dot</b>. (Unless of course you have a different keyboard layout from the
standard US layout.)</p>
<p>Note that <b class="KEYCAP">C</b>-<b class="KEYCAP">k</b> deletes (kills, as it is
commonly called) all the text after the cursor to the end of the line, but doesn't delete
the line itself (i.e., it doesn't delete the final newline). It only deletes the line if
there was no text after the cursor. In other words, in order to delete a complete line,
you have to put the cursor at the beginning of the line, and then hit <b
class="KEYCAP">C</b>-<b class="KEYCAP">k</b> twice: once to delete the text on the line,
once to delete the line itself.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="EMACS-SAVING-FILES" name="EMACS-SAVING-FILES">17.5 Saving
Files</a></h2>
<p>In order to save a file, you type</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<kbd class="USERINPUT">C-x C-s</kbd>
</pre>
</td>
</tr>
</table>
<p>Emacs will not ask you for a filename, the buffer will just be saved to the file it
was loaded from. If you want to save your text to another file, type</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<kbd class="USERINPUT">C-x C-w</kbd>
</pre>
</td>
</tr>
</table>
<p>When you save the file for the first time in this session, Emacs will normally save
the old version of your file to a backup file, which has the same name appended with a
tilde: so if you're editing a file “<tt class="FILENAME">cars.txt</tt>”,
Emacs will create a backup “<tt class="FILENAME">cars.txt~</tt>”.</p>
<p>This backup file is a copy of the file that you opened. While you are working, Emacs
will also regularly create an auto-save copy of the work you are doing, to a file named
with hash signs: <tt class="FILENAME">#cars.txt#</tt>. This backup is deleted when you
save the file with C-x C-s.</p>
<p>When you are done editing a file, you can kill the buffer that holds it by typing</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<kbd class="USERINPUT">C-x k</kbd>
</pre>
</td>
</tr>
</table>
<p>Emacs will then ask you which buffer you want to kill, with the current buffer as
default, which you can select by hitting <b class="KEYCAP">ENTER</b>. If you haven't
saved your file yet, Emacs will ask you if you really want to kill the buffer.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="EMACS-QUITING" name="EMACS-QUITING">17.5.1 Quitting
Emacs</a></h3>
<p>When you are done with Emacs altogether, you can type</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<kbd class="USERINPUT">C-x C-c</kbd>
</pre>
</td>
</tr>
</table>
<p>This quits Emacs. If you have any unsaved files, Emacs will tell you so, and ask if
you want to save them each in turn. If you answer no to any of these, Emacs will ask for
one final confirmation and then quit.</p>
</div>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="PACKAGE-MANAGEMENT" name="PACKAGE-MANAGEMENT"></a>Chapter 18 Slackware Package
Management</h1>
<p>A software package is a bundle of related programs that are ready for you to install.
When you download a source code archive, you have to configure, compile, and install it
by hand. With a software package, this has already been done for you. All that you have
to do is install the package. Another handy feature of using software packages is that it
is very easy to remove and upgrade them, if you so desire. Slackware comes with programs
for all your package management needs. You can install, remove, upgrade, make, and
examine packages very easily.</p>
<p>There's a myth that's been going around ever since RedHat debuted RedHat Package
Manager, that Slackware has no package management tool. This simply couldn't be further
from the truth. Slackware has always included a package manager, even before RedHat
existed. While not as full-featured or as ubiquitous as rpm (or for that matter deb), <tt
class="COMMAND">pkgtool</tt> and its associated programs are every bit as good at
installing packages as rpm. The truth about <tt class="COMMAND">pkgtool</tt> is not that
it doesn't exist, but that it doesn't do any dependency checking.</p>
<p>Apparently many people in the Linux community think that a packager manager must by
definition include dependency checking. Well, that simply isn't the case, as Slackware
most certainly does not. This is not to say that Slackware packages don't have
dependencies, but rather that its package manager doesn't check for them. Dependency
management is left up to the sysadmin, and that's the way we like it.</p>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="PACKAGE-MANAGEMENT-OVERVIEW"
name="PACKAGE-MANAGEMENT-OVERVIEW">18.1 Overview of Package Format</a></h2>
<p>Before learning the utilities, you should become familiar with the format of a
Slackware package. In Slackware, a package is simply a tar archive file that has been
compressed with <tt class="COMMAND">gzip</tt>. Packages are built to be extracted in the
root directory.</p>
<p>Here is a fictitious program and its example package:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
./
usr/
usr/bin/
usr/bin/makehejaz
usr/doc/
usr/doc/makehejaz-1.0/
usr/doc/makehejaz-1.0/COPYING
usr/doc/makehejaz-1.0/README
usr/man/
usr/man/man1
usr/man/man1/makehejaz.1.gz
install/
install/doinst.sh
</pre>
</td>
</tr>
</table>
<p>The package system will extract this file in the root directory to install it. An
entry in the package database will be created that contains the contents of this package
so that it can be upgraded or removed later.</p>
<p>Notice the <tt class="FILENAME">install/</tt> subdirectory. This is a special
directory that can contain a postinstallation script called <tt
class="FILENAME">doinst.sh</tt>. If the package system finds this file, it will execute
it after installing the package.</p>
<p>Other scripts can be embedded in the package, but those are discussed more in detail
in <a href="#PACKAGE-MANAGEMENT-MAKEPKG">Section 18.3.2</a> below.</p>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="PACKAGE-MANAGEMENT-PACKAGE-UTILITIES"
name="PACKAGE-MANAGEMENT-PACKAGE-UTILITIES">18.2 Package Utilities</a></h2>
<p>There are four main utilities for package management. They perform installation,
removal, and upgrades of packages.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-PKGTOOL"
name="PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-PKGTOOL">18.2.1 pkgtool</a></h3>
<p><tt class="COMMAND">pkgtool</tt>(8) is a menu-driven program that allows installation
and removal of packages. The main menu is shown in <a href="#PKGTOOL-MAIN-MENU">Figure
18-1</a>.</p>
<div class="FIGURE"><a id="PKGTOOL-MAIN-MENU" name="PKGTOOL-MAIN-MENU"></a>
<p><b>Figure 18-1. Pkgtool's main menu.</b></p>
<p><img src="package-management/pkgtool-w.png" /></p>
</div>
<p>Installation is offered from the current directory, another directory, or from floppy
disks. Simply select the installation method you want and pkgtool will search that
location for valid packages to install.</p>
<p>You may also view a list of installed packages, as shown in <a
href="#PKGTOOL-VIEW-MODE">Figure 18-2</a>.</p>
<div class="FIGURE"><a id="PKGTOOL-VIEW-MODE" name="PKGTOOL-VIEW-MODE"></a>
<p><b>Figure 18-2. Pkgtool view mode</b></p>
<p><img src="package-management/pkgtool-view-w.png" /></p>
</div>
<p>If you want to remove packages, select the remove option and you will be presented
with a checklist of all the installed packages. Flag the ones you want to remove and
select OK. <tt class="COMMAND">pkgtool</tt> will remove them.</p>
<p>Some users prefer this utility to the command line utilities. However, it should be
noted that the command line utilities offer many more options. Also, the ability to
upgrade packages is only offered through the command line utilities.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-INSTALLPKG"
name="PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-INSTALLPKG">18.2.2 installpkg</a></h3>
<p><tt class="COMMAND">installpkg</tt>(8) handles installation of new packages on the
system. The syntax is as follows:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">installpkg option package_name</kbd>
</pre>
</td>
</tr>
</table>
<p>Three options are provided for <tt class="COMMAND">installpkg</tt>. Only one option
can be used at a time.</p>
<div class="TABLE"><a id="AEN6446" name="AEN6446"></a>
<p><b>Table 18-1. <tt class="COMMAND">installpkg</tt> Options</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col width="1*" />
<col width="3*" />
<thead>
<tr>
<th align="LEFT">Option</th>
<th align="LEFT">Effects</th>
</tr>
</thead>
<tbody>
<tr>
<td>-m</td>
<td>Performs a makepkg operation on the current directory.</td>
</tr>
<tr>
<td>-warn</td>
<td>Shows what would happen if you installed the specified package. This is useful for
production systems so you can see exactly what would happen before installing
something.</td>
</tr>
<tr>
<td>-r</td>
<td>Recursively install all packages in the current directory and down. The package name
can use wildcards, which would be used as the search mask when recursively
installing.</td>
</tr>
</tbody>
</table>
</div>
<p>If you pass the <tt class="ENVAR">ROOT</tt> environment variable before <tt
class="COMMAND">installpkg</tt>, that path will be used for the root directory. This is
useful for setting up new drives for your root directory. They will typically be mounted
to <tt class="FILENAME">/mnt</tt> or something other than <tt
class="FILENAME">/</tt>.</p>
<p>The installed package database entry is stored in <tt
class="FILENAME">/var/log/packages</tt>. The entry is really just a plain text file, one
for each package. If the package has a postinstallation script, it is written to <tt
class="FILENAME">/var/log/scripts/</tt>.</p>
<p>You may specify several packages or use wildcards for the package name. Be advised
that <tt class="COMMAND">installpkg</tt> will not tell you if you are overwriting an
installed package. It will simply install right on top of the old one. If you want to
ensure that old files from the previous package are safely removed, use <tt
class="COMMAND">upgradepkg</tt>.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-REMOVEPKG"
name="PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-REMOVEPKG">18.2.3 removepkg</a></h3>
<p><tt class="COMMAND">removepkg</tt>(8) handles removing installed packages from the
system. The syntax is as follows:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">removepkg option package_name</kbd>
</pre>
</td>
</tr>
</table>
<p>Four options are provided for <tt class="COMMAND">removepkg</tt>. Only one option may
be used at a time.</p>
<div class="TABLE"><a id="AEN6491" name="AEN6491"></a>
<p><b>Table 18-2. <tt class="COMMAND">removepkg</tt> Options</b></p>
<table border="0" frame="void" class="CALSTABLE">
<col width="1*" />
<col width="3*" />
<thead>
<tr>
<th>Option</th>
<th>Effects</th>
</tr>
</thead>
<tbody>
<tr>
<td>-copy</td>
<td>The package is copied to the preserved packages directory. This creates a tree of the
original package without removing it.</td>
</tr>
<tr>
<td>-keep</td>
<td>Saves temporary files created during the removal. Really only useful for debugging
purposes.</td>
</tr>
<tr>
<td>-preserve</td>
<td>The package is removed, but copied to the preserved packages directory at the same
time.</td>
</tr>
<tr>
<td>-warn</td>
<td>Shows what would happen if you removed the package.</td>
</tr>
</tbody>
</table>
</div>
<p>If you pass the <tt class="ENVAR">ROOT</tt> environment variable before <tt
class="COMMAND">removepkg</tt>, that path will be used for the root directory. This is
useful for setting up new drives for your root directory. They will typically be mounted
to <tt class="FILENAME">/mnt</tt> or something other than <tt
class="FILENAME">/</tt>.</p>
<p><tt class="COMMAND">removepkg</tt> looks at the other installed packages and only
removes files unique to the package you specify. It will also scan the postinstallation
script for the specified package and remove any symbolic links that were created by
it.</p>
<p>During the removal process, a status report is displayed. After the removal, the
package database entry is moved to <tt class="FILENAME">/var/log/removed_packages</tt>
and the postinstallation script is moved to <tt
class="FILENAME">/var/log/removed</tt>_scripts.</p>
<p>Just as with <tt class="COMMAND">installpkg</tt>, you can specify several packages or
use wildcards for the package name.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-UPGRADEPKG"
name="PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-UPGRADEPKG">18.2.4 upgradepkg</a></h3>
<p><tt class="COMMAND">upgradepkg</tt>(8) will upgrade an installed Slackware package.
The syntax is as follows:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">upgradepkg package_name</kbd>
</pre>
</td>
</tr>
</table>
<p>or</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd
class="USERINPUT">upgradepkg old_package_name%new_package_name</kbd>
</pre>
</td>
</tr>
</table>
<p><tt class="COMMAND">upgradepkg</tt> works by first installing the new package and then
removing the old package so that old files are no longer around on the system. If the
upgraded package name has changed, use the percent sign syntax to specify the old package
(the one that is installed) and the new package (the one you are upgrading it to).</p>
<p>If you pass the <tt class="ENVAR">ROOT</tt> environment variable before <tt
class="COMMAND">upgradepkg</tt>, that path will be used for the root directory. This is
useful for setting up new drives for your root directory. They will typically be mounted
to <tt class="FILENAME">/mnt</tt> or something other than <tt
class="FILENAME">/</tt>.</p>
<p><tt class="COMMAND">upgradepkg</tt> is not flawless. You should always back up your
configuration files. If they get removed or overwritten, you'll want a copy of the
originals for any needed repair work.</p>
<p>Just as with <tt class="COMMAND">installpkg</tt> and <tt
class="COMMAND">removepkg</tt>, you can specify several packages or use wildcards for the
package name.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-RPM"
name="PACKAGE-MANAGEMENT-PACKAGE-UTILITIES-RPM">18.2.5 <tt
class="COMMAND">rpm2tgz</tt>/<tt class="COMMAND">rpm2targz</tt></a></h3>
<p>The Red Hat Package Manager is a popular packaging system available today. Many
software distributors are offering their products in RPM format. Since this is not our
native format, we do not recommend people rely on them. However, some things are only
available as an RPM (even the source).</p>
<p>We provide a program that will convert RPM packages to our native <tt
class="FILENAME">.tgz</tt> format. This will allow you to extract the package (perhaps
with <tt class="COMMAND">explodepkg</tt>) to a temporary directory and examine its
contents.</p>
<p>The <tt class="COMMAND">rpm2tgz</tt> program will create a Slackware package with a
<tt class="FILENAME">.tgz</tt> extension, while <tt class="FILENAME">rpm2targz</tt>
creates an archive with a <tt class="FILENAME">.tar.gz</tt> extension.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="PACKAGE-MANAGEMENT-MAKING-PACKAGES"
name="PACKAGE-MANAGEMENT-MAKING-PACKAGES">18.3 Making Packages</a></h2>
<p>Making Slackware packages can be either easy or difficult. There is no specific method
for building a package. The only requirement is that the package be a tar gzipped file
and if there is a postinstallation script, it must be <tt
class="FILENAME">/install/doinst.sh</tt>.</p>
<p>If you are interested in making packages for your system or for a network that you
manage, you should have a look at the various build scripts in the Slackware source tree.
There are several methods we use for making packages.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="PACKAGE-MANAGEMENT-EXPLODEPKG"
name="PACKAGE-MANAGEMENT-EXPLODEPKG">18.3.1 <tt class="COMMAND">explodepkg</tt></a></h3>
<p><tt class="COMMAND">explodepkg</tt>(8) will do the same thing that <tt
class="COMMAND">installpkg</tt> does to extract the package, but it doesn't actually
install it and it doesn't record it in the packages database. It simply extracts it to
the current directory.</p>
<p>If you look at the Slackware source tree, you will see how we use this command for
“framework” packages. These packages contain a skeleton of what the final
package will look like. They hold all the necessary filenames (zero-length), permissions,
and ownerships. The build script will cat the package contents from the source directory
to the package build directory.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="PACKAGE-MANAGEMENT-MAKEPKG"
name="PACKAGE-MANAGEMENT-MAKEPKG">18.3.2 <tt class="COMMAND">makepkg</tt></a></h3>
<p><tt class="COMMAND">makepkg</tt>(8) will package up the current directory into a valid
Slackware package. It will search the tree for any symbolic links and add a creation
block to the postinstallation script for creating them during the package install. It
also warns of any zero-length files in the package tree.</p>
<p>This command is typically run after you have created your package tree.</p>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="PACKAGE-MANAGEMENT-SLACKBUILD-SCRIPTS"
name="PACKAGE-MANAGEMENT-SLACKBUILD-SCRIPTS">18.3.3 SlackBuild Scripts</a></h3>
<p>Slackware packages are built in many different ways by necessity. Not all software
packages are written by their programmers to compile the same way. Many have compile time
options that are not all included in the packages Slackware uses. Perhaps you need some
of this functionality; you'll need to compile your own package then. Fortunately for many
Slackware packages, you can find SlackBuild scripts in the package's source code.</p>
<p>So what is a SlackBuild script? SlackBuild scripts are executable shell scripts that
you run as <tt class="USERNAME">root</tt> to configure, compile, and create Slackware
packages. You can freely modify these scripts in the source directory and run them to
create your own versions of the default Slackware packages.</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="PACKAGE-MANAGEMENT-MAKING-TAGS-AND-TAGFILES"
name="PACKAGE-MANAGEMENT-MAKING-TAGS-AND-TAGFILES">18.4 Making Tags and Tagfiles (for
setup)</a></h2>
<p>The Slackware setup program handles installation of the software packages on your
system. There are files that tell the setup program which packages must be installed,
which ones are optional, and which ones are selected by default by the setup program.</p>
<p>A tagfile is in the first software series directory and is called tagfile. It lists
the packages in that particular disk set and their status. The status can be:</p>
<div class="TABLE"><a id="AEN6621" name="AEN6621"></a>
<p><b>Table 18-3. Tagfile Status Options</b></p>
<table border="0" frame="void" width="100%" class="CALSTABLE">
<col width="25%" />
<col width="75%" />
<thead>
<tr>
<th>Option</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>ADD</td>
<td>The package is required for proper system operation</td>
</tr>
<tr>
<td>SKP</td>
<td>The package will be automatically skipped</td>
</tr>
<tr>
<td>REC</td>
<td>The package is not required, but recommended</td>
</tr>
<tr>
<td>OPT</td>
<td>The package is optional</td>
</tr>
</tbody>
</table>
</div>
<p>The format is simply:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
package_name: status
</pre>
</td>
</tr>
</table>
<p>One package per line. The original tagfiles for each software series are stored as
tagfile.org. So if you mess up yours, you can restore the original one.</p>
<p>Many administrators prefer writing their own tagfiles and starting the installer and
selecting “full”. The setup program will read the tagfiles and perform the
installation according to their contents. If you use REC or OPT, a dialog box will be
presented to the user asking whether or not they want a particular package. Therefore, it
is recommended that you stick with ADD and SKP when writing tagfiles for automated
installs.</p>
<p>Just make sure your tagfiles are written to the same location as the originals. Or you
can specify a custom tagfile path if you have custom tagfiles.</p>
</div>
</div>
<div class="CHAPTER">
<hr />
<h1><a id="ZIPSLACK" name="ZIPSLACK"></a>Chapter 19 ZipSlack</h1>
<div class="SECT1">
<h2 class="SECT1"><a id="ZIPSLACK-WHAT" name="ZIPSLACK-WHAT">19.1 What is
ZipSlack?</a></h2>
<p>ZipSlack is a special version of Slackware Linux. It's an already installed copy of
Slackware that's ready to run from your DOS or Windows partition. It's a basic
installation, you do not get everything that comes with Slackware.</p>
<p>ZipSlack gets its name from the form it's distributed in, a big .ZIP file. Users of
DOS and Windows will probably be familiar with these files. They are compressed archives.
The ZipSlack archive contains everything you need to get up and running with
Slackware.</p>
<p>It is important to note that ZipSlack is significantly different from a regular
installation. Even though they function the same and contain the same programs, their
intended audiences and functions differ. Several advantages and disadvantages of ZipSlack
are discussed below.</p>
<p>One last thing, you should always review the documentation included in the actual
ZipSlack directory. It contains the latest information regarding installation, booting,
and general use of the product.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="ZIPSLACK-ADVANTAGES" name="ZIPSLACK-ADVANTAGES">19.1.1
Advantages</a></h3>
<ul>
<li>
<p>Does not require repartitioning of your hard disk.</p>
</li>
<li>
<p>Great way to learn Slackware Linux without stumbling through the installation
process.</p>
</li>
</ul>
</div>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="ZIPSLACK-DISADVANTAGES" name="ZIPSLACK-DISADVANTAGES">19.1.2
Disadvantages</a></h3>
<ul>
<li>
<p>Uses the DOS filesystem, which is slower than a native Linux filesystem.</p>
</li>
<li>
<p>Will not work with Windows NT.</p>
</li>
</ul>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="ZIPSLACK-GETTING" name="ZIPSLACK-GETTING">19.2 Getting
ZipSlack</a></h2>
<p>Obtaining ZipSlack is easy. If you have purchased the official Slackware Linux CD set,
then you already have ZipSlack. Just find the CD that contains the <tt
class="FILENAME">zipslack</tt> directory and place it in your CD-ROM drive. It's usually
the third or fourth disc, but always trust the labels over this documentation as the disk
it resides on is prone to change.</p>
<p>If you want to download ZipSlack, you should first visit our “Get Slack”
web page for the latest download information:</p>
<p><a href="http://www.slackware.com/getslack/"
target="_top">http://www.slackware.com/getslack/</a></p>
<p>ZipSlack is part of each Slackware release. Locate the release you want, and go to
that directory on the FTP site. The latest release directory can be found at this
location:</p>
<p><a href="ftp://ftp.slackware.com/pub/slackware/slackware/"
target="_top">ftp://ftp.slackware.com/pub/slackware/slackware/</a></p>
<p>You'll find ZipSlack in the <tt class="FILENAME">/zipslack</tt> subdirectory. ZipSlack
is offered as one big <tt class="FILENAME">.ZIP</tt> file or floppy-sized chunks. The
chunks are in the <tt class="FILENAME">/zipslack/split</tt> directory.</p>
<p>Don't stop at just the <tt class="FILENAME">.ZIP</tt> files. You should also download
the documentation files and any boot images that appear in the directory.</p>
<div class="SECT2">
<hr />
<h3 class="SECT2"><a id="ZIPSLACK-INSTALLATION" name="ZIPSLACK-INSTALLATION">19.2.1
Installation</a></h3>
<p>Once you've downloaded the necessary components, you'll need to extract the <tt
class="FILENAME">.ZIP</tt> file. Be sure to use a 32-bit unzipper. The size and filenames
in the archive are too much for a 16-bit unzipper. Examples of 32-bit unzippers include
WinZip and PKZIP for Windows.</p>
<p>ZipSlack is designed to be extracted directly to the root directory of a drive (such
as <tt class="DEVICENAME">C:</tt> or <tt class="DEVICENAME">D:</tt>). A <tt
class="FILENAME">\LINUX</tt> directory will be created that contains the actual Slackware
installation. You'll also find the files necessary to booting the system in that
directory as well.</p>
<p>After you've extracted the files, you should have a <tt class="FILENAME">\LINUX</tt>
directory on the drive of your choosing (we'll use <tt class="DEVICENAME">C:</tt> from
here on).</p>
</div>
</div>
<div class="SECT1">
<hr />
<h2 class="SECT1"><a id="ZIPSLACK-BOOTING" name="ZIPSLACK-BOOTING">19.3 Booting
ZipSlack</a></h2>
<p>There are several ways to boot ZipSlack. The most common is to use the included
LINUX.BAT to boot the system from DOS (or from DOS mode under Windows 9x). This file must
be edited to match your system before it will work.</p>
<p>Start by opening the <tt class="FILENAME">C:\LINUX\LINUX.BAT</tt> file in your
favorite text editor. At the top of the file you will notice a large comment. It explains
what you need to edit in this file (and also what to do if you are booting from an
external Zip drive). Don't worry if you don't understand the <var
class="LITERAL">root=</var> setting. There are several examples, so feel free to pick one
and try it. If it doesn't work, you can edit the file again, comment out the line you
uncommented, and pick another one.</p>
<p>After you uncomment the line you want by removing the “rem” at the
beginning of the line, save the file and exit the editor. Bring your machine into DOS
mode.</p>
<p>A DOS prompt window in Windows 9x will NOT work.</p>
<p>Type <tt class="COMMAND">C:\LINUX\LINUX.BAT</tt> to boot the system. If all goes well,
you should be presented with a login prompt.</p>
<p>Log in as <tt class="USERNAME">root</tt>, with no password. You'll probably want to
set a password for root, as well as adding an account for yourself. At this point you can
refer to the other sections in this book for general system usage.</p>
<p>If using the <tt class="FILENAME">LINUX.BAT</tt> file to boot the system didn't work
for you, you should refer to the included <tt class="FILENAME">C:\LINUX\README.1ST</tt>
file for other ways to boot.</p>
</div>
</div>
<div class="GLOSSARY">
<h1><a id="GLOSSARY" name="GLOSSARY"></a>Glossary</h1>
<dl>
<dt><b>Account</b></dt>
<dd>
<p>All of the information about a user, including username, password, finger information,
UID and GID, and home directory. To create an account is to add and define a user.</p>
</dd>
<dt><b>Background</b></dt>
<dd>
<p>Any process that is running without accepting or controlling the input of a terminal
is said to be running in the background.</p>
</dd>
<dt><b>Boot disk</b></dt>
<dd>
<p>A floppy disk containing an operating system (in our case, the Linux kernel) from
which a computer can be started.</p>
</dd>
<dt><b>Compile</b></dt>
<dd>
<p>To convert source code to machine-readable “binary” code.</p>
</dd>
<dt><b>Daemon</b></dt>
<dd>
<p>A program designed to run in the background and, without user intervention, perform a
specific task (usually providing a service).</p>
</dd>
<dt><b>Darkstar</b></dt>
<dd>
<p>The default hostname in Slackware; your computer will be called darkstar if you do not
specify some other name.</p>
<p>One of Patrick Volkerding's development machines, named after “Dark Star”,
a song by the Grateful Dead.</p>
</dd>
<dt><b>Desktop Environment</b></dt>
<dd>
<p>A graphical user interface (GUI) that runs atop the X Window System and provides such
features as integrated applications, cohesive look-and-feel between programs and
components, file and window management capabilities, etc. A step beyond the simple window
manager.</p>
</dd>
<dt><b>Device driver</b></dt>
<dd>
<p>A chunk of code in the kernel that directly controls a piece of hardware.</p>
</dd>
<dt><b>Device node</b></dt>
<dd>
<p>A special type of file in the <tt class="FILENAME">/dev</tt> filesystem that
represents a hardware component to the operating system.</p>
</dd>
<dt><b>DNS</b></dt>
<dd>
<p>Domain Name Service. A system in which networked computers are given names which
translate to numerical addresses.</p>
</dd>
<dt><b>Domain name</b></dt>
<dd>
<p>A computer's DNS name, excluding its host name.</p>
</dd>
<dt><b>Dot file</b></dt>
<dd>
<p>In Linux, files which are to be hidden have filenames beginning with a dot ('.').</p>
</dd>
<dt><b>Dotted quad</b></dt>
<dd>
<p>The format of IP addresses, so called because it consists of four numbers (range 0-255
decimal) separated by periods.</p>
</dd>
<dt><b>Dynamic loader</b></dt>
<dd>
<p>When programs are compiled under Linux, they usually use pieces of code (functions)
from external libraries. When such programs are run, those libraries must be found and
the required functions loaded into memory. This is the job of the dynamic loader.</p>
</dd>
<dt><b>Environment variable</b></dt>
<dd>
<p>A variable set in the user's shell which can be referenced by that user or programs
run by that user within that shell. Environment variables are generally used to store
preferences and default parameters.</p>
</dd>
<dt><b>Epoch</b></dt>
<dd>
<p>A period of history; in Unix, “The Epoch” begins at 00:00:00 UTC January
1, 1970. This is considered the “dawn of time” by Unix and Unix-like
operating systems, and all other time is calculated relative to this date.</p>
</dd>
<dt><b>Filesystem</b></dt>
<dd>
<p>A representation of stored data in which “files” of data are kept
organized in “directories”. The filesystem is the nearly universal form of
representation for data stored to disks (both fixed and removable).</p>
</dd>
<dt><b>Foreground</b></dt>
<dd>
<p>A program that is accepting or controlling a terminal's input is said to be running in
the foreground.</p>
</dd>
<dt><b>Framebuffer</b></dt>
<dd>
<p>A type of graphics device; in Linux, this most often refers to the software
framebuffer, which provides a standard framebuffer interface to programs while keeping
specific hardware drivers hidden from them. This layer of abstraction frees programs of
the need to speak to various hardware drivers.</p>
</dd>
<dt><b>FTP</b></dt>
<dd>
<p>The File Transfer Protocol. FTP is a very popular method of transferring data between
computers.</p>
</dd>
<dt><b>Gateway</b></dt>
<dd>
<p>A computer through which data on a network is transferred to another network.</p>
</dd>
<dt><b>GID</b></dt>
<dd>
<p>Group Identifier. The GID is a unique number attributed to a group of users.</p>
</dd>
<dt><b>Group</b></dt>
<dd>
<p>Users in Unix belong to “groups”, which can contain many other users and
are used for more general access control than the existence of users alone can easily
allow.</p>
</dd>
<dt><b>GUI</b></dt>
<dd>
<p>Graphical User Interface. A software interface that uses rendered graphical elements
such as buttons, scrollbars, windows, etc. rather than solely text-based input and
output</p>
</dd>
<dt><b>Home directory</b></dt>
<dd>
<p>A user's “home directory” is the directory the user is placed in
immediately upon logging in. Users have full permissions and more or less free reign
within their home directories.</p>
</dd>
<dt><b>HOWTO</b></dt>
<dd>
<p>A document describing “how to” do something, such as configure a firewall
or manage users and groups. There is a large collection of these documents available from
the Linux Documentation Project.</p>
</dd>
<dt><b>HTTP</b></dt>
<dd>
<p>The Hypertext Transfer Protocol. HTTP is the primary protocol on which the World Wide
Web operates.</p>
</dd>
<dt><b>ICMP</b></dt>
<dd>
<p>Internet Control Message Protocol. A very basic networking protocol, used mostly for
pings.</p>
</dd>
<dt><b>Kernel</b></dt>
<dd>
<p>The heart of an operating system. The kernel is the part that provides basic process
control and interfaces with the computer's hardware.</p>
</dd>
<dt><b>Kernel module</b></dt>
<dd>
<p>A piece of kernel code, usually a driver of some sort, that can be loaded and unloaded
from memory separately from the main body of the kernel. Modules are handy when upgrading
drivers or testing kernel settings, because they can be loaded and unloaded without
rebooting.</p>
</dd>
<dt><b>Library</b></dt>
<dd>
<p>A collection of functions which can be shared between programs.</p>
</dd>
<dt><b>LILO</b></dt>
<dd>
<p>The LInux LOader. LILO is the most widely-used Linux boot manager.</p>
</dd>
<dt><b>LOADLIN</b></dt>
<dd>
<p>LOADLIN is a program that runs under MS DOS or Windows and boots a Linux system. It is
most commonly used on computers with multiple operating systems (including Linux and
DOS/Windows, of course).</p>
</dd>
<dt><b>Man section</b></dt>
<dd>
<p>Pages in the standard Unix online manual ("man") are grouped into sections for easy
reference. All C programming pages are in section 3, system administration pages in
section 5, etc.</p>
</dd>
<dt><b>MBR</b></dt>
<dd>
<p>The Master Boot Record. A reserved space on a hard drive where information on what to
do when booting is stored. LILO or other boot managers can be written here.</p>
</dd>
<dt><b>Motif</b></dt>
<dd>
<p>A popular programming toolkit used in many older X programs.</p>
</dd>
<dt><b>MOTD</b></dt>
<dd>
<p>Message of the Day. The motd (stored in Linux in <tt class="FILENAME">/etc/motd</tt>
is a text file that is displayed to all users upon logging in. Traditionally, it is used
by the system administrator as a sort of “bulletin board” for communicating
with users.</p>
</dd>
<dt><b>Mount point</b></dt>
<dd>
<p>An empty directory in a filesystem where another filesystem is to be
“mounted”, or grafted on.</p>
</dd>
<dt><b>Nameserver</b></dt>
<dd>
<p>A DNS information server. Nameservers translate DNS names to numerical IP
addresses.</p>
</dd>
<dt><b>Network interface</b></dt>
<dd>
<p>A virtual representation of a network device provided by the kernel. Network
interfaces allow users and programs to talk to network devices.</p>
</dd>
<dt><b>NFS</b></dt>
<dd>
<p>The Network Filesystem. NFS allows the mounting of remote filesystems as if they were
local to your computer and thus provides a transparent method of file sharing.</p>
</dd>
<dt><b>Octal</b></dt>
<dd>
<p>Base-8 number system, with digits 0-7.</p>
</dd>
<dt><b>Pager</b></dt>
<dd>
<p>An X program that allows the user to see and switch between multiple
“desktops”.</p>
</dd>
<dt><b>Partition</b></dt>
<dd>
<p>A division of a hard drive. Filesystems exist on top of partitions.</p>
</dd>
<dt><b>PPP</b></dt>
<dd>
<p>Point-to-Point Protocol. PPP is used mainly for connecting via modem to an Internet
Service Provider.</p>
</dd>
<dt><b>Process</b></dt>
<dd>
<p>A running program.</p>
</dd>
<dt><b>Root directory</b></dt>
<dd>
<p>Represented as “/”, the root directory exists at the top of the
filesystem, with all other directories branching out beneath it in a “file
tree”.</p>
</dd>
<dt><b>Root disk</b></dt>
<dd>
<p>The disk (usually fixed) on which the root directory is stored.</p>
</dd>
<dt><b>Routing table</b></dt>
<dd>
<p>The set of information the kernel uses in “routing” network data around.
It contains such tidbits as where your default gateway is, which network interface is
connected to which network, etc.</p>
</dd>
<dt><b>Runlevel</b></dt>
<dd>
<p>The overall system state as defined by init. Runlevel 6 is rebooting, runlevel 1 is
“single user mode”, runlevel 4 is an X login, etc. There are 6 available
runlevels on a Slackware system.</p>
</dd>
<dt><b>Secure shell</b></dt>
<dd>
<p>An encrypted (thus secure) method of logging in remotely to a computer. Many secure
shell programs are available; both a client and server are needed.</p>
</dd>
<dt><b>Service</b></dt>
<dd>
<p>The sharing of information and/or data between programs and computers from a single
“server” to multiple “clients”. HTTP, FTP, NFS, etc. are
services.</p>
</dd>
<dt><b>Shadow password suite</b></dt>
<dd>
<p>The shadow password suite allows encrypted passwords to be hidden from users, while
the rest of the information in the <tt class="FILENAME">/etc/passwd</tt> file remains
visible to all. This helps prevent brute-force attempts at cracking passwords.</p>
</dd>
<dt><b>Shell</b></dt>
<dd>
<p>Shells provide a commandline interface to the user. When you're looking at a text
prompt, you're in a shell.</p>
</dd>
<dt><b>Shell builtin</b></dt>
<dd>
<p>A command built into the shell, as opposed to being provided by an external program.
For instance, <tt class="COMMAND">bash</tt> has a <tt class="COMMAND">cd</tt>
builtin.</p>
</dd>
<dt><b>Signal</b></dt>
<dd>
<p>Unix programs can communicate between each other using simple “signals”,
which are enumerated and usually have specific meanings. <tt class="COMMAND">kill -l</tt>
will list the available signals.</p>
</dd>
<dt><b>SLIP</b></dt>
<dd>
<p>Serial Line Interface Protocol. SLIP is a similar protocol to PPP, in that it's used
for connecting two machines via a serial interface.</p>
</dd>
<dt><b>Software package</b></dt>
<dd>
<p>A program and its associated files, archived and compressed into a single file along
with any necessary scripts or information to aid in managing the installation, upgrade,
and removal of those files.</p>
</dd>
<dt><b>Software series</b></dt>
<dd>
<p>A collection of related software packages in Slackware. All KDE packages are in the
“kde” series, networking packages in the “n” series, etc.</p>
</dd>
<dt><b>Source code</b></dt>
<dd>
<p>The (more or less) human-readable code in which most programs are written. Source code
is compiled into “binary” code.</p>
</dd>
<dt><b>Standard Error (stderr)</b></dt>
<dd>
<p>The Unix-standard output stream for errors. Programs write any error messages on
stderr, so that they can be separated from normal output.</p>
</dd>
<dt><b>Standard Input (stdin)</b></dt>
<dd>
<p>The Unix-standard input stream. Data can be redirected or piped into a program's stdin
from any source.</p>
</dd>
<dt><b>Standard Output (stdout)</b></dt>
<dd>
<p>The Unix-standard output stream. Normal text output from a program is written to
stdout, which is separate from the error messages reported on stderr and can be piped or
redirected into other programs' stdin or to a file.</p>
</dd>
<dt><b>Subnet</b></dt>
<dd>
<p>An IP address range that is part of a larger range. For instance, 192.168.1.0 is a
subnet of 192.168.0.0 (where 0 is a mask meaning “undefined”); it is, in
fact, the “.1” subnet.</p>
</dd>
<dt><b>Superblock</b></dt>
<dd>
<p>In Linux, partitions are discussed in terms of blocks. A block is 512 bytes. The
superblock is the first 512 bytes of a partition.</p>
</dd>
<dt><b>Supplemental disk</b></dt>
<dd>
<p>In Slackware, a floppy disk used during installation that contains neither the kernel
(which is on the boot disk) nor the root filesystem (which is on the root disk), but
additional needed files such as network modules or PCMCIA support.</p>
</dd>
<dt><b>Suspended process</b></dt>
<dd>
<p>A process which has been frozen until killed or resumed.</p>
</dd>
<dt><b>Swap space</b></dt>
<dd>
<p>Disk space used by the kernel as “virtual” RAM. It is slower than RAM, but
because disk space is cheaper, swap is usually more plentiful. Swap space is useful to
the kernel for holding lesser-used data and as a fallback when physical RAM is
exhausted.</p>
</dd>
<dt><b>Symbolic link</b></dt>
<dd>
<p>A special file that simply points to the location of another file. Symbolic links are
used to avoid data duplication when a file is needed in multiple locations.</p>
</dd>
<dt><b>Tagfile</b></dt>
<dd>
<p>A file used by the Slackware <tt class="COMMAND">setup</tt> program during
installation, which describes a set of packages to be installed.</p>
</dd>
<dt><b>Terminal</b></dt>
<dd>
<p>A human-computer interface consisting of at least a screen (or virtual screen) and
some method of input (almost always at least a keyboard).</p>
</dd>
<dt><b>Toolkit, GUI</b></dt>
<dd>
<p>A GUI toolkit is a collection of libraries that provide a programmer with code to draw
“widgets” such as scrollbars, checkboxes, etc. and construct a graphical
interface. The GUI toolkit used by a program often defines its “look and
feel”.</p>
</dd>
<dt><b>UID</b></dt>
<dd>
<p>User Identifier. A unique number that identifies a user to the system. UIDs are used
by most programs instead of usernames because a number is easier to deal with; usernames
are generally only used when the user has to see things happen.</p>
</dd>
<dt><b>VESA</b></dt>
<dd>
<p>Video Electronics Standards Association. The term “VESA” is often used to
denote a standard specified by said Association. Nearly all modern video adapters are
VESA-compliant.</p>
</dd>
<dt><b>Virtual terminal</b></dt>
<dd>
<p>The use of software to simulate multiple terminals while using only a single set of
input/output devices (keyboard, monitor, mouse). Special keystrokes switch between
virtual terminals at a single physical terminal.</p>
</dd>
<dt><b>Window manager</b></dt>
<dd>
<p>An X program whose purpose is to provide a graphical interface beyond the simple
rectangle-drawing of the X Window System. Window managers generally provide titlebars,
menus for running programs, etc.</p>
</dd>
<dt><b>Working directory</b></dt>
<dd>
<p>The directory in which a program considers itself to be while running.</p>
</dd>
<dt><b>Wrapper program</b></dt>
<dd>
<p>A program whose sole purpose is to run other programs, but change their behavior in
some way by altering their environments or filtering their input.</p>
</dd>
<dt><b>X server</b></dt>
<dd>
<p>The program in the X Window System which interfaces with graphics hardware and handles
the actual running of X programs.</p>
</dd>
<dt><b>X Window System</b></dt>
<dd>
<p>Network-oriented graphical interface system used on most Unix-like operating systems,
including Linux.</p>
</dd>
</dl>
</div>
<div class="APPENDIX">
<hr />
<h1><a id="GPL" name="GPL"></a>Appendix A. The GNU General Public License</h1>
<p class="LITERALLAYOUT">GNU GENERAL PUBLIC LICENSE<br />
<br />
Version 2, June 1991<br />
Copyright (C) 1989, 1991 Free Software Foundation, Inc.<br />
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA<br />
Everyone is permitted to copy and distribute verbatim copies of this<br />
license document, but changing it is not allowed.</p>
<div class="SIMPLESECT">
<hr />
<h4 class="SIMPLESECT"><a id="AEN7088" name="AEN7088">A.1. Preamble</a></h4>
<p>The licenses for most software are designed to take away your freedom to share and
change it. By contrast, the GNU General Public License is intended to guarantee your
freedom to share and change free software--to make sure the software is free for all its
users. This General Public License applies to most of the Free Software Foundation's
software and to any other program whose authors commit to using it. (Some other Free
Software Foundation software is covered by the GNU Library General Public License
instead.) You can apply it to your programs, too.</p>
<p>When we speak of free software, we are referring to freedom, not price. Our General
Public Licenses are designed to make sure that you have the freedom to distribute copies
of free software (and charge for this service if you wish), that you receive source code
or can get it if you want it, that you can change the software or use pieces of it in new
free programs; and that you know you can do these things.</p>
<p>To protect your rights, we need to make restrictions that forbid anyone to deny you
these rights or to ask you to surrender the rights. These restrictions translate to
certain responsibilities for you if you distribute copies of the software, or if you
modify it.</p>
<p>For example, if you distribute copies of such a program, whether gratis or for a fee,
you must give the recipients all the rights that you have. You must make sure that they,
too, receive or can get the source code. And you must show them these terms so they know
their rights.</p>
<p>We protect your rights with two steps: (1) copyright the software, and (2) offer you
this license which gives you legal permission to copy, distribute and/or modify the
software.</p>
<p>Also, for each author's protection and ours, we want to make certain that everyone
understands that there is no warranty for this free software. If the software is modified
by someone else and passed on, we want its recipients to know that what they have is not
the original, so that any problems introduced by others will not reflect on the original
authors' reputations.</p>
<p>Finally, any free program is threatened constantly by software patents. We wish to
avoid the danger that redistributors of a free program will individually obtain patent
licenses, in effect making the program proprietary. To prevent this, we have made it
clear that any patent must be licensed for everyone's free use or not licensed at
all.</p>
<p>The precise terms and conditions for copying, distribution and modification
follow.</p>
</div>
<div class="SIMPLESECT">
<hr />
<h4 class="SIMPLESECT"><a id="AEN7098" name="AEN7098">A.2. TERMS AND CONDITIONS</a></h4>
<p><span class="emphasis"><i class="EMPHASIS">TERMS AND CONDITIONS FOR COPYING,
DISTRIBUTION AND MODIFICATION</i></span></p>
<ol type="1">
<li>
<p>This License applies to any program or other work which contains a notice placed by
the copyright holder saying it may be distributed under the terms of this General Public
License. The “Program”, below, refers to any such program or work, and a
“work based on the Program” means either the Program or any derivative work
under copyright law: that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another language.
(Hereinafter, translation is included without limitation in the term
“modification”.) Each licensee is addressed as “you”.</p>
<p>Activities other than copying, distribution and modification are not covered by this
License; they are outside its scope. The act of running the Program is not restricted,
and the output from the Program is covered only if its contents constitute a work based
on the Program (independent of having been made by running the Program). Whether that is
true depends on what the Program does.</p>
</li>
<li>
<p>You may copy and distribute verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and appropriately publish on
each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty; and give any other
recipients of the Program a copy of this License along with the Program.</p>
<p>You may charge a fee for the physical act of transferring a copy, and you may at your
option offer warranty protection in exchange for a fee.</p>
</li>
<li>
<p>You may modify your copy or copies of the Program or any portion of it, thus forming a
work based on the Program, and copy and distribute such modifications or work under the
terms of Section 1 above, provided that you also meet all of these conditions:</p>
<ol type="a">
<li>
<p>You must cause the modified files to carry prominent notices stating that you changed
the files and the date of any change.</p>
</li>
<li>
<p>You must cause any work that you distribute or publish, that in whole or in part
contains or is derived from the Program or any part thereof, to be licensed as a whole at
no charge to all third parties under the terms of this License.</p>
</li>
<li>
<p>If the modified program normally reads commands interactively when run, you must cause
it, when started running for such interactive use in the most ordinary way, to print or
display an announcement including an appropriate copyright notice and a notice that there
is no warranty (or else, saying that you provide a warranty) and that users may
redistribute the program under these conditions, and telling the user how to view a copy
of this License. (Exception: if the Program itself is interactive but does not normally
print such an announcement, your work based on the Program is not required to print an
announcement.)</p>
</li>
</ol>
<p>These requirements apply to the modified work as a whole. If identifiable sections of
that work are not derived from the Program, and can be reasonably considered independent
and separate works in themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you distribute the same
sections as part of a whole which is a work based on the Program, the distribution of the
whole must be on the terms of this License, whose permissions for other licensees extend
to the entire whole, and thus to each and every part regardless of who wrote it.</p>
<p>Thus, it is not the intent of this section to claim rights or contest your rights to
work written entirely by you; rather, the intent is to exercise the right to control the
distribution of derivative or collective works based on the Program.</p>
<p>In addition, mere aggregation of another work not based on the Program with the
Program (or with a work based on the Program) on a volume of a storage or distribution
medium does not bring the other work under the scope of this License.</p>
</li>
<li>
<p>You may copy and distribute the Program (or a work based on it, under Section 2) in
object code or executable form under the terms of Sections 1 and 2 above provided that
you also do one of the following:</p>
<ol type="a">
<li>
<p>Accompany it with the complete corresponding machine-readable source code, which must
be distributed under the terms of Sections 1 and 2 above on a medium customarily used for
software interchange; or,</p>
</li>
<li>
<p>Accompany it with a written offer, valid for at least three years, to give any third
party, for a charge no more than your cost of physically performing source distribution,
a complete machine-readable copy of the corresponding source code, to be distributed
under the terms of Sections 1 and 2 above on a medium customarily used for software
interchange; or,</p>
</li>
<li>
<p>Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for noncommercial
distribution and only if you received the program in object code or executable form with
such an offer, in accord with Subsection b above.)</p>
</li>
</ol>
<p>The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all the source
code for all modules it contains, plus any associated interface definition files, plus
the scripts used to control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major components (compiler,
kernel, and so on) of the operating system on which the executable runs, unless that
component itself accompanies the executable.</p>
<p>If distribution of executable or object code is made by offering access to copy from a
designated place, then offering equivalent access to copy the source code from the same
place counts as distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.</p>
</li>
<li>
<p>You may not copy, modify, sublicense, or distribute the Program except as expressly
provided under this License. Any attempt otherwise to copy, modify, sublicense or
distribute the Program is void, and will automatically terminate your rights under this
License. However, parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such parties remain in full
compliance.</p>
</li>
<li>
<p>You are not required to accept this License, since you have not signed it. However,
nothing else grants you permission to modify or distribute the Program or its derivative
works. These actions are prohibited by law if you do not accept this License. Therefore,
by modifying or distributing the Program (or any work based on the Program), you indicate
your acceptance of this License to do so, and all its terms and conditions for copying,
distributing or modifying the Program or works based on it.</p>
</li>
<li>
<p>Each time you redistribute the Program (or any work based on the Program), the
recipient automatically receives a license from the original licensor to copy, distribute
or modify the Program subject to these terms and conditions. You may not impose any
further restrictions on the recipients' exercise of the rights granted herein. You are
not responsible for enforcing compliance by third parties to this License.</p>
</li>
<li>
<p>If, as a consequence of a court judgment or allegation of patent infringement or for
any other reason (not limited to patent issues), conditions are imposed on you (whether
by court order, agreement or otherwise) that contradict the conditions of this License,
they do not excuse you from the conditions of this License. If you cannot distribute so
as to satisfy simultaneously your obligations under this License and any other pertinent
obligations, then as a consequence you may not distribute the Program at all. For
example, if a patent license would not permit royalty-free redistribution of the Program
by all those who receive copies directly or indirectly through you, then the only way you
could satisfy both it and this License would be to refrain entirely from distribution of
the Program.</p>
<p>If any portion of this section is held invalid or unenforceable under any particular
circumstance, the balance of the section is intended to apply and the section as a whole
is intended to apply in other circumstances.</p>
<p>It is not the purpose of this section to induce you to infringe any patents or other
property right claims or to contest validity of any such claims; this section has the
sole purpose of protecting the integrity of the free software distribution system, which
is implemented by public license practices. Many people have made generous contributions
to the wide range of software distributed through that system in reliance on consistent
application of that system; it is up to the author/donor to decide if he or she is
willing to distribute software through any other system and a licensee cannot impose that
choice.</p>
<p>This section is intended to make thoroughly clear what is believed to be a consequence
of the rest of this License.</p>
</li>
<li>
<p>If the distribution and/or use of the Program is restricted in certain countries
either by patents or by copyrighted interfaces, the original copyright holder who places
the Program under this License may add an explicit geographical distribution limitation
excluding those countries, so that distribution is permitted only in or among countries
not thus excluded. In such case, this License incorporates the limitation as if written
in the body of this License.</p>
</li>
<li>
<p>The Free Software Foundation may publish revised and/or new versions of the General
Public License from time to time. Such new versions will be similar in spirit to the
present version, but may differ in detail to address new problems or concerns.</p>
<p>Each version is given a distinguishing version number. If the Program specifies a
version number of this License which applies to it and “any later version”,
you have the option of following the terms and conditions either of that version or of
any later version published by the Free Software Foundation. If the Program does not
specify a version number of this License, you may choose any version ever published by
the Free Software Foundation.</p>
</li>
<li>
<p>If you wish to incorporate parts of the Program into other free programs whose
distribution conditions are different, write to the author to ask for permission. For
software which is copyrighted by the Free Software Foundation, write to the Free Software
Foundation; we sometimes make exceptions for this. Our decision will be guided by the two
goals of preserving the free status of all derivatives of our free software and of
promoting the sharing and reuse of software generally.</p>
</li>
<li>
<p>NO WARRANTY</p>
<p>BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM,
TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE
RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM
PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.</p>
</li>
<li>
<p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS
PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES
SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.</p>
</li>
</ol>
<p>END OF TERMS AND CONDITIONS</p>
</div>
<div class="SIMPLESECT">
<hr />
<h4 class="SIMPLESECT"><a id="AEN7162" name="AEN7162">A.3. How to Apply These Terms to
Your New Programs</a></h4>
<p>If you develop a new program, and you want it to be of the greatest possible use to
the public, the best way to achieve this is to make it free software which everyone can
redistribute and change under these terms.</p>
<p>To do so, attach the following notices to the program. It is safest to attach them to
the start of each source file to most effectively convey the exclusion of warranty; and
each file should have at least the “copyright” line and a pointer to where
the full notice is found.</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
</pre>
</td>
</tr>
</table>
<p>Also add information on how to contact you by electronic and paper mail.</p>
<p>If the program is interactive, make it output a short notice like this when it starts
in an interactive mode:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
</pre>
</td>
</tr>
</table>
<p>The hypothetical commands `show w' and `show c' should show the appropriate parts of
the General Public License. Of course, the commands you use may be called something other
than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits
your program.</p>
<p>You should also get your employer (if you work as a programmer) or your school, if
any, to sign a “copyright disclaimer” for the program, if necessary. Here is
a sample; alter the names:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
</pre>
</td>
</tr>
</table>
<p>This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may consider it more
useful to permit linking proprietary applications with the library. If this is what you
want to do, use the GNU Library General Public License instead of this License.</p>
</div>
</div>
</div>
<hr />
</body>
</html>
|