This file is indexed.

/usr/share/debian-reference/ch01.en.html is in debian-reference-en 2.72.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Chapter 1. GNU/Linux tutorials</title>
    <link rel="stylesheet" type="text/css" href="debian-reference.css"/>
    <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel="home" href="index.en.html" title="Debian Reference"/>
    <link rel="up" href="index.en.html" title="Debian Reference"/>
    <link rel="prev" href="pr01.en.html" title="Preface"/>
    <link rel="next" href="ch02.en.html" title="Chapter 2. Debian package management"/>
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Chapter 1. GNU/Linux tutorials</th>
        </tr>
        <tr>
          <td align="left"><a accesskey="p" href="pr01.en.html"><img src="images/prev.png" alt="Prev"/></a> </td>
          <th width="60%" align="center"> </th>
          <td align="right"> <a accesskey="n" href="ch02.en.html"><img src="images/next.png" alt="Next"/></a></td>
        </tr>
      </table>
      <hr/>
    </div>
    <div class="chapter">
      <div class="titlepage">
        <div>
          <div>
            <h1 class="title"><a id="_gnu_linux_tutorials"/>Chapter 1. GNU/Linux tutorials</h1>
          </div>
        </div>
      </div>
      <div class="toc">
        <p>
          <strong>Table of Contents</strong>
        </p>
        <dl class="toc">
          <dt>
            <span class="section">
              <a href="ch01.en.html#_console_basics">1.1. Console basics</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_the_shell_prompt">1.1.1. The shell prompt</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_the_shell_prompt_under_x">1.1.2. The shell prompt under X</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_the_root_account">1.1.3. The root account</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_the_root_shell_prompt">1.1.4. The root shell prompt</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_gui_system_administration_tools">1.1.5. GUI system administration tools</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_virtual_consoles">1.1.6. Virtual consoles</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_how_to_leave_the_command_prompt">1.1.7. How to leave the command prompt</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_how_to_shutdown_the_system">1.1.8. How to shutdown the system</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_recovering_a_sane_console">1.1.9. Recovering a sane console</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_additional_package_suggestions_for_the_newbie">1.1.10. Additional package suggestions for the newbie</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_an_extra_user_account">1.1.11. An extra user account</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_sudo_configuration">1.1.12. sudo configuration</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_play_time">1.1.13. Play time</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="section">
              <a href="ch01.en.html#_unix_like_filesystem">1.2. Unix-like filesystem</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_unix_file_basics">1.2.1. Unix file basics</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_filesystem_internals">1.2.2. Filesystem internals</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_filesystem_permissions">1.2.3. Filesystem permissions</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_control_of_permissions_for_newly_created_files_umask">1.2.4. Control of permissions for newly created files: umask</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_permissions_for_groups_of_users_group">1.2.5. Permissions for groups of users (group)</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_timestamps">1.2.6. Timestamps</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_links">1.2.7. Links</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_named_pipes_fifos">1.2.8. Named pipes (FIFOs)</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_sockets">1.2.9. Sockets</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_device_files">1.2.10. Device files</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_special_device_files">1.2.11. Special device files</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_procfs_and_sysfs">1.2.12. procfs and sysfs</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_tmpfs">1.2.13. tmpfs</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="section">
              <a href="ch01.en.html#_midnight_commander_mc">1.3. Midnight Commander (MC)</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_customization_of_mc">1.3.1. Customization of MC</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_starting_mc">1.3.2. Starting MC</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_file_manager_in_mc">1.3.3. File manager in MC</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_command_line_tricks_in_mc">1.3.4. Command-line tricks in MC</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_the_internal_editor_in_mc">1.3.5. The internal editor in MC</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_the_internal_viewer_in_mc">1.3.6. The internal viewer in MC</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_auto_start_features_of_mc">1.3.7. Auto-start features of MC</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_ftp_virtual_filesystem_of_mc">1.3.8. FTP virtual filesystem of MC</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="section">
              <a href="ch01.en.html#_the_basic_unix_like_work_environment">1.4. The basic Unix-like work environment</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_the_login_shell">1.4.1. The login shell</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_customizing_bash">1.4.2. Customizing bash</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_special_key_strokes">1.4.3. Special key strokes</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_unix_style_mouse_operations">1.4.4. Unix style mouse operations</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_the_pager">1.4.5. The pager</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_the_text_editor">1.4.6. The text editor</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_setting_a_default_text_editor">1.4.7. Setting a default text editor</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_customizing_vim">1.4.8. Customizing vim</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_recording_the_shell_activities">1.4.9. Recording the shell activities</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_basic_unix_commands">1.4.10. Basic Unix commands</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="section">
              <a href="ch01.en.html#_the_simple_shell_command">1.5. The simple shell command</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_command_execution_and_environment_variable">1.5.1. Command execution and environment variable</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_the_literal_lang_literal_variable">1.5.2. The "<code class="literal">$LANG</code>" variable</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_the_literal_path_literal_variable">1.5.3. The "<code class="literal">$PATH</code>" variable</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_the_literal_home_literal_variable">1.5.4. The "<code class="literal">$HOME</code>" variable</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_command_line_options">1.5.5. Command line options</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_shell_glob">1.5.6. Shell glob</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_return_value_of_the_command">1.5.7. Return value of the command</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_typical_command_sequences_and_shell_redirection">1.5.8. Typical command sequences and shell redirection</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_command_alias">1.5.9. Command alias</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="section">
              <a href="ch01.en.html#_unix_like_text_processing">1.6. Unix-like text processing</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_unix_text_tools">1.6.1. Unix text tools</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_regular_expressions">1.6.2. Regular expressions</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_replacement_expressions">1.6.3. Replacement expressions</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_global_substitution_with_regular_expressions">1.6.4. Global substitution with regular expressions</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_extracting_data_from_text_file_table">1.6.5. Extracting data from text file table</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="ch01.en.html#_script_snippets_for_piping_commands">1.6.6. Script snippets for piping commands</a>
                </span>
              </dt>
            </dl>
          </dd>
        </dl>
      </div>
      <p>I think learning a computer system is like learning a new foreign language.  Although tutorial books and documentation are helpful, you have to practice it yourself.  In order to help you get started smoothly, I elaborate a few basic points.</p>
      <p>The powerful design of <a class="ulink" href="https://www.debian.org">Debian</a> <a class="ulink" href="http://en.wikipedia.org/wiki/GNU">GNU</a>/<a class="ulink" href="http://en.wikipedia.org/wiki/Linux">Linux</a> comes from the <a class="ulink" href="http://en.wikipedia.org/wiki/Unix">Unix</a> operating system, i.e., a <a class="ulink" href="http://en.wikipedia.org/wiki/Multi-user">multiuser</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/Computer_multitasking">multitasking</a> operating system.  You must learn to take advantage of the power of these features and similarities between Unix and GNU/Linux.</p>
      <p>Don't shy away from Unix oriented texts and don't rely solely on GNU/Linux texts, as this robs you of much useful information.</p>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
        <table border="0" summary="Note">
          <tr>
            <td rowspan="2" align="center" valign="top">
              <img alt="[Note]" src="images/note.png"/>
            </td>
            <th align="left">Note</th>
          </tr>
          <tr>
            <td align="left" valign="top">
              <p>If you have been using any <a class="ulink" href="http://en.wikipedia.org/wiki/Unix-like">Unix-like</a> system for a while with command line tools, you probably know everything I explain here.  Please use this as a reality check and refresher.</p>
            </td>
          </tr>
        </table>
      </div>
      <div class="section">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title"><a id="_console_basics"/>1.1. Console basics</h2>
            </div>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_the_shell_prompt"/>1.1.1. The shell prompt</h3>
              </div>
            </div>
          </div>
          <p>Upon starting the system, you are presented with the character based login screen if you did not install <a class="ulink" href="http://en.wikipedia.org/wiki/X_Window_System">X Window System</a> with the display manager such as <code class="literal">gdm3</code>. Suppose your hostname is <code class="literal">foo</code>, the login prompt looks as follows.</p>
          <pre class="screen">foo login:</pre>
          <p>If you did install a <a class="ulink" href="http://en.wikipedia.org/wiki/Graphical_user_interface">GUI</a> environment such as <a class="ulink" href="http://en.wikipedia.org/wiki/GNOME">GNOME</a> or <a class="ulink" href="http://en.wikipedia.org/wiki/KDE">KDE</a>, then you can get to a login prompt by Ctrl-Alt-F1, and you can return to the GUI environment via Alt-F7 (see <a class="xref" href="ch01.en.html#_virtual_consoles" title="1.1.6. Virtual consoles">Section 1.1.6, “Virtual consoles”</a> below for more).</p>
          <p>At the login prompt, you type your username, e.g. <code class="literal">penguin</code>, and press the Enter-key, then type your password and press the Enter-key again.</p>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Following the Unix tradition, the username and password of the Debian system are case sensitive.  The username is usually chosen only from the lowercase.  The first user account is usually created during the installation.  Additional user accounts can be created with <span class="citerefentry"><span class="refentrytitle">adduser</span>(8)</span> by root.</p>
                </td>
              </tr>
            </table>
          </div>
          <p>The system starts with the greeting message stored in "<code class="literal">/etc/motd</code>" (Message Of The Day) and presents a command prompt.</p>
          <pre class="screen">Debian GNU/Linux jessie/sid foo tty1
foo login: penguin
Password:
Last login: Mon Sep 23 19:36:44 JST 2013 on tty3
Linux snoopy 3.11-1-amd64 #1 SMP Debian 3.11.6-2 (2013-11-01) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
foo:~$</pre>
          <p>Now you are in the <a class="ulink" href="http://en.wikipedia.org/wiki/Shell_(computing)">shell</a>. The shell interprets your commands.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_the_shell_prompt_under_x"/>1.1.2. The shell prompt under X</h3>
              </div>
            </div>
          </div>
          <p>If you installed <a class="ulink" href="http://en.wikipedia.org/wiki/X_Window_System">X Window System</a> with a display manager such as <a class="ulink" href="http://en.wikipedia.org/wiki/GNOME">GNOME</a>'s <code class="literal">gdm3</code> by selecting "Desktop environment" task during the installation, you are presented with the graphical login screen upon starting your system.  You type your username and your password to login to the non-privileged user account.  Use tab to navigate between username and password, or use the mouse and primary click.</p>
          <p>You can gain the shell prompt under X by starting a <code class="literal">x-terminal-emulator</code> program such as <span class="citerefentry"><span class="refentrytitle">gnome-terminal</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">rxvt</span>(1)</span> or <span class="citerefentry"><span class="refentrytitle">xterm</span>(1)</span>.  Under the GNOME Desktop environment, clicking "Applications" → "Accessories" → "Terminal" does the trick.</p>
          <p>You can also see the section below <a class="xref" href="ch01.en.html#_virtual_consoles" title="1.1.6. Virtual consoles">Section 1.1.6, “Virtual consoles”</a>.</p>
          <p>Under some other Desktop systems (like <code class="literal">fluxbox</code>), there may be no obvious starting point for the menu.  If this happens, just try (right) clicking the background of the desktop screen and hope for a menu to pop-up.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_the_root_account"/>1.1.3. The root account</h3>
              </div>
            </div>
          </div>
          <p>The root account is also called <a class="ulink" href="http://en.wikipedia.org/wiki/Superuser">superuser</a> or privileged user.  From this account, you can perform the following system administration tasks.</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
Read, write, and remove any files on the system irrespective of their file permissions
</p>
              </li>
              <li class="listitem">
                <p>
Set file ownership and permissions of any files on the system
</p>
              </li>
              <li class="listitem">
                <p>
Set the password of any non-privileged users on the system
</p>
              </li>
              <li class="listitem">
                <p>
Login to any accounts without their passwords
</p>
              </li>
            </ul>
          </div>
          <p>This unlimited power of root account requires you to be considerate and responsible when using it.</p>
          <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Warning">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Warning]" src="images/warning.png"/>
                </td>
                <th align="left">Warning</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Never share the root password with others.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>File permissions of a file (including hardware devices such as CD-ROM etc. which are just another file for the Debian system) may render it unusable or inaccessible by non-root users.  Although the use of root account is a quick way to test this kind of situation, its resolution should be done through proper setting of file permissions and user's group membership (see <a class="xref" href="ch01.en.html#_filesystem_permissions" title="1.2.3. Filesystem permissions">Section 1.2.3, “Filesystem permissions”</a>).</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_the_root_shell_prompt"/>1.1.4. The root shell prompt</h3>
              </div>
            </div>
          </div>
          <p>Here are a few basic methods to gain the root shell prompt by using the root password.</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
Type <code class="literal">root</code> at the character based login prompt.
</p>
              </li>
              <li class="listitem">
                <p>
Click "Applications" → "Accessories" → "Root Terminal", under the GNOME Desktop environment.
</p>
              </li>
              <li class="listitem">
                <p>
Type "<code class="literal">su -l</code>" from any user shell prompt.
</p>
                <div class="itemizedlist">
                  <ul class="itemizedlist">
                    <li class="listitem">
                      <p>
This does not preserve the environment of the current user.
</p>
                    </li>
                  </ul>
                </div>
              </li>
              <li class="listitem">
                <p>
Type "<code class="literal">su</code>" from any user shell prompt.
</p>
                <div class="itemizedlist">
                  <ul class="itemizedlist">
                    <li class="listitem">
                      <p>
This preserves some of the environment of the current user.
</p>
                    </li>
                  </ul>
                </div>
              </li>
            </ul>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_gui_system_administration_tools"/>1.1.5. GUI system administration tools</h3>
              </div>
            </div>
          </div>
          <p>When your desktop menu does not start GUI system administration tools automatically with the appropriate privilege, you can start them from the root shell prompt of the X terminal emulator, such as <span class="citerefentry"><span class="refentrytitle">gnome-terminal</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">rxvt</span>(1)</span>, or <span class="citerefentry"><span class="refentrytitle">xterm</span>(1)</span>. See <a class="xref" href="ch01.en.html#_the_root_shell_prompt" title="1.1.4. The root shell prompt">Section 1.1.4, “The root shell prompt”</a> and <a class="xref" href="ch07.en.html#_running_x_clients_as_root" title="7.8.5. Running X clients as root">Section 7.8.5, “Running X clients as root”</a>.</p>
          <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Warning">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Warning]" src="images/warning.png"/>
                </td>
                <th align="left">Warning</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Never start the X display/session manager under the root account by typing in <code class="literal">root</code> to the prompt of the display manager such as <span class="citerefentry"><span class="refentrytitle">gdm3</span>(1)</span>.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Warning">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Warning]" src="images/warning.png"/>
                </td>
                <th align="left">Warning</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Never run untrusted remote GUI program under X Window when critical information is displayed since it may eavesdrop your X screen.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_virtual_consoles"/>1.1.6. Virtual consoles</h3>
              </div>
            </div>
          </div>
          <p>In the default Debian system, there are six switchable <a class="ulink" href="http://en.wikipedia.org/wiki/VT100">VT100-like</a> character consoles available to start the command shell directly on the Linux host.  Unless you are in a GUI environment, you can switch between the virtual consoles by pressing the <code class="literal">Left-Alt-key</code> and one of the <code class="literal">F1</code><code class="literal">F6</code> keys simultaneously.  Each character console allows independent login to the account and offers the multiuser environment.  This multiuser environment is a great Unix feature, and very addictive.</p>
          <p>If you are under the X Window System, you gain access to the character console 1 by pressing <code class="literal">Ctrl-Alt-F1</code> key, i.e., the <code class="literal">left-Ctrl-key</code>, the <code class="literal">left-Alt-key</code>, and the <code class="literal">F1-key</code> are pressed together.   You can get back to the X Window System, normally running on the virtual console 7, by pressing <code class="literal">Alt-F7</code>.</p>
          <p>You can alternatively change to another virtual console, e.g. to the console 1, from the commandline.</p>
          <pre class="screen"># chvt 1</pre>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_how_to_leave_the_command_prompt"/>1.1.7. How to leave the command prompt</h3>
              </div>
            </div>
          </div>
          <p>You type <code class="literal">Ctrl-D</code>, i.e., the <code class="literal">left-Ctrl-key</code> and the <code class="literal">d-key</code> pressed together, at the command prompt to close the shell activity.  If you are at the character console, you return to the login prompt with this.  Even though these control characters are referred as "control D" with the upper case, you do not need to press the Shift-key. The short hand expression, <code class="literal">^D</code>, is also used for <code class="literal">Ctrl-D</code>.  Alternately, you can type "exit".</p>
          <p>If you are at <span class="citerefentry"><span class="refentrytitle">x-terminal-emulator</span>(1)</span>, you can close <code class="literal">x-terminal-emulator</code> window with this.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_how_to_shutdown_the_system"/>1.1.8. How to shutdown the system</h3>
              </div>
            </div>
          </div>
          <p>Just like any other modern OS where the file operation involves <a class="ulink" href="http://en.wikipedia.org/wiki/Cache">caching data</a> in memory for improved performance, the Debian system needs the proper shutdown procedure before power can safely be turned off. This is to maintain the integrity of files, by forcing all changes in memory to be written to disk. If the software power control is available, the shutdown procedure automatically turns off power of the system. (Otherwise, you may have to press power button for few seconds after the shutdown procedure.)</p>
          <p>You can shutdown the system under the normal multiuser mode from the commandline.</p>
          <pre class="screen"># shutdown -h now</pre>
          <p>You can shutdown the system under the single-user mode from the commandline.</p>
          <pre class="screen"># poweroff -i -f</pre>
          <p>Alternatively, you may type <code class="literal">Ctrl-Alt-Delete</code> (The <code class="literal">left-Ctrl-key</code>, the <code class="literal">left-Alt-Key</code>, and the <code class="literal">Delete</code> are pressed together) to shutdown if "<code class="literal">/etc/inittab</code>" contains "<code class="literal">ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -h now</code>" in it.  See <span class="citerefentry"><span class="refentrytitle">inittab</span>(5)</span> for details.</p>
          <p>See <a class="xref" href="ch06.en.html#_how_to_shutdown_the_remote_system_on_ssh" title="6.9.6. How to shutdown the remote system on SSH">Section 6.9.6, “How to shutdown the remote system on SSH”</a>.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_recovering_a_sane_console"/>1.1.9. Recovering a sane console</h3>
              </div>
            </div>
          </div>
          <p>When the screen goes berserk after doing some funny things such as "<code class="literal">cat &lt;some-binary-file&gt;</code>", type "<code class="literal">reset</code>" at the command prompt. You may not be able to see the command echoed as you type.  You may also issue "<code class="literal">clear</code>" to clean up the screen.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_additional_package_suggestions_for_the_newbie"/>1.1.10. Additional package suggestions for the newbie</h3>
              </div>
            </div>
          </div>
          <p>Although even the minimal installation of the Debian system without any desktop environment tasks provides the basic Unix functionality, it is a good idea to install few additional commandline and curses based character terminal packages such as <code class="literal">mc</code> and <code class="literal">vim</code> with <span class="citerefentry"><span class="refentrytitle">apt-get</span>(8)</span> for beginners to get started by the following.</p>
          <pre class="screen"># apt-get update
 ...
# apt-get install mc vim sudo
 ...</pre>
          <p>If you already had these packages installed, no new packages are installed.</p>
          <div class="table">
            <a id="listofinterestineprogrampackages"/>
            <p class="title">
              <strong>Table 1.1. List of interesting text-mode program packages</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of interesting text-mode program packages" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    package
    </th>
                    <th style="text-align: left">
    popcon
    </th>
                    <th style="text-align: left">
    size
    </th>
                    <th style="text-align: left">
    description
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/mc">
                  <code class="literal">mc</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=mc">V:67, I:234</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/m/mc.html">1428</a>
                    </td>
                    <td style="text-align: left">
    A text-mode full-screen file manager
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/sudo">
                  <code class="literal">sudo</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=sudo">V:447, I:719</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/s/sudo.html">3178</a>
                    </td>
                    <td style="text-align: left">
    A program to allow limited root privileges to users
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/vim">
                  <code class="literal">vim</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=vim">V:121, I:390</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/v/vim.html">2660</a>
                    </td>
                    <td style="text-align: left">
    Unix text editor Vi IMproved, a programmers text editor (standard version)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/vim-tiny">
                  <code class="literal">vim-tiny</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=vim-tiny">V:68, I:967</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/v/vim-tiny.html">1241</a>
                    </td>
                    <td style="text-align: left">
    Unix text editor Vi IMproved, a programmers text editor (compact version)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/emacs25">
                  <code class="literal">emacs25</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=emacs25">V:10, I:19</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/e/emacs25.html">19216</a>
                    </td>
                    <td style="text-align: left">
    GNU project Emacs, the Lisp based extensible text editor
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/w3m">
                  <code class="literal">w3m</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=w3m">V:126, I:564</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/w/w3m.html">2302</a>
                    </td>
                    <td style="text-align: left">
    Text-mode WWW browsers
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/gpm">
                  <code class="literal">gpm</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=gpm">V:12, I:20</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/g/gpm.html">497</a>
                    </td>
                    <td style="text-align: left">
    The Unix style cut-and-paste on the text console (daemon)
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>It may be a good idea to read some informative documentations.</p>
          <div class="table">
            <a id="listofinformativentationpackages"/>
            <p class="title">
              <strong>Table 1.2. List of informative documentation packages</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of informative documentation packages" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    package
    </th>
                    <th style="text-align: left">
    popcon
    </th>
                    <th style="text-align: left">
    size
    </th>
                    <th style="text-align: left">
    description
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/doc-debian">
                  <code class="literal">doc-debian</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=doc-debian">I:859</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/d/doc-debian.html">166</a>
                    </td>
                    <td style="text-align: left">
    Debian Project documentation, (Debian FAQ) and other documents
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/debian-policy">
                  <code class="literal">debian-policy</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=debian-policy">I:78</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/d/debian-policy.html">5237</a>
                    </td>
                    <td style="text-align: left">
    Debian Policy Manual and related documents
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/developers-reference">
                  <code class="literal">developers-reference</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=developers-reference">I:6</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/d/developers-reference.html">1304</a>
                    </td>
                    <td style="text-align: left">
    Guidelines and information for Debian developers
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/maint-guide">
                  <code class="literal">maint-guide</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=maint-guide">I:4</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/m/maint-guide.html">987</a>
                    </td>
                    <td style="text-align: left">
    Debian New Maintainers' Guide
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/debian-history">
                  <code class="literal">debian-history</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=debian-history">I:1</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/d/debian-history.html">5034</a>
                    </td>
                    <td style="text-align: left">
    History of the Debian Project
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/debian-faq">
                  <code class="literal">debian-faq</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=debian-faq">I:849</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/d/debian-faq.html">1277</a>
                    </td>
                    <td style="text-align: left">
    Debian FAQ
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>You can install some of these packages by the following.</p>
          <pre class="screen"># apt-get install package_name</pre>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_an_extra_user_account"/>1.1.11. An extra user account</h3>
              </div>
            </div>
          </div>
          <p>If you do not want to use your main user account for the following training activities, you can create a training user account, e.g. <code class="literal">fish</code> by the following.</p>
          <pre class="screen"># adduser fish</pre>
          <p>Answer all questions.</p>
          <p>This creates a new account named as <code class="literal">fish</code>.  After your practice, you can remove this user account and its home directory by the following.</p>
          <pre class="screen"># deluser --remove-home fish</pre>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_sudo_configuration"/>1.1.12. sudo configuration</h3>
              </div>
            </div>
          </div>
          <p>For the typical single user workstation such as the desktop Debian system on the laptop PC, it is common to deploy simple configuration of <span class="citerefentry"><span class="refentrytitle">sudo</span>(8)</span> as follows to let the non-privileged user, e.g. <code class="literal">penguin</code>, to gain administrative privilege just with his user password but without the root password.</p>
          <pre class="screen"># echo "penguin  ALL=(ALL) ALL" &gt;&gt; /etc/sudoers</pre>
          <p>Alternatively, it is also common to do as follows to let the non-privileged user, e.g. <code class="literal">penguin</code>, to gain administrative privilege without any password.</p>
          <pre class="screen"># echo "penguin  ALL=(ALL) NOPASSWD:ALL" &gt;&gt; /etc/sudoers</pre>
          <p>This trick should only be used for the single user workstation which you administer and where you are the only user.</p>
          <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Warning">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Warning]" src="images/warning.png"/>
                </td>
                <th align="left">Warning</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Do not set up accounts of regular users on multiuser workstation like this because it would be very bad for system security.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Caution">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Caution]" src="images/caution.png"/>
                </td>
                <th align="left">Caution</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>The password and the account of the <code class="literal">penguin</code> in the above example requires as much protection as the root password and the root account.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Caution">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Caution]" src="images/caution.png"/>
                </td>
                <th align="left">Caution</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Administrative privilege in this context belongs to someone authorized to perform the system administration task on the workstation.  Never give some manager in the Admin department of your company or your boss such privilege unless they are authorized and capable.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>For providing access privilege to limited devices and limited files, you should consider to use <span class="strong"><strong>group</strong></span> to provide limited access instead of using the <code class="literal">root</code> privilege via <span class="citerefentry"><span class="refentrytitle">sudo</span>(8)</span>.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>With more thoughtful and careful configuration, <span class="citerefentry"><span class="refentrytitle">sudo</span>(8)</span> can grant limited administrative privileges to other users on a shared system without sharing the root password.  This can help with accountability with hosts with multiple administrators so you can tell who did what.  On the other hand, you might not want anyone else to have such privileges.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_play_time"/>1.1.13. Play time</h3>
              </div>
            </div>
          </div>
          <p>Now you are ready to play with the Debian system without risks as long as you use the non-privileged user account.</p>
          <p>This is because the Debian system is, even after the default installation, configured with proper file permissions which prevent non-privileged users from damaging the system.  Of course, there may still be some holes which can be exploited but those who worry about these issues should not be reading this section but should be reading <a class="ulink" href="https://www.debian.org/doc/manuals/securing-debian-howto/">Securing Debian Manual</a>.</p>
          <p>We learn the Debian system as a <a class="ulink" href="http://en.wikipedia.org/wiki/Unix-like">Unix-like</a> system with the following.</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p><a class="xref" href="ch01.en.html#_unix_like_filesystem" title="1.2. Unix-like filesystem">Section 1.2, “Unix-like filesystem”</a> (basic concept)
</p>
              </li>
              <li class="listitem">
                <p><a class="xref" href="ch01.en.html#_midnight_commander_mc" title="1.3. Midnight Commander (MC)">Section 1.3, “Midnight Commander (MC)”</a> (survival method)
</p>
              </li>
              <li class="listitem">
                <p><a class="xref" href="ch01.en.html#_the_basic_unix_like_work_environment" title="1.4. The basic Unix-like work environment">Section 1.4, “The basic Unix-like work environment”</a> (basic method)
</p>
              </li>
              <li class="listitem">
                <p><a class="xref" href="ch01.en.html#_the_simple_shell_command" title="1.5. The simple shell command">Section 1.5, “The simple shell command”</a> (shell mechanism)
</p>
              </li>
              <li class="listitem">
                <p><a class="xref" href="ch01.en.html#_unix_like_text_processing" title="1.6. Unix-like text processing">Section 1.6, “Unix-like text processing”</a> (text processing method)
</p>
              </li>
            </ul>
          </div>
        </div>
      </div>
      <div class="section">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title"><a id="_unix_like_filesystem"/>1.2. Unix-like filesystem</h2>
            </div>
          </div>
        </div>
        <p>In GNU/Linux and other <a class="ulink" href="http://en.wikipedia.org/wiki/Unix-like">Unix-like</a> operating systems, <a class="ulink" href="http://en.wikipedia.org/wiki/Computer_file">files</a> are organized into <a class="ulink" href="http://en.wikipedia.org/wiki/Directory_(file_systems)">directories</a>.  All files and directories are arranged in one big tree rooted at "<code class="literal">/</code>". It's called a tree because if you draw the filesystem, it looks like a tree but it is upside down.</p>
        <p>These files and directories can be spread out over several devices. <span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> serves to attach the filesystem found on some device to the big file tree.  Conversely, <span class="citerefentry"><span class="refentrytitle">umount</span>(8)</span> detaches it again.  On recent Linux kernels, <span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> with some options can bind part of a file tree somewhere else or can mount filesystem as shared, private, slave, or unbindable.  Supported mount options for each filesystem are available in "<code class="literal">/usr/share/doc/linux-doc-*/Documentation/filesystems/</code>".</p>
        <p><span class="strong"><strong>Directories</strong></span> on Unix systems are called <span class="strong"><strong>folders</strong></span> on some other systems.  Please also note that there is no concept for <span class="strong"><strong>drive</strong></span> such as "<code class="literal">A:</code>" on any Unix system.  There is one filesystem, and everything is included. This is a huge advantage compared to Windows.</p>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_unix_file_basics"/>1.2.1. Unix file basics</h3>
              </div>
            </div>
          </div>
          <p>Here are some Unix file basics.</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
Filenames are <span class="strong"><strong>case sensitive</strong></span>.  That is, "<code class="literal">MYFILE</code>" and "<code class="literal">MyFile</code>" are different files.
</p>
              </li>
              <li class="listitem">
                <p>
The <span class="strong"><strong>root directory</strong></span> means root of the filesystem referred as simply "<code class="literal">/</code>".  Don't confuse this with the home directory for the root user: "<code class="literal">/root</code>".
</p>
              </li>
              <li class="listitem">
                <p>
Every directory has a name which can contain any letters or symbols <span class="strong"><strong>except "<code class="literal">/</code>"</strong></span>.  The root directory is an exception; its name is "<code class="literal">/</code>" (pronounced "slash" or "the root directory") and it cannot be renamed.
</p>
              </li>
              <li class="listitem">
                <p>
Each file or directory is designated by a <span class="strong"><strong>fully-qualified filename</strong></span>, <span class="strong"><strong>absolute filename</strong></span>, or <span class="strong"><strong>path</strong></span>, giving the sequence of directories which must be passed through to reach it.  The three terms are synonymous.
</p>
              </li>
              <li class="listitem">
                <p>
All <span class="strong"><strong>fully-qualified filenames</strong></span> begin with the "<code class="literal">/</code>" directory, and there's a "<code class="literal">/</code>" between each directory or file in the filename.  The first "<code class="literal">/</code>" is the top level directory, and the other "<code class="literal">/</code>"'s separate successive subdirectories, until we reach the last entry which is the name of the actual file.  The words used here can be confusing.  Take the following  <span class="strong"><strong>fully-qualified filename</strong></span> as an example: "<code class="literal">/usr/share/keytables/us.map.gz</code>".  However, people also refers to its basename "<code class="literal">us.map.gz</code>" alone as a filename.
</p>
              </li>
              <li class="listitem">
                <p>
The root directory has a number of branches, such as "<code class="literal">/etc/</code>" and "<code class="literal">/usr/</code>".  These subdirectories in turn branch into still more subdirectories, such as "<code class="literal">/etc/init.d/</code>" and "<code class="literal">/usr/local/</code>".  The whole thing viewed collectively is called the <span class="strong"><strong>directory tree</strong></span>.  You can think of an absolute filename as a route from the base of the tree ("<code class="literal">/</code>") to the end of some branch (a file).  You also hear people talk about the directory tree as if it were a <span class="strong"><strong>family</strong></span> tree encompassing all direct descendants of a single figure called the root directory ("<code class="literal">/</code>"): thus subdirectories have <span class="strong"><strong>parents</strong></span>, and a path shows the complete ancestry of a file.  There are also relative paths that begin somewhere other than the root directory.  You should remember that the directory "<code class="literal">../</code>" refers to the parent directory.  This terminology also applies to other directory like structures, such as hierarchical data structures.
</p>
              </li>
              <li class="listitem">
                <p>
There's no special directory path name component that corresponds to a physical device, such as your hard disk.  This differs from <a class="ulink" href="http://en.wikipedia.org/wiki/RT-11">RT-11</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/CP/M">CP/M</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/OpenVMS">OpenVMS</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/MS-DOS">MS-DOS</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/AmigaOS">AmigaOS</a>, and <a class="ulink" href="http://en.wikipedia.org/wiki/Microsoft_Windows">Microsoft Windows</a>, where the path contains a device name such as "<code class="literal">C:\</code>".  (However, directory entries do exist that refer to physical devices as a part of the normal filesystem.  See <a class="xref" href="ch01.en.html#_filesystem_internals" title="1.2.2. Filesystem internals">Section 1.2.2, “Filesystem internals”</a>.)
</p>
              </li>
            </ul>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>While you <span class="strong"><strong>can</strong></span> use almost any letters or symbols in a file name, in practice it is a bad idea to do so.  It is better to avoid any characters that often have special meanings on the command line, including spaces, tabs, newlines, and other special characters: <code class="literal">{ } ( ) [ ] ' ` " \ / &gt; &lt; | ; ! # &amp; ^ * % @ $</code> .  If you want to separate words in a name, good choices are the period, hyphen, and underscore.  You could also capitalize each word, "<code class="literal">LikeThis</code>". Experienced Linux users tend to avoid spaces in filenames.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>The word "root" can mean either "root user" or "root directory".  The context of their usage should make it clear.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>The word <span class="strong"><strong>path</strong></span> is used not only for <span class="strong"><strong>fully-qualified filename</strong></span> as above but also for the <span class="strong"><strong>command search path</strong></span>.  The intended meaning is usually clear from the context.</p>
                </td>
              </tr>
            </table>
          </div>
          <p>The detailed best practices for the file hierarchy are described in the Filesystem Hierarchy Standard ("<code class="literal">/usr/share/doc/debian-policy/fhs/fhs-2.3.txt.gz</code>" and <span class="citerefentry"><span class="refentrytitle">hier</span>(7)</span>).  You should remember the following facts as the starter.</p>
          <div class="table">
            <a id="listofusageofkeydirectories"/>
            <p class="title">
              <strong>Table 1.3. List of usage of key directories</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of usage of key directories" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    directory
    </th>
                    <th style="text-align: left">
    usage of the directory
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/</code>
                </td>
                    <td style="text-align: left">
    the root directory
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/etc/</code>
                </td>
                    <td style="text-align: left">
    system wide configuration files
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/var/log/</code>
                </td>
                    <td style="text-align: left">
    system log files
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/home/</code>
                </td>
                    <td style="text-align: left">
    all the home directories for all non-privileged users
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_filesystem_internals"/>1.2.2. Filesystem internals</h3>
              </div>
            </div>
          </div>
          <p>Following the <span class="strong"><strong>Unix tradition</strong></span>, the Debian GNU/Linux system provides the <a class="ulink" href="http://en.wikipedia.org/wiki/File_system">filesystem</a> under which physical data on hard disks and other storage devices reside, and the interaction with the hardware devices such as console screens and remote serial consoles are represented in an unified manner under "<code class="literal">/dev/</code>".</p>
          <p>Each file, directory, named pipe (a way two programs can share data), or physical device on a Debian GNU/Linux system has a data structure called an <a class="ulink" href="http://en.wikipedia.org/wiki/Inode">inode</a> which describes its associated attributes such as the user who owns it (owner), the group that it belongs to, the time last accessed, etc.  The idea of representing just about everything in the filesystem was a Unix innovation, and modern Linux kernels have developed this idea ever further. Now, even information about processes running in the computer can be found in the filesystem.</p>
          <p>This abstract and unified representation of physical entities and internal processes is very powerful since this allows us to use the same command for the same kind of operation on many totally different devices. It is even possible to change the way the kernel works by writing data to special files that are linked to running processes.</p>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>If you need to identify the correspondence between the file tree and the physical entity, execute <span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> with no arguments.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_filesystem_permissions"/>1.2.3. Filesystem permissions</h3>
              </div>
            </div>
          </div>
          <p><a class="ulink" href="http://en.wikipedia.org/wiki/File_system_permissions">Filesystem permissions</a> of <a class="ulink" href="http://en.wikipedia.org/wiki/Unix-like">Unix-like</a> system are defined for three categories of affected users.</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
The <span class="strong"><strong>user</strong></span> who owns the file (<span class="strong"><strong>u</strong></span>)
</p>
              </li>
              <li class="listitem">
                <p>
Other users in the <span class="strong"><strong>group</strong></span> which the file belongs to (<span class="strong"><strong>g</strong></span>)
</p>
              </li>
              <li class="listitem">
                <p>
All <span class="strong"><strong>other</strong></span> users (<span class="strong"><strong>o</strong></span>) also referred to as "world" and "everyone"
</p>
              </li>
            </ul>
          </div>
          <p>For the file, each corresponding permission allows following actions.</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
The <span class="strong"><strong>read</strong></span> (<span class="strong"><strong>r</strong></span>) permission allows owner to examine contents of the file.
</p>
              </li>
              <li class="listitem">
                <p>
The <span class="strong"><strong>write</strong></span> (<span class="strong"><strong>w</strong></span>) permission allows owner to modify the file.
</p>
              </li>
              <li class="listitem">
                <p>
The <span class="strong"><strong>execute</strong></span> (<span class="strong"><strong>x</strong></span>) permission allows owner to run the file as a command.
</p>
              </li>
            </ul>
          </div>
          <p>For the directory, each corresponding permission allows following actions.</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
The <span class="strong"><strong>read</strong></span> (<span class="strong"><strong>r</strong></span>) permission allows owner to list contents of the directory.
</p>
              </li>
              <li class="listitem">
                <p>
The <span class="strong"><strong>write</strong></span> (<span class="strong"><strong>w</strong></span>) permission allows owner to add or remove files in the directory.
</p>
              </li>
              <li class="listitem">
                <p>
The <span class="strong"><strong>execute</strong></span> (<span class="strong"><strong>x</strong></span>) permission allows owner to access files in the directory.
</p>
              </li>
            </ul>
          </div>
          <p>Here, the <span class="strong"><strong>execute</strong></span> permission on a directory means not only to allow reading of files in that directory but also to allow viewing their attributes, such as the size and the modification time.</p>
          <p><span class="citerefentry"><span class="refentrytitle">ls</span>(1)</span> is used to display permission information (and more) for files and directories.  When it is invoked with the "<code class="literal">-l</code>" option, it displays the following information in the order given.</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p><span class="strong"><strong>Type of file</strong></span> (first character)
</p>
              </li>
              <li class="listitem">
                <p>
Access <span class="strong"><strong>permission</strong></span> of the file (nine characters, consisting of three characters each for user, group, and other in this order)
</p>
              </li>
              <li class="listitem">
                <p><span class="strong"><strong>Number of hard links</strong></span> to the file
</p>
              </li>
              <li class="listitem">
                <p>
Name of the <span class="strong"><strong>user</strong></span> who owns the file
</p>
              </li>
              <li class="listitem">
                <p>
Name of the <span class="strong"><strong>group</strong></span> which the file belongs to
</p>
              </li>
              <li class="listitem">
                <p><span class="strong"><strong>Size</strong></span> of the file in characters (bytes)
</p>
              </li>
              <li class="listitem">
                <p><span class="strong"><strong>Date and time</strong></span> of the file (mtime)
</p>
              </li>
              <li class="listitem">
                <p><span class="strong"><strong>Name</strong></span> of the file
</p>
              </li>
            </ul>
          </div>
          <div class="table">
            <a id="listofthefirstchacteroflsloutput"/>
            <p class="title">
              <strong>Table 1.4. List of the first character of "<code class="literal">ls -l</code>" output</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of the first character of &quot;ls -l&quot; output" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    character
    </th>
                    <th style="text-align: left">
    meaning
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">-</code>
                </td>
                    <td style="text-align: left">
    normal file
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">d</code>
                </td>
                    <td style="text-align: left">
    directory
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">l</code>
                </td>
                    <td style="text-align: left">
    symlink
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">c</code>
                </td>
                    <td style="text-align: left">
    character device node
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">b</code>
                </td>
                    <td style="text-align: left">
    block device node
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">p</code>
                </td>
                    <td style="text-align: left">
    named pipe
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">s</code>
                </td>
                    <td style="text-align: left">
    socket
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p><span class="citerefentry"><span class="refentrytitle">chown</span>(1)</span> is used from the root account to change the owner of the file.  <span class="citerefentry"><span class="refentrytitle">chgrp</span>(1)</span> is used from the file's owner or root account to change the group of the file.  <span class="citerefentry"><span class="refentrytitle">chmod</span>(1)</span> is used from the file's owner or root account to change file and directory access permissions.  Basic syntax to manipulate a <code class="literal">foo</code> file is the following.</p>
          <pre class="screen"># chown &lt;newowner&gt; foo
# chgrp &lt;newgroup&gt; foo
# chmod  [ugoa][+-=][rwxXst][,...] foo</pre>
          <p>For example, you can make a directory tree to be owned by a user <code class="literal">foo</code> and shared by a group <code class="literal">bar</code> by the following.</p>
          <pre class="screen"># cd /some/location/
# chown -R foo:bar .
# chmod -R ug+rwX,o=rX .</pre>
          <p>There are three more special permission bits.</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
The <span class="strong"><strong>set user ID</strong></span> bit (<span class="strong"><strong>s</strong></span> or <span class="strong"><strong>S</strong></span> instead of user's <span class="strong"><strong>x</strong></span>)
</p>
              </li>
              <li class="listitem">
                <p>
The <span class="strong"><strong>set group ID</strong></span> bit (<span class="strong"><strong>s</strong></span> or <span class="strong"><strong>S</strong></span> instead of group's <span class="strong"><strong>x</strong></span>)
</p>
              </li>
              <li class="listitem">
                <p>
The <span class="strong"><strong>sticky</strong></span> bit (<span class="strong"><strong>t</strong></span> or <span class="strong"><strong>T</strong></span> instead of other's <span class="strong"><strong>x</strong></span>)
</p>
              </li>
            </ul>
          </div>
          <p>Here the output of "<code class="literal">ls -l</code>" for these bits is <span class="strong"><strong>capitalized</strong></span> if execution bits hidden by these outputs are <span class="strong"><strong>unset</strong></span>.</p>
          <p>Setting <span class="strong"><strong>set user ID</strong></span> on an executable file allows a user to execute the executable file with the owner ID of the file (for example <span class="strong"><strong>root</strong></span>).  Similarly, setting <span class="strong"><strong>set group ID</strong></span> on an executable file allows a user to execute the executable file with the group ID of the file (for example <span class="strong"><strong>root</strong></span>).  Because these settings can cause security risks, enabling them requires extra caution.</p>
          <p>Setting <span class="strong"><strong>set group ID</strong></span> on a directory enables the <a class="ulink" href="http://en.wikipedia.org/wiki/Berkeley_Software_Distribution">BSD-like</a> file creation scheme where all files created in the directory belong to the <span class="strong"><strong>group</strong></span> of the directory.</p>
          <p>Setting the <span class="strong"><strong>sticky bit</strong></span> on a directory prevents a file in the directory from being removed by a user who is not the owner of the file.  In order to secure contents of a file in world-writable directories such as "<code class="literal">/tmp</code>" or in group-writable directories, one must not only reset the <span class="strong"><strong>write</strong></span> permission for the file but also set the <span class="strong"><strong>sticky bit</strong></span> on the directory.  Otherwise, the file can be removed and a new file can be created with the same name by any user who has write access to the directory.</p>
          <p>Here are a few interesting examples of file permissions.</p>
          <pre class="screen">$ ls -l /etc/passwd /etc/shadow /dev/ppp /usr/sbin/exim4
crw------T 1 root root   108, 0 Oct 16 20:57 /dev/ppp
-rw-r--r-- 1 root root     2761 Aug 30 10:38 /etc/passwd
-rw-r----- 1 root shadow   1695 Aug 30 10:38 /etc/shadow
-rwsr-xr-x 1 root root   973824 Sep 23 20:04 /usr/sbin/exim4
$ ls -ld /tmp /var/tmp /usr/local /var/mail /usr/src
drwxrwxrwt 14 root root  20480 Oct 16 21:25 /tmp
drwxrwsr-x 10 root staff  4096 Sep 29 22:50 /usr/local
drwxr-xr-x 10 root root   4096 Oct 11 00:28 /usr/src
drwxrwsr-x  2 root mail   4096 Oct 15 21:40 /var/mail
drwxrwxrwt  3 root root   4096 Oct 16 21:20 /var/tmp</pre>
          <p>There is an alternative numeric mode to describe file permissions with <span class="citerefentry"><span class="refentrytitle">chmod</span>(1)</span>.  This numeric mode uses 3 to 4 digit wide octal (radix=8) numbers.</p>
          <div class="table">
            <a id="thenumericmodefoinchmodbcommands"/>
            <p class="title">
              <strong>Table 1.5. The numeric mode for file permissions in <span class="citerefentry"><span class="refentrytitle">chmod</span>(1)</span> commands</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="The numeric mode for file permissions in chmod1 commands" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    digit
    </th>
                    <th style="text-align: left">
    meaning
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
    1st optional digit
    </td>
                    <td style="text-align: left">
    sum of <span class="strong"><strong>set user ID</strong></span> (=4), <span class="strong"><strong>set group ID</strong></span> (=2), and <span class="strong"><strong>sticky bit</strong></span> (=1)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
    2nd digit
    </td>
                    <td style="text-align: left">
    sum of <span class="strong"><strong>read</strong></span> (=4), <span class="strong"><strong>write</strong></span> (=2), and <span class="strong"><strong>execute</strong></span> (=1) permissions for <span class="strong"><strong>user</strong></span>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
    3rd digit
    </td>
                    <td style="text-align: left">
    ditto for <span class="strong"><strong>group</strong></span>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
    4th digit
    </td>
                    <td style="text-align: left">
    ditto for <span class="strong"><strong>other</strong></span>
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>This sounds complicated but it is actually quite simple.  If you look at the first few (2-10) columns from "<code class="literal">ls -l</code>" command output and read it as a binary (radix=2) representation of file permissions ("-" being "0" and "rwx" being "1"), the last 3 digit of the numeric mode value should make sense as an octal (radix=8) representation of file permissions to you.</p>
          <p>For example, try the following</p>
          <pre class="screen">$ touch foo bar
$ chmod u=rw,go=r foo
$ chmod 644 bar
$ ls -l foo bar
-rw-r--r-- 1 penguin penguin 0 Oct 16 21:39 bar
-rw-r--r-- 1 penguin penguin 0 Oct 16 21:35 foo</pre>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>If you need to access information displayed by "<code class="literal">ls -l</code>" in shell script, you should use pertinent commands such as <span class="citerefentry"><span class="refentrytitle">test</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">stat</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">readlink</span>(1)</span>.  The shell builtin such as "<code class="literal">[</code>" or "<code class="literal">test</code>" may be used too.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_control_of_permissions_for_newly_created_files_umask"/>1.2.4. Control of permissions for newly created files: umask</h3>
              </div>
            </div>
          </div>
          <p>What permissions are applied to a newly created file or directory is restricted by the <code class="literal">umask</code> shell builtin command.  See <span class="citerefentry"><span class="refentrytitle">dash</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">bash</span>(1)</span>, and <span class="citerefentry"><span class="refentrytitle">builtins</span>(7)</span>.</p>
          <pre class="screen"> (file permissions) = (requested file permissions) &amp; ~(umask value)</pre>
          <div class="table">
            <a id="theumaskvalueexamples"/>
            <p class="title">
              <strong>Table 1.6. The <span class="strong">umask</span> value examples</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="The umask value examples" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    umask
    </th>
                    <th style="text-align: left">
    file permissions created
    </th>
                    <th style="text-align: left">
    directory permissions created
    </th>
                    <th style="text-align: left">
    usage
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">0022</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">-rw-r--r--</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">-rwxr-xr-x</code>
                </td>
                    <td style="text-align: left">
    writable only by the user
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">0002</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">-rw-rw-r--</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">-rwxrwxr-x</code>
                </td>
                    <td style="text-align: left">
    writable by the group
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>The Debian system uses a user private group (UPG) scheme as its default. A UPG is created whenever a new user is added to the system. A UPG has the same name as the user for which it was created and that user is the only member of the UPG. UPG scheme makes it safe to set umask to <code class="literal">0002</code> since every user has their own private group.  (In some Unix variants, it is quite common to setup all normal users belonging to a single <span class="strong"><strong><code class="literal">users</code></strong></span> group and is a good idea to set umask to <code class="literal">0022</code> for security in such cases.)</p>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Enable UPG by putting "<code class="literal">umask 002</code>" in the <code class="literal">~/.bashrc</code> file.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_permissions_for_groups_of_users_group"/>1.2.5. Permissions for groups of users (group)</h3>
              </div>
            </div>
          </div>
          <p>In order to make group permissions to be applied to a particular user, that user needs to be made a member of the group using "<code class="literal">sudo vigr</code>" for <code class="literal">/etc/group</code> and "<code class="literal">sudo vigr -s</code>" for <code class="literal">/etc/gshadow</code>.  You need to login after logout (or run "<code class="literal">exec newgrp</code>") to enable the new group configuration.</p>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Alternatively, you may dynamically add users to groups during the authentication process by adding "<code class="literal">auth optional pam_group.so</code>" line to "<code class="literal">/etc/pam.d/common-auth</code>" and setting "<code class="literal">/etc/security/group.conf</code>".  (See <a class="xref" href="ch04.en.html" title="Chapter 4. Authentication">Chapter 4, <em>Authentication</em></a>.)</p>
                </td>
              </tr>
            </table>
          </div>
          <p>The hardware devices are just another kind of file on the Debian system.  If you have problems accessing devices such as CD-ROM and USB memory stick from a user account, you should make that user a member of the relevant group.</p>
          <p>Some notable system-provided groups allow their members to access particular files and devices without <code class="literal">root</code> privilege.</p>
          <div class="table">
            <a id="listofnotablesysupsforfileaccess"/>
            <p class="title">
              <strong>Table 1.7. List of notable system-provided groups for file access</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of notable system-provided groups for file access" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    group
    </th>
                    <th style="text-align: left">
    description for accessible files and devices
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">dialout</code>
                </td>
                    <td style="text-align: left">
    full and direct access to serial ports ("<code class="literal">/dev/ttyS[0-3]</code>")
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">dip</code>
                </td>
                    <td style="text-align: left">
    limited access to serial ports for <span class="strong"><strong>Dialup IP</strong></span> connection to trusted peers
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">cdrom</code>
                </td>
                    <td style="text-align: left">
    CD-ROM, DVD+/-RW drives
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">audio</code>
                </td>
                    <td style="text-align: left">
    audio device
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">video</code>
                </td>
                    <td style="text-align: left">
    video device
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">scanner</code>
                </td>
                    <td style="text-align: left">
    scanner(s)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">adm</code>
                </td>
                    <td style="text-align: left">
    system monitoring logs
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">staff</code>
                </td>
                    <td style="text-align: left">
    some directories for junior administrative work: "<code class="literal">/usr/local</code>", "<code class="literal">/home</code>"
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>You need to belong to the <code class="literal">dialout</code> group to reconfigure modem, dial anywhere, etc.  But if <code class="literal">root</code> creates pre-defined configuration files for trusted peers in "<code class="literal">/etc/ppp/peers/</code>", you only need to belong to the <code class="literal">dip</code> group to create <span class="strong"><strong>Dialup IP</strong></span> connection to those trusted peers using <span class="citerefentry"><span class="refentrytitle">pppd</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">pon</span>(1)</span>, and <span class="citerefentry"><span class="refentrytitle">poff</span>(1)</span> commands.</p>
                </td>
              </tr>
            </table>
          </div>
          <p>Some notable system-provided groups allow their members to execute particular commands without <code class="literal">root</code> privilege.</p>
          <div class="table">
            <a id="listofnotablesysommandexecutions"/>
            <p class="title">
              <strong>Table 1.8. List of notable system provided groups for particular command executions</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of notable system provided groups for particular command executions" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    group
    </th>
                    <th style="text-align: left">
    accessible commands
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">sudo</code>
                </td>
                    <td style="text-align: left">
    execute <code class="literal">sudo</code> without their password
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">lpadmin</code>
                </td>
                    <td style="text-align: left">
    execute commands to add, modify, and remove printers from printer databases
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>For the full listing of the system provided users and groups, see the recent version of the "Users and Groups" document in "<code class="literal">/usr/share/doc/base-passwd/users-and-groups.html</code>" provided by the <code class="literal">base-passwd</code> package.</p>
          <p>See <span class="citerefentry"><span class="refentrytitle">passwd</span>(5)</span>, <span class="citerefentry"><span class="refentrytitle">group</span>(5)</span>, <span class="citerefentry"><span class="refentrytitle">shadow</span>(5)</span>, <span class="citerefentry"><span class="refentrytitle">newgrp</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">vipw</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">vigr</span>(8)</span>, and <span class="citerefentry"><span class="refentrytitle">pam_group</span>(8)</span> for management commands of the user and group system.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_timestamps"/>1.2.6. Timestamps</h3>
              </div>
            </div>
          </div>
          <p>There are three types of timestamps for a GNU/Linux file.</p>
          <div class="table">
            <a id="listoftypesoftimestamps"/>
            <p class="title">
              <strong>Table 1.9. List of types of timestamps</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of types of timestamps" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    type
    </th>
                    <th style="text-align: left">
    meaning (historic Unix definition)
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <span class="strong"><strong>mtime</strong></span>
                </td>
                    <td style="text-align: left">
    the file modification time (<code class="literal">ls -l</code>)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <span class="strong"><strong>ctime</strong></span>
                </td>
                    <td style="text-align: left">
    the file status change time (<code class="literal">ls -lc</code>)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <span class="strong"><strong>atime</strong></span>
                </td>
                    <td style="text-align: left">
    the last file access time (<code class="literal">ls -lu</code>)
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p><span class="strong"><strong>ctime</strong></span> is not file creation time.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>The actual value of <span class="strong"><strong>atime</strong></span> on GNU/Linux system may be different from that of the historic Unix definition.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
Overwriting a file changes all of the <span class="strong"><strong>mtime</strong></span>, <span class="strong"><strong>ctime</strong></span>, and <span class="strong"><strong>atime</strong></span> attributes of the file.
</p>
              </li>
              <li class="listitem">
                <p>
Changing ownership or permission of a file changes the <span class="strong"><strong>ctime</strong></span> and <span class="strong"><strong>atime</strong></span> attributes of the file.
</p>
              </li>
              <li class="listitem">
                <p>
Reading a file changes the <span class="strong"><strong>atime</strong></span> attribute of the file on the historic Unix system.
</p>
              </li>
              <li class="listitem">
                <p>
Reading a file changes the <span class="strong"><strong>atime</strong></span> attribute of the file on the GNU/Linux system if its filesystem is mounted with "<code class="literal">strictatime</code>".
</p>
              </li>
              <li class="listitem">
                <p>
Reading a file for the first time or after one day changes the <span class="strong"><strong>atime</strong></span> attribute of the file on the GNU/Linux system if its filesystem is mounted with "<code class="literal">relatime</code>". (default behavior since Linux 2.6.30)
</p>
              </li>
              <li class="listitem">
                <p>
Reading a file doesn't change the <span class="strong"><strong>atime</strong></span> attribute of the file on the GNU/Linux system if its filesystem is mounted with "<code class="literal">noatime</code>".
</p>
              </li>
            </ul>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>The "<code class="literal">noatime</code>" and "<code class="literal">relatime</code>" mount options are introduced to improve the filesystem read performance under the normal use cases.  Simple file read operation under the "<code class="literal">strictatime</code>" option accompanies the time-consuming write operation to update the <span class="strong"><strong>atime</strong></span> attribute.  But the <span class="strong"><strong>atime</strong></span> attribute is rarely used except for the <span class="citerefentry"><span class="refentrytitle">mbox</span>(5)</span> file.  See <span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span>.</p>
                </td>
              </tr>
            </table>
          </div>
          <p>Use <span class="citerefentry"><span class="refentrytitle">touch</span>(1)</span> command to change timestamps of existing files.</p>
          <p>For timestamps, the <code class="literal">ls</code> command outputs different strings under non-English locale ("<code class="literal">fr_FR.UTF-8</code>") from under the old one ("<code class="literal">C</code>").</p>
          <pre class="screen">$ LANG=fr_FR.UTF-8  ls -l foo
-rw-rw-r-- 1 penguin penguin 0 oct. 16 21:35 foo
$ LANG=C  ls -l foo
-rw-rw-r-- 1 penguin penguin 0 Oct 16 21:35 foo</pre>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>See <a class="xref" href="ch09.en.html#_customized_display_of_time_and_date" title="9.2.5. Customized display of time and date">Section 9.2.5, “Customized display of time and date”</a> to customize "<code class="literal">ls -l</code>" output.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_links"/>1.2.7. Links</h3>
              </div>
            </div>
          </div>
          <p>There are two methods of associating a file "<code class="literal">foo</code>" with a different filename "<code class="literal">bar</code>".</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
              <a class="ulink" href="http://en.wikipedia.org/wiki/Hard_link">Hard link</a>
            </p>
                <div class="itemizedlist">
                  <ul class="itemizedlist">
                    <li class="listitem">
                      <p>
Duplicate name for an existing file
</p>
                    </li>
                    <li class="listitem">
                      <p>
"<code class="literal">ln foo bar</code>"
</p>
                    </li>
                  </ul>
                </div>
              </li>
              <li class="listitem">
                <p>
              <a class="ulink" href="http://en.wikipedia.org/wiki/Symbolic_link">Symbolic link or symlink</a>
            </p>
                <div class="itemizedlist">
                  <ul class="itemizedlist">
                    <li class="listitem">
                      <p>
Special file that points to another file by name
</p>
                    </li>
                    <li class="listitem">
                      <p>
"<code class="literal">ln -s foo bar</code>"
</p>
                    </li>
                  </ul>
                </div>
              </li>
            </ul>
          </div>
          <p>See the following example for changes in link counts and the subtle differences in the result of the <code class="literal">rm</code> command.</p>
          <pre class="screen">$ umask 002
$ echo "Original Content" &gt; foo
$ ls -li foo
1449840 -rw-rw-r-- 1 penguin penguin 17 Oct 16 21:42 foo
$ ln foo bar     # hard link
$ ln -s foo baz  # symlink
$ ls -li foo bar baz
1449840 -rw-rw-r-- 2 penguin penguin 17 Oct 16 21:42 bar
1450180 lrwxrwxrwx 1 penguin penguin  3 Oct 16 21:47 baz -&gt; foo
1449840 -rw-rw-r-- 2 penguin penguin 17 Oct 16 21:42 foo
$ rm foo
$ echo "New Content" &gt; foo
$ ls -li foo bar baz
1449840 -rw-rw-r-- 1 penguin penguin 17 Oct 16 21:42 bar
1450180 lrwxrwxrwx 1 penguin penguin  3 Oct 16 21:47 baz -&gt; foo
1450183 -rw-rw-r-- 1 penguin penguin 12 Oct 16 21:48 foo
$ cat bar
Original Content
$ cat baz
New Content</pre>
          <p>The hardlink can be made within the same filesystem and shares the same inode number which the "<code class="literal">-i</code>" option with <span class="citerefentry"><span class="refentrytitle">ls</span>(1)</span>  reveals.</p>
          <p>The symlink always has nominal file access permissions of "<code class="literal">rwxrwxrwx</code>", as shown in the above example, with the effective access permissions dictated by permissions of the file that it points to.</p>
          <div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Caution">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Caution]" src="images/caution.png"/>
                </td>
                <th align="left">Caution</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>It is generally a good idea not to create complicated symbolic links or hardlinks at all unless you have a very good reason.  It may cause nightmares where the logical combination of the symbolic links results in loops in the filesystem.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>It is generally preferable to use symbolic links rather than hardlinks unless you have a good reason for using a hardlink.</p>
                </td>
              </tr>
            </table>
          </div>
          <p>The "<code class="literal">.</code>"  directory links to the directory that it appears in, thus the link count of any new directory starts at 2.  The "<code class="literal">..</code>"  directory links to the parent directory, thus the link count of the directory increases with the addition of new subdirectories.</p>
          <p>If you are just moving to Linux from Windows, it soon becomes clear how well-designed the filename linking of Unix is, compared with the nearest Windows equivalent of "shortcuts".  Because it is implemented in the filesystem, applications can't see any difference between a linked file and the original. In the case of hardlinks, there really is no difference.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_named_pipes_fifos"/>1.2.8. Named pipes (FIFOs)</h3>
              </div>
            </div>
          </div>
          <p>A <a class="ulink" href="http://en.wikipedia.org/wiki/Named_pipe">named pipe</a> is a file that acts like a pipe.  You put something into the file, and it comes out the other end.  Thus it's called a FIFO, or First-In-First-Out: the first thing you put in the pipe is the first thing to come out the other end.</p>
          <p>If you write to a named pipe, the process which is writing to the pipe doesn't terminate until the information being written is read from the pipe.  If you read from a named pipe, the reading process waits until there is nothing to read before terminating.  The size of the pipe is always zero --- it does not store data, it just links two processes like the functionality offered by the shell "<code class="literal">|</code>" syntax.  However, since this pipe has a name, the two processes don't have to be on the same command line or even be run by the same user. Pipes were a very influential innovation of Unix.</p>
          <p>For example, try the following</p>
          <pre class="screen">$ cd; mkfifo mypipe
$ echo "hello" &gt;mypipe &amp; # put into background
[1] 8022
$ ls -l mypipe
prw-rw-r-- 1 penguin penguin 0 Oct 16 21:49 mypipe
$ cat mypipe
hello
[1]+  Done                    echo "hello" &gt;mypipe
$ ls mypipe
mypipe
$ rm mypipe</pre>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_sockets"/>1.2.9. Sockets</h3>
              </div>
            </div>
          </div>
          <p>Sockets are used extensively by all the Internet communication, databases, and the operating system itself. It is similar to the named pipe (FIFO) and allows processes to exchange information even between different computers.  For the socket, those processes do not need to be running at the same time nor to be running as the children of the same ancestor process.  This is the endpoint for <a class="ulink" href="http://en.wikipedia.org/wiki/Inter-process_communication">the inter process communication (IPC)</a>.  The exchange of information may occur over the network between different hosts.  The two most common ones are <a class="ulink" href="http://en.wikipedia.org/wiki/Internet_socket">the Internet socket</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/Unix_domain_socket">the Unix domain socket</a>.</p>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>"<code class="literal">netstat -an</code>" provides a very useful overview of sockets that are open on a given system.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_device_files"/>1.2.10. Device files</h3>
              </div>
            </div>
          </div>
          <p><a class="ulink" href="http://en.wikipedia.org/wiki/Device_file">Device files</a> refer to physical or virtual devices on your system, such as your hard disk, video card, screen, or keyboard.  An example of a virtual device is the console, represented by "<code class="literal">/dev/console</code>".</p>
          <p>There are 2 types of device files.</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
              <span class="strong"><strong>Character device</strong></span>
            </p>
                <div class="itemizedlist">
                  <ul class="itemizedlist">
                    <li class="listitem">
                      <p>
Accessed one character at a time
</p>
                    </li>
                    <li class="listitem">
                      <p>
1 character = 1 byte
</p>
                    </li>
                    <li class="listitem">
                      <p>
E.g. keyboard device, serial port, …
</p>
                    </li>
                  </ul>
                </div>
              </li>
              <li class="listitem">
                <p>
              <span class="strong"><strong>Block device</strong></span>
            </p>
                <div class="itemizedlist">
                  <ul class="itemizedlist">
                    <li class="listitem">
                      <p>
accessed in larger units called blocks
</p>
                    </li>
                    <li class="listitem">
                      <p>
1 block &gt; 1 byte
</p>
                    </li>
                    <li class="listitem">
                      <p>
E.g. hard disk, …
</p>
                    </li>
                  </ul>
                </div>
              </li>
            </ul>
          </div>
          <p>You can read and write device files, though the file may well contain binary data which may be an incomprehensible-to-humans gibberish.  Writing data directly to these files is sometimes useful for the troubleshooting of hardware connections.  For example, you can dump a text file to the printer device "<code class="literal">/dev/lp0</code>" or send modem commands to the appropriate serial port "<code class="literal">/dev/ttyS0</code>".  But, unless this is done carefully, it may cause a major disaster.  So be cautious.</p>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>For the normal access to a printer, use <span class="citerefentry"><span class="refentrytitle">lp</span>(1)</span>.</p>
                </td>
              </tr>
            </table>
          </div>
          <p>The device node number are displayed by executing <span class="citerefentry"><span class="refentrytitle">ls</span>(1)</span> as the following.</p>
          <pre class="screen">$ ls -l /dev/sda /dev/sr0 /dev/ttyS0 /dev/zero
brw-rw---T  1 root disk     8,  0 Oct 16 20:57 /dev/sda
brw-rw---T+ 1 root cdrom   11,  0 Oct 16 21:53 /dev/sr0
crw-rw---T  1 root dialout  4, 64 Oct 16 20:57 /dev/ttyS0
crw-rw-rw-  1 root root     1,  5 Oct 16 20:57 /dev/zero</pre>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
"<code class="literal">/dev/sda</code>" has the major device number 8 and the minor device number 0.  This is read/write accessible by users belonging to the <code class="literal">disk</code> group.
</p>
              </li>
              <li class="listitem">
                <p>
"<code class="literal">/dev/sr0</code>" has the major device number 11 and the minor device number 0.  This is read/write accessible by users belonging to the <code class="literal">cdrom</code> group.
</p>
              </li>
              <li class="listitem">
                <p>
"<code class="literal">/dev/ttyS0</code>" has the major device number 4 and the minor device number 64.  This is read/write accessible by users belonging to the <code class="literal">dialout</code> group.
</p>
              </li>
              <li class="listitem">
                <p>
"<code class="literal">/dev/zero</code>" has the major device number 1 and the minor device number 5.  This is read/write accessible by anyone.
</p>
              </li>
            </ul>
          </div>
          <p>On the modern Linux system, the filesystem under "<code class="literal">/dev/</code>" is automatically populated by the <span class="citerefentry"><span class="refentrytitle">udev</span>(7)</span> mechanism.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_special_device_files"/>1.2.11. Special device files</h3>
              </div>
            </div>
          </div>
          <p>There are some special device files.</p>
          <div class="table">
            <a id="listofspecialdevicefiles"/>
            <p class="title">
              <strong>Table 1.10. List of special device files</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of special device files" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    device file
    </th>
                    <th style="text-align: left">
    action
    </th>
                    <th style="text-align: left">
    description of response
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/dev/null</code>
                </td>
                    <td style="text-align: left">
    read
    </td>
                    <td style="text-align: left">
    return "end-of-file (EOF) character"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/dev/null</code>
                </td>
                    <td style="text-align: left">
    write
    </td>
                    <td style="text-align: left">
    return nothing (a bottomless data dump pit)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/dev/zero</code>
                </td>
                    <td style="text-align: left">
    read
    </td>
                    <td style="text-align: left">
    return "the <code class="literal">\0</code> (NUL) character" (not the same as the number zero ASCII)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/dev/random</code>
                </td>
                    <td style="text-align: left">
    read
    </td>
                    <td style="text-align: left">
    return random characters from a true random number generator, delivering real entropy (slow)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/dev/urandom</code>
                </td>
                    <td style="text-align: left">
    read
    </td>
                    <td style="text-align: left">
    return random characters from a cryptographically secure pseudorandom number generator
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/dev/full</code>
                </td>
                    <td style="text-align: left">
    write
    </td>
                    <td style="text-align: left">
    return the disk-full (ENOSPC) error
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>These are frequently used in conjunction with the shell redirection (see <a class="xref" href="ch01.en.html#_typical_command_sequences_and_shell_redirection" title="1.5.8. Typical command sequences and shell redirection">Section 1.5.8, “Typical command sequences and shell redirection”</a>).</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_procfs_and_sysfs"/>1.2.12. procfs and sysfs</h3>
              </div>
            </div>
          </div>
          <p>The <a class="ulink" href="http://en.wikipedia.org/wiki/Procfs">procfs</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/Sysfs">sysfs</a> mounted on "<code class="literal">/proc</code>" and "<code class="literal">/sys</code>" are the pseudo-filesystem and expose internal data structures of the kernel to the userspace.  In other word, these entries are virtual, meaning that they act as a convenient window into the operation of the operating system.</p>
          <p>The directory "<code class="literal">/proc</code>" contains (among other things) one subdirectory for each process running on the system, which is named after the process ID (PID). System utilities that access process information, such as <span class="citerefentry"><span class="refentrytitle">ps</span>(1)</span>, get their information from this directory structure.</p>
          <p>The directories under "<code class="literal">/proc/sys/</code>" contain interfaces to change certain kernel parameters at run time.  (You may do the same through the specialized <span class="citerefentry"><span class="refentrytitle">sysctl</span>(8)</span> command or its preload/configuration file "<code class="literal">/etc/sysctl.conf</code>".)</p>
          <p>People frequently panic when they notice one file in particular - "<code class="literal">/proc/kcore</code>" - which is generally huge.  This is (more or less) a copy of the content of your computer's memory.  It's used to debug the kernel.  It is a virtual file that points to computer memory, so don't worry about its size.</p>
          <p>The directory under "<code class="literal">/sys</code>" contains exported kernel data structures, their attributes, and their linkages between them. It also contains interfaces to change certain kernel parameters at run time.</p>
          <p>See "<code class="literal">proc.txt(.gz)</code>", "<code class="literal">sysfs.txt(.gz)</code>" and other related documents in the Linux kernel documentation ("<code class="literal">/usr/share/doc/linux-doc-*/Documentation/filesystems/*</code>") provided by the <code class="literal">linux-doc-*</code> package.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_tmpfs"/>1.2.13. tmpfs</h3>
              </div>
            </div>
          </div>
          <p>The <a class="ulink" href="http://en.wikipedia.org/wiki/Tmpfs#Linux">tmpfs</a> is a temporary filesystem which keeps all files in the <a class="ulink" href="http://en.wikipedia.org/wiki/Virtual_memory">virtual memory</a>.  The data of the tmpfs in the <a class="ulink" href="http://en.wikipedia.org/wiki/Page_cache">page cache</a> on memory may be swapped out to the <a class="ulink" href="http://en.wikipedia.org/wiki/Paging">swap space</a> on disk as needed.</p>
          <p>The directory "<code class="literal">/run</code>" is mounted as the tmpfs in the early boot process.  This enables writing to it even when the directory "<code class="literal">/</code>" is mounted as read-only.  This is the new location for the storage of transient state files and replaces several locations described in the <a class="ulink" href="http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard">Filesystem Hierarchy Standard</a> version 2.3:</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
"<code class="literal">/var/run</code>" → "<code class="literal">/run</code>"
</p>
              </li>
              <li class="listitem">
                <p>
"<code class="literal">/var/lock</code>" → "<code class="literal">/run/lock</code>"
</p>
              </li>
              <li class="listitem">
                <p>
"<code class="literal">/dev/shm</code>" → "<code class="literal">/run/shm</code>"
</p>
              </li>
            </ul>
          </div>
          <p>See "<code class="literal">tmpfs.txt(.gz)</code>" in the Linux kernel documentation ("<code class="literal">/usr/share/doc/linux-doc-*/Documentation/filesystems/*</code>") provided by the <code class="literal">linux-doc-*</code> package.</p>
        </div>
      </div>
      <div class="section">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title"><a id="_midnight_commander_mc"/>1.3. Midnight Commander (MC)</h2>
            </div>
          </div>
        </div>
        <p><a class="ulink" href="http://en.wikipedia.org/wiki/Midnight_Commander">Midnight Commander (MC)</a> is a GNU "Swiss army knife" for the Linux console and other terminal environments.  This gives newbie a menu driven console experience which is much easier to learn than standard Unix commands.</p>
        <p>You may need to install the Midnight Commander package which is titled "<code class="literal">mc</code>" by the following.</p>
        <pre class="screen">$ sudo apt-get install mc</pre>
        <p>Use the <span class="citerefentry"><span class="refentrytitle">mc</span>(1)</span> command to explore the Debian system.  This is the best way to learn.  Please explore few interesting locations just using the cursor keys and Enter key.</p>
        <div class="itemizedlist">
          <ul class="itemizedlist">
            <li class="listitem">
              <p>
"<code class="literal">/etc</code>" and its subdirectories
</p>
            </li>
            <li class="listitem">
              <p>
"<code class="literal">/var/log</code>" and its subdirectories
</p>
            </li>
            <li class="listitem">
              <p>
"<code class="literal">/usr/share/doc</code>" and its subdirectories
</p>
            </li>
            <li class="listitem">
              <p>
"<code class="literal">/sbin</code>" and "<code class="literal">/bin</code>"
</p>
            </li>
          </ul>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_customization_of_mc"/>1.3.1. Customization of MC</h3>
              </div>
            </div>
          </div>
          <p>In order to make MC to change working directory upon exit and <code class="literal">cd</code> to the directory, I suggest to modify "<code class="literal">~/.bashrc</code>" to include a script provided by the <code class="literal">mc</code> package.</p>
          <pre class="screen">. /usr/lib/mc/mc.sh</pre>
          <p>See <span class="citerefentry"><span class="refentrytitle">mc</span>(1)</span> (under the "<code class="literal">-P</code>" option) for the reason. (If you do not understand what exactly I am talking here, you can do this later.)</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_starting_mc"/>1.3.2. Starting MC</h3>
              </div>
            </div>
          </div>
          <p>MC can be started by the following.</p>
          <pre class="screen">$ mc</pre>
          <p>MC takes care of all file operations through its menu, requiring minimal user effort.  Just press F1 to get the help screen.  You can play with MC just by pressing cursor-keys and function-keys.</p>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>In some consoles such as <span class="citerefentry"><span class="refentrytitle">gnome-terminal</span>(1)</span>, key strokes of function-keys may be stolen by the console program.   You can disable these features by "Edit" → "Keyboard Shortcuts" for <code class="literal">gnome-terminal</code>.</p>
                </td>
              </tr>
            </table>
          </div>
          <p>If you encounter character encoding problem which displays garbage characters, adding "<code class="literal">-a</code>" to MC's command line may help prevent problems.</p>
          <p>If this doesn't clear up your display problems with MC, see <a class="xref" href="ch09.en.html#_the_terminal_configuration" title="9.4.6. The terminal configuration">Section 9.4.6, “The terminal configuration”</a>.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_file_manager_in_mc"/>1.3.3. File manager in MC</h3>
              </div>
            </div>
          </div>
          <p>The default is two directory panels containing file lists.  Another useful mode is to set the right window to "information" to see file access privilege information, etc.  Following are some essential keystrokes.  With the <span class="citerefentry"><span class="refentrytitle">gpm</span>(8)</span> daemon running, one can use a mouse on Linux character consoles, too.  (Make sure to press the shift-key to obtain the normal behavior of cut and paste in MC.)</p>
          <div class="table">
            <a id="thekeybindingsofmc"/>
            <p class="title">
              <strong>Table 1.11. The key bindings of MC</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="The key bindings of MC" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    key
    </th>
                    <th style="text-align: left">
    key binding
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">F1</code>
                </td>
                    <td style="text-align: left">
    help menu
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">F3</code>
                </td>
                    <td style="text-align: left">
    internal file viewer
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">F4</code>
                </td>
                    <td style="text-align: left">
    internal editor
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">F9</code>
                </td>
                    <td style="text-align: left">
    activate pull down menu
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">F10</code>
                </td>
                    <td style="text-align: left">
    exit Midnight Commander
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Tab</code>
                </td>
                    <td style="text-align: left">
    move between two windows
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left"><code class="literal">Insert</code> or <code class="literal">Ctrl-T</code>
    </td>
                    <td style="text-align: left">
    mark file for a multiple-file operation such as copy
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Del</code>
                </td>
                    <td style="text-align: left">
    delete file (be careful---set MC to safe delete mode)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
    Cursor keys
    </td>
                    <td style="text-align: left">
    self-explanatory
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_command_line_tricks_in_mc"/>1.3.4. Command-line tricks in MC</h3>
              </div>
            </div>
          </div>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p><code class="literal">cd</code> command changes the directory shown on the selected screen.
</p>
              </li>
              <li class="listitem">
                <p><code class="literal">Ctrl-Enter</code> or <code class="literal">Alt-Enter</code> copies a filename to the command line. Use this with <span class="citerefentry"><span class="refentrytitle">cp</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">mv</span>(1)</span> commands together with command-line editing.
</p>
              </li>
              <li class="listitem">
                <p><code class="literal">Alt-Tab</code> shows shell filename expansion choices.
</p>
              </li>
              <li class="listitem">
                <p>
One can specify the starting directory for both windows as arguments to MC; for example, "<code class="literal">mc /etc /root</code>".
</p>
              </li>
              <li class="listitem">
                <p><code class="literal">Esc</code> + <code class="literal">n-key</code><code class="literal">Fn</code> (i.e., <code class="literal">Esc</code> + <code class="literal">1</code><code class="literal">F1</code>, etc.; <code class="literal">Esc</code> + <code class="literal">0</code><code class="literal">F10</code>)
</p>
              </li>
              <li class="listitem">
                <p>
Pressing <code class="literal">Esc</code> before the key has the same effect as pressing the <code class="literal">Alt</code> and the key together.; i.e., type <code class="literal">Esc</code> + <code class="literal">c</code> for <code class="literal">Alt-C</code>.  <code class="literal">Esc</code> is called meta-key and sometimes noted as "<code class="literal">M-</code>".
</p>
              </li>
            </ul>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_the_internal_editor_in_mc"/>1.3.5. The internal editor in MC</h3>
              </div>
            </div>
          </div>
          <p>The internal editor has an interesting cut-and-paste scheme.  Pressing <code class="literal">F3</code> marks the start of a selection, a second <code class="literal">F3</code> marks the end of selection and highlights the selection.  Then you can move your cursor.  If you press F6, the selected area is moved to the cursor location.  If you press F5, the selected area is copied and inserted at the cursor location.  <code class="literal">F2</code> saves the file.  <code class="literal">F10</code> gets you out.  Most cursor keys work intuitively.</p>
          <p>This editor can be directly started on a file using one of the following commands.</p>
          <pre class="screen">$ mc -e filename_to_edit</pre>
          <pre class="screen">$ mcedit filename_to_edit</pre>
          <p>This is not a multi-window editor, but one can use multiple Linux consoles to achieve the same effect.  To copy between windows, use Alt-F&lt;n&gt; keys to switch virtual consoles and use "File→Insert file" or "File→Copy to file" to move a portion of a file to another file.</p>
          <p>This internal editor can be replaced with any external editor of choice.</p>
          <p>Also, many programs use the environment variables "<code class="literal">$EDITOR</code>" or "<code class="literal">$VISUAL</code>" to decide which editor to use.  If you are uncomfortable with <span class="citerefentry"><span class="refentrytitle">vim</span>(1)</span> or <span class="citerefentry"><span class="refentrytitle">nano</span>(1)</span> initially, you may set these to "<code class="literal">mcedit</code>" by adding the following lines to "<code class="literal">~/.bashrc</code>".</p>
          <pre class="screen">export EDITOR=mcedit
export VISUAL=mcedit</pre>
          <p>I do recommend setting these to "<code class="literal">vim</code>" if possible.</p>
          <p>If you are uncomfortable with <span class="citerefentry"><span class="refentrytitle">vim</span>(1)</span>, you can keep using <span class="citerefentry"><span class="refentrytitle">mcedit</span>(1)</span> for most system maintenance tasks.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_the_internal_viewer_in_mc"/>1.3.6. The internal viewer in MC</h3>
              </div>
            </div>
          </div>
          <p>MC is a very smart viewer.  This is a great tool for searching words in documents.  I always use this for files in the "<code class="literal">/usr/share/doc</code>" directory.  This is the fastest way to browse through masses of Linux information.  This viewer can be directly started using one of the following commands.</p>
          <pre class="screen">$ mc -v path/to/filename_to_view</pre>
          <pre class="screen">$ mcview path/to/filename_to_view</pre>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_auto_start_features_of_mc"/>1.3.7. Auto-start features of MC</h3>
              </div>
            </div>
          </div>
          <p>Press Enter on a file, and the appropriate program handles the content of the file (see <a class="xref" href="ch09.en.html#_customizing_program_to_be_started" title="9.3.11. Customizing program to be started">Section 9.3.11, “Customizing program to be started”</a>).  This is a very convenient MC feature.</p>
          <div class="table">
            <a id="thereactiontotheenterkeyinmc"/>
            <p class="title">
              <strong>Table 1.12. The reaction to the enter key in MC</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="The reaction to the enter key in MC" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    file type
    </th>
                    <th style="text-align: left">
    reaction to enter key
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
    executable file
    </td>
                    <td style="text-align: left">
    execute command
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
    man file
    </td>
                    <td style="text-align: left">
    pipe content to viewer software
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
    html file
    </td>
                    <td style="text-align: left">
    pipe content to web browser
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
    "<code class="literal">*.tar.gz</code>" and "<code class="literal">*.deb</code>" file
    </td>
                    <td style="text-align: left">
    browse its contents as if subdirectory
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>In order to allow these viewer and virtual file features to function, viewable files should not be set as executable.  Change their status using <span class="citerefentry"><span class="refentrytitle">chmod</span>(1)</span> or via the MC file menu.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_ftp_virtual_filesystem_of_mc"/>1.3.8. FTP virtual filesystem of MC</h3>
              </div>
            </div>
          </div>
          <p>MC can be used to access files over the Internet using FTP.  Go to the menu by pressing <code class="literal">F9</code>, then type "<code class="literal">p</code>" to activate the FTP virtual filesystem.  Enter a URL in the form "<code class="literal">username:passwd@hostname.domainname</code>", which retrieves a remote directory that appears like a local one.</p>
          <p>Try "[deb.debian.org/debian]" as the URL and browse the Debian archive.</p>
        </div>
      </div>
      <div class="section">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title"><a id="_the_basic_unix_like_work_environment"/>1.4. The basic Unix-like work environment</h2>
            </div>
          </div>
        </div>
        <p>Although MC enables you to do almost everything, it is very important for you to learn how to use the command line tools invoked from the shell prompt and become familiar with the Unix-like work environment.</p>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_the_login_shell"/>1.4.1. The login shell</h3>
              </div>
            </div>
          </div>
          <p>You can select your login shell with <span class="citerefentry"><span class="refentrytitle">chsh</span>(1)</span>.</p>
          <div class="table">
            <a id="list-of-shell-programs"/>
            <p class="title">
              <strong>Table 1.13. List of shell programs</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of shell programs" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    package
    </th>
                    <th style="text-align: left">
    popcon
    </th>
                    <th style="text-align: left">
    size
    </th>
                    <th style="text-align: left">
    POSIX shell
    </th>
                    <th style="text-align: left">
    description
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/bash">
                  <code class="literal">bash</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=bash">V:830, I:999</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/b/bash.html">5790</a>
                    </td>
                    <td style="text-align: left">
    Yes
    </td>
                    <td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Bash">Bash</a>: the GNU Bourne Again SHell (de facto standard)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/tcsh">
                  <code class="literal">tcsh</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=tcsh">V:10, I:37</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/t/tcsh.html">1306</a>
                    </td>
                    <td style="text-align: left">
    No
    </td>
                    <td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Tcsh">TENEX C Shell</a>: an enhanced version of <a class="ulink" href="http://en.wikipedia.org/wiki/C_shell">Berkeley csh</a></td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/dash">
                  <code class="literal">dash</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=dash">V:917, I:985</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/d/dash.html">218</a>
                    </td>
                    <td style="text-align: left">
    Yes
    </td>
                    <td style="text-align: left">
    Debian <a class="ulink" href="http://en.wikipedia.org/wiki/Almquist_shell">Almquist Shell</a>, good for shell script
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/zsh">
                  <code class="literal">zsh</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=zsh">V:35, I:68</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/z/zsh.html">2183</a>
                    </td>
                    <td style="text-align: left">
    Yes
    </td>
                    <td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Z_shell">Z shell</a>: the standard shell with many enhancements
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/mksh">
                  <code class="literal">mksh</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=mksh">V:6, I:12</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/m/mksh.html">1339</a>
                    </td>
                    <td style="text-align: left">
    Yes
    </td>
                    <td style="text-align: left">
    A version of the <a class="ulink" href="http://en.wikipedia.org/wiki/Korn_shell">Korn shell</a>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/csh">
                  <code class="literal">csh</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=csh">V:2, I:11</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/c/csh.html">339</a>
                    </td>
                    <td style="text-align: left">
    No
    </td>
                    <td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/OpenBSD">OpenBSD</a> C Shell, a version of <a class="ulink" href="http://en.wikipedia.org/wiki/C_shell">Berkeley csh</a>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/sash">
                  <code class="literal">sash</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=sash">V:0, I:4</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/s/sash.html">969</a>
                    </td>
                    <td style="text-align: left">
    Yes
    </td>
                    <td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Stand-alone_shell">Stand-alone shell</a> with builtin commands (Not meant for standard "<code class="literal">/bin/sh</code>")
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/ksh">
                  <code class="literal">ksh</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=ksh">V:4, I:21</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/k/ksh.html">3276</a>
                    </td>
                    <td style="text-align: left">
    Yes
    </td>
                    <td style="text-align: left">
    the real, AT&amp;T version of the <a class="ulink" href="http://en.wikipedia.org/wiki/Korn_shell">Korn shell</a>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/rc">
                  <code class="literal">rc</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=rc">V:0, I:3</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/r/rc.html">154</a>
                    </td>
                    <td style="text-align: left">
    No
    </td>
                    <td style="text-align: left">
    implementation of the <a class="ulink" href="http://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs">AT&amp;T Plan 9</a> <a class="ulink" href="http://en.wikipedia.org/wiki/Rc">rc shell</a>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.debian.org/sid/posh">
                  <code class="literal">posh</code>
                </a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://qa.debian.org/popcon.php?package=posh">V:0, I:0</a>
                    </td>
                    <td style="text-align: left">
                      <a class="ulink" href="http://packages.qa.debian.org/p/posh.html">186</a>
                    </td>
                    <td style="text-align: left">
    Yes
    </td>
                    <td style="text-align: left">
    Policy-compliant Ordinary SHell (<code class="literal">pdksh</code> derivative)
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Although POSIX-like shells share the basic syntax, they can differ
in behavior for things as basic as shell variables and glob expansions.
Please check their documentation for details.</p>
                </td>
              </tr>
            </table>
          </div>
          <p>In this tutorial chapter, the interactive shell always means <code class="literal">bash</code>.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_customizing_bash"/>1.4.2. Customizing bash</h3>
              </div>
            </div>
          </div>
          <p>You can customize <span class="citerefentry"><span class="refentrytitle">bash</span>(1)</span> behavior by "<code class="literal">~/.bashrc</code>".</p>
          <p>For example, try the following.</p>
          <pre class="screen"># enable bash-completion
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

# CD upon exiting MC
. /usr/lib/mc/mc.sh

# set CDPATH to a good one
CDPATH=.:/usr/share/doc:~:~/Desktop:~
export CDPATH

PATH="${PATH+$PATH:}/usr/sbin:/sbin"
# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
  PATH="~/bin${PATH+:$PATH}"
fi
export PATH

EDITOR=vim
export EDITOR</pre>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>You can find more <code class="literal">bash</code> customization tips, such as <a class="xref" href="ch09.en.html#_colorized_commands" title="9.2.7. Colorized commands">Section 9.2.7, “Colorized commands”</a>, in <a class="xref" href="ch09.en.html" title="Chapter 9. System tips">Chapter 9, <em>System tips</em></a>.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>The <code class="literal">bash-completion</code> package enables programmable completion for <code class="literal">bash</code>.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_special_key_strokes"/>1.4.3. Special key strokes</h3>
              </div>
            </div>
          </div>
          <p>In the <a class="ulink" href="http://en.wikipedia.org/wiki/Unix-like">Unix-like</a> environment, there are few key strokes which have special meanings.  Please note that on a normal Linux character console, only the left-hand <code class="literal">Ctrl</code> and <code class="literal">Alt</code> keys work as expected.  Here are few notable key strokes to remember.</p>
          <div class="table">
            <a id="listofkeybindingsforbash"/>
            <p class="title">
              <strong>Table 1.14. List of key bindings for bash</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of key bindings for bash" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    key
    </th>
                    <th style="text-align: left">
    description of key binding
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Ctrl-U</code>
                </td>
                    <td style="text-align: left">
    erase line before cursor
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Ctrl-H</code>
                </td>
                    <td style="text-align: left">
    erase a character before cursor
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Ctrl-D</code>
                </td>
                    <td style="text-align: left">
    terminate input (exit shell if you are using shell)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Ctrl-C</code>
                </td>
                    <td style="text-align: left">
    terminate a running program
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Ctrl-Z</code>
                </td>
                    <td style="text-align: left">
    temporarily stop program by moving it to the background job
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Ctrl-S</code>
                </td>
                    <td style="text-align: left">
    halt output to screen
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Ctrl-Q</code>
                </td>
                    <td style="text-align: left">
    reactivate output to screen
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Ctrl-Alt-Del</code>
                </td>
                    <td style="text-align: left">
    reboot/halt the system, see <span class="citerefentry"><span class="refentrytitle">inittab</span>(5)</span>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left"><code class="literal">Left-Alt-key</code> (optionally, <code class="literal">Windows-key</code>)
    </td>
                    <td style="text-align: left">
    meta-key for Emacs and the similar UI
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Up-arrow</code>
                </td>
                    <td style="text-align: left">
    start command history search under <code class="literal">bash</code>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Ctrl-R</code>
                </td>
                    <td style="text-align: left">
    start incremental command history search under <code class="literal">bash</code>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Tab</code>
                </td>
                    <td style="text-align: left">
    complete input of the filename to the command line under <code class="literal">bash</code>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">Ctrl-V</code>
                  <code class="literal">Tab</code>
                </td>
                    <td style="text-align: left">
    input <code class="literal">Tab</code> without expansion to the command line under <code class="literal">bash</code>
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>The terminal feature of <code class="literal">Ctrl-S</code> can be disabled using <span class="citerefentry"><span class="refentrytitle">stty</span>(1)</span>.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_unix_style_mouse_operations"/>1.4.4. Unix style mouse operations</h3>
              </div>
            </div>
          </div>
          <p>Unix style mouse operations are based on the 3 button mouse system.</p>
          <div class="table">
            <a id="listofunixstylemouseoperations"/>
            <p class="title">
              <strong>Table 1.15. List of Unix style mouse operations</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of Unix style mouse operations" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    action
    </th>
                    <th style="text-align: left">
    response
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
    Left-click-and-drag mouse
    </td>
                    <td style="text-align: left">
    select and copy to the clipboard
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
    Left-click
    </td>
                    <td style="text-align: left">
    select the start of selection
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
    Right-click
    </td>
                    <td style="text-align: left">
    select the end of selection and copy to the clipboard
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
    Middle-click
    </td>
                    <td style="text-align: left">
    paste clipboard at the cursor
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>The center wheel on the modern wheel mouse is considered middle mouse button and can be used for middle-click.  Clicking left and right mouse buttons together serves as the middle-click under the 2 button mouse system situation.  In order to use a mouse in Linux character consoles, you need to have <span class="citerefentry"><span class="refentrytitle">gpm</span>(8)</span> running as daemon.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_the_pager"/>1.4.5. The pager</h3>
              </div>
            </div>
          </div>
          <p>The <span class="citerefentry"><span class="refentrytitle">less</span>(1)</span> command is the enhanced pager (file content browser). It reads the file specified by its command argument or its standard input.  Hit "<code class="literal">h</code>" if you need help while browsing with the <code class="literal">less</code> command.  It can do much more than <span class="citerefentry"><span class="refentrytitle">more</span>(1)</span> and can be supercharged by executing "<code class="literal">eval $(lesspipe)</code>" or "<code class="literal">eval $(lessfile)</code>" in the shell startup script. See more in "<code class="literal">/usr/share/doc/lessf/LESSOPEN</code>".  The "<code class="literal">-R</code>" option allows raw character output and enables ANSI color escape sequences.  See <span class="citerefentry"><span class="refentrytitle">less</span>(1)</span>.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_the_text_editor"/>1.4.6. The text editor</h3>
              </div>
            </div>
          </div>
          <p>You should become proficient in one of variants of <a class="ulink" href="http://en.wikipedia.org/wiki/Vim_(text_editor)">Vim</a> or <a class="ulink" href="http://en.wikipedia.org/wiki/Emacs">Emacs</a> programs which are popular in the Unix-like system.</p>
          <p>I think getting used to Vim commands is the right thing to do, since Vi-editor is always there in the Linux/Unix world.  (Actually, original <code class="literal">vi</code> or new <code class="literal">nvi</code> are programs you find everywhere.  I chose Vim instead for newbie since it offers you help through <code class="literal">F1</code> key while it is similar enough and more powerful.)</p>
          <p>If you chose either <a class="ulink" href="http://en.wikipedia.org/wiki/Emacs">Emacs</a> or <a class="ulink" href="http://en.wikipedia.org/wiki/XEmacs">XEmacs</a> instead as your choice of the editor, that is another good choice indeed, particularly for programming.  Emacs has a plethora of other features as well, including functioning as a newsreader, directory editor, mail program, etc.  When used for programming or editing shell scripts, it intelligently recognizes the format of what you are working on, and tries to provide assistance.  Some people maintain that the only program they need on Linux is Emacs.  Ten minutes learning Emacs now can save hours later.  Having the GNU Emacs manual for reference when learning Emacs is highly recommended.</p>
          <p>All these programs usually come with tutoring program for you to learn them by practice.  Start Vim by typing "<code class="literal">vim</code>" and press F1-key.  You should at least read the first 35 lines.  Then do the online training course by moving cursor to "<code class="literal">|tutor|</code>" and pressing <code class="literal">Ctrl-]</code>.</p>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Good editors, such as Vim and Emacs, can handle UTF-8 and other exotic encoding texts correctly.  It is a good idea to use the X environment in the UTF-8 locale and to install required programs and fonts to it.  Editors have options to set the file encoding independent of the X environment.  Please refer to their documentation on multibyte text.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_setting_a_default_text_editor"/>1.4.7. Setting a default text editor</h3>
              </div>
            </div>
          </div>
          <p>Debian comes with a number of different editors. We recommend to install the <code class="literal">vim</code> package, as mentioned above.</p>
          <p>Debian provides unified access to the system default editor via command "<code class="literal">/usr/bin/editor</code>" so other programs (e.g., <span class="citerefentry"><span class="refentrytitle">reportbug</span>(1)</span>) can invoke it.  You can change it by the following.</p>
          <pre class="screen">$ sudo update-alternatives --config editor</pre>
          <p>The choice "<code class="literal">/usr/bin/vim.basic</code>" over "<code class="literal">/usr/bin/vim.tiny</code>" is my recommendation for newbies since it supports syntax highlighting.</p>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Many programs use the environment variables "<code class="literal">$EDITOR</code>" or "<code class="literal">$VISUAL</code>" to decide which editor to use (see <a class="xref" href="ch01.en.html#_the_internal_editor_in_mc" title="1.3.5. The internal editor in MC">Section 1.3.5, “The internal editor in MC”</a> and <a class="xref" href="ch09.en.html#_customizing_program_to_be_started" title="9.3.11. Customizing program to be started">Section 9.3.11, “Customizing program to be started”</a>).  For the consistency on the Debian system, set these to "<code class="literal">/usr/bin/editor</code>". (Historically, "<code class="literal">$EDITOR</code>" was "<code class="literal">ed</code>" and "<code class="literal">$VISUAL</code>" was "<code class="literal">vi</code>".)</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_customizing_vim"/>1.4.8. Customizing vim</h3>
              </div>
            </div>
          </div>
          <p>You can customize <span class="citerefentry"><span class="refentrytitle">vim</span>(1)</span> behavior by "<code class="literal">~/.vimrc</code>".</p>
          <p>For example, try the following</p>
          <pre class="screen">" -------------------------------
" Local configuration
"
set nocompatible
set nopaste
set pastetoggle=&lt;f2&gt;
syn on
if $USER == "root"
 set nomodeline
 set noswapfile
else
 set modeline
 set swapfile
endif
" filler to avoid the line above being recognized as a modeline
" filler
" filler</pre>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_recording_the_shell_activities"/>1.4.9. Recording the shell activities</h3>
              </div>
            </div>
          </div>
          <p>The output of the shell command may roll off your screen and may be lost forever.  It is a good practice to log shell activities into the file for you to review them later.  This kind of record is essential when you perform any system administration tasks.</p>
          <p>The basic method of recording the shell activity is to run it under <span class="citerefentry"><span class="refentrytitle">script</span>(1)</span>.</p>
          <p>For example, try the following</p>
          <pre class="screen">$ script
Script started, file is typescript</pre>
          <p>Do whatever shell commands under <code class="literal">script</code>.</p>
          <p>Press <code class="literal">Ctrl-D</code> to exit <code class="literal">script</code>.</p>
          <pre class="screen">$ vim typescript</pre>
          <p>See <a class="xref" href="ch09.en.html#_recording_the_shell_activities_cleanly" title="9.2.3. Recording the shell activities cleanly">Section 9.2.3, “Recording the shell activities cleanly”</a> .</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_basic_unix_commands"/>1.4.10. Basic Unix commands</h3>
              </div>
            </div>
          </div>
          <p>Let's learn basic Unix commands.  Here I use "Unix" in its generic sense.  Any Unix clone OSs usually offer equivalent commands.  The Debian system is no exception.  Do not worry if some commands do not work as you wish now. If <code class="literal">alias</code> is used in the shell, its corresponding command outputs are different.  These examples are not meant to be executed in this order.</p>
          <p>Try all following commands from the non-privileged user account.</p>
          <div class="table">
            <a id="listofbasicunixcommands"/>
            <p class="title">
              <strong>Table 1.16. List of basic Unix commands</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of basic Unix commands" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    command
    </th>
                    <th style="text-align: left">
    description
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">pwd</code>
                </td>
                    <td style="text-align: left">
    display name of current/working directory
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">whoami</code>
                </td>
                    <td style="text-align: left">
    display current user name
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">id</code>
                </td>
                    <td style="text-align: left">
    display current user identity (name, uid, gid, and associated groups)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">file &lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    display a type of file for the file "<code class="literal">&lt;foo&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">type -p &lt;commandname&gt;</code>
                </td>
                    <td style="text-align: left">
    display a file location of command "<code class="literal">&lt;commandname&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">which &lt;commandname&gt;</code>
                </td>
                    <td style="text-align: left">
    , ,
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">type &lt;commandname&gt;</code>
                </td>
                    <td style="text-align: left">
    display information on command "<code class="literal">&lt;commandname&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">apropos &lt;key-word&gt;</code>
                </td>
                    <td style="text-align: left">
    find commands related to "<code class="literal">&lt;key-word&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">man -k &lt;key-word&gt;</code>
                </td>
                    <td style="text-align: left">
    , ,
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">whatis &lt;commandname&gt;</code>
                </td>
                    <td style="text-align: left">
    display one line explanation on command "<code class="literal">&lt;commandname&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">man -a &lt;commandname&gt;</code>
                </td>
                    <td style="text-align: left">
    display explanation on command "<code class="literal">&lt;commandname&gt;</code>" (Unix style)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">info &lt;commandname&gt;</code>
                </td>
                    <td style="text-align: left">
    display rather long explanation on command "<code class="literal">&lt;commandname&gt;</code>" (GNU style)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ls</code>
                </td>
                    <td style="text-align: left">
    list contents of directory (non-dot files and directories)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ls -a</code>
                </td>
                    <td style="text-align: left">
    list contents of directory (all files and directories)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ls -A</code>
                </td>
                    <td style="text-align: left">
    list contents of directory (almost all files and directories, i.e., skip "<code class="literal">..</code>" and "<code class="literal">.</code>")
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ls -la</code>
                </td>
                    <td style="text-align: left">
    list all contents of directory with detail information
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ls -lai</code>
                </td>
                    <td style="text-align: left">
    list all contents of directory with inode number and detail information
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ls -d</code>
                </td>
                    <td style="text-align: left">
    list all directories under the current directory
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">tree</code>
                </td>
                    <td style="text-align: left">
    display file tree contents
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">lsof &lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    list open status of file "<code class="literal">&lt;foo&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">lsof -p &lt;pid&gt;</code>
                </td>
                    <td style="text-align: left">
    list files opened by the process ID: "<code class="literal">&lt;pid&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">mkdir &lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    make a new directory "<code class="literal">&lt;foo&gt;</code>" in the current directory
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">rmdir &lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    remove a directory "<code class="literal">&lt;foo&gt;</code>" in the current directory
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">cd &lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    change directory to the directory "<code class="literal">&lt;foo&gt;</code>" in the current directory or in the directory listed in the variable "<code class="literal">$CDPATH</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">cd /</code>
                </td>
                    <td style="text-align: left">
    change directory to the root directory
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">cd</code>
                </td>
                    <td style="text-align: left">
    change directory to the current user's home directory
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">cd /&lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    change directory to the absolute path directory "<code class="literal">/&lt;foo&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">cd ..</code>
                </td>
                    <td style="text-align: left">
    change directory to the parent directory
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">cd ~&lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    change directory to the home directory of the user "<code class="literal">&lt;foo&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">cd -</code>
                </td>
                    <td style="text-align: left">
    change directory to the previous directory
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">&lt;/etc/motd pager</code>
                </td>
                    <td style="text-align: left">
    display contents of "<code class="literal">/etc/motd</code>" using the default pager
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">touch &lt;junkfile&gt;</code>
                </td>
                    <td style="text-align: left">
    create a empty file "<code class="literal">&lt;junkfile&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">cp &lt;foo&gt; &lt;bar&gt;</code>
                </td>
                    <td style="text-align: left">
    copy a existing file "<code class="literal">&lt;foo&gt;</code>" to a new file "<code class="literal">&lt;bar&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">rm &lt;junkfile&gt;</code>
                </td>
                    <td style="text-align: left">
    remove a file "<code class="literal">&lt;junkfile&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">mv &lt;foo&gt; &lt;bar&gt;</code>
                </td>
                    <td style="text-align: left">
    rename an existing file "<code class="literal">&lt;foo&gt;</code>" to a new name "<code class="literal">&lt;bar&gt;</code>" ("<code class="literal">&lt;bar&gt;</code>" must not exist)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">mv &lt;foo&gt; &lt;bar&gt;</code>
                </td>
                    <td style="text-align: left">
    move an existing file "<code class="literal">&lt;foo&gt;</code>" to a new location "<code class="literal">&lt;bar&gt;/&lt;foo&gt;</code>" (the directory "<code class="literal">&lt;bar&gt;</code>" must exist)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">mv &lt;foo&gt; &lt;bar&gt;/&lt;baz&gt;</code>
                </td>
                    <td style="text-align: left">
    move an existing file "<code class="literal">&lt;foo&gt;</code>" to a new location with a new name "<code class="literal">&lt;bar&gt;/&lt;baz&gt;</code>" (the directory "<code class="literal">&lt;bar&gt;</code>" must exist but the directory "<code class="literal">&lt;bar&gt;/&lt;baz&gt;</code>" must not exist)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">chmod 600 &lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    make an existing file "<code class="literal">&lt;foo&gt;</code>" to be non-readable and non-writable by the other people (non-executable for all)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">chmod 644 &lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    make an existing file "<code class="literal">&lt;foo&gt;</code>" to be readable but non-writable by the other people (non-executable for all)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">chmod 755 &lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    make an existing file "<code class="literal">&lt;foo&gt;</code>" to be readable but non-writable by the other people (executable for all)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">find .  -name &lt;pattern&gt;</code>
                </td>
                    <td style="text-align: left">
    find matching filenames using shell "<code class="literal">&lt;pattern&gt;</code>" (slower)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">locate -d .  &lt;pattern&gt;</code>
                </td>
                    <td style="text-align: left">
    find matching filenames using shell "<code class="literal">&lt;pattern&gt;</code>" (quicker using regularly generated database)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">grep -e "&lt;pattern&gt;" *.html</code>
                </td>
                    <td style="text-align: left">
    find a "<code class="literal">&lt;pattern&gt;</code>" in all files ending with "<code class="literal">.html</code>" in current directory and display them all
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">top</code>
                </td>
                    <td style="text-align: left">
    display process information using full screen, type "<code class="literal">q</code>" to quit
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ps aux | pager</code>
                </td>
                    <td style="text-align: left">
    display information on all the running processes using BSD style output
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ps -ef | pager</code>
                </td>
                    <td style="text-align: left">
    display information on all the running processes using Unix system-V style output
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ps aux | grep -e "[e]xim4*"</code>
                </td>
                    <td style="text-align: left">
    display all processes running "<code class="literal">exim</code>" and "<code class="literal">exim4</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ps axf | pager</code>
                </td>
                    <td style="text-align: left">
    display information on all the running processes with ASCII art output
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">kill &lt;1234&gt;</code>
                </td>
                    <td style="text-align: left">
    kill a process identified by the process ID: "&lt;1234&gt;"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">gzip &lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    compress "<code class="literal">&lt;foo&gt;</code>" to create "<code class="literal">&lt;foo&gt;.gz</code>" using the Lempel-Ziv coding (LZ77)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">gunzip &lt;foo&gt;.gz</code>
                </td>
                    <td style="text-align: left">
    decompress "<code class="literal">&lt;foo&gt;.gz</code>" to create "<code class="literal">&lt;foo&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">bzip2 &lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    compress "<code class="literal">&lt;foo&gt;</code>" to create "<code class="literal">&lt;foo&gt;.bz2</code>" using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding (better compression than <code class="literal">gzip</code>)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">bunzip2 &lt;foo&gt;.bz2</code>
                </td>
                    <td style="text-align: left">
    decompress "<code class="literal">&lt;foo&gt;.bz2</code>" to create "<code class="literal">&lt;foo&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">xz &lt;foo&gt;</code>
                </td>
                    <td style="text-align: left">
    compress "<code class="literal">&lt;foo&gt;</code>" to create "<code class="literal">&lt;foo&gt;.xz</code>" using the Lempel–Ziv–Markov chain algorithm (better compression than <code class="literal">bzip2</code>)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">unxz &lt;foo&gt;.xz</code>
                </td>
                    <td style="text-align: left">
    decompress "<code class="literal">&lt;foo&gt;.xz</code>" to create "<code class="literal">&lt;foo&gt;</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">tar -xvf &lt;foo&gt;.tar</code>
                </td>
                    <td style="text-align: left">
    extract files from "<code class="literal">&lt;foo&gt;.tar</code>" archive
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">tar -xvzf &lt;foo&gt;.tar.gz</code>
                </td>
                    <td style="text-align: left">
    extract files from gzipped "<code class="literal">&lt;foo&gt;.tar.gz</code>" archive
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">tar -xvjf &lt;foo&gt;.tar.bz2</code>
                </td>
                    <td style="text-align: left">
    extract files from "<code class="literal">&lt;foo&gt;.tar.bz2</code>" archive
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">tar -xvJf &lt;foo&gt;.tar.xz</code>
                </td>
                    <td style="text-align: left">
    extract files from "<code class="literal">&lt;foo&gt;.tar.xz</code>" archive
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">tar -cvf &lt;foo&gt;.tar &lt;bar&gt;/</code>
                </td>
                    <td style="text-align: left">
    archive contents of folder "<code class="literal">&lt;bar&gt;/</code>" in "<code class="literal">&lt;foo&gt;.tar</code>" archive
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">tar -cvzf &lt;foo&gt;.tar.gz &lt;bar&gt;/</code>
                </td>
                    <td style="text-align: left">
    archive contents of folder "<code class="literal">&lt;bar&gt;/</code>" in compressed "<code class="literal">&lt;foo&gt;.tar.gz</code>" archive
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">tar -cvjf &lt;foo&gt;.tar.bz2 &lt;bar&gt;/</code>
                </td>
                    <td style="text-align: left">
    archive contents of folder "<code class="literal">&lt;bar&gt;/</code>" in "<code class="literal">&lt;foo&gt;.tar.bz2</code>" archive
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">tar -cvJf &lt;foo&gt;.tar.xz &lt;bar&gt;/</code>
                </td>
                    <td style="text-align: left">
    archive contents of folder "<code class="literal">&lt;bar&gt;/</code>" in "<code class="literal">&lt;foo&gt;.tar.xz</code>" archive
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">zcat README.gz | pager</code>
                </td>
                    <td style="text-align: left">
    display contents of compressed "<code class="literal">README.gz</code>" using the default pager
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">zcat README.gz &gt; foo</code>
                </td>
                    <td style="text-align: left">
    create a file "<code class="literal">foo</code>" with the decompressed content of "<code class="literal">README.gz</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">zcat README.gz &gt;&gt; foo</code>
                </td>
                    <td style="text-align: left">
    append the decompressed content of "<code class="literal">README.gz</code>" to the end of the file "<code class="literal">foo</code>" (if it does not exist, create it first)
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Unix has a tradition to hide filenames which start with "<code class="literal">.</code>".  They are traditionally files that contain configuration information and user preferences.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>For <code class="literal">cd</code> command, see <span class="citerefentry"><span class="refentrytitle">builtins</span>(7)</span>.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>The default pager of the bare bone Debian system is <span class="citerefentry"><span class="refentrytitle">more</span>(1)</span> which cannot scroll back.  By installing the <code class="literal">less</code> package using command line "<code class="literal">apt-get install less</code>", <span class="citerefentry"><span class="refentrytitle">less</span>(1)</span> becomes default pager and you can scroll back with cursor keys.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>The "<code class="literal">[</code>" and "<code class="literal">]</code>" in the regular expression of the "<code class="literal">ps aux | grep -e "[e]xim4*"</code>" command above enable <code class="literal">grep</code> to avoid matching itself.  The "<code class="literal">4*</code>" in the regular expression means 0 or more repeats of character "<code class="literal">4</code>" thus enables <code class="literal">grep</code> to match both "<code class="literal">exim</code>" and "<code class="literal">exim4</code>".  Although "<code class="literal">*</code>" is used in the shell filename glob and the regular expression, their meanings are different.  Learn the regular expression from <span class="citerefentry"><span class="refentrytitle">grep</span>(1)</span>.</p>
                </td>
              </tr>
            </table>
          </div>
          <p>Please traverse directories and peek into the system using the above commands as training.  If you have questions on any of console commands, please make sure to read the manual page.</p>
          <p>For example, try the following</p>
          <pre class="screen">$ man man
$ man bash
$ man builtins
$ man grep
$ man ls</pre>
          <p>The style of man pages may be a little hard to get used to, because they are rather terse, particularly the older, very traditional ones. But once you get used to it, you come to appreciate their succinctness.</p>
          <p>Please note that many Unix-like commands including ones from GNU and BSD display brief help information if you invoke them in one of the following ways (or without any arguments in some cases).</p>
          <pre class="screen">$ &lt;commandname&gt; --help
$ &lt;commandname&gt; -h</pre>
        </div>
      </div>
      <div class="section">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title"><a id="_the_simple_shell_command"/>1.5. The simple shell command</h2>
            </div>
          </div>
        </div>
        <p>Now you have some feel on how to use the Debian system.  Let's look deep into the mechanism of the command execution in the Debian system. Here, I have simplified reality for the newbie.  See <span class="citerefentry"><span class="refentrytitle">bash</span>(1)</span> for the exact explanation.</p>
        <p>A simple command is a sequence of components.</p>
        <div class="orderedlist">
          <ol class="orderedlist">
            <li class="listitem">
              <p>
Variable assignments (optional)
</p>
            </li>
            <li class="listitem">
              <p>
Command name
</p>
            </li>
            <li class="listitem">
              <p>
Arguments (optional)
</p>
            </li>
            <li class="listitem">
              <p>
Redirections (optional: <code class="literal">&gt;</code> , <code class="literal">&gt;&gt;</code> , <code class="literal">&lt;</code> , <code class="literal">&lt;&lt;</code> , etc.)
</p>
            </li>
            <li class="listitem">
              <p>
Control operator (optional: <code class="literal">&amp;&amp;</code> , <code class="literal">||</code> , &lt;newline&gt; , <code class="literal">;</code> , <code class="literal">&amp;</code> , <code class="literal">(</code> , <code class="literal">)</code> )
</p>
            </li>
          </ol>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_command_execution_and_environment_variable"/>1.5.1. Command execution and environment variable</h3>
              </div>
            </div>
          </div>
          <p>The values of some <a class="ulink" href="http://en.wikipedia.org/wiki/Environment_variable">environment variables</a> change the behavior of some Unix commands.</p>
          <p>Default values of environment variables are initially set by the PAM system and then some of them may be reset by some application programs.</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
The display manager such as <code class="literal">gdm3</code> resets environment variables.
</p>
              </li>
              <li class="listitem">
                <p>
The shell in its start up codes resets environment variables in "<code class="literal">~/.bash_profile</code>" and "<code class="literal">~/.bashrc</code>".
</p>
              </li>
            </ul>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_the_literal_lang_literal_variable"/>1.5.2. The "<code class="literal">$LANG</code>" variable</h3>
              </div>
            </div>
          </div>
          <p>The full locale value given to "<code class="literal">$LANG</code>" variable consists of 3 parts: "<code class="literal">xx_YY.ZZZZ</code>".</p>
          <div class="table">
            <a id="thedpartsoflocalevalue"/>
            <p class="title">
              <strong>Table 1.17. The 3 parts of locale value</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="The 3 parts of locale value" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    locale value
    </th>
                    <th style="text-align: left">
    meaning
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">xx</code>
                </td>
                    <td style="text-align: left">
                  <a class="ulink" href="http://en.wikipedia.org/wiki/ISO_639">ISO 639 language codes (lower case) such as "en"</a>
                </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">YY</code>
                </td>
                    <td style="text-align: left">
                  <a class="ulink" href="http://en.wikipedia.org/wiki/ISO_3166-3">ISO 3166 country codes (upper case) such as "US"</a>
                </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ZZZZ</code>
                </td>
                    <td style="text-align: left">
                  <a class="ulink" href="http://en.wikipedia.org/wiki/Codeset">codeset, always set to "UTF-8"</a>
                </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>For language codes and country codes, see pertinent description in the "<code class="literal">info gettext</code>".</p>
          <p>For the codeset on the modern Debian system, you should always set it to <span class="strong"><strong><code class="literal">UTF-8</code></strong></span> unless you specifically want to use the historic one with good reason and background knowledge.</p>
          <p>For fine details of the locale configuration, see <a class="xref" href="ch08.en.html#_the_locale" title="8.4. The locale">Section 8.4, “The locale”</a>.</p>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>The "<code class="literal">LANG=en_US</code>" is not "<code class="literal">LANG=C</code>" nor "<code class="literal">LANG=en_US.UTF-8</code>". It is "<code class="literal">LANG=en_US.ISO-8859-1</code>" (see <a class="xref" href="ch08.en.html#_basics_of_encoding" title="8.4.1. Basics of encoding">Section 8.4.1, “Basics of encoding”</a>).</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="table">
            <a id="listoflocalerecommendations"/>
            <p class="title">
              <strong>Table 1.18. List of locale recommendations</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of locale recommendations" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    locale recommendation
    </th>
                    <th style="text-align: left">
    Language (area)
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">en_US.UTF-8</code>
                </td>
                    <td style="text-align: left">
    English (USA)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">en_GB.UTF-8</code>
                </td>
                    <td style="text-align: left">
    English (Great Britain)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">fr_FR.UTF-8</code>
                </td>
                    <td style="text-align: left">
    French (France)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">de_DE.UTF-8</code>
                </td>
                    <td style="text-align: left">
    German (Germany)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">it_IT.UTF-8</code>
                </td>
                    <td style="text-align: left">
    Italian (Italy)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">es_ES.UTF-8</code>
                </td>
                    <td style="text-align: left">
    Spanish (Spain)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ca_ES.UTF-8</code>
                </td>
                    <td style="text-align: left">
    Catalan (Spain)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">sv_SE.UTF-8</code>
                </td>
                    <td style="text-align: left">
    Swedish (Sweden)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">pt_BR.UTF-8</code>
                </td>
                    <td style="text-align: left">
    Portuguese (Brazil)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ru_RU.UTF-8</code>
                </td>
                    <td style="text-align: left">
    Russian (Russia)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">zh_CN.UTF-8</code>
                </td>
                    <td style="text-align: left">
    Chinese (P.R. of China)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">zh_TW.UTF-8</code>
                </td>
                    <td style="text-align: left">
    Chinese (Taiwan R.O.C.)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ja_JP.UTF-8</code>
                </td>
                    <td style="text-align: left">
    Japanese (Japan)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">ko_KR.UTF-8</code>
                </td>
                    <td style="text-align: left">
    Korean (Republic of Korea)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">vi_VN.UTF-8</code>
                </td>
                    <td style="text-align: left">
    Vietnamese (Vietnam)
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>Typical command execution uses a shell line sequence as the following.</p>
          <pre class="screen">$ date
Sun Jun  3 10:27:39 JST 2007
$ LANG=fr_FR.UTF-8 date
dimanche 3 juin 2007, 10:27:33 (UTC+0900)</pre>
          <p>Here, the program <span class="citerefentry"><span class="refentrytitle">date</span>(1)</span> is executed with different values of the environment variable "<code class="literal">$LANG</code>".</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
For the first command, "<code class="literal">$LANG</code>" is set to the system default <a class="ulink" href="http://en.wikipedia.org/wiki/Locale">locale</a> value "<code class="literal">en_US.UTF-8</code>".
</p>
              </li>
              <li class="listitem">
                <p>
For the second command, "<code class="literal">$LANG</code>" is set to the French UTF-8 <a class="ulink" href="http://en.wikipedia.org/wiki/Locale">locale</a> value "<code class="literal">fr_FR.UTF-8</code>".
</p>
              </li>
            </ul>
          </div>
          <p>Most command executions usually do not have preceding environment variable definition.  For the above example, you can alternatively execute as the following.</p>
          <pre class="screen">$ LANG=fr_FR.UTF-8
$ date
dimanche 3 juin 2007, 10:27:33 (UTC+0900)</pre>
          <p>As you can see here, the output of command is affected by the environment variable to produce French output.  If you want the environment variable to be inherited to subprocesses (e.g., when calling shell script), you need to <span class="strong"><strong>export</strong></span> it instead by the following.</p>
          <pre class="screen">$ export LANG</pre>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>When you use a typical console terminal, the "<code class="literal">$LANG</code>" environment variable is usually set to be <span class="strong"><strong>exported</strong></span> by the desktop environment.  So the above is not really a good example to test the effect of <code class="literal">export</code>.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>When filing a bug report, running and checking the command under "<code class="literal">LANG=en_US.UTF-8</code>" is a good idea if you use non-English environment.</p>
                </td>
              </tr>
            </table>
          </div>
          <p>See <span class="citerefentry"><span class="refentrytitle">locale</span>(5)</span> and <span class="citerefentry"><span class="refentrytitle">locale</span>(7)</span> for "<code class="literal">$LANG</code>" and related environment variables.</p>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>I recommend you to configure the system environment just by the "<code class="literal">$LANG</code>" variable and to stay away from "<code class="literal">$LC_*</code>" variables unless it is absolutely needed.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_the_literal_path_literal_variable"/>1.5.3. The "<code class="literal">$PATH</code>" variable</h3>
              </div>
            </div>
          </div>
          <p>When you type a command into the shell, the shell searches the command in the list of directories contained in the "<code class="literal">$PATH</code>" environment variable.  The value of the "<code class="literal">$PATH</code>" environment variable is also called the shell's search path.</p>
          <p>In the default Debian installation, the "<code class="literal">$PATH</code>" environment variable of user accounts may not include "<code class="literal">/sbin</code>" and "<code class="literal">/usr/sbin</code>".  For example, the <code class="literal">ifconfig</code> command needs to be issued with full path as "<code class="literal">/sbin/ifconfig</code>". (Similar <code class="literal">ip</code> command is located in "<code class="literal">/bin</code>".)</p>
          <p>You can change the "<code class="literal">$PATH</code>" environment variable of Bash shell by "<code class="literal">~/.bash_profile</code>" or "<code class="literal">~/.bashrc</code>" files.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_the_literal_home_literal_variable"/>1.5.4. The "<code class="literal">$HOME</code>" variable</h3>
              </div>
            </div>
          </div>
          <p>Many commands stores user specific configuration in the home directory and changes their behavior by their contents.  The home directory is identified by the environment variable "<code class="literal">$HOME</code>".</p>
          <div class="table">
            <a id="listofhomevalues"/>
            <p class="title">
              <strong>Table 1.19. List of "<code class="literal">$HOME</code>" values</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of &quot;$HOME&quot; values" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    value of "<code class="literal">$HOME</code>"
    </th>
                    <th style="text-align: left">
    program execution situation
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/</code>
                </td>
                    <td style="text-align: left">
    program run by the init process (daemon)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/root</code>
                </td>
                    <td style="text-align: left">
    program run from the normal root shell
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/home/&lt;normal_user&gt;</code>
                </td>
                    <td style="text-align: left">
    program run from the normal user shell
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/home/&lt;normal_user&gt;</code>
                </td>
                    <td style="text-align: left">
    program run from the normal user GUI desktop menu
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/home/&lt;normal_user&gt;</code>
                </td>
                    <td style="text-align: left">
    program run as root with "<code class="literal">sudo program</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">/root</code>
                </td>
                    <td style="text-align: left">
    program run as root with "<code class="literal">sudo -H program</code>"
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Shell expands "<code class="literal">~/</code>" to current user's home directory, i.e., "<code class="literal">$HOME/</code>". Shell expands "<code class="literal">~foo/</code>" to <code class="literal">foo</code>'s home directory, i.e., "<code class="literal">/home/foo/</code>".</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_command_line_options"/>1.5.5. Command line options</h3>
              </div>
            </div>
          </div>
          <p>Some commands take arguments.  Arguments starting with "<code class="literal">-</code>" or "<code class="literal">--</code>" are called options and control the behavior of the command.</p>
          <pre class="screen">$ date
Mon Oct 27 23:02:09 CET 2003
$ date -R
Mon, 27 Oct 2003 23:02:40 +0100</pre>
          <p>Here the command-line argument "<code class="literal">-R</code>" changes <span class="citerefentry"><span class="refentrytitle">date</span>(1)</span> behavior to output <a class="ulink" href="http://tools.ietf.org/html/rfc2822">RFC2822</a> compliant date string.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_shell_glob"/>1.5.6. Shell glob</h3>
              </div>
            </div>
          </div>
          <p>Often you want a command to work with a group of files without typing all of them.  The filename expansion pattern using the shell <span class="strong"><strong>glob</strong></span>, (sometimes referred as <span class="strong"><strong>wildcards</strong></span>), facilitate this need.</p>
          <div class="table">
            <a id="shellglobpatterns"/>
            <p class="title">
              <strong>Table 1.20. Shell glob patterns</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="Shell glob patterns" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    shell glob pattern
    </th>
                    <th style="text-align: left">
    description of match rule
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">*</code>
                </td>
                    <td style="text-align: left">
    filename (segment) not started with "<code class="literal">.</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">.*</code>
                </td>
                    <td style="text-align: left">
    filename (segment) started with "<code class="literal">.</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">?</code>
                </td>
                    <td style="text-align: left">
    exactly one character
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">[…]</code>
                </td>
                    <td style="text-align: left">
    exactly one character with any character enclosed in brackets
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">[a-z]</code>
                </td>
                    <td style="text-align: left">
    exactly one character with any character between "<code class="literal">a</code>" and "<code class="literal">z</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">[^…]</code>
                </td>
                    <td style="text-align: left">
    exactly one character other than any character enclosed in brackets (excluding "<code class="literal">^</code>")
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>For example, try the following</p>
          <pre class="screen">$ mkdir junk; cd junk; touch 1.txt 2.txt 3.c 4.h .5.txt ..6.txt
$ echo *.txt
1.txt 2.txt
$ echo *
1.txt 2.txt 3.c 4.h
$ echo *.[hc]
3.c 4.h
$ echo .*
. .. .5.txt ..6.txt
$ echo .*[^.]*
.5.txt ..6.txt
$ echo [^1-3]*
4.h
$ cd ..; rm -rf junk</pre>
          <p>See <span class="citerefentry"><span class="refentrytitle">glob</span>(7)</span>.</p>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Unlike normal filename expansion by the shell, the shell pattern "<code class="literal">*</code>" tested in <span class="citerefentry"><span class="refentrytitle">find</span>(1)</span> with "<code class="literal">-name</code>" test etc., matches the initial "<code class="literal">.</code>" of the filename. (New <a class="ulink" href="http://en.wikipedia.org/wiki/POSIX">POSIX</a> feature)</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>BASH can be tweaked to change its glob behavior with its shopt builtin options such as "<code class="literal">dotglob</code>", "<code class="literal">noglob</code>", "<code class="literal">nocaseglob</code>", "<code class="literal">nullglob</code>", "<code class="literal">extglob</code>", etc.  See <span class="citerefentry"><span class="refentrytitle">bash</span>(1)</span>.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_return_value_of_the_command"/>1.5.7. Return value of the command</h3>
              </div>
            </div>
          </div>
          <p>Each command returns its exit status (variable: "<code class="literal">$?</code>") as the return value.</p>
          <div class="table">
            <a id="commandexitcodes"/>
            <p class="title">
              <strong>Table 1.21. Command exit codes</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="Command exit codes" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    command exit status
    </th>
                    <th style="text-align: left">
    numeric return value
    </th>
                    <th style="text-align: left">
    logical return value
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
    success
    </td>
                    <td style="text-align: left">
    zero, 0
    </td>
                    <td style="text-align: left">
                  <span class="strong"><strong>TRUE</strong></span>
                </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
    error
    </td>
                    <td style="text-align: left">
    non-zero, -1
    </td>
                    <td style="text-align: left">
                  <span class="strong"><strong>FALSE</strong></span>
                </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>For example, try the following.</p>
          <pre class="screen">$ [ 1 = 1 ] ; echo $?
0
$ [ 1 = 2 ] ; echo $?
1</pre>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Please note that, in the logical context for the shell, <span class="strong"><strong>success</strong></span> is treated as the logical <span class="strong"><strong>TRUE</strong></span> which has 0 (zero) as its value.  This is somewhat non-intuitive and needs to be reminded here.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_typical_command_sequences_and_shell_redirection"/>1.5.8. Typical command sequences and shell redirection</h3>
              </div>
            </div>
          </div>
          <p>Let's try to remember following shell command idioms typed in one line as a part of shell command.</p>
          <div class="table">
            <a id="shellcommandidioms"/>
            <p class="title">
              <strong>Table 1.22. Shell command idioms</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="Shell command idioms" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    command idiom
    </th>
                    <th style="text-align: left">
    description
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command &amp;</code>
                </td>
                    <td style="text-align: left"><span class="strong"><strong>background</strong></span> execution of <code class="literal">command</code> in the subshell
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command1 | command2</code>
                </td>
                    <td style="text-align: left"><span class="strong"><strong>pipe</strong></span> the standard output of <code class="literal">command1</code> to the standard input of <code class="literal">command2</code> (<span class="strong"><strong>concurrent</strong></span> execution)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command1 2&gt;&amp;1 | command2</code>
                </td>
                    <td style="text-align: left"><span class="strong"><strong>pipe</strong></span> both standard output and standard error of <code class="literal">command1</code> to the standard input of <code class="literal">command2</code> (<span class="strong"><strong>concurrent</strong></span> execution)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command1 ; command2</code>
                </td>
                    <td style="text-align: left">
    execute <code class="literal">command1</code> and <code class="literal">command2</code> <span class="strong"><strong>sequentially</strong></span>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command1 &amp;&amp; command2</code>
                </td>
                    <td style="text-align: left">
    execute <code class="literal">command1</code>; if successful, execute <code class="literal">command2</code> <span class="strong"><strong>sequentially</strong></span> (return success if both <code class="literal">command1</code> <span class="strong"><strong>and</strong></span> <code class="literal">command2</code> are successful)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command1 || command2</code>
                </td>
                    <td style="text-align: left">
    execute <code class="literal">command1</code>; if not successful, execute <code class="literal">command2</code> <span class="strong"><strong>sequentially</strong></span> (return success if <code class="literal">command1</code> <span class="strong"><strong>or</strong></span> <code class="literal">command2</code> are successful)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command &gt; foo</code>
                </td>
                    <td style="text-align: left">
    redirect standard output of <code class="literal">command</code> to a file <code class="literal">foo</code> (overwrite)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command 2&gt; foo</code>
                </td>
                    <td style="text-align: left">
    redirect standard error of <code class="literal">command</code> to a file <code class="literal">foo</code> (overwrite)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command &gt;&gt; foo</code>
                </td>
                    <td style="text-align: left">
    redirect standard output of <code class="literal">command</code> to a file <code class="literal">foo</code> (append)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command 2&gt;&gt; foo</code>
                </td>
                    <td style="text-align: left">
    redirect standard error of <code class="literal">command</code> to a file <code class="literal">foo</code> (append)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command &gt; foo 2&gt;&amp;1</code>
                </td>
                    <td style="text-align: left">
    redirect both standard output and standard error of <code class="literal">command</code> to a file <code class="literal">foo</code>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command &lt; foo</code>
                </td>
                    <td style="text-align: left">
    redirect standard input of <code class="literal">command</code> to a file <code class="literal">foo</code>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command &lt;&lt; delimiter</code>
                </td>
                    <td style="text-align: left">
    redirect standard input of <code class="literal">command</code> to the following lines until "<code class="literal">delimiter</code>" is met (here document)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">command &lt;&lt;- delimiter</code>
                </td>
                    <td style="text-align: left">
    redirect standard input of <code class="literal">command</code> to the following lines until "<code class="literal">delimiter</code>" is met (here document, the leading tab characters are stripped from input lines)
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>The Debian system is a multi-tasking system. Background jobs allow users to run multiple programs in a single shell.  The management of the background process involves the shell builtins: <code class="literal">jobs</code>, <code class="literal">fg</code>, <code class="literal">bg</code>, and <code class="literal">kill</code>.  Please read sections of bash(1) under "SIGNALS", and "JOB CONTROL", and <span class="citerefentry"><span class="refentrytitle">builtins</span>(1)</span>.</p>
          <p>For example, try the following</p>
          <pre class="screen">$ &lt;/etc/motd pager</pre>
          <pre class="screen">$ pager &lt;/etc/motd</pre>
          <pre class="screen">$ pager /etc/motd</pre>
          <pre class="screen">$ cat /etc/motd | pager</pre>
          <p>Although all 4 examples of shell redirections display the same thing, the last example runs an extra <code class="literal">cat</code> command and wastes resources with no reason.</p>
          <p>The shell allows you to open files using the <code class="literal">exec</code> builtin with an arbitrary file descriptor.</p>
          <pre class="screen">$ echo Hello &gt;foo
$ exec 3&lt;foo 4&gt;bar  # open files
$ cat &lt;&amp;3 &gt;&amp;4       # redirect stdin to 3, stdout to 4
$ exec 3&lt;&amp;- 4&gt;&amp;-    # close files
$ cat bar
Hello</pre>
          <p>The file descriptor 0-2 are predefined.</p>
          <div class="table">
            <a id="predefinedfiledescriptors"/>
            <p class="title">
              <strong>Table 1.23. Predefined file descriptors</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="Predefined file descriptors" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    device
    </th>
                    <th style="text-align: left">
    description
    </th>
                    <th style="text-align: left">
    file descriptor
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">stdin</code>
                </td>
                    <td style="text-align: left">
    standard input
    </td>
                    <td style="text-align: left">
    0
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">stdout</code>
                </td>
                    <td style="text-align: left">
    standard output
    </td>
                    <td style="text-align: left">
    1
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">stderr</code>
                </td>
                    <td style="text-align: left">
    standard error
    </td>
                    <td style="text-align: left">
    2
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_command_alias"/>1.5.9. Command alias</h3>
              </div>
            </div>
          </div>
          <p>You can set an alias for the frequently used command.</p>
          <p>For example, try the following</p>
          <pre class="screen">$ alias la='ls -la'</pre>
          <p>Now, "<code class="literal">la</code>" works as a short hand for "<code class="literal">ls -la</code>" which lists all files in the long listing format.</p>
          <p>You can list any existing aliases by <code class="literal">alias</code> (see <span class="citerefentry"><span class="refentrytitle">bash</span>(1)</span> under "SHELL BUILTIN COMMANDS").</p>
          <pre class="screen">$ alias
...
alias la='ls -la'</pre>
          <p>You can identity exact path or identity of the command by <code class="literal">type</code> (see <span class="citerefentry"><span class="refentrytitle">bash</span>(1)</span> under "SHELL BUILTIN COMMANDS").</p>
          <p>For example, try the following</p>
          <pre class="screen">$ type ls
ls is hashed (/bin/ls)
$ type la
la is aliased to ls -la
$ type echo
echo is a shell builtin
$ type file
file is /usr/bin/file</pre>
          <p>Here <code class="literal">ls</code> was recently searched while "<code class="literal">file</code>" was not, thus "<code class="literal">ls</code>" is "hashed", i.e., the shell has an internal record for the quick access to the location of the "<code class="literal">ls</code>" command.</p>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>See <a class="xref" href="ch09.en.html#_colorized_commands" title="9.2.7. Colorized commands">Section 9.2.7, “Colorized commands”</a>.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
      </div>
      <div class="section">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title"><a id="_unix_like_text_processing"/>1.6. Unix-like text processing</h2>
            </div>
          </div>
        </div>
        <p>In Unix-like work environment, text processing is done by piping text through chains of standard text processing tools. This was another crucial Unix innovation.</p>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_unix_text_tools"/>1.6.1. Unix text tools</h3>
              </div>
            </div>
          </div>
          <p>There are few standard text processing tools which are used very often on the Unix-like system.</p>
          <div class="itemizedlist">
            <ul class="itemizedlist">
              <li class="listitem">
                <p>
No regular expression is used:
</p>
                <div class="itemizedlist">
                  <ul class="itemizedlist">
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">cat</span>(1)</span> concatenates files and outputs the whole content.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">tac</span>(1)</span> concatenates files and outputs in reverse.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">cut</span>(1)</span> selects parts of lines and outputs.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">head</span>(1)</span> outputs the first part of files.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">tail</span>(1)</span> outputs the last part of files.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">sort</span>(1)</span> sorts lines of text files.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">uniq</span>(1)</span> removes duplicate lines from a sorted file.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">tr</span>(1)</span> translates or deletes characters.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">diff</span>(1)</span> compares files line by line.
</p>
                    </li>
                  </ul>
                </div>
              </li>
              <li class="listitem">
                <p>
Basic regular expression (<span class="strong"><strong>BRE</strong></span>) is used:
</p>
                <div class="itemizedlist">
                  <ul class="itemizedlist">
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">grep</span>(1)</span> matches text with patterns.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">ed</span>(1)</span> is a primitive line editor.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">sed</span>(1)</span> is a stream editor.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">vim</span>(1)</span> is a screen editor.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">emacs</span>(1)</span> is a screen editor. (somewhat extended <span class="strong"><strong>BRE</strong></span>)
</p>
                    </li>
                  </ul>
                </div>
              </li>
              <li class="listitem">
                <p>
Extended regular expression (<span class="strong"><strong>ERE</strong></span>) is used:
</p>
                <div class="itemizedlist">
                  <ul class="itemizedlist">
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">egrep</span>(1)</span> matches text with patterns.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">awk</span>(1)</span> does simple text processing.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">tcl</span>(3tcl)</span> can do every conceivable text processing: See <span class="citerefentry"><span class="refentrytitle">re_syntax</span>(3)</span>. Often used with <span class="citerefentry"><span class="refentrytitle">tk</span>(3tk)</span>.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">perl</span>(1)</span> can do every conceivable text processing. See <span class="citerefentry"><span class="refentrytitle">perlre</span>(1)</span>.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">pcregrep</span>(1)</span> from the <code class="literal">pcregrep</code> package matches text with <a class="ulink" href="http://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions">Perl Compatible Regular Expressions (PCRE)</a> pattern.
</p>
                    </li>
                    <li class="listitem">
                      <p><span class="citerefentry"><span class="refentrytitle">python</span>(1)</span> with the <code class="literal">re</code> module can do every conceivable text processing. See "<code class="literal">/usr/share/doc/python/html/index.html</code>".
</p>
                    </li>
                  </ul>
                </div>
              </li>
            </ul>
          </div>
          <p>If you are not sure what exactly these commands do, please use "<code class="literal">man command</code>" to figure it out by yourself.</p>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Sort order and range expression are locale dependent.  If you wish to obtain traditional behavior for a command, use <span class="strong"><strong>C</strong></span> locale instead of <span class="strong"><strong>UTF-8</strong></span> ones by prepending command with "<code class="literal">LANG=C</code>" (see <a class="xref" href="ch01.en.html#_the_literal_lang_literal_variable" title="1.5.2. The &quot;$LANG&quot; variable">Section 1.5.2, “The "<code class="literal">$LANG</code>" variable”</a> and <a class="xref" href="ch08.en.html#_the_locale" title="8.4. The locale">Section 8.4, “The locale”</a>).</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p><a class="ulink" href="http://en.wikipedia.org/wiki/Perl">Perl</a> regular expressions (<span class="citerefentry"><span class="refentrytitle">perlre</span>(1)</span>), <a class="ulink" href="http://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions">Perl Compatible Regular Expressions (PCRE)</a>, and <a class="ulink" href="http://en.wikipedia.org/wiki/Python_(programming_language)">Python</a> regular expressions offered by the <code class="literal">re</code> module have many common extensions to the normal <span class="strong"><strong>ERE</strong></span>.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_regular_expressions"/>1.6.2. Regular expressions</h3>
              </div>
            </div>
          </div>
          <p><a class="ulink" href="http://en.wikipedia.org/wiki/Regular_expression">Regular expressions</a> are used in many text processing tools.  They are analogous to the shell globs, but they are more complicated and powerful.</p>
          <p>The regular expression describes the matching pattern and is made up of text characters and <span class="strong"><strong>metacharacters</strong></span>.</p>
          <p>A <span class="strong"><strong>metacharacter</strong></span> is just a character with a special meaning.  There are 2 major styles, <span class="strong"><strong>BRE</strong></span> and <span class="strong"><strong>ERE</strong></span>, depending on the text tools as described above.</p>
          <div class="table">
            <a id="metacharactersforbreandere"/>
            <p class="title">
              <strong>Table 1.24. Metacharacters for BRE and ERE</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="Metacharacters for BRE and ERE" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    BRE
    </th>
                    <th style="text-align: left">
    ERE
    </th>
                    <th style="text-align: left">
    description of the regular expression
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">\ .  [ ] ^ $ *</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">\ .  [ ] ^ $ *</code>
                </td>
                    <td style="text-align: left">
    common <span class="strong"><strong>metacharacters</strong></span>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">\+ \? \( \) \{ \} \|</code>
                </td>
                    <td style="text-align: left">
     
    </td>
                    <td style="text-align: left">
    BRE only "<code class="literal">\</code>" escaped <span class="strong"><strong>metacharacters</strong></span>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
     
    </td>
                    <td style="text-align: left">
                  <code class="literal">+ ? ( ) { } |</code>
                </td>
                    <td style="text-align: left">
    ERE only non-"<code class="literal">\</code>" escaped <span class="strong"><strong>metacharacters</strong></span>
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">c</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">c</code>
                </td>
                    <td style="text-align: left">
    match <span class="strong"><strong>non-metacharacter</strong></span> "<code class="literal">c</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">\c</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">\c</code>
                </td>
                    <td style="text-align: left">
    match a literal character "<code class="literal">c</code>" even if "<code class="literal">c</code>" is <span class="strong"><strong>metacharacter</strong></span> by itself
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">.</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">.</code>
                </td>
                    <td style="text-align: left">
    match any character including newline
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">^</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">^</code>
                </td>
                    <td style="text-align: left">
    position at the beginning of a string
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">$</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">$</code>
                </td>
                    <td style="text-align: left">
    position at the end of a string
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">\&lt;</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">\&lt;</code>
                </td>
                    <td style="text-align: left">
    position at the beginning of a word
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">\&gt;</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">\&gt;</code>
                </td>
                    <td style="text-align: left">
    position at the end of a word
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">[abc…]</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">[abc…]</code>
                </td>
                    <td style="text-align: left">
    match any characters in "<code class="literal">abc…</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">[^abc…]</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">[^abc…]</code>
                </td>
                    <td style="text-align: left">
    match any characters except in "<code class="literal">abc…</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">r*</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">r*</code>
                </td>
                    <td style="text-align: left">
    match zero or more regular expressions identified by "<code class="literal">r</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">r\+</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">r+</code>
                </td>
                    <td style="text-align: left">
    match one or more regular expressions identified by "<code class="literal">r</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">r\?</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">r?</code>
                </td>
                    <td style="text-align: left">
    match zero or one regular expressions identified by "<code class="literal">r</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">r1\|r2</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">r1|r2</code>
                </td>
                    <td style="text-align: left">
    match one of the regular expressions identified by "<code class="literal">r1</code>" or "<code class="literal">r2</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">\(r1\|r2\)</code>
                </td>
                    <td style="text-align: left">
                  <code class="literal">(r1|r2)</code>
                </td>
                    <td style="text-align: left">
    match one of the regular expressions identified by "<code class="literal">r1</code>" or "<code class="literal">r2</code>" and treat it as a <span class="strong"><strong>bracketed</strong></span> regular expression
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>The regular expression of <span class="strong"><strong><code class="literal">emacs</code></strong></span> is basically <span class="strong"><strong>BRE</strong></span> but has been extended to treat "<code class="literal">+</code>"and "<code class="literal">?</code>" as the <span class="strong"><strong>metacharacters</strong></span> as in <span class="strong"><strong>ERE</strong></span>.  Thus, there are no needs to escape them with "<code class="literal">\</code>" in the regular expression of <code class="literal">emacs</code>.</p>
          <p><span class="citerefentry"><span class="refentrytitle">grep</span>(1)</span> can be used to perform the text search using the regular expression.</p>
          <p>For example, try the following</p>
          <pre class="screen">$ egrep 'GNU.*LICENSE|Yoyodyne' /usr/share/common-licenses/GPL
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
Yoyodyne, Inc., hereby disclaims all copyright interest in the program</pre>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>See <a class="xref" href="ch09.en.html#_colorized_commands" title="9.2.7. Colorized commands">Section 9.2.7, “Colorized commands”</a>.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_replacement_expressions"/>1.6.3. Replacement expressions</h3>
              </div>
            </div>
          </div>
          <p>For the replacement expression, some characters have special meanings.</p>
          <div class="table">
            <a id="thereplacementexpression"/>
            <p class="title">
              <strong>Table 1.25. The replacement expression</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="The replacement expression" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    replacement expression
    </th>
                    <th style="text-align: left">
    description of the text to replace the replacement expression
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">&amp;</code>
                </td>
                    <td style="text-align: left">
    what the regular expression matched (use <code class="literal">\&amp;</code> in <code class="literal">emacs</code>)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">\n</code>
                </td>
                    <td style="text-align: left">
    what the n-th <span class="strong"><strong>bracketed</strong></span> regular expression matched ("n" being number)
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>For Perl replacement string, "$&amp;" is used instead of "&amp;" and "$n" is used instead of "\n".</p>
          <p>For example, try the following</p>
          <pre class="screen">$ echo zzz1abc2efg3hij4 | \
sed -e 's/\(1[a-z]*\)[0-9]*\(.*\)$/=&amp;=/'
zzz=1abc2efg3hij4=
$ echo zzz1abc2efg3hij4 | \
sed -e 's/\(1[a-z]*\)[0-9]*\(.*\)$/\2===\1/'
zzzefg3hij4===1abc
$ echo zzz1abc2efg3hij4 | \
perl -pe 's/(1[a-z]*)[0-9]*(.*)$/$2===$1/'
zzzefg3hij4===1abc
$ echo zzz1abc2efg3hij4 | \
perl -pe 's/(1[a-z]*)[0-9]*(.*)$/=$&amp;=/'
zzz=1abc2efg3hij4=</pre>
          <p>Here please pay extra attention to the style of the <span class="strong"><strong>bracketed</strong></span> regular expression and how the matched strings are used in the text replacement process on different tools.</p>
          <p>These regular expressions can be used for cursor movements and text replacement actions in some editors too.</p>
          <p>The back slash "<code class="literal">\</code>" at the end of line in the shell commandline escapes newline as a white space character and continues shell command line input to the next line.</p>
          <p>Please read all the related manual pages to learn these commands.</p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_global_substitution_with_regular_expressions"/>1.6.4. Global substitution with regular expressions</h3>
              </div>
            </div>
          </div>
          <p>The <span class="citerefentry"><span class="refentrytitle">ed</span>(1)</span> command can replace all instances of "<code class="literal">FROM_REGEX</code>" with "<code class="literal">TO_TEXT</code>" in "<code class="literal">file</code>".</p>
          <pre class="screen">$ ed file &lt;&lt;EOF
,s/FROM_REGEX/TO_TEXT/g
w
q
EOF</pre>
          <p>The <span class="citerefentry"><span class="refentrytitle">sed</span>(1)</span> command can replace all instances of "<code class="literal">FROM_REGEX</code>" with "<code class="literal">TO_TEXT</code>" in "<code class="literal">file</code>".</p>
          <pre class="screen">$ sed -i -e 's/FROM_REGEX/TO_TEXT/g' file</pre>
          <p>The <span class="citerefentry"><span class="refentrytitle">vim</span>(1)</span> command can replace all instances of "<code class="literal">FROM_REGEX</code>" with "<code class="literal">TO_TEXT</code>" in "<code class="literal">file</code>" by using <span class="citerefentry"><span class="refentrytitle">ex</span>(1)</span> commands.</p>
          <pre class="screen">$ vim '+%s/FROM_REGEX/TO_TEXT/gc' '+w' '+q' file</pre>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>The "<code class="literal">c</code>" flag in the above ensures interactive confirmation for each substitution.</p>
                </td>
              </tr>
            </table>
          </div>
          <p>Multiple files ("<code class="literal">file1</code>", "<code class="literal">file2</code>", and "<code class="literal">file3</code>") can be processed with regular expressions similarly with <span class="citerefentry"><span class="refentrytitle">vim</span>(1)</span> or <span class="citerefentry"><span class="refentrytitle">perl</span>(1)</span>.</p>
          <pre class="screen">$ vim '+argdo %s/FROM_REGEX/TO_TEXT/ge|update' '+q' file1 file2 file3</pre>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>The "<code class="literal">e</code>" flag in the above prevents the "No match" error from breaking a mapping.</p>
                </td>
              </tr>
            </table>
          </div>
          <pre class="screen">$ perl -i -p -e 's/FROM_REGEX/TO_TEXT/g;' file1 file2 file3</pre>
          <p>In the perl(1) example, "<code class="literal">-i</code>" is for the in-place editing of each target file, and "<code class="literal">-p</code>" is for the implicit loop over all given files.</p>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>Use of argument "<code class="literal">-i.bak</code>" instead of "<code class="literal">-i</code>" keeps each original file by adding "<code class="literal">.bak</code>" to its filename.  This makes recovery from errors easier for complex substitutions.</p>
                </td>
              </tr>
            </table>
          </div>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Note]" src="images/note.png"/>
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p><span class="citerefentry"><span class="refentrytitle">ed</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">vim</span>(1)</span> are <span class="strong"><strong>BRE</strong></span>; <span class="citerefentry"><span class="refentrytitle">perl</span>(1)</span> is <span class="strong"><strong>ERE</strong></span>.</p>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_extracting_data_from_text_file_table"/>1.6.5. Extracting data from text file table</h3>
              </div>
            </div>
          </div>
          <p>Let's consider a text file called "<code class="literal">DPL</code>" in which some pre-2004 Debian project leader's names and their initiation date are listed in a
space-separated format.</p>
          <pre class="screen">Ian     Murdock   August  1993
Bruce   Perens    April   1996
Ian     Jackson   January 1998
Wichert Akkerman  January 1999
Ben     Collins   April   2001
Bdale   Garbee    April   2002
Martin  Michlmayr March   2003</pre>
          <div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Tip">
              <tr>
                <td rowspan="2" align="center" valign="top">
                  <img alt="[Tip]" src="images/tip.png"/>
                </td>
                <th align="left">Tip</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>See <a class="ulink" href="https://www.debian.org/doc/manuals/project-history/">"A Brief History of Debian"</a> for the latest <a class="ulink" href="https://www.debian.org/doc/manuals/project-history/ch-leaders">Debian leadership history</a>.</p>
                </td>
              </tr>
            </table>
          </div>
          <p>Awk is frequently used to extract data from these types of files.</p>
          <p>For example, try the following</p>
          <pre class="screen">$ awk '{ print $3 }' &lt;DPL                   # month started
August
April
January
January
April
April
March
$ awk '($1=="Ian") { print }' &lt;DPL          # DPL called Ian
Ian     Murdock   August  1993
Ian     Jackson   January 1998
$ awk '($2=="Perens") { print $3,$4 }' &lt;DPL # When Perens started
April 1996</pre>
          <p>Shells such as Bash can be also used to parse this kind of file.</p>
          <p>For example, try the following</p>
          <pre class="screen">$ while read first last month year; do
    echo $month
  done &lt;DPL
... same output as the first Awk example</pre>
          <p>Here, the <code class="literal">read</code> builtin command uses characters in "<code class="literal">$IFS</code>" (internal field separators) to split lines into words.</p>
          <p>If you change "<code class="literal">$IFS</code>" to "<code class="literal">:</code>", you can parse "<code class="literal">/etc/passwd</code>" with shell nicely.</p>
          <pre class="screen">$ oldIFS="$IFS"   # save old value
$ IFS=':'
$ while read user password uid gid rest_of_line; do
    if [ "$user" = "bozo" ]; then
      echo "$user's ID is $uid"
    fi
  done &lt; /etc/passwd
bozo's ID is 1000
$ IFS="$oldIFS"   # restore old value</pre>
          <p>(If Awk is used to do the equivalent, use "<code class="literal">FS=':'</code>" to set the field separator.)</p>
          <p>IFS is also used by the shell to split results of parameter expansion, command substitution, and arithmetic expansion.  These do not occur within double or single quoted words.  The default value of IFS is &lt;space&gt;, &lt;tab&gt;, and &lt;newline&gt; combined.</p>
          <p>Be careful about using this shell IFS tricks.  Strange things may happen, when shell interprets some parts of the script as its <span class="strong"><strong>input</strong></span>.</p>
          <pre class="screen">$ IFS=":,"                        # use ":" and "," as IFS
$ echo IFS=$IFS,   IFS="$IFS"     # echo is a Bash builtin
IFS=  , IFS=:,
$ date -R                         # just a command output
Sat, 23 Aug 2003 08:30:15 +0200
$ echo $(date -R)                 # sub shell --&gt; input to main shell
Sat  23 Aug 2003 08 30 36 +0200
$ unset IFS                       # reset IFS to the default
$ echo $(date -R)
Sat, 23 Aug 2003 08:30:50 +0200</pre>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="_script_snippets_for_piping_commands"/>1.6.6. Script snippets for piping commands</h3>
              </div>
            </div>
          </div>
          <p>The following scripts do nice things as a part of a pipe.</p>
          <div class="table">
            <a id="listofscriptsniporpipingcommands"/>
            <p class="title">
              <strong>Table 1.26. List of script snippets for piping commands</strong>
            </p>
            <div class="table-contents">
              <table class="table" summary="List of script snippets for piping commands" border="1">
                <colgroup>
                  <col style="text-align: left"/>
                  <col style="text-align: left"/>
                </colgroup>
                <thead>
                  <tr>
                    <th style="text-align: left">
    script snippet (type in one line)
    </th>
                    <th style="text-align: left">
    effect of command
    </th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">find /usr -print</code>
                </td>
                    <td style="text-align: left">
    find all files under "<code class="literal">/usr</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">seq 1 100</code>
                </td>
                    <td style="text-align: left">
    print 1 to 100
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| xargs -n 1 &lt;command&gt;</code>
                </td>
                    <td style="text-align: left">
    run command repeatedly with each item from pipe as its argument
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| xargs -n 1 echo</code>
                </td>
                    <td style="text-align: left">
    split white-space-separated items from pipe into lines
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| xargs echo</code>
                </td>
                    <td style="text-align: left">
    merge all lines from pipe into a line
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| grep -e &lt;regex_pattern&gt;</code>
                </td>
                    <td style="text-align: left">
    extract lines from pipe containing &lt;regex_pattern&gt;
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| grep -v -e &lt;regex_pattern&gt;</code>
                </td>
                    <td style="text-align: left">
    extract lines from pipe not containing &lt;regex_pattern&gt;
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| cut -d: -f3 -</code>
                </td>
                    <td style="text-align: left">
    extract third field from pipe separated by "<code class="literal">:</code>" (passwd file etc.)
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| awk '{ print $3 }'</code>
                </td>
                    <td style="text-align: left">
    extract third field from pipe separated by whitespaces
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| awk -F'\t' '{ print $3 }'</code>
                </td>
                    <td style="text-align: left">
    extract third field from pipe separated by tab
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| col -bx</code>
                </td>
                    <td style="text-align: left">
    remove backspace and expand tabs to spaces
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| expand -</code>
                </td>
                    <td style="text-align: left">
    expand tabs
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| sort| uniq</code>
                </td>
                    <td style="text-align: left">
    sort and remove duplicates
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| tr 'A-Z' 'a-z'</code>
                </td>
                    <td style="text-align: left">
    convert uppercase to lowercase
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| tr -d '\n'</code>
                </td>
                    <td style="text-align: left">
    concatenate lines into one line
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| tr -d '\r'</code>
                </td>
                    <td style="text-align: left">
    remove CR
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| sed 's/^/# /'</code>
                </td>
                    <td style="text-align: left">
    add "<code class="literal">#</code>" to the start of each line
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| sed 's/\.ext//g'</code>
                </td>
                    <td style="text-align: left">
    remove "<code class="literal">.ext</code>"
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| sed -n -e 2p</code>
                </td>
                    <td style="text-align: left">
    print the second line
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| head -n 2 -</code>
                </td>
                    <td style="text-align: left">
    print the first 2 lines
    </td>
                  </tr>
                  <tr>
                    <td style="text-align: left">
                  <code class="literal">| tail -n 2 -</code>
                </td>
                    <td style="text-align: left">
    print the last 2 lines
    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
          <br class="table-break"/>
          <p>A one-line shell script can loop over many files using <span class="citerefentry"><span class="refentrytitle">find</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">xargs</span>(1)</span> to perform quite complicated tasks.  See <a class="xref" href="ch10.en.html#_idioms_for_the_selection_of_files" title="10.1.5. Idioms for the selection of files">Section 10.1.5, “Idioms for the selection of files”</a> and <a class="xref" href="ch09.en.html#_repeating_a_command_looping_over_files" title="9.3.9. Repeating a command looping over files">Section 9.3.9, “Repeating a command looping over files”</a>.</p>
          <p>When using the shell interactive mode becomes too complicated, please consider to write a shell script (see <a class="xref" href="ch12.en.html#_the_shell_script" title="12.1. The shell script">Section 12.1, “The shell script”</a>).</p>
        </div>
      </div>
    </div>
    <div class="navfooter">
      <hr/>
      <table width="100%" summary="Navigation footer">
        <tr>
          <td align="left"><a accesskey="p" href="pr01.en.html"><img src="images/prev.png" alt="Prev"/></a> </td>
          <td align="center"> </td>
          <td align="right"> <a accesskey="n" href="ch02.en.html"><img src="images/next.png" alt="Next"/></a></td>
        </tr>
        <tr>
          <td align="left" valign="top">Preface </td>
          <td align="center">
            <a accesskey="h" href="index.en.html">
              <img src="images/home.png" alt="Home"/>
            </a>
          </td>
          <td align="right" valign="top"> Chapter 2. Debian package management</td>
        </tr>
      </table>
    </div>
  </body>
</html>