/usr/share/debian-reference/ch09.en.html is in debian-reference-en 2.58.
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 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 | <?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 9. System tips</title>
<link rel="stylesheet" type="text/css" href="debian-reference.css"/>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.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="ch08.en.html" title="Chapter 8. I18N and L10N"/>
<link rel="next" href="ch10.en.html" title="Chapter 10. Data management"/>
</head>
<body>
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Chapter 9. System tips</th>
</tr>
<tr>
<td align="left"><a accesskey="p" href="ch08.en.html"><img src="images/prev.png" alt="Prev"/></a> </td>
<th width="60%" align="center"> </th>
<td align="right"> <a accesskey="n" href="ch10.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="_system_tips"/>Chapter 9. System tips</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<strong>Table of Contents</strong>
</p>
<dl class="toc">
<dt>
<span class="section">
<a href="ch09.en.html#_the_screen_program">9.1. The screen program</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch09.en.html#_the_use_scenario_for_screen_1">9.1.1. The use scenario for screen(1)</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_key_bindings_for_the_screen_command">9.1.2. Key bindings for the screen command</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch09.en.html#_data_recording_and_presentation">9.2. Data recording and presentation</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch09.en.html#_the_log_daemon">9.2.1. The log daemon</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_log_analyzer">9.2.2. Log analyzer</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_recording_the_shell_activities_cleanly">9.2.3. Recording the shell activities cleanly</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_customized_display_of_text_data">9.2.4. Customized display of text data</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_customized_display_of_time_and_date">9.2.5. Customized display of time and date</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_colorized_shell_echo">9.2.6. Colorized shell echo</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_colorized_commands">9.2.7. Colorized commands</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_recording_the_editor_activities_for_complex_repeats">9.2.8. Recording the editor activities for complex repeats</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_recording_the_graphic_image_of_an_x_application">9.2.9. Recording the graphic image of an X application</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_recording_changes_in_configuration_files">9.2.10. Recording changes in configuration files</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch09.en.html#_monitoring_controlling_and_starting_program_activities">9.3. Monitoring, controlling, and starting program activities</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch09.en.html#_timing_a_process">9.3.1. Timing a process</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_the_scheduling_priority">9.3.2. The scheduling priority</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_the_ps_command">9.3.3. The ps command</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_the_top_command">9.3.4. The top command</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_listing_files_opened_by_a_process">9.3.5. Listing files opened by a process</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_tracing_program_activities">9.3.6. Tracing program activities</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_identification_of_processes_using_files_or_sockets">9.3.7. Identification of processes using files or sockets</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_repeating_a_command_with_a_constant_interval">9.3.8. Repeating a command with a constant interval</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_repeating_a_command_looping_over_files">9.3.9. Repeating a command looping over files</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_starting_a_program_from_gui">9.3.10. Starting a program from GUI</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_customizing_program_to_be_started">9.3.11. Customizing program to be started</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_killing_a_process">9.3.12. Killing a process</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_scheduling_tasks_once">9.3.13. Scheduling tasks once</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_scheduling_tasks_regularly">9.3.14. Scheduling tasks regularly</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_alt_sysrq_key">9.3.15. Alt-SysRq key</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch09.en.html#_system_maintenance_tips">9.4. System maintenance tips</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch09.en.html#_who_is_on_the_system">9.4.1. Who is on the system?</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_warning_everyone">9.4.2. Warning everyone</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_hardware_identification">9.4.3. Hardware identification</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_hardware_configuration">9.4.4. Hardware configuration</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_system_and_hardware_time">9.4.5. System and hardware time</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_the_terminal_configuration">9.4.6. The terminal configuration</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_the_sound_infrastructure">9.4.7. The sound infrastructure</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_disabling_the_screen_saver">9.4.8. Disabling the screen saver</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_disabling_beep_sounds">9.4.9. Disabling beep sounds</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_memory_usage">9.4.10. Memory usage</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_system_security_and_integrity_check">9.4.11. System security and integrity check</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch09.en.html#_data_storage_tips">9.5. Data storage tips</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch09.en.html#_disk_space_usage">9.5.1. Disk space usage</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_disk_partition_configuration">9.5.2. Disk partition configuration</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_accessing_partition_using_uuid">9.5.3. Accessing partition using UUID</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_lvm2">9.5.4. LVM2</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_filesystem_configuration">9.5.5. Filesystem configuration</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_filesystem_creation_and_integrity_check">9.5.6. Filesystem creation and integrity check</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_optimization_of_filesystem_by_mount_options">9.5.7. Optimization of filesystem by mount options</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_optimization_of_filesystem_via_superblock">9.5.8. Optimization of filesystem via superblock</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_optimization_of_hard_disk">9.5.9. Optimization of hard disk</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_optimization_of_solid_state_drive">9.5.10. Optimization of solid state drive</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_using_smart_to_predict_hard_disk_failure">9.5.11. Using SMART to predict hard disk failure</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_specify_temporary_storage_directory_via_tmpdir">9.5.12. Specify temporary storage directory via $TMPDIR</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_expansion_of_usable_storage_space_via_lvm">9.5.13. Expansion of usable storage space via LVM</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_expansion_of_usable_storage_space_by_mounting_another_partition">9.5.14. Expansion of usable storage space by mounting another partition</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_expansion_of_usable_storage_space_by_bind_mounting_another_directory">9.5.15. Expansion of usable storage space by bind-mounting another directory</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_expansion_of_usable_storage_space_using_symlink">9.5.16. Expansion of usable storage space using symlink</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_expansion_of_usable_storage_space_using_aufs">9.5.17. Expansion of usable storage space using aufs</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch09.en.html#_the_disk_image">9.6. The disk image</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch09.en.html#_making_the_disk_image_file">9.6.1. Making the disk image file</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_writing_directly_to_the_disk">9.6.2. Writing directly to the disk</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_mounting_the_disk_image_file">9.6.3. Mounting the disk image file</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_cleaning_a_disk_image_file">9.6.4. Cleaning a disk image file</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_making_the_empty_disk_image_file">9.6.5. Making the empty disk image file</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_making_the_iso9660_image_file">9.6.6. Making the ISO9660 image file</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_writing_directly_to_the_cd_dvd_r_rw">9.6.7. Writing directly to the CD/DVD-R/RW</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_mounting_the_iso9660_image_file">9.6.8. Mounting the ISO9660 image file</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch09.en.html#_the_binary_data">9.7. The binary data</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch09.en.html#_viewing_and_editing_binary_data">9.7.1. Viewing and editing binary data</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_manipulating_files_without_mounting_disk">9.7.2. Manipulating files without mounting disk</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_data_redundancy">9.7.3. Data redundancy</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_data_file_recovery_and_forensic_analysis">9.7.4. Data file recovery and forensic analysis</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_splitting_a_large_file_into_small_files">9.7.5. Splitting a large file into small files</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_clearing_file_contents">9.7.6. Clearing file contents</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_dummy_files">9.7.7. Dummy files</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_erasing_an_entire_hard_disk">9.7.8. Erasing an entire hard disk</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_erasing_unused_area_of_an_hard_disk">9.7.9. Erasing unused area of an hard disk</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_undeleting_deleted_but_still_open_files">9.7.10. Undeleting deleted but still open files</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_searching_all_hardlinks">9.7.11. Searching all hardlinks</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_invisible_disk_space_consumption">9.7.12. Invisible disk space consumption</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch09.en.html#_data_encryption_tips">9.8. Data encryption tips</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch09.en.html#_removable_disk_encryption_with_dm_crypt_luks">9.8.1. Removable disk encryption with dm-crypt/LUKS</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_encrypted_swap_partition_with_dm_crypt">9.8.2. Encrypted swap partition with dm-crypt</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_mounting_encrypted_disk_with_dm_crypt_luks">9.8.3. Mounting encrypted disk with dm-crypt/LUKS</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_automatically_encrypting_files_with_ecryptfs">9.8.4. Automatically encrypting files with eCryptfs</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_automatically_mounting_ecryptfs">9.8.5. Automatically mounting eCryptfs</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch09.en.html#_the_kernel">9.9. The kernel</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch09.en.html#_linux_kernel_2_6_3_x">9.9.1. Linux kernel 2.6/3.x</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_kernel_parameters">9.9.2. Kernel parameters</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_kernel_headers">9.9.3. Kernel headers</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_compiling_the_kernel_and_related_modules">9.9.4. Compiling the kernel and related modules</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_compiling_the_kernel_source_debian_kernel_team_recommendation">9.9.5. Compiling the kernel source: Debian Kernel Team recommendation</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_hardware_drivers_and_firmware">9.9.6. Hardware drivers and firmware</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch09.en.html#_virtualized_system">9.10. Virtualized system</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch09.en.html#_virtualization_tools">9.10.1. Virtualization tools</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_virtualization_work_flow">9.10.2. Virtualization work flow</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_mounting_the_virtual_disk_image_file">9.10.3. Mounting the virtual disk image file</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_chroot_system">9.10.4. Chroot system</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch09.en.html#_multiple_desktop_systems">9.10.5. Multiple desktop systems</a>
</span>
</dt>
</dl>
</dd>
</dl>
</div>
<p>Here, I describe basic tips to configure and manage systems, mostly from the console.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_the_screen_program"/>9.1. The screen program</h2>
</div>
</div>
</div>
<p><span class="citerefentry"><span class="refentrytitle">screen</span>(1)</span> is a very useful tool for people to access remote sites via unreliable or intermittent connections since it supports interrupted network connections.</p>
<div class="table">
<a id="listofprogramstotworkconnections"/>
<p class="title">
<strong>Table 9.1. List of programs to support interrupted network connections</strong>
</p>
<div class="table-contents">
<table summary="List of programs to support interrupted network connections" 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/screen">
<code class="literal">screen</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=screen">V:84, I:284</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/screen.html">992</a>
</td>
<td style="text-align: left">
terminal multiplexer with VT100/ANSI terminal emulation
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_use_scenario_for_screen_1"/>9.1.1. The use scenario for screen(1)</h3>
</div>
</div>
</div>
<p><span class="citerefentry"><span class="refentrytitle">screen</span>(1)</span> not only allows one terminal window to work with multiple processes, but also allows <span class="strong"><strong>remote shell process to survive interrupted connections</strong></span>. Here is a typical use scenario of <span class="citerefentry"><span class="refentrytitle">screen</span>(1)</span>.</p>
<div class="orderedlist">
<ol class="orderedlist">
<li class="listitem">
<p>
You login to a remote machine.
</p>
</li>
<li class="listitem">
<p>
You start <code class="literal">screen</code> on a single console.
</p>
</li>
<li class="listitem">
<p>
You execute multiple programs in <code class="literal">screen</code> windows created with <code class="literal">^A c</code> ("Control-A" followed by "c").
</p>
</li>
<li class="listitem">
<p>
You switch among the multiple <code class="literal">screen</code> windows by <code class="literal">^A n</code> ("Control-A" followed by "n").
</p>
</li>
<li class="listitem">
<p>
Suddenly you need to leave your terminal, but you don't want to lose your active work by keeping the connection.
</p>
</li>
<li class="listitem">
<p>
You may <span class="strong"><strong>detach</strong></span> the <code class="literal">screen</code> session by any methods.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Brutally unplug your network connection
</p>
</li>
<li class="listitem">
<p>
Type <code class="literal">^A d</code> ("Control-A" followed by "d") and manually logging out from the remote connection
</p>
</li>
<li class="listitem">
<p>
Type <code class="literal">^A DD</code> ("Control-A" followed by "DD") to have <code class="literal">screen</code> detach and log you out
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
You log in again to the same remote machine (even from a different terminal).
</p>
</li>
<li class="listitem">
<p>
You start <code class="literal">screen</code> as "<code class="literal">screen -r</code>".
</p>
</li>
<li class="listitem">
<p><code class="literal">screen</code> magically <span class="strong"><strong>reattaches</strong></span> all previous <code class="literal">screen</code> windows with all actively running programs.
</p>
</li>
</ol>
</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>You can save connection fees with <code class="literal">screen</code> for metered network connections such as dial-up and packet ones, because you can leave a process active while disconnected, and then re-attach it later when you connect again.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_key_bindings_for_the_screen_command"/>9.1.2. Key bindings for the screen command</h3>
</div>
</div>
</div>
<p>In a <code class="literal">screen</code> session, all keyboard inputs are sent to your current window except for the command keystroke. All <code class="literal">screen</code> command keystrokes are entered by typing <code class="literal">^A</code> ("Control-A") plus a single key [plus any parameters]. Here are important ones to remember.</p>
<div class="table">
<a id="listofkeybindingsforscreen"/>
<p class="title">
<strong>Table 9.2. List of key bindings for screen</strong>
</p>
<div class="table-contents">
<table summary="List of key bindings for screen" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
key binding
</th>
<th style="text-align: left">
meaning
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<code class="literal">^A ?</code>
</td>
<td style="text-align: left">
show a help screen (display key bindings)
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">^A c</code>
</td>
<td style="text-align: left">
create a new window and switch to it
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">^A n</code>
</td>
<td style="text-align: left">
go to next window
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">^A p</code>
</td>
<td style="text-align: left">
go to previous window
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">^A 0</code>
</td>
<td style="text-align: left">
go to window number 0
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">^A 1</code>
</td>
<td style="text-align: left">
go to window number 1
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">^A w</code>
</td>
<td style="text-align: left">
show a list of windows
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">^A a</code>
</td>
<td style="text-align: left">
send a Ctrl-A to current window as keyboard input
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">^A h</code>
</td>
<td style="text-align: left">
write a hardcopy of current window to file
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">^A H</code>
</td>
<td style="text-align: left">
begin/end logging current window to file
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">^A ^X</code>
</td>
<td style="text-align: left">
lock the terminal (password protected)
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">^A d</code>
</td>
<td style="text-align: left">
detach screen session from the terminal
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">^A DD</code>
</td>
<td style="text-align: left">
detach screen session and log out
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>See <span class="citerefentry"><span class="refentrytitle">screen</span>(1)</span> for details.</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_data_recording_and_presentation"/>9.2. Data recording and presentation</h2>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_log_daemon"/>9.2.1. The log daemon</h3>
</div>
</div>
</div>
<p>Many programs record their activities under the "<code class="literal">/var/log/</code>" directory.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
The kernel log daemon: <span class="citerefentry"><span class="refentrytitle">klogd</span>(8)</span>
</p>
</li>
<li class="listitem">
<p>
The system log daemon: <span class="citerefentry"><span class="refentrytitle">rsyslogd</span>(8)</span>
</p>
</li>
</ul>
</div>
<p>See <a class="xref" href="ch03.en.html#_the_system_message" title="3.2.9. The system message">Section 3.2.9, “The system message”</a> and <a class="xref" href="ch03.en.html#_the_kernel_message" title="3.2.10. The kernel message">Section 3.2.10, “The kernel message”</a>.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_log_analyzer"/>9.2.2. Log analyzer</h3>
</div>
</div>
</div>
<p>Here are notable log analyzers ("<code class="literal">~Gsecurity::log-analyzer</code>" in <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span>).</p>
<div class="table">
<a id="listofsystemloganalyzers"/>
<p class="title">
<strong>Table 9.3. List of system log analyzers</strong>
</p>
<div class="table-contents">
<table summary="List of system log analyzers" 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/logwatch">
<code class="literal">logwatch</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=logwatch">V:21, I:23</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/l/logwatch.html">2132</a>
</td>
<td style="text-align: left">
log analyzer with nice output written in Perl
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/fail2ban">
<code class="literal">fail2ban</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=fail2ban">V:72, I:82</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/f/fail2ban.html">563</a>
</td>
<td style="text-align: left">
ban IPs that cause multiple authentication errors
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/analog">
<code class="literal">analog</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=analog">V:6, I:138</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/a/analog.html">3165</a>
</td>
<td style="text-align: left">
web server log analyzer
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/awstats">
<code class="literal">awstats</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=awstats">V:16, I:24</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/a/awstats.html">3141</a>
</td>
<td style="text-align: left">
powerful and featureful web server log analyzer
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/sarg">
<code class="literal">sarg</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=sarg">V:9, I:10</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/sarg.html">685</a>
</td>
<td style="text-align: left">
squid analysis report generator
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/pflogsumm">
<code class="literal">pflogsumm</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=pflogsumm">V:1, I:4</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/p/pflogsumm.html">133</a>
</td>
<td style="text-align: left">
Postfix log entry summarizer
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/syslog-summary">
<code class="literal">syslog-summary</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=syslog-summary">V:1, I:8</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/syslog-summary.html">84</a>
</td>
<td style="text-align: left">
summarize the contents of a syslog log file
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/lire">
<code class="literal">lire</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=lire">V:0, I:0</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/l/lire.html">3700</a>
</td>
<td style="text-align: left">
full-featured log analyzer and report generator
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/fwlogwatch">
<code class="literal">fwlogwatch</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=fwlogwatch">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/f/fwlogwatch.html">440</a>
</td>
<td style="text-align: left">
firewall log analyzer
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/squidview">
<code class="literal">squidview</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=squidview">V:0, I:3</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/squidview.html">211</a>
</td>
<td style="text-align: left">
monitor and analyze squid access.log files
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/visitors">
<code class="literal">visitors</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=visitors">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/v/visitors.html">293</a>
</td>
<td style="text-align: left">
fast web server log analyzer
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/swatch">
<code class="literal">swatch</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=swatch">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/swatch.html">112</a>
</td>
<td style="text-align: left">
log file viewer with regexp matching, highlighting, and hooks
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/crm114">
<code class="literal">crm114</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=crm114">V:0, I:0</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/c/crm114.html">1074</a>
</td>
<td style="text-align: left">
Controllable Regex Mutilator and Spam Filter (CRM114)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/icmpinfo">
<code class="literal">icmpinfo</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=icmpinfo">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/i/icmpinfo.html">84</a>
</td>
<td style="text-align: left">
interpret ICMP messages
</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><a class="ulink" href="http://crm114.sourceforge.net/">CRM114</a> provides language infrastructure to write <span class="strong"><strong>fuzzy</strong></span> filters with the <a class="ulink" href="http://www.laurikari.net/tre/">TRE regex library</a>. Its popular use is spam mail filter but it can be used as log analyzer.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_recording_the_shell_activities_cleanly"/>9.2.3. Recording the shell activities cleanly</h3>
</div>
</div>
</div>
<p>The simple use of <span class="citerefentry"><span class="refentrytitle">script</span>(1)</span> (see <a class="xref" href="ch01.en.html#_recording_the_shell_activities" title="1.4.9. Recording the shell activities">Section 1.4.9, “Recording the shell activities”</a>) to record shell activity produces a file with control characters. This can be avoided by using <span class="citerefentry"><span class="refentrytitle">col</span>(1)</span> as the following.</p>
<pre class="screen">$ script
Script started, file is typescript</pre>
<p>Do whatever … and press <code class="literal">Ctrl-D</code> to exit <code class="literal">script</code>.</p>
<pre class="screen">$ col -bx <typescript >cleanedfile
$ vim cleanedfile</pre>
<p>If you don't have <code class="literal">script</code> (for example, during the boot process in the initramfs), you can use the following instead.</p>
<pre class="screen">$ sh -i 2>&1 | tee typescript</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>Some <code class="literal">x-terminal-emulator</code> such as <code class="literal">gnome-terminal</code> can record. You may wish to extend line buffer for scrollback.</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>You may use <span class="citerefentry"><span class="refentrytitle">screen</span>(1)</span> with "<code class="literal">^A H</code>" (see <a class="xref" href="ch09.en.html#_key_bindings_for_the_screen_command" title="9.1.2. Key bindings for the screen command">Section 9.1.2, “Key bindings for the screen command”</a>) to perform recording of console.</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>You may use <span class="citerefentry"><span class="refentrytitle">emacs</span>(1)</span> with "<code class="literal">M-x shell</code>", "<code class="literal">M-x eshell</code>", or "<code class="literal">M-x term</code>" to perform recording of console. You may later use "<code class="literal">C-x C-w</code>" to write the buffer to a file.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_customized_display_of_text_data"/>9.2.4. Customized display of text data</h3>
</div>
</div>
</div>
<p>Although pager tools such as <span class="citerefentry"><span class="refentrytitle">more</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">less</span>(1)</span> (see <a class="xref" href="ch01.en.html#_the_pager" title="1.4.5. The pager">Section 1.4.5, “The pager”</a>) and custom tools for highlighting and formatting (see <a class="xref" href="ch11.en.html#_highlighting_and_formatting_plain_text_data" title="11.1.8. Highlighting and formatting plain text data">Section 11.1.8, “Highlighting and formatting plain text data”</a>) can display text data nicely, general purpose editors (see <a class="xref" href="ch01.en.html#_the_text_editor" title="1.4.6. The text editor">Section 1.4.6, “The text editor”</a>) are most versatile and customizable.</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>For <span class="citerefentry"><span class="refentrytitle">vim</span>(1)</span> and its pager mode alias <span class="citerefentry"><span class="refentrytitle">view</span>(1)</span>, "<code class="literal">:set hls</code>" enables highlighted search.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_customized_display_of_time_and_date"/>9.2.5. Customized display of time and date</h3>
</div>
</div>
</div>
<p>The default display format of time and date by the "<code class="literal">ls -l</code>" command depends on the <span class="strong"><strong>locale</strong></span> (see <a class="xref" href="ch01.en.html#_timestamps" title="1.2.6. Timestamps">Section 1.2.6, “Timestamps”</a> for value). The "<code class="literal">$LANG</code>" variable is referred first and it can be overridden by the "<code class="literal">$LC_TIME</code>" variable.</p>
<p>The actual default display format for each locale depends on the version of the standard C library (the <code class="literal">libc6</code> package) used. I.e., different releases of Debian had different defaults.</p>
<p>If you really wish to customize this display format of time and date beyond the <span class="strong"><strong>locale</strong></span>, you should set the <span class="strong"><strong>time style value</strong></span> by the "<code class="literal">--time-style</code>" argument or by the "<code class="literal">$TIME_STYLE</code>" value (see <span class="citerefentry"><span class="refentrytitle">ls</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">date</span>(1)</span>, "<code class="literal">info coreutils 'ls invocation'</code>").</p>
<div class="table">
<a id="displayexamplesocommandforwheezy"/>
<p class="title">
<strong>Table 9.4. Display examples of time and date for the "<code class="literal">ls -l</code>" command for <code class="literal">wheezy</code></strong>
</p>
<div class="table-contents">
<table summary="Display examples of time and date for the "ls -l" command for wheezy" 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">
time style value
</th>
<th style="text-align: left">
locale
</th>
<th style="text-align: left">
display of time and date
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<code class="literal">iso</code>
</td>
<td style="text-align: left">
any
</td>
<td style="text-align: left">
<code class="literal">01-19 00:15</code>
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">long-iso</code>
</td>
<td style="text-align: left">
any
</td>
<td style="text-align: left">
<code class="literal">2009-01-19 00:15</code>
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">full-iso</code>
</td>
<td style="text-align: left">
any
</td>
<td style="text-align: left">
<code class="literal">2009-01-19 00:15:16.000000000 +0900</code>
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">locale</code>
</td>
<td style="text-align: left">
<code class="literal">C</code>
</td>
<td style="text-align: left">
<code class="literal">Jan 19 00:15</code>
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">locale</code>
</td>
<td style="text-align: left">
<code class="literal">en_US.UTF-8</code>
</td>
<td style="text-align: left">
<code class="literal">Jan 19 00:15</code>
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">locale</code>
</td>
<td style="text-align: left">
<code class="literal">es_ES.UTF-8</code>
</td>
<td style="text-align: left">
<code class="literal">ene 19 00:15</code>
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">+%d.%m.%y %H:%M</code>
</td>
<td style="text-align: left">
any
</td>
<td style="text-align: left">
<code class="literal">19.01.09 00:15</code>
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">+%d.%b.%y %H:%M</code>
</td>
<td style="text-align: left"><code class="literal">C</code> or <code class="literal">en_US.UTF-8</code>
</td>
<td style="text-align: left">
<code class="literal">19.Jan.09 00:15</code>
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">+%d.%b.%y %H:%M</code>
</td>
<td style="text-align: left">
<code class="literal">es_ES.UTF-8</code>
</td>
<td style="text-align: left">
<code class="literal">19.ene.09 00:15</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 can eliminate typing long option on commandline using command alias, e.g. "<code class="literal">alias ls='ls --time-style=+%d.%m.%y\ %H:%M'</code>" (see <a class="xref" href="ch01.en.html#_command_alias" title="1.5.9. Command alias">Section 1.5.9, “Command alias”</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><a class="ulink" href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> is followed for these iso-formats.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_colorized_shell_echo"/>9.2.6. Colorized shell echo</h3>
</div>
</div>
</div>
<p>Shell echo to most modern terminals can be colorized using <a class="ulink" href="http://en.wikipedia.org/wiki/ANSI_escape_code">ANSI escape code</a> (see "<code class="literal">/usr/share/doc/xterm/ctlseqs.txt.gz</code>").</p>
<p>For example, try the following</p>
<pre class="screen">$ RED=$(printf "\x1b[31m")
$ NORMAL=$(printf "\x1b[0m")
$ REVERSE=$(printf "\x1b[7m")
$ echo "${RED}RED-TEXT${NORMAL} ${REVERSE}REVERSE-TEXT${NORMAL}"</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_colorized_commands"/>9.2.7. Colorized commands</h3>
</div>
</div>
</div>
<p>Colorized commands are handy for inspecting their output in the interactive environment. I include the following in my "<code class="literal">~/.bashrc</code>".</p>
<pre class="screen">if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=always'
alias ll='ls --color=always -l'
alias la='ls --color=always -A'
alias less='less -R'
alias ls='ls --color=always'
alias grep='grep --color=always'
alias egrep='egrep --color=always'
alias fgrep='fgrep --color=always'
alias zgrep='zgrep --color=always'
else
alias ll='ls -l'
alias la='ls -A'
fi</pre>
<p>The use of alias limits color effects to the interactive command usage. It has advantage over exporting environment variable "<code class="literal">export GREP_OPTIONS='--color=auto'</code>" since color can be seen under pager programs such as <span class="citerefentry"><span class="refentrytitle">less</span>(1)</span>. If you wish to suppress color when piping to other programs, use "<code class="literal">--color=auto</code>" instead in the above example for "<code class="literal">~/.bashrc</code>".</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>You can turn off these colorizing aliases in the interactive environment by invoking shell with "<code class="literal">TERM=dumb bash</code>".</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_recording_the_editor_activities_for_complex_repeats"/>9.2.8. Recording the editor activities for complex repeats</h3>
</div>
</div>
</div>
<p>You can record the editor activities for complex repeats.</p>
<p>For <a class="ulink" href="http://en.wikipedia.org/wiki/Vim_(text_editor)">Vim</a>, as follows.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
"<code class="literal">qa</code>": start recording typed characters into named register "<code class="literal">a</code>".
</p>
</li>
<li class="listitem">
<p>
… editor activities
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">q</code>": end recording typed characters.
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">@a</code>": execute the contents of register "<code class="literal">a</code>".
</p>
</li>
</ul>
</div>
<p>For <a class="ulink" href="http://en.wikipedia.org/wiki/Emacs">Emacs</a>, as follows.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
"<code class="literal">C-x (</code>": start defining a keyboard macro.
</p>
</li>
<li class="listitem">
<p>
… editor activities
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">C-x )</code>": end defining a keyboard macro.
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">C-x e</code>": execute a keyboard macro.
</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_recording_the_graphic_image_of_an_x_application"/>9.2.9. Recording the graphic image of an X application</h3>
</div>
</div>
</div>
<p>There are few ways to record the graphic image of an X application, including an <code class="literal">xterm</code> display.</p>
<div class="table">
<a id="listofgraphicimaanipulationtools"/>
<p class="title">
<strong>Table 9.5. List of graphic image manipulation tools</strong>
</p>
<div class="table-contents">
<table summary="List of graphic image manipulation tools" 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">
command
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/xbase-clients">
<code class="literal">xbase-clients</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=xbase-clients">I:144</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/x/xbase-clients.html">62</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">xwd</span>(1)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/gimp">
<code class="literal">gimp</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=gimp">V:102, I:519</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/g/gimp.html">15644</a>
</td>
<td style="text-align: left">
GUI menu
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/imagemagick">
<code class="literal">imagemagick</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=imagemagick">V:229, I:579</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/i/imagemagick.html">247</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">import</span>(1)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/scrot">
<code class="literal">scrot</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=scrot">V:4, I:25</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/scrot.html">80</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">scrot</span>(1)</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_recording_changes_in_configuration_files"/>9.2.10. Recording changes in configuration files</h3>
</div>
</div>
</div>
<p>There are specialized tools to record changes in configuration files with help of DVCS system.</p>
<div class="table">
<a id="listofpackagestotionhistoryinvcs"/>
<p class="title">
<strong>Table 9.6. List of packages to record configuration history in VCS</strong>
</p>
<div class="table-contents">
<table summary="List of packages to record configuration history in VCS" 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/etckeeper">
<code class="literal">etckeeper</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=etckeeper">V:20, I:24</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/e/etckeeper.html">206</a>
</td>
<td style="text-align: left">
store configuration files and their metadata with <a class="ulink" href="http://en.wikipedia.org/wiki/Git_(software)">Git</a> (default), <a class="ulink" href="http://en.wikipedia.org/wiki/Mercurial_(software)">Mercurial</a>, or <a class="ulink" href="http://en.wikipedia.org/wiki/Bazaar_(software)">Bazaar</a> (new)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/changetrack">
<code class="literal">changetrack</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=changetrack">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/c/changetrack.html">109</a>
</td>
<td style="text-align: left">
store configuration files with <a class="ulink" href="http://en.wikipedia.org/wiki/Revision_Control_System">RCS</a> (old)
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>I recommend to use the <code class="literal">etckeeper</code> package with <span class="citerefentry"><span class="refentrytitle">git</span>(1)</span> which put entire "<code class="literal">/etc</code>" under VCS control. Its installation guide and tutorial are found in "<code class="literal">/usr/share/doc/etckeeper/README.gz</code>".</p>
<p>Essentially, running "<code class="literal">sudo etckeeper init</code>" initializes the git repository for "<code class="literal">/etc</code>" just like the process explained in <a class="xref" href="ch10.en.html#_git_for_recording_configuration_history" title="10.6.5. Git for recording configuration history">Section 10.6.5, “Git for recording configuration history”</a> but with special hook scripts for more thorough setups.</p>
<p>As you change your configuration, you can use <span class="citerefentry"><span class="refentrytitle">git</span>(1)</span> normally to record them. It automatically records changes nicely every time you run package management commands, too.</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>You can browse the change history of "<code class="literal">/etc</code>" by executing "<code class="literal">sudo GIT_DIR=/etc/.git gitk</code>" with clear view for new installed packages, removed packages, and version changes of packages.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_monitoring_controlling_and_starting_program_activities"/>9.3. Monitoring, controlling, and starting program activities</h2>
</div>
</div>
</div>
<p>Program activities can be monitored and controlled using specialized tools.</p>
<div class="table">
<a id="listoftoolsformorogramactivities"/>
<p class="title">
<strong>Table 9.7. List of tools for monitoring and controlling program activities</strong>
</p>
<div class="table-contents">
<table summary="List of tools for monitoring and controlling program activities" 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/coreutils">
<code class="literal">coreutils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=coreutils">V:866, I:999</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/c/coreutils.html">13844</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">nice</span>(1)</span>: run a program with modified scheduling priority
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/bsdutils">
<code class="literal">bsdutils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=bsdutils">V:815, I:999</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/b/bsdutils.html">180</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">renice</span>(1)</span>: modify the scheduling priority of a running process
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/procps">
<code class="literal">procps</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=procps">V:811, I:999</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/p/procps.html">670</a>
</td>
<td style="text-align: left">
"<code class="literal">/proc</code>" filesystem utilities: <span class="citerefentry"><span class="refentrytitle">ps</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">top</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">kill</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">watch</span>(1)</span>, …
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/psmisc">
<code class="literal">psmisc</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=psmisc">V:639, I:966</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/p/psmisc.html">764</a>
</td>
<td style="text-align: left">
"<code class="literal">/proc</code>" filesystem utilities: <span class="citerefentry"><span class="refentrytitle">killall</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">fuser</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">peekfd</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">pstree</span>(1)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/time">
<code class="literal">time</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=time">V:51, I:885</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/t/time.html">108</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">time</span>(1)</span>: run a program to report system resource usages with respect to time
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/sysstat">
<code class="literal">sysstat</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=sysstat">V:76, I:94</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/sysstat.html">983</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">sar</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">iostat</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">mpstat</span>(1)</span>, …: system performance tools for Linux
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/isag">
<code class="literal">isag</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=isag">V:0, I:6</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/i/isag.html">131</a>
</td>
<td style="text-align: left">
Interactive System Activity Grapher for sysstat
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/lsof">
<code class="literal">lsof</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=lsof">V:401, I:931</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/l/lsof.html">420</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">lsof</span>(8)</span>: list files opened by a running process using "<code class="literal">-p</code>" option
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/strace">
<code class="literal">strace</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=strace">V:28, I:191</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/strace.html">990</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">strace</span>(1)</span>: trace system calls and signals
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/ltrace">
<code class="literal">ltrace</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=ltrace">V:2, I:25</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/l/ltrace.html">333</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">ltrace</span>(1)</span>: trace library calls
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/xtrace">
<code class="literal">xtrace</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=xtrace">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/x/xtrace.html">336</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">xtrace</span>(1)</span>: trace communication between X11 client and server
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/powertop">
<code class="literal">powertop</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=powertop">V:6, I:227</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/p/powertop.html">529</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">powertop</span>(1)</span>: information about system power use
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/cron">
<code class="literal">cron</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=cron">V:863, I:998</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/c/cron.html">193</a>
</td>
<td style="text-align: left">
run processes according to a schedule in background from <span class="citerefentry"><span class="refentrytitle">cron</span>(8)</span> daemon
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/anacron">
<code class="literal">anacron</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=anacron">V:450, I:547</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/a/anacron.html">60</a>
</td>
<td style="text-align: left">
cron-like command scheduler for systems that don't run 24 hours a day
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/at">
<code class="literal">at</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=at">V:503, I:887</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/a/at.html">103</a>
</td>
<td style="text-align: left"><span class="citerefentry"><span class="refentrytitle">at</span>(1)</span> or <span class="citerefentry"><span class="refentrytitle">batch</span>(1)</span>: run a job at a specified time or below certain load level
</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 <code class="literal">procps</code> packages provide very basics of monitoring, controlling, and starting program activities. You should learn all of them.</p>
</td>
</tr>
</table>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_timing_a_process"/>9.3.1. Timing a process</h3>
</div>
</div>
</div>
<p>Display time used by the process invoked by the command.</p>
<pre class="screen"># time some_command >/dev/null
real 0m0.035s # time on wall clock (elapsed real time)
user 0m0.000s # time in user mode
sys 0m0.020s # time in kernel mode</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_scheduling_priority"/>9.3.2. The scheduling priority</h3>
</div>
</div>
</div>
<p>A nice value is used to control the scheduling priority for the process.</p>
<div class="table">
<a id="listofnicevalueshedulingpriority"/>
<p class="title">
<strong>Table 9.8. List of nice values for the scheduling priority</strong>
</p>
<div class="table-contents">
<table summary="List of nice values for the scheduling priority" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
nice value
</th>
<th style="text-align: left">
scheduling priority
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
19
</td>
<td style="text-align: left">
lowest priority process (nice)
</td>
</tr>
<tr>
<td style="text-align: left">
0
</td>
<td style="text-align: left">
very high priority process for user
</td>
</tr>
<tr>
<td style="text-align: left">
-20
</td>
<td style="text-align: left">
very high priority process for root (not-nice)
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<pre class="screen"># nice -19 top # very nice
# nice --20 wodim -v -eject speed=2 dev=0,0 disk.img # very fast</pre>
<p>Sometimes an extreme nice value does more harm than good to the system. Use this command carefully.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_ps_command"/>9.3.3. The ps command</h3>
</div>
</div>
</div>
<p>The <span class="citerefentry"><span class="refentrytitle">ps</span>(1)</span> command on a Debian system support both BSD and SystemV features and helps to identify the process activity statically.</p>
<div class="table">
<a id="listofpscommandstyles"/>
<p class="title">
<strong>Table 9.9. List of ps command styles</strong>
</p>
<div class="table-contents">
<table summary="List of ps command styles" 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">
style
</th>
<th style="text-align: left">
typical command
</th>
<th style="text-align: left">
feature
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
BSD
</td>
<td style="text-align: left">
<code class="literal">ps aux</code>
</td>
<td style="text-align: left">
display %CPU %MEM
</td>
</tr>
<tr>
<td style="text-align: left">
System V
</td>
<td style="text-align: left">
<code class="literal">ps -efH</code>
</td>
<td style="text-align: left">
display PPID
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>For the zombie (defunct) children process, you can kill them by the parent process ID identified in the "<code class="literal">PPID</code>" field.</p>
<p>The <span class="citerefentry"><span class="refentrytitle">pstree</span>(1)</span> command display a tree of processes.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_top_command"/>9.3.4. The top command</h3>
</div>
</div>
</div>
<p><span class="citerefentry"><span class="refentrytitle">top</span>(1)</span> on the Debian system has rich features and helps to identify what process is acting funny dynamically.</p>
<p>Its is an interactive full screen program. You can get its usage help press by pressing the "h"-key and terminate it by pressing the "q"-key.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_listing_files_opened_by_a_process"/>9.3.5. Listing files opened by a process</h3>
</div>
</div>
</div>
<p>You can list all files opened by a process with a process ID (PID), e.g. 1, by the following.</p>
<pre class="screen">$ sudo lsof -p 1</pre>
<p>PID=1 is usually the <code class="literal">init</code> program.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_tracing_program_activities"/>9.3.6. Tracing program activities</h3>
</div>
</div>
</div>
<p>You can trace program activity with <span class="citerefentry"><span class="refentrytitle">strace</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">ltrace</span>(1)</span>, or <span class="citerefentry"><span class="refentrytitle">xtrace</span>(1)</span> for system calls and signals, library calls, or communication between X11 client and server.</p>
<p>You can trace system calls of the <code class="literal">ls</code> command as the following.</p>
<pre class="screen">$ sudo strace ls</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_identification_of_processes_using_files_or_sockets"/>9.3.7. Identification of processes using files or sockets</h3>
</div>
</div>
</div>
<p>You can also identify processes using files by <span class="citerefentry"><span class="refentrytitle">fuser</span>(1)</span>, e.g. for "<code class="literal">/var/log/mail.log</code>" by the following.</p>
<pre class="screen">$ sudo fuser -v /var/log/mail.log
USER PID ACCESS COMMAND
/var/log/mail.log: root 2946 F.... rsyslogd</pre>
<p>You see that file "<code class="literal">/var/log/mail.log</code>" is open for writing by the <span class="citerefentry"><span class="refentrytitle">rsyslogd</span>(8)</span> command.</p>
<p>You can also identify processes using sockets by <span class="citerefentry"><span class="refentrytitle">fuser</span>(1)</span>, e.g. for "<code class="literal">smtp/tcp</code>" by the following.</p>
<pre class="screen">$ sudo fuser -v smtp/tcp
USER PID ACCESS COMMAND
smtp/tcp: Debian-exim 3379 F.... exim4</pre>
<p>Now you know your system runs <span class="citerefentry"><span class="refentrytitle">exim4</span>(8)</span> to handle <a class="ulink" href="http://en.wikipedia.org/wiki/Transmission_Control_Protocol">TCP</a> connections to <a class="ulink" href="http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol">SMTP</a> port (25).</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_repeating_a_command_with_a_constant_interval"/>9.3.8. Repeating a command with a constant interval</h3>
</div>
</div>
</div>
<p><span class="citerefentry"><span class="refentrytitle">watch</span>(1)</span> executes a program repeatedly with a constant interval while showing its output in fullscreen.</p>
<pre class="screen">$ watch w</pre>
<p>This displays who is logged on to the system updated every 2 seconds.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_repeating_a_command_looping_over_files"/>9.3.9. Repeating a command looping over files</h3>
</div>
</div>
</div>
<p>There are several ways to repeat a command looping over files matching some condition, e.g. matching glob pattern "<code class="literal">*.ext</code>".</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Shell for-loop method (see <a class="xref" href="ch12.en.html#_shell_loops" title="12.1.4. Shell loops">Section 12.1.4, “Shell loops”</a>):
</p>
</li>
</ul>
</div>
<pre class="screen">for x in *.ext; do if [ -f "$x"]; then command "$x" ; fi; done</pre>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">find</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">xargs</span>(1)</span> combination:
</p>
</li>
</ul>
</div>
<pre class="screen">find . -type f -maxdepth 1 -name '*.ext' -print0 | xargs -0 -n 1 command</pre>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">find</span>(1)</span> with "<code class="literal">-exec</code>" option with a command:
</p>
</li>
</ul>
</div>
<pre class="screen">find . -type f -maxdepth 1 -name '*.ext' -exec command '{}' \;</pre>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">find</span>(1)</span> with "<code class="literal">-exec</code>" option with a short shell script:
</p>
</li>
</ul>
</div>
<pre class="screen">find . -type f -maxdepth 1 -name '*.ext' -exec sh -c "command '{}' && echo 'successful'" \;</pre>
<p>The above examples are written to ensure proper handling of funny file names such as ones containing spaces. 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> for more advance uses of <span class="citerefentry"><span class="refentrytitle">find</span>(1)</span>.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_starting_a_program_from_gui"/>9.3.10. Starting a program from GUI</h3>
</div>
</div>
</div>
<p>For the <a class="ulink" href="http://en.wikipedia.org/wiki/Command-line_interface">command-line interface (CLI)</a>, the first program with the matching name found in the directories specified in the <code class="literal">$PATH</code> environment variable is executed. See <a class="xref" href="ch01.en.html#_the_literal_path_literal_variable" title="1.5.3. The "$PATH" variable">Section 1.5.3, “The "<code class="literal">$PATH</code>" variable”</a>.</p>
<p>For the <a class="ulink" href="http://en.wikipedia.org/wiki/Graphical_user_interface">graphical user interface (GUI)</a> compliant to the <a class="ulink" href="http://en.wikipedia.org/wiki/Freedesktop.org">freedesktop.org</a> standards, the <code class="literal">*.desktop</code> files in the <code class="literal">/usr/share/applications/</code> directory provide necessary attributes for the GUI menu display of each program. See <a class="xref" href="ch07.en.html#_freedesktop_org_menu" title="7.2.2. Freedesktop.org menu">Section 7.2.2, “Freedesktop.org menu”</a>.</p>
<p>For example, the <code class="literal">chromium.desktop</code> file defines attributes for the "Chromium Web Browser" such as "Name" for the program name, "Exec" for the program execution path and arguments, "Icon" for the icon used, etc. (see the <a class="ulink" href="http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html">Desktop Entry Specification</a>) as follows:</p>
<pre class="screen">[Desktop Entry]
Version=1.0
Name=Chromium Web Browser
GenericName=Web Browser
Comment=Access the Internet
Comment[fr]=Explorer le Web
Exec=/usr/bin/chromium %U
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=chromium
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
StartupWMClass=Chromium
StartupNotify=true</pre>
<p>This is an oversimplified description. The <code class="literal">*.desktop</code> files are scanned as follows.</p>
<p>The desktop environment sets <code class="literal">$XDG_DATA_HOME</code> and <code class="literal">$XDG_DATA_DIR</code> environment variables. For example, under the GNOME 3:</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><code class="literal">$XDG_DATA_HOME</code> is unset. (The default value of <code class="literal">$HOME/.local/share</code> is used.)
</p>
</li>
<li class="listitem">
<p><code class="literal">$XDG_DATA_DIRS</code> is set to <code class="literal">/usr/share/gnome:/usr/local/share/:/usr/share/</code>.
</p>
</li>
</ul>
</div>
<p>So the base directories (see <a class="ulink" href="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG Base Directory Specification</a>) and the <code class="literal">applications</code> directories are as follows.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><code class="literal">$HOME/.local/share/</code> → <code class="literal">$HOME/.local/share/applications/</code>
</p>
</li>
<li class="listitem">
<p><code class="literal">/usr/share/gnome/</code> → <code class="literal">/usr/share/gnome/applications/</code>
</p>
</li>
<li class="listitem">
<p><code class="literal">/usr/local/share/</code> → <code class="literal">/usr/local/share/applications/</code>
</p>
</li>
<li class="listitem">
<p><code class="literal">/usr/share/</code> → <code class="literal">/usr/share/applications/</code>
</p>
</li>
</ul>
</div>
<p>The <code class="literal">*.desktop</code> files are scanned in these <code class="literal">applications</code> directories in this order.</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>A user custom GUI menu entry can be created by adding a <code class="literal">*.desktop</code> file in the <code class="literal">$HOME/.local/share/applications/</code> directory.</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>Similarly, if a <code class="literal">*.desktop</code> file is created in the <code class="literal">autostart</code> directory under these base directories, the specified program in the <code class="literal">*.desktop</code> file is executed automatically when the desktop environment is started. See <a class="ulink" href="http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html">Desktop Application Autostart Specification</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>Similarly, if a <code class="literal">*.desktop</code> file is created in the <code class="literal">$HOME/Desktop</code> directory and the Desktop environment is configured to support the desktop icon launcher feature, the specified program in it is executed upon clicking the icon. Please note that the actual name of the <code class="literal">$HOME/Desktop</code> directory is locale dependent. See <span class="citerefentry"><span class="refentrytitle">xdg-user-dirs-update</span>(1)</span>.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_customizing_program_to_be_started"/>9.3.11. Customizing program to be started</h3>
</div>
</div>
</div>
<p>Some programs start another program automatically. Here are check points for customizing this process.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Application configuration menu:
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
GNOME3 desktop: "Settings" → "System" → "Details" → "Default Applications"
</p>
</li>
<li class="listitem">
<p>
KDE desktop: "K" → "Control Center" → "KDE Components" → "Component Chooser"
</p>
</li>
<li class="listitem">
<p>
Iceweasel browser: "Edit" → "Preferences" → "Applications"
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">mc</span>(1)</span>: "<code class="literal">/etc/mc/mc.ext</code>"
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Environment variables such as "<code class="literal">$BROWSER</code>", "<code class="literal">$EDITOR</code>", "<code class="literal">$VISUAL</code>", and "<code class="literal">$PAGER</code>" (see <span class="citerefentry"><span class="refentrytitle">eviron</span>(7)</span>)
</p>
</li>
<li class="listitem">
<p>
The <span class="citerefentry"><span class="refentrytitle">update-alternatives</span>(8)</span> system for programs such as "<code class="literal">editor</code>", "<code class="literal">view</code>", "<code class="literal">x-www-browser</code>", "<code class="literal">gnome-www-browser</code>", and "<code class="literal">www-browser</code>" (see <a class="xref" href="ch01.en.html#_setting_a_default_text_editor" title="1.4.7. Setting a default text editor">Section 1.4.7, “Setting a default text editor”</a>)
</p>
</li>
<li class="listitem">
<p>
the "<code class="literal">~/.mailcap</code>" and "<code class="literal">/etc/mailcap</code>" file contents which associate <a class="ulink" href="http://en.wikipedia.org/wiki/MIME">MIME</a> type with program (see <span class="citerefentry"><span class="refentrytitle">mailcap</span>(5)</span>)
</p>
</li>
<li class="listitem">
<p>
The "<code class="literal">~/.mime.types</code>" and "<code class="literal">/etc/mime.types</code>" file contents which associate file name extension with <a class="ulink" href="http://en.wikipedia.org/wiki/MIME">MIME</a> type (see <span class="citerefentry"><span class="refentrytitle">run-mailcap</span>(1)</span>)
</p>
</li>
</ul>
</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><span class="citerefentry"><span class="refentrytitle">update-mime</span>(8)</span> updates the "<code class="literal">/etc/mailcap</code>" file using "<code class="literal">/etc/mailcap.order</code>" file (see <span class="citerefentry"><span class="refentrytitle">mailcap.order</span>(5)</span>).</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">debianutils</code> package provides <span class="citerefentry"><span class="refentrytitle">sensible-browser</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">sensible-editor</span>(1)</span>, and <span class="citerefentry"><span class="refentrytitle">sensible-pager</span>(1)</span> which make sensible decisions on which editor, pager, and web browser to call, respectively. I recommend you to read these shell scripts.</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>In order to run a console application such as <code class="literal">mutt</code> under X as your preferred application, you should create an X application as following and set "<code class="literal">/usr/local/bin/mutt-term</code>" as your preferred application to be started as described.</p>
</td>
</tr>
</table>
</div>
<pre class="screen"># cat /usr/local/bin/mutt-term <<EOF
#!/bin/sh
gnome-terminal -e "mutt \$@"
EOF
chmod 755 /usr/local/bin/mutt-term</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_killing_a_process"/>9.3.12. Killing a process</h3>
</div>
</div>
</div>
<p>Use <span class="citerefentry"><span class="refentrytitle">kill</span>(1)</span> to kill (or send a signal to) a process by the process ID.</p>
<p>Use <span class="citerefentry"><span class="refentrytitle">killall</span>(1)</span> or <span class="citerefentry"><span class="refentrytitle">pkill</span>(1)</span> to do the same by the process command name and other attributes.</p>
<div class="table">
<a id="listoffrequentlylsforkillcommand"/>
<p class="title">
<strong>Table 9.10. List of frequently used signals for kill command</strong>
</p>
<div class="table-contents">
<table summary="List of frequently used signals for kill command" 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">
signal value
</th>
<th style="text-align: left">
signal name
</th>
<th style="text-align: left">
function
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
1
</td>
<td style="text-align: left">
HUP
</td>
<td style="text-align: left">
restart daemon
</td>
</tr>
<tr>
<td style="text-align: left">
15
</td>
<td style="text-align: left">
TERM
</td>
<td style="text-align: left">
normal kill
</td>
</tr>
<tr>
<td style="text-align: left">
9
</td>
<td style="text-align: left">
KILL
</td>
<td style="text-align: left">
kill hard
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_scheduling_tasks_once"/>9.3.13. Scheduling tasks once</h3>
</div>
</div>
</div>
<p>Run the <span class="citerefentry"><span class="refentrytitle">at</span>(1)</span> command to schedule a one-time job by the following.</p>
<pre class="screen">$ echo 'command -args'| at 3:40 monday</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_scheduling_tasks_regularly"/>9.3.14. Scheduling tasks regularly</h3>
</div>
</div>
</div>
<p>Use <span class="citerefentry"><span class="refentrytitle">cron</span>(8)</span> to schedule tasks regularly. See <span class="citerefentry"><span class="refentrytitle">crontab</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">crontab</span>(5)</span>.</p>
<p>You can schedule to run processes as a normal user, e.g. <code class="literal">foo</code> by creating a <span class="citerefentry"><span class="refentrytitle">crontab</span>(5)</span> file as "<code class="literal">/var/spool/cron/crontabs/foo</code>" with "<code class="literal">crontab -e</code>" command.</p>
<p>Here is an example of a <span class="citerefentry"><span class="refentrytitle">crontab</span>(5)</span> file.</p>
<pre class="screen"># use /bin/sh to run commands, no matter what /etc/passwd says
SHELL=/bin/sh
# mail any output to paul, no matter whose crontab this is
MAILTO=paul
# Min Hour DayOfMonth Month DayOfWeek command (Day... are OR'ed)
# run at 00:05, every day
5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
# run at 14:15 on the first of every month -- output mailed to paul
15 14 1 * * $HOME/bin/monthly
# run at 22:00 on weekdays(1-5), annoy Joe. % for newline, last % for cc:
0 22 * * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?%.%%
23 */2 1 2 * echo "run 23 minutes after 0am, 2am, 4am ..., on Feb 1"
5 4 * * sun echo "run at 04:05 every Sunday"
# run at 03:40 on the first Monday of each month
40 3 1-7 * * [ "$(date +%a)" == "Mon" ] && command -args</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>For the system not running continuously, install the <code class="literal">anacron</code> package to schedule periodic commands at the specified intervals as closely as machine-uptime permits. See <span class="citerefentry"><span class="refentrytitle">anacron</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">anacrontab</span>(5)</span>.</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>For scheduled system maintenance scripts, you can run them periodically from root account by placing such scripts in "<code class="literal">/etc/cron.hourly/</code>", "<code class="literal">/etc/cron.daily/</code>", "<code class="literal">/etc/cron.weekly/</code>", or "<code class="literal">/etc/cron.monthly/</code>". Execution timings of these scripts can be customized by "<code class="literal">/etc/crontab</code>" and "<code class="literal">/etc/anacrontab</code>".</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_alt_sysrq_key"/>9.3.15. Alt-SysRq key</h3>
</div>
</div>
</div>
<p>Insurance against system malfunction is provided by the kernel compile option "Magic SysRq key" (<a class="ulink" href="http://en.wikipedia.org/wiki/Secure_attention_key">SAK</a> key) which is now the default for the Debian kernel. Pressing Alt-SysRq followed by one of the following keys does the magic of rescuing control of the system.</p>
<div class="table">
<a id="listofsakcommandkeys"/>
<p class="title">
<strong>Table 9.11. List of SAK command keys</strong>
</p>
<div class="table-contents">
<table summary="List of SAK command keys" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
key following Alt-SysRq
</th>
<th style="text-align: left">
description of action
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<code class="literal">r</code>
</td>
<td style="text-align: left">
restore the keyboard from <span class="strong"><strong>r</strong></span>aw mode after X crashes
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">0</code>
</td>
<td style="text-align: left">
change the console loglevel to <span class="strong"><strong>0</strong></span> to reduce error messages
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">k</code>
</td>
<td style="text-align: left"><span class="strong"><strong>k</strong></span>ill all processes on the <span class="strong"><strong>current virtual console</strong></span></td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">e</code>
</td>
<td style="text-align: left">
send a SIGT<span class="strong"><strong>E</strong></span>RM to all processes, except for <span class="citerefentry"><span class="refentrytitle">init</span>(8)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">i</code>
</td>
<td style="text-align: left">
send a SIGK<span class="strong"><strong>I</strong></span>LL to all processes, except for <span class="citerefentry"><span class="refentrytitle">init</span>(8)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">s</code>
</td>
<td style="text-align: left"><span class="strong"><strong>s</strong></span>ync all mounted filesystems to avoid data corruption
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">u</code>
</td>
<td style="text-align: left">
remount all mounted filesystems read-only (<span class="strong"><strong>u</strong></span>mount)
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">b</code>
</td>
<td style="text-align: left">
re<span class="strong"><strong>b</strong></span>oot the system without syncing or unmounting
</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>Read the <span class="citerefentry"><span class="refentrytitle">signal</span>(7)</span>, <span class="citerefentry"><span class="refentrytitle">kill</span>(1)</span>, and <span class="citerefentry"><span class="refentrytitle">sync</span>(1)</span> manpages to understand the description above.</p>
</td>
</tr>
</table>
</div>
<p>The combination of "Alt-SysRq s", "Alt-SysRq u", and "Alt-SysRq r" is good for getting out of really bad situations and gaining usable keyboard access without stopping the system.</p>
<p>See "<code class="literal">/usr/share/doc/linux-doc-3.*/Documentation/sysrq.txt.gz</code>".</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>The Alt-SysRq feature may be considered a security risk by allowing users access to root-privileged functions. Placing "<code class="literal">echo 0 >/proc/sys/kernel/sysrq</code>" in "<code class="literal">/etc/rc.local</code>" or "<code class="literal">kernel.sysrq = 0</code>" in "<code class="literal">/etc/sysctl.conf</code>" disables the Alt-SysRq feature.</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>From SSH terminal etc., you can use the Alt-SysRq feature by writing to the "<code class="literal">/proc/sysrq-trigger</code>". For example, "<code class="literal">echo s > /proc/sysrq-trigger; echo u > /proc/sysrq-trigger</code>" from the root shell prompt <span class="strong"><strong>s</strong></span>yncs and <span class="strong"><strong>u</strong></span>mounts all mounted filesystems.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_system_maintenance_tips"/>9.4. System maintenance tips</h2>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_who_is_on_the_system"/>9.4.1. Who is on the system?</h3>
</div>
</div>
</div>
<p>You can check who is on the system by the following.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">who</span>(1)</span> shows who is logged on.
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">w</span>(1)</span> shows who is logged on and what they are doing.
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">last</span>(1)</span> shows listing of last logged in user.
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">lastb</span>(1)</span> shows listing of last bad logged in users.
</p>
</li>
</ul>
</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>"<code class="literal">/var/run/utmp</code>", and "<code class="literal">/var/log/wtmp</code>" hold such user information. See <span class="citerefentry"><span class="refentrytitle">login</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">utmp</span>(5)</span>.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_warning_everyone"/>9.4.2. Warning everyone</h3>
</div>
</div>
</div>
<p>You can send message to everyone who is logged on to the system with <span class="citerefentry"><span class="refentrytitle">wall</span>(1)</span> by the following.</p>
<pre class="screen">$ echo "We are shutting down in 1 hour" | wall</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_hardware_identification"/>9.4.3. Hardware identification</h3>
</div>
</div>
</div>
<p>For the <a class="ulink" href="http://en.wikipedia.org/wiki/Peripheral_Component_Interconnect">PCI</a>-like devices (<a class="ulink" href="http://en.wikipedia.org/wiki/Accelerated_Graphics_Port">AGP</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/PCI_Express">PCI-Express</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/PC_Card#CardBus">CardBus</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/ExpressCard">ExpressCard</a>, etc.), <span class="citerefentry"><span class="refentrytitle">lspci</span>(8)</span> (probably with "<code class="literal">-nn</code>" option) is a good start for the hardware identification.</p>
<p>Alternatively, you can identify the hardware by reading contents of "<code class="literal">/proc/bus/pci/devices</code>" or browsing directory tree under "<code class="literal">/sys/bus/pci</code>" (see <a class="xref" href="ch01.en.html#_procfs_and_sysfs" title="1.2.12. procfs and sysfs">Section 1.2.12, “procfs and sysfs”</a>).</p>
<div class="table">
<a id="listofhardwareidntificationtools"/>
<p class="title">
<strong>Table 9.12. List of hardware identification tools</strong>
</p>
<div class="table-contents">
<table summary="List of hardware identification tools" 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/pciutils">
<code class="literal">pciutils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=pciutils">V:181, I:989</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/p/pciutils.html">1069</a>
</td>
<td style="text-align: left">
Linux PCI Utilities: <span class="citerefentry"><span class="refentrytitle">lspci</span>(8)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/usbutils">
<code class="literal">usbutils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=usbutils">V:217, I:892</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/u/usbutils.html">640</a>
</td>
<td style="text-align: left">
Linux USB utilities: <span class="citerefentry"><span class="refentrytitle">lsusb</span>(8)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/pcmciautils">
<code class="literal">pcmciautils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=pcmciautils">V:64, I:187</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/p/pcmciautils.html">121</a>
</td>
<td style="text-align: left">
PCMCIA utilities for Linux: <span class="citerefentry"><span class="refentrytitle">pccardctl</span>(8)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/scsitools">
<code class="literal">scsitools</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=scsitools">V:1, I:6</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/scsitools.html">302</a>
</td>
<td style="text-align: left">
collection of tools for SCSI hardware management: <span class="citerefentry"><span class="refentrytitle">lsscsi</span>(8)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/procinfo">
<code class="literal">procinfo</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=procinfo">V:1, I:21</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/p/procinfo.html">164</a>
</td>
<td style="text-align: left">
system information obtained from "<code class="literal">/proc</code>": <span class="citerefentry"><span class="refentrytitle">lsdev</span>(8)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/lshw">
<code class="literal">lshw</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=lshw">V:11, I:82</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/l/lshw.html">793</a>
</td>
<td style="text-align: left">
information about hardware configuration: <span class="citerefentry"><span class="refentrytitle">lshw</span>(1)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/discover">
<code class="literal">discover</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=discover">V:49, I:867</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/d/discover.html">122</a>
</td>
<td style="text-align: left">
hardware identification system: <span class="citerefentry"><span class="refentrytitle">discover</span>(8)</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_hardware_configuration"/>9.4.4. Hardware configuration</h3>
</div>
</div>
</div>
<p>Although most of the hardware configuration on modern GUI desktop systems such as GNOME and KDE can be managed through accompanying GUI configuration tools, it is a good idea to know some basics methods to configure them.</p>
<div class="table">
<a id="listofhardwareconfigurationtools"/>
<p class="title">
<strong>Table 9.13. List of hardware configuration tools</strong>
</p>
<div class="table-contents">
<table summary="List of hardware configuration tools" 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/console-setup">
<code class="literal">console-setup</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=console-setup">V:507, I:877</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/c/console-setup.html">467</a>
</td>
<td style="text-align: left">
Linux console font and keytable utilities
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/x11-xserver-utils">
<code class="literal">x11-xserver-utils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=x11-xserver-utils">V:386, I:613</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/x/x11-xserver-utils.html">485</a>
</td>
<td style="text-align: left">
X server utilities: <span class="citerefentry"><span class="refentrytitle">xset</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">xmodmap</span>(1)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/acpid">
<code class="literal">acpid</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=acpid">V:554, I:946</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/a/acpid.html">179</a>
</td>
<td style="text-align: left">
daemon to manage events delivered by the Advanced Configuration and Power Interface (ACPI)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/acpi">
<code class="literal">acpi</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=acpi">V:48, I:865</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/a/acpi.html">71</a>
</td>
<td style="text-align: left">
utility to display information on ACPI devices
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/apmd">
<code class="literal">apmd</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=apmd">V:1, I:32</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/a/apmd.html">94</a>
</td>
<td style="text-align: left">
daemon to manage events delivered by the Advanced Power Management (APM)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/sleepd">
<code class="literal">sleepd</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=sleepd">V:0, I:0</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/sleepd.html">55</a>
</td>
<td style="text-align: left">
daemon to put a laptop to sleep during inactivity
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/hdparm">
<code class="literal">hdparm</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=hdparm">V:403, I:639</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/h/hdparm.html">187</a>
</td>
<td style="text-align: left">
hard disk access optimization (see <a class="xref" href="ch09.en.html#_optimization_of_hard_disk" title="9.5.9. Optimization of hard disk">Section 9.5.9, “Optimization of hard disk”</a>)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/smartmontools">
<code class="literal">smartmontools</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=smartmontools">V:63, I:241</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/smartmontools.html">1683</a>
</td>
<td style="text-align: left">
control and monitor storage systems using <a class="ulink" href="http://en.wikipedia.org/wiki/S.M.A.R.T.">S.M.A.R.T.</a>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/setserial">
<code class="literal">setserial</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=setserial">V:6, I:16</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/setserial.html">141</a>
</td>
<td style="text-align: left">
collection of tools for serial port management
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/memtest86+">
<code class="literal">memtest86+</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=memtest86+">V:3, I:68</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/m/memtest86+.html">2424</a>
</td>
<td style="text-align: left">
collection of tools for memory hardware management
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/scsitools">
<code class="literal">scsitools</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=scsitools">V:1, I:6</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/scsitools.html">302</a>
</td>
<td style="text-align: left">
collection of tools for <a class="ulink" href="http://en.wikipedia.org/wiki/SCSI">SCSI</a> hardware management
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/tpconfig">
<code class="literal">tpconfig</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=tpconfig">V:0, I:5</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/t/tpconfig.html">164</a>
</td>
<td style="text-align: left">
utility to configure touchpad devices
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/setcd">
<code class="literal">setcd</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=setcd">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/setcd.html">28</a>
</td>
<td style="text-align: left">
compact disc drive access optimization
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/big-cursor">
<code class="literal">big-cursor</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=big-cursor">I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/b/big-cursor.html">48</a>
</td>
<td style="text-align: left">
larger mouse cursors for X
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>Here, <a class="ulink" href="http://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface">ACPI</a> is a newer framework for the power management system than <a class="ulink" href="http://en.wikipedia.org/wiki/Advanced_Power_Management">APM</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>CPU frequency scaling on modern system is governed by kernel modules such as <code class="literal">acpi_cpufreq</code>.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_system_and_hardware_time"/>9.4.5. System and hardware time</h3>
</div>
</div>
</div>
<p>The following sets system and hardware time to MM/DD hh:mm, CCYY.</p>
<pre class="screen"># date MMDDhhmmCCYY
# hwclock --utc --systohc
# hwclock --show</pre>
<p>Times are normally displayed in the local time on the Debian system but the hardware and system time usually use <a class="ulink" href="http://en.wikipedia.org/wiki/UTC">UTC(GMT)</a>.</p>
<p>If the hardware (BIOS) time is set to UTC, change the setting to "<code class="literal">UTC=yes</code>" in the "<code class="literal">/etc/default/rcS</code>".</p>
<p>The following reconfigure the timezone used by the Debian system.</p>
<pre class="screen"># dpkg-reconfigure tzdata</pre>
<p>If you wish to update system time via network, consider to use the <a class="ulink" href="http://en.wikipedia.org/wiki/Network_Time_Protocol">NTP</a> service with the packages such as <code class="literal">ntp</code>, <code class="literal">ntpdate</code>, and <code class="literal">chrony</code>.</p>
<p>See the following.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
<a class="ulink" href="http://www.tldp.org/HOWTO/TimePrecision-HOWTO/index.html">Managing Accurate Date and Time HOWTO</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="http://www.ntp.org/">NTP Public Services Project</a>
</p>
</li>
<li class="listitem">
<p>
The <code class="literal">ntp-doc</code> package
</p>
</li>
</ul>
</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><span class="citerefentry"><span class="refentrytitle">ntptrace</span>(8)</span> in the <code class="literal">ntp</code> package can trace a chain of NTP servers back to the primary source.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_terminal_configuration"/>9.4.6. The terminal configuration</h3>
</div>
</div>
</div>
<p>There are several components to configure character console and <span class="citerefentry"><span class="refentrytitle">ncurses</span>(3)</span> system features.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
The "<code class="literal">/etc/terminfo/*/*</code>" file (<span class="citerefentry"><span class="refentrytitle">terminfo</span>(5)</span>)
</p>
</li>
<li class="listitem">
<p>
The "<code class="literal">$TERM</code>" environment variable (<span class="citerefentry"><span class="refentrytitle">term</span>(7)</span>)
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">setterm</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">stty</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">tic</span>(1)</span>, and <span class="citerefentry"><span class="refentrytitle">toe</span>(1)</span>
</p>
</li>
</ul>
</div>
<p>If the <code class="literal">terminfo</code> entry for <code class="literal">xterm</code> doesn't work with a non-Debian <code class="literal">xterm</code>, change your terminal type, "<code class="literal">$TERM</code>", from "<code class="literal">xterm</code>" to one of the feature-limited versions such as "<code class="literal">xterm-r6</code>" when you log in to a Debian system remotely. See "<code class="literal">/usr/share/doc/libncurses5/FAQ</code>" for more. "<code class="literal">dumb</code>" is the lowest common denominator for "<code class="literal">$TERM</code>".</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_sound_infrastructure"/>9.4.7. The sound infrastructure</h3>
</div>
</div>
</div>
<p>Device drivers for sound cards for current Linux are provided by <a class="ulink" href="http://en.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture">Advanced Linux Sound Architecture (ALSA)</a>. ALSA provides emulation mode for previous <a class="ulink" href="http://en.wikipedia.org/wiki/Open_Sound_System">Open Sound System (OSS)</a> for compatibility.</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 "<code class="literal">cat /dev/urandom > /dev/audio</code>" or <span class="citerefentry"><span class="refentrytitle">speaker-test</span>(1)</span> to test speaker (^C to stop).</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>If you can not get sound, your speaker may be connected to a muted output. Modern sound system has many outputs. <span class="citerefentry"><span class="refentrytitle">alsamixer</span>(1)</span> in the <code class="literal">alsa-utils</code> package is useful to configure volume and mute settings.</p>
</td>
</tr>
</table>
</div>
<p>Application softwares may be configured not only to access sound devices directly but also to access them via some standardized sound server system.</p>
<div class="table">
<a id="listofsoundpackages"/>
<p class="title">
<strong>Table 9.14. List of sound packages</strong>
</p>
<div class="table-contents">
<table summary="List of sound 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/alsa-base">
<code class="literal">alsa-base</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=alsa-base">I:548</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/a/alsa-base.html">83</a>
</td>
<td style="text-align: left">
ALSA driver configuration files
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/alsa-utils">
<code class="literal">alsa-utils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=alsa-utils">V:391, I:556</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/a/alsa-utils.html">2042</a>
</td>
<td style="text-align: left">
utilities for configuring and using ALSA
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/oss-compat">
<code class="literal">oss-compat</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=oss-compat">V:18, I:84</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/o/oss-compat.html">7</a>
</td>
<td style="text-align: left">
OSS compatibility under ALSA preventing "<code class="literal">/dev/dsp not found</code>" errors
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/jackd">
<code class="literal">jackd</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=jackd">V:4, I:27</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/j/jackd.html">32</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/JACK_Audio_Connection_Kit">JACK Audio Connection Kit. (JACK)</a> server (low latency)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libjack0">
<code class="literal">libjack0</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libjack0">I:37</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libj/libjack0.html">148</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/JACK_Audio_Connection_Kit">JACK Audio Connection Kit. (JACK)</a> library (low latency)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/nas">
<code class="literal">nas</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=nas">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/n/nas.html">268</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Network_Audio_System">Network Audio System (NAS)</a> server
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libaudio2">
<code class="literal">libaudio2</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libaudio2">I:572</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/liba/libaudio2.html">175</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Network_Audio_System">Network Audio System (NAS)</a> library
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/pulseaudio">
<code class="literal">pulseaudio</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=pulseaudio">V:320, I:435</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/p/pulseaudio.html">4944</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/PulseAudio">PulseAudio</a> server, replacement for ESD
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libpulse0">
<code class="literal">libpulse0</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libpulse0">V:242, I:651</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libp/libpulse0.html">888</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/PulseAudio">PulseAudio</a> client library, replacement for ESD
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libgstreamer0.10-0">
<code class="literal">libgstreamer0.10-0</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libgstreamer0.10-0">V:241, I:597</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libg/libgstreamer0.10-0.html">3991</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/GStreamer">GStreamer</a>: GNOME sound engine
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libphonon4">
<code class="literal">libphonon4</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libphonon4">I:244</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libp/libphonon4.html">609</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Phonon_(KDE)">Phonon</a>: KDE sound engine
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>There is usually a common sound engine for each popular desktop environment. Each sound engine used by the application can choose to connect to different sound servers.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_disabling_the_screen_saver"/>9.4.8. Disabling the screen saver</h3>
</div>
</div>
</div>
<p>For disabling the screen saver, use following commands.</p>
<div class="table">
<a id="listofcommandsfongthescreensaver"/>
<p class="title">
<strong>Table 9.15. List of commands for disabling the screen saver</strong>
</p>
<div class="table-contents">
<table summary="List of commands for disabling the screen saver" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
environment
</th>
<th style="text-align: left">
command
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
The Linux console
</td>
<td style="text-align: left">
<code class="literal">setterm -powersave off</code>
</td>
</tr>
<tr>
<td style="text-align: left">
The X Window (turning off screensaver)
</td>
<td style="text-align: left">
<code class="literal">xset s off</code>
</td>
</tr>
<tr>
<td style="text-align: left">
The X Window (disabling dpms)
</td>
<td style="text-align: left">
<code class="literal">xset -dpms</code>
</td>
</tr>
<tr>
<td style="text-align: left">
The X Window (GUI configuration of screen saver)
</td>
<td style="text-align: left">
<code class="literal">xscreensaver-command -prefs</code>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_disabling_beep_sounds"/>9.4.9. Disabling beep sounds</h3>
</div>
</div>
</div>
<p>One can always unplug the PC speaker to disable beep sounds. Removing <code class="literal">pcspkr</code> kernel module does this for you.</p>
<p>The following prevents the <span class="citerefentry"><span class="refentrytitle">readline</span>(3)</span> program used by <span class="citerefentry"><span class="refentrytitle">bash</span>(1)</span> to beep when encountering an alert character (ASCII=7).</p>
<pre class="screen">$ echo "set bell-style none">> ~/.inputrc</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_memory_usage"/>9.4.10. Memory usage</h3>
</div>
</div>
</div>
<p>There are 2 resources available for you to get the memory usage situation.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
The kernel boot message in the "<code class="literal">/var/log/dmesg</code>" contains the total exact size of available memory.
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">free</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">top</span>(1)</span> display information on memory resources on the running system.
</p>
</li>
</ul>
</div>
<p>Here is an example.</p>
<pre class="screen"># grep '\] Memory' /var/log/dmesg
[ 0.004000] Memory: 990528k/1016784k available (1975k kernel code, 25868k reserved, 931k data, 296k init)
$ free -k
total used free shared buffers cached
Mem: 997184 976928 20256 0 129592 171932
-/+ buffers/cache: 675404 321780
Swap: 4545576 4 4545572</pre>
<p>You may be wondering "dmesg tells me a free of 990 MB, and free -k says 320 MB is free. More than 600 MB missing …".</p>
<p>Do not worry about the large size of "<code class="literal">used</code>" and the small size of "<code class="literal">free</code>" in the "<code class="literal">Mem:</code>" line, but read the one under them (675404 and 321780 in the example above) and relax.</p>
<p>For my MacBook with 1GB=1048576k DRAM (video system steals some of this), I see the following.</p>
<div class="table">
<a id="listofmemorysizesreported"/>
<p class="title">
<strong>Table 9.16. List of memory sizes reported</strong>
</p>
<div class="table-contents">
<table summary="List of memory sizes reported" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
report
</th>
<th style="text-align: left">
size
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
Total size in dmesg
</td>
<td style="text-align: left">
1016784k = 1GB - 31792k
</td>
</tr>
<tr>
<td style="text-align: left">
Free in dmesg
</td>
<td style="text-align: left">
990528k
</td>
</tr>
<tr>
<td style="text-align: left">
Total under shell
</td>
<td style="text-align: left">
997184k
</td>
</tr>
<tr>
<td style="text-align: left">
Free under shell
</td>
<td style="text-align: left">
20256k (but effectively 321780k)
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_system_security_and_integrity_check"/>9.4.11. System security and integrity check</h3>
</div>
</div>
</div>
<p>Poor system maintenance may expose your system to external exploitation.</p>
<p>For system security and integrity check, you should start with the following.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
The <code class="literal">debsums</code> package, see <span class="citerefentry"><span class="refentrytitle">debsums</span>(1)</span> and <a class="xref" href="ch02.en.html#_top_level_release_file_and_authenticity" title="2.5.2. Top level "Release" file and authenticity">Section 2.5.2, “Top level "Release" file and authenticity”</a>.
</p>
</li>
<li class="listitem">
<p>
The <code class="literal">chkrootkit</code> package, see <span class="citerefentry"><span class="refentrytitle">chkrootkit</span>(1)</span>.
</p>
</li>
<li class="listitem">
<p>
The <code class="literal">clamav</code> package family, see <span class="citerefentry"><span class="refentrytitle">clamscan</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">freshclam</span>(1)</span>.
</p>
</li>
<li class="listitem">
<p><a class="ulink" href="http://www.debian.org/security/faq">Debian security FAQ</a>.
</p>
</li>
<li class="listitem">
<p><a class="ulink" href="http://www.debian.org/doc/manuals/securing-debian-howto/">Securing Debian Manual</a>.
</p>
</li>
</ul>
</div>
<div class="table">
<a id="listoftoolsforsyndintegritycheck"/>
<p class="title">
<strong>Table 9.17. List of tools for system security and integrity check</strong>
</p>
<div class="table-contents">
<table summary="List of tools for system security and integrity check" 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/logcheck">
<code class="literal">logcheck</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=logcheck">V:16, I:20</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/l/logcheck.html">218</a>
</td>
<td style="text-align: left">
daemon to mail anomalies in the system logfiles to the administrator
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/debsums">
<code class="literal">debsums</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=debsums">V:14, I:41</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/d/debsums.html">200</a>
</td>
<td style="text-align: left">
utility to verify installed package files against MD5 checksums
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/chkrootkit">
<code class="literal">chkrootkit</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=chkrootkit">V:11, I:39</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/c/chkrootkit.html">976</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Rootkit">rootkit</a> detector
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/clamav">
<code class="literal">clamav</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=clamav">V:20, I:78</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/c/clamav.html">755</a>
</td>
<td style="text-align: left">
anti-virus utility for Unix - command-line interface
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/tiger">
<code class="literal">tiger</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=tiger">V:5, I:7</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/t/tiger.html">2519</a>
</td>
<td style="text-align: left">
report system security vulnerabilities
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/tripwire">
<code class="literal">tripwire</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=tripwire">V:5, I:6</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/t/tripwire.html">10139</a>
</td>
<td style="text-align: left">
file and directory integrity checker
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/john">
<code class="literal">john</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=john">V:4, I:16</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/j/john.html">448</a>
</td>
<td style="text-align: left">
active password cracking tool
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/aide">
<code class="literal">aide</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=aide">V:1, I:2</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/a/aide.html">1499</a>
</td>
<td style="text-align: left">
Advanced Intrusion Detection Environment - static binary
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/integrit">
<code class="literal">integrit</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=integrit">V:0, I:0</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/i/integrit.html">440</a>
</td>
<td style="text-align: left">
file integrity verification program
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/crack">
<code class="literal">crack</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=crack">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/c/crack.html">160</a>
</td>
<td style="text-align: left">
password guessing program
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>Here is a simple script to check for typical world writable incorrect file permissions.</p>
<pre class="screen"># find / -perm 777 -a \! -type s -a \! -type l -a \! \( -type d -a -perm 1777 \)</pre>
<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>Since the <code class="literal">debsums</code> package uses <a class="ulink" href="http://en.wikipedia.org/wiki/MD5">MD5</a> checksums stored locally, it can not be fully trusted as the system security audit tool against malicious attacks.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_data_storage_tips"/>9.5. Data storage tips</h2>
</div>
</div>
</div>
<p>Booting your system with Linux <a class="ulink" href="http://en.wikipedia.org/wiki/Live_CD">live CDs</a> or <a class="ulink" href="http://www.debian.org/releases/stable/debian-installer/">debian-installer CDs</a> in rescue mode makes it easy for you to reconfigure data storage on your boot device.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_disk_space_usage"/>9.5.1. Disk space usage</h3>
</div>
</div>
</div>
<p>The disk space usage can be evaluated by programs provided by the <code class="literal">mount</code>, <code class="literal">coreutils</code>, and <code class="literal">xdu</code> packages:</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> reports all mounted filesystems (= disks).
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">df</span>(1)</span> reports the disk space usage for the file system.
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">du</span>(1)</span> reports the disk space usage for the directory tree.
</p>
</li>
</ul>
</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>You can feed the output of <span class="citerefentry"><span class="refentrytitle">du</span>(8)</span> to <span class="citerefentry"><span class="refentrytitle">xdu</span>(1x)</span> to produce its graphical and interactive presentation with "<code class="literal">du -k . |xdu</code>", "<code class="literal">sudo du -k -x / |xdu</code>", etc.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_disk_partition_configuration"/>9.5.2. Disk partition configuration</h3>
</div>
</div>
</div>
<p>For <a class="ulink" href="http://en.wikipedia.org/wiki/Disk_partitioning">disk partition</a> configuration, although <span class="citerefentry"><span class="refentrytitle">fdisk</span>(8)</span> has been considered standard, <span class="citerefentry"><span class="refentrytitle">parted</span>(8)</span> deserves some attention. "Disk partitioning data", "partition table", "partition map", and "disk label" are all synonyms.</p>
<p>Most PCs use the classic <a class="ulink" href="http://en.wikipedia.org/wiki/Master_boot_record">Master Boot Record (MBR)</a> scheme to hold <a class="ulink" href="http://en.wikipedia.org/wiki/Disk_partitioning">disk partitioning</a> data in the first sector, i.e., <a class="ulink" href="http://en.wikipedia.org/wiki/Logical_block_addressing">LBA</a> sector 0 (512 bytes).</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>Some new PCs with <a class="ulink" href="http://en.wikipedia.org/wiki/Extensible_Firmware_Interface">Extensible Firmware Interface (EFI)</a>, including Intel-based Macs, use <a class="ulink" href="http://en.wikipedia.org/wiki/GUID_Partition_Table">GUID Partition Table (GPT)</a> scheme to hold <a class="ulink" href="http://en.wikipedia.org/wiki/Disk_partitioning">disk partitioning</a> data not in the first sector.</p>
</td>
</tr>
</table>
</div>
<p>Although <span class="citerefentry"><span class="refentrytitle">fdisk</span>(8)</span> has been standard for the disk partitioning tool, <span class="citerefentry"><span class="refentrytitle">parted</span>(8)</span> is replacing it.</p>
<div class="table">
<a id="listofdiskpartitnagementpackages"/>
<p class="title">
<strong>Table 9.18. List of disk partition management packages</strong>
</p>
<div class="table-contents">
<table summary="List of disk partition management packages" 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">
GPT
</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/util-linux">
<code class="literal">util-linux</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=util-linux">V:860, I:999</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/u/util-linux.html">2737</a>
</td>
<td style="text-align: left">
Not supported
</td>
<td style="text-align: left">
miscellaneous system utilities including <span class="citerefentry"><span class="refentrytitle">fdisk</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">cfdisk</span>(8)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/parted">
<code class="literal">parted</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=parted">V:104, I:245</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/p/parted.html">261</a>
</td>
<td style="text-align: left">
Supported
</td>
<td style="text-align: left">
GNU Parted disk partition resizing program
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/gparted">
<code class="literal">gparted</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=gparted">V:28, I:153</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/g/gparted.html">6582</a>
</td>
<td style="text-align: left">
Supported
</td>
<td style="text-align: left">
GNOME partition editor based on <code class="literal">libparted</code>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/gdisk">
<code class="literal">gdisk</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=gdisk">V:7, I:125</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/g/gdisk.html">793</a>
</td>
<td style="text-align: left">
Supported
</td>
<td style="text-align: left">
partition editor for the GPT disk
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/kpartx">
<code class="literal">kpartx</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=kpartx">V:14, I:26</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/k/kpartx.html">106</a>
</td>
<td style="text-align: left">
Supported
</td>
<td style="text-align: left">
program to create device mappings for partitions
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<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>Although <span class="citerefentry"><span class="refentrytitle">parted</span>(8)</span> claims to create and to resize filesystem too, it is safer to do such things using best maintained specialized tools such as <span class="citerefentry"><span class="refentrytitle">mkfs</span>(8)</span> (<span class="citerefentry"><span class="refentrytitle">mkfs.msdos</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">mkfs.ext2</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">mkfs.ext3</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">mkfs.ext4</span>(8)</span>, …) and <span class="citerefentry"><span class="refentrytitle">resize2fs</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>In order to switch between <a class="ulink" href="http://en.wikipedia.org/wiki/GUID_Partition_Table">GPT</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/Master_boot_record">MBR</a>, you need to erase first few blocks of disk contents directly (see <a class="xref" href="ch09.en.html#_clearing_file_contents" title="9.7.6. Clearing file contents">Section 9.7.6, “Clearing file contents”</a>) and use "<code class="literal">parted /dev/sdx mklabel gpt</code>" or "<code class="literal">parted /dev/sdx mklabel msdos</code>" to set it. Please note "<code class="literal">msdos</code>" is use here for <a class="ulink" href="http://en.wikipedia.org/wiki/Master_boot_record">MBR</a>.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_accessing_partition_using_uuid"/>9.5.3. Accessing partition using UUID</h3>
</div>
</div>
</div>
<p>Although reconfiguration of your partition or activation order of removable storage media may yield different names for partitions, you can access them consistently. This is also helpful if you have multiple disks and your BIOS doesn't give them consistent device names.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> with "<code class="literal">-U</code>" option can mount a block device using <a class="ulink" href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier">UUID</a>, instead of using its file name such as "<code class="literal">/dev/sda3</code>".
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">/etc/fstab</code>" (see <span class="citerefentry"><span class="refentrytitle">fstab</span>(5)</span>) can use <a class="ulink" href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier">UUID</a>.
</p>
</li>
<li class="listitem">
<p>
Boot loaders (<a class="xref" href="ch03.en.html#_stage_2_the_boot_loader" title="3.1.2. Stage 2: the boot loader">Section 3.1.2, “Stage 2: the boot loader”</a>) may use <a class="ulink" href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier">UUID</a> too.
</p>
</li>
</ul>
</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>You can probe <a class="ulink" href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier">UUID</a> of a block special device with <span class="citerefentry"><span class="refentrytitle">blkid</span>(8)</span>.</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>Device nodes of devices such as removable storage media can be made static by using <a class="ulink" href="http://www.reactivated.net/writing_udev_rules.html">udev rules</a>, if needed. See <a class="xref" href="ch03.en.html#_the_udev_system" title="3.3. The udev system">Section 3.3, “The udev system”</a>.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_lvm2"/>9.5.4. LVM2</h3>
</div>
</div>
</div>
<p>LVM2 is a <a class="ulink" href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)">logical volume manager</a> for the Linux kernel. With LVM2, disk partitions can be created on logical volumes instead of the physical harddisks.</p>
<p>LVM requires the following.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
device-mapper support in the Linux kernel (default for Debian kernels)
</p>
</li>
<li class="listitem">
<p>
the userspace device-mapper support library (<code class="literal">libdevmapper*</code> package)
</p>
</li>
<li class="listitem">
<p>
the userspace LVM2 tools (<code class="literal">lvm2</code> package)
</p>
</li>
</ul>
</div>
<p>Please start learning LVM2 from the following manpages.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">lvm</span>(8)</span>: Basics of LVM2 mechanism (list of all LVM2 commands)
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">lvm.conf</span>(5)</span>: Configuration file for LVM2
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">lvs</span>(8)</span>: Report information about logical volumes
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">vgs</span>(8)</span>: Report information about volume groups
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">pvs</span>(8)</span>: Report information about physical volumes
</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_filesystem_configuration"/>9.5.5. Filesystem configuration</h3>
</div>
</div>
</div>
<p>For <a class="ulink" href="http://en.wikipedia.org/wiki/Ext4">ext4</a> filesystem, the <code class="literal">e2fsprogs</code> package provides the following.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">mkfs.ext4</span>(8)</span> to create new <a class="ulink" href="http://en.wikipedia.org/wiki/Ext4">ext4</a> filesystem
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">fsck.ext4</span>(8)</span> to check and to repair existing <a class="ulink" href="http://en.wikipedia.org/wiki/Ext4">ext4</a> filesystem
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">tune2fs</span>(8)</span> to configure superblock of <a class="ulink" href="http://en.wikipedia.org/wiki/Ext4">ext4</a> filesystem
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">debugfs</span>(8)</span> to debug <a class="ulink" href="http://en.wikipedia.org/wiki/Ext4">ext4</a> filesystem interactively. (It has <code class="literal">undel</code> command to recover deleted files.)
</p>
</li>
</ul>
</div>
<p>The <span class="citerefentry"><span class="refentrytitle">mkfs</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">fsck</span>(8)</span> commands are provided by the <code class="literal">e2fsprogs</code> package as front-ends to various filesystem dependent programs (<code class="literal">mkfs.fstype</code> and <code class="literal">fsck.fstype</code>). For <a class="ulink" href="http://en.wikipedia.org/wiki/Ext4">ext4</a> filesystem, they are <span class="citerefentry"><span class="refentrytitle">mkfs.ext4</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">fsck.ext4</span>(8)</span> (they are hardlinked to <span class="citerefentry"><span class="refentrytitle">mke2fs</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">e2fsck</span>(8)</span>).</p>
<p>Similar commands are available for each filesystem supported by Linux.</p>
<div class="table">
<a id="listoffilesystemnagementpackages"/>
<p class="title">
<strong>Table 9.19. List of filesystem management packages</strong>
</p>
<div class="table-contents">
<table summary="List of filesystem management 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/e2fsprogs">
<code class="literal">e2fsprogs</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=e2fsprogs">V:566, I:999</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/e/e2fsprogs.html">2957</a>
</td>
<td style="text-align: left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/Ext2">ext2</a>/<a class="ulink" href="http://en.wikipedia.org/wiki/Ext3">ext3</a>/<a class="ulink" href="http://en.wikipedia.org/wiki/Ext4">ext4</a> filesystems
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/reiserfsprogs">
<code class="literal">reiserfsprogs</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=reiserfsprogs">V:5, I:28</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/r/reiserfsprogs.html">1085</a>
</td>
<td style="text-align: left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/Reiserfs">Reiserfs</a> filesystem
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/dosfstools">
<code class="literal">dosfstools</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=dosfstools">V:59, I:592</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/d/dosfstools.html">238</a>
</td>
<td style="text-align: left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/File_Allocation_Table">FAT</a> filesystem. (Microsoft: MS-DOS, Windows)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/xfsprogs">
<code class="literal">xfsprogs</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=xfsprogs">V:19, I:73</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/x/xfsprogs.html">3513</a>
</td>
<td style="text-align: left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/XFS">XFS</a> filesystem. (SGI: IRIX)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/ntfs-3g">
<code class="literal">ntfs-3g</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=ntfs-3g">V:189, I:577</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/n/ntfs-3g.html">1506</a>
</td>
<td style="text-align: left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/NTFS">NTFS</a> filesystem. (Microsoft: Windows NT, …)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/jfsutils">
<code class="literal">jfsutils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=jfsutils">V:2, I:17</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/j/jfsutils.html">1031</a>
</td>
<td style="text-align: left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/JFS_(file_system)">JFS</a> filesystem. (IBM: AIX, OS/2)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/reiser4progs">
<code class="literal">reiser4progs</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=reiser4progs">V:0, I:5</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/r/reiser4progs.html">1254</a>
</td>
<td style="text-align: left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/Reiser4">Reiser4</a> filesystem
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/hfsprogs">
<code class="literal">hfsprogs</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=hfsprogs">V:0, I:9</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/h/hfsprogs.html">274</a>
</td>
<td style="text-align: left">
utilities for <a class="ulink" href="http://en.wikipedia.org/wiki/Hierarchical_File_System">HFS</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/HFS_Plus">HFS Plus</a> filesystem. (Apple: Mac OS)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/btrfs-tools">
<code class="literal">btrfs-tools</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=btrfs-tools">V:16, I:29</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/b/btrfs-tools.html">2854</a>
</td>
<td style="text-align: left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/Btrfs">Btrfs</a> filesystem
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/zerofree">
<code class="literal">zerofree</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=zerofree">V:1, I:16</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/z/zerofree.html">14</a>
</td>
<td style="text-align: left">
program to zero free blocks from ext2/3/4 filesystems
</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><a class="ulink" href="http://en.wikipedia.org/wiki/Ext4">Ext4</a> filesystem is the default filesystem for the Linux system and strongly recommended to use it unless you have some specific reasons not to.</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><a class="ulink" href="http://en.wikipedia.org/wiki/Btrfs">Btrfs</a> filesystem is available in Linux kernel 3.2 (Debian <code class="literal">wheezy</code>). It is expected to be the next default filesystem after the ext4 filesystem.</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>You should not use the Btrfs filesystem for your critical data yet before it acquires the live kernel space <span class="citerefentry"><span class="refentrytitle">fsck</span>(8)</span> feature and the boot loader support.</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>Some tools allow access to filesystem without Linux kernel support (see <a class="xref" href="ch09.en.html#_manipulating_files_without_mounting_disk" title="9.7.2. Manipulating files without mounting disk">Section 9.7.2, “Manipulating files without mounting disk”</a>).</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_filesystem_creation_and_integrity_check"/>9.5.6. Filesystem creation and integrity check</h3>
</div>
</div>
</div>
<p>The <span class="citerefentry"><span class="refentrytitle">mkfs</span>(8)</span> command creates the filesystem on a Linux system. The <span class="citerefentry"><span class="refentrytitle">fsck</span>(8)</span> command provides the filesystem integrity check and repair on a Linux system.</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 not safe to run <code class="literal">fsck</code> on <span class="strong"><strong>mounted filesystems</strong></span>.</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>Check files in "<code class="literal">/var/log/fsck/</code>" for the result of the <span class="citerefentry"><span class="refentrytitle">fsck</span>(8)</span> command run from the boot script.</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>Use "<code class="literal">shutdown -F -r now</code>" to force to run the <span class="citerefentry"><span class="refentrytitle">fsck</span>(8)</span> command safely on all filesystems including root filesystem on reboot. See the <span class="citerefentry"><span class="refentrytitle">shutdown</span>(8)</span> manpage for more.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_optimization_of_filesystem_by_mount_options"/>9.5.7. Optimization of filesystem by mount options</h3>
</div>
</div>
</div>
<p>The basic static filesystem configuration is given by "<code class="literal">/etc/fstab</code>". For example,</p>
<pre class="screen"># <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
UUID=709cbe4c-80c1-56db-8ab1-dbce3146d2f7 / ext4 noatime,errors=remount-ro 0 1
UUID=817bae6b-45d2-5aca-4d2a-1267ab46ac23 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0</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><a class="ulink" href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier">UUID</a> (see <a class="xref" href="ch09.en.html#_accessing_partition_using_uuid" title="9.5.3. Accessing partition using UUID">Section 9.5.3, “Accessing partition using UUID”</a>) may be used to identify a block device instead of normal block device names such as "<code class="literal">/dev/sda1</code>", "<code class="literal">/dev/sda2</code>", …</p>
</td>
</tr>
</table>
</div>
<p>Performance and characteristics of a filesystem can be optimized by mount options used on it (see <span class="citerefentry"><span class="refentrytitle">fstab</span>(5)</span> and <span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span>). Notable ones are the following.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
"<code class="literal">defaults</code>" option implies default options: "<code class="literal">rw,suid,dev,exec,auto,nouser,async</code>". (general)
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">noatime</code>" or "<code class="literal">relatime</code>" option is very effective for speeding up the read access. (general)
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">user</code>" option allows an ordinary user to mount the filesystem. This option implies "<code class="literal">noexec,nosuid,nodev</code>" option combination. (general, used for CDs or usb storage devices)
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">noexec,nodev,nosuid</code>" option combination is used to enhance security. (general)
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">noauto</code>" option limits mounting by explicit operation only. (general)
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">data=journal</code>" option for ext3fs can enhance data integrity against power failure with some loss of write speed.
</p>
</li>
</ul>
</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>You need to provide kernel boot parameter (see <a class="xref" href="ch03.en.html#_stage_2_the_boot_loader" title="3.1.2. Stage 2: the boot loader">Section 3.1.2, “Stage 2: the boot loader”</a>), e.g. "<code class="literal">rootflags=data=journal</code>" to deploy a non-default journaling mode for the root filesystem. For <code class="literal">lenny</code>, the default jounaling mode is "<code class="literal">rootflags=data=ordered</code>". For <code class="literal">squeeze</code>, it is "<code class="literal">rootflags=data=writeback</code>".</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_optimization_of_filesystem_via_superblock"/>9.5.8. Optimization of filesystem via superblock</h3>
</div>
</div>
</div>
<p>Characteristics of a filesystem can be optimized via its superblock using the <span class="citerefentry"><span class="refentrytitle">tune2fs</span>(8)</span> command.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Execution of "<code class="literal">sudo tune2fs -l /dev/hda1</code>" displays the contents of the filesystem superblock on "<code class="literal">/dev/hda1</code>".
</p>
</li>
<li class="listitem">
<p>
Execution of "<code class="literal">sudo tune2fs -c 50 /dev/hda1</code>" changes frequency of filesystem checks (<code class="literal">fsck</code> execution during boot-up) to every 50 boots on "<code class="literal">/dev/hda1</code>".
</p>
</li>
<li class="listitem">
<p>
Execution of "<code class="literal">sudo tune2fs -j /dev/hda1</code>" adds journaling capability to the filesystem, i.e. filesystem conversion from <a class="ulink" href="http://en.wikipedia.org/wiki/Ext2">ext2</a> to <a class="ulink" href="http://en.wikipedia.org/wiki/Ext3">ext3</a> on "<code class="literal">/dev/hda1</code>". (Do this on the unmounted filesystem.)
</p>
</li>
<li class="listitem">
<p>
Execution of "<code class="literal">sudo tune2fs -O extents,uninit_bg,dir_index /dev/hda1 && fsck -pf /dev/hda1</code>" converts it from <a class="ulink" href="http://en.wikipedia.org/wiki/Ext3">ext3</a> to <a class="ulink" href="http://en.wikipedia.org/wiki/Ext4">ext4</a> on "<code class="literal">/dev/hda1</code>". (Do this on the unmounted filesystem.)
</p>
</li>
</ul>
</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>Despite its name, <span class="citerefentry"><span class="refentrytitle">tune2fs</span>(8)</span> works not only on the <a class="ulink" href="http://en.wikipedia.org/wiki/Ext2">ext2</a> filesystem but also on the <a class="ulink" href="http://en.wikipedia.org/wiki/Ext3">ext3</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/Ext4">ext4</a> filesystems.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_optimization_of_hard_disk"/>9.5.9. Optimization of hard disk</h3>
</div>
</div>
</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>Please check your hardware and read manpage of <span class="citerefentry"><span class="refentrytitle">hdparam</span>(8)</span> before playing with hard disk configuration because this may be quite dangerous for the data integrity.</p>
</td>
</tr>
</table>
</div>
<p>You can test disk access speed of a hard disk, e.g. "<code class="literal">/dev/hda</code>", by "<code class="literal">hdparm -tT /dev/hda</code>". For some hard disk connected with (E)IDE, you can speed it up with "<code class="literal">hdparm -q -c3 -d1 -u1 -m16 /dev/hda</code>" by enabling the "(E)IDE 32-bit I/O support", enabling the "using_dma flag", setting "interrupt-unmask flag", and setting the "multiple 16 sector I/O" (dangerous!).</p>
<p>You can test write cache feature of a hard disk, e.g. "<code class="literal">/dev/sda</code>", by "<code class="literal">hdparm -W /dev/sda</code>". You can disable its write cache feature with "<code class="literal">hdparm -W 0 /dev/sda</code>".</p>
<p>You may be able to read badly pressed CDROMs on modern high speed CD-ROM drive by slowing it down with "<code class="literal">setcd -x 2</code>".</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_optimization_of_solid_state_drive"/>9.5.10. Optimization of solid state drive</h3>
</div>
</div>
</div>
<p>Performance and disk wear of the <a class="ulink" href="http://en.wikipedia.org/wiki/Solid-state_drive">solid state drive (SSD)</a> can be optimized as follows.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Use the latest Linux kernel. (>= 3.2)
</p>
</li>
<li class="listitem">
<p>
Reduce disk writes for read disk accesses.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Set "<code class="literal">noatime</code>" or "<code class="literal">relatime</code>" mount option in <code class="literal">/etc/fstab</code>.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Enable the <a class="ulink" href="http://en.wikipedia.org/wiki/TRIM">TRIM</a> command.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Set "<code class="literal">discard</code>" mount option in <code class="literal">/etc/fstab</code> for the ext4 filesystem, swap partition, Btrfs, etc. See <span class="citerefentry"><span class="refentrytitle">fstab</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p>
Set "<code class="literal">discard</code>" option in <code class="literal">/etc/lvm/lvm.conf</code> for <a class="ulink" href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)">LVM</a>. See <span class="citerefentry"><span class="refentrytitle">lvm.conf</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p>
Set "<code class="literal">discard</code>" option in <code class="literal">/etc/crypttab</code> for <a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt">dm-crypt</a>. See <span class="citerefentry"><span class="refentrytitle">crypttab</span>(5)</span>.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Enable the SSD optimized disk space allocation scheme.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Set "<code class="literal">ssd</code>" mount option in <code class="literal">/etc/fstab</code> for the Btrfs.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Make system flush data to the disk every 10 minutes for laptop PCs.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Set "<code class="literal">commit=600</code>" mount option in <code class="literal">/etc/fstab</code>. See <span class="citerefentry"><span class="refentrytitle">fstab</span>(5)</span>.
</p>
</li>
<li class="listitem">
<p>
Set pm-utils to use laptop-mode even under AC operation. See <a class="ulink" href="http://bugs.debian.org/659260">Debian BTS #659260</a>.
</p>
</li>
</ul>
</div>
</li>
</ul>
</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>Changing flushing interval from normal 5 seconds to 10 minutes makes your data vulnerable to the power failure.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_using_smart_to_predict_hard_disk_failure"/>9.5.11. Using SMART to predict hard disk failure</h3>
</div>
</div>
</div>
<p>You can monitor and log your hard disk which is compliant to <a class="ulink" href="http://en.wikipedia.org/wiki/S.M.A.R.T.">SMART</a> with the <span class="citerefentry"><span class="refentrytitle">smartd</span>(8)</span> daemon.</p>
<div class="orderedlist">
<ol class="orderedlist">
<li class="listitem">
<p>
Enable <a class="ulink" href="http://en.wikipedia.org/wiki/S.M.A.R.T.">SMART</a> feature in <a class="ulink" href="http://en.wikipedia.org/wiki/BIOS">BIOS</a>.
</p>
</li>
<li class="listitem">
<p>
Install the <code class="literal">smartmontools</code> package.
</p>
</li>
<li class="listitem">
<p>
Identify your hard disk drives by listing them with <span class="citerefentry"><span class="refentrytitle">df</span>(1)</span>.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Let's assume a hard disk drive to be monitored as "<code class="literal">/dev/hda</code>".
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Check the output of "<code class="literal">smartctl -a /dev/hda</code>" to see if <a class="ulink" href="http://en.wikipedia.org/wiki/S.M.A.R.T.">SMART</a> feature is actually enabled.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
If not, enable it by "<code class="literal">smartctl -s on -a /dev/hda</code>".
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Enable <span class="citerefentry"><span class="refentrytitle">smartd</span>(8)</span> daemon to run by the following.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
uncomment "<code class="literal">start_smartd=yes</code>" in the "<code class="literal">/etc/default/smartmontools</code>" file.
</p>
</li>
<li class="listitem">
<p>
restart the <span class="citerefentry"><span class="refentrytitle">smartd</span>(8)</span> daemon by "<code class="literal">sudo /etc/init.d/smartmontools restart</code>".
</p>
</li>
</ul>
</div>
</li>
</ol>
</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 <span class="citerefentry"><span class="refentrytitle">smartd</span>(8)</span> daemon can be customized with the <code class="literal">/etc/smartd.conf</code> file including how to be notified of warnings.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_specify_temporary_storage_directory_via_tmpdir"/>9.5.12. Specify temporary storage directory via $TMPDIR</h3>
</div>
</div>
</div>
<p>Applications create temporary files normally under the temporary storage directory "<code class="literal">/tmp</code>". If "<code class="literal">/tmp</code>" does not provide enough space, you can specify such temporary storage directory via the <code class="literal">$TMPDIR</code> variable for well-behaving programs.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_expansion_of_usable_storage_space_via_lvm"/>9.5.13. Expansion of usable storage space via LVM</h3>
</div>
</div>
</div>
<p>For partitions created on <a class="ulink" href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)">Logical Volume Manager (LVM)</a> (Linux feature) at install time, they can be resized easily by concatenating extents onto them or truncating extents from them over multiple storage devices without major system reconfiguration.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_expansion_of_usable_storage_space_by_mounting_another_partition"/>9.5.14. Expansion of usable storage space by mounting another partition</h3>
</div>
</div>
</div>
<p>If you have an empty partition (e.g., "<code class="literal">/dev/sdx</code>"), you can format it with <span class="citerefentry"><span class="refentrytitle">mkfs.ext4</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> it to a directory where you need more space. (You need to copy original data contents.)</p>
<pre class="screen">$ sudo mv work-dir old-dir
$ sudo mkfs.ext4 /dev/sdx
$ sudo mount -t ext4 /dev/sdx work-dir
$ sudo cp -a old-dir/* work-dir
$ sudo rm -rf old-dir</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 may alternatively mount an empty disk image file (see <a class="xref" href="ch09.en.html#_making_the_empty_disk_image_file" title="9.6.5. Making the empty disk image file">Section 9.6.5, “Making the empty disk image file”</a>) as a loop device (see <a class="xref" href="ch09.en.html#_mounting_the_disk_image_file" title="9.6.3. Mounting the disk image file">Section 9.6.3, “Mounting the disk image file”</a>). The actual disk usage grows with the actual data stored.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_expansion_of_usable_storage_space_by_bind_mounting_another_directory"/>9.5.15. Expansion of usable storage space by bind-mounting another directory</h3>
</div>
</div>
</div>
<p>If you have an empty directory (e.g., "<code class="literal">/path/to/emp-dir</code>") on another partition with usable space, you can mount(8) it with "<code class="literal">--bind</code>" option to a directory (e.g., "<code class="literal">work-dir</code>") where you need more space.</p>
<pre class="screen">$ sudo mount --bind /path/to/emp-dir work-dir</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_expansion_of_usable_storage_space_using_symlink"/>9.5.16. Expansion of usable storage space using symlink</h3>
</div>
</div>
</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>This is a deprecated method. Use <a class="xref" href="ch09.en.html#_expansion_of_usable_storage_space_by_bind_mounting_another_directory" title="9.5.15. Expansion of usable storage space by bind-mounting another directory">Section 9.5.15, “Expansion of usable storage space by bind-mounting another directory”</a> instead, if possible.</p>
</td>
</tr>
</table>
</div>
<p>If you have an empty directory (e.g., "<code class="literal">/path/to/emp-dir</code>") in another partition with usable space, you can create a symlink to the directory with <span class="citerefentry"><span class="refentrytitle">ln</span>(8)</span>.</p>
<pre class="screen">$ sudo mv work-dir old-dir
$ sudo mkdir -p /path/to/emp-dir
$ sudo ln -sf /path/to/emp-dir work-dir
$ sudo cp -a old-dir/* work-dir
$ sudo rm -rf old-dir</pre>
<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 use "symlink to a directory" for directories managed by the system such as "<code class="literal">/opt</code>". Such a symlink may be overwritten when the system is upgraded.</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>Some software may not function well with "symlink to a directory".</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_expansion_of_usable_storage_space_using_aufs"/>9.5.17. Expansion of usable storage space using aufs</h3>
</div>
</div>
</div>
<p>If you have usable space in another partition (e.g., "<code class="literal">/path/to/</code>"), you can create a directory in it and stack that on to a directory where you need space with <a class="ulink" href="http://en.wikipedia.org/wiki/Aufs">aufs</a>.</p>
<pre class="screen">$ sudo mv work-dir old-dir
$ sudo mkdir work-dir
$ sudo mkdir -p /path/to/emp-dir
$ sudo mount -t aufs -o br:/path/to/emp-dir:old-dir none work-dir</pre>
<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>Use of <a class="ulink" href="http://en.wikipedia.org/wiki/Aufs">aufs</a> for long term data storage is not a good idea since it is under development and its design change may introduce issues.</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><a class="ulink" href="http://en.wikipedia.org/wiki/Aufs">aufs</a> is used to provide writable root filesystem by many modern <a class="ulink" href="http://en.wikipedia.org/wiki/Live_CD">live CD</a> projects.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_the_disk_image"/>9.6. The disk image</h2>
</div>
</div>
</div>
<p>Here, we discuss manipulations of the disk image.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_making_the_disk_image_file"/>9.6.1. Making the disk image file</h3>
</div>
</div>
</div>
<p>The disk image file, "<code class="literal">disk.img</code>", of an unmounted device, e.g., the second SCSI or serial ATA drive "<code class="literal">/dev/sdb</code>", can be made using <span class="citerefentry"><span class="refentrytitle">cp</span>(1)</span> or <span class="citerefentry"><span class="refentrytitle">dd</span>(1)</span> by the following.</p>
<pre class="screen"># cp /dev/sdb disk.img
# dd if=/dev/sdb of=disk.img</pre>
<p>The disk image of the traditional PC's <a class="ulink" href="http://en.wikipedia.org/wiki/Master_boot_record">master boot record (MBR)</a> (see <a class="xref" href="ch09.en.html#_disk_partition_configuration" title="9.5.2. Disk partition configuration">Section 9.5.2, “Disk partition configuration”</a>) which reside on the first sector on the primary IDE disk can be made by using <span class="citerefentry"><span class="refentrytitle">dd</span>(1)</span> by the following.</p>
<pre class="screen"># dd if=/dev/hda of=mbr.img bs=512 count=1
# dd if=/dev/hda of=mbr-nopart.img bs=446 count=1
# dd if=/dev/hda of=mbr-part.img skip=446 bs=1 count=66</pre>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
"<code class="literal">mbr.img</code>": The MBR with the partition table
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">mbr-nopart.img</code>": The MBR without the partition table
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">mbr-part.img</code>": The partition table of the MBR only
</p>
</li>
</ul>
</div>
<p>If you have an SCSI or serial ATA device as the boot disk, substitute "<code class="literal">/dev/hda</code>" with "<code class="literal">/dev/sda</code>".</p>
<p>If you are making an image of a disk partition of the original disk, substitute "<code class="literal">/dev/hda</code>" with "<code class="literal">/dev/hda1</code>" etc.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_writing_directly_to_the_disk"/>9.6.2. Writing directly to the disk</h3>
</div>
</div>
</div>
<p>The disk image file, "<code class="literal">disk.img</code>" can be written to an unmounted device, e.g., the second SCSI drive "<code class="literal">/dev/sdb</code>" with matching size, by the following.</p>
<pre class="screen"># dd if=disk.img of=/dev/sdb</pre>
<p>Similarly, the disk partition image file, "<code class="literal">partition.img</code>" can be written to an unmounted partition, e.g., the first partition of the second SCSI drive "<code class="literal">/dev/sdb1</code>" with matching size, by the following.</p>
<pre class="screen"># dd if=partition.img of=/dev/sdb1</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_mounting_the_disk_image_file"/>9.6.3. Mounting the disk image file</h3>
</div>
</div>
</div>
<p>The disk image "<code class="literal">partition.img</code>" containing a single partition image can be mounted and unmounted by using the <a class="ulink" href="http://en.wikipedia.org/wiki/Loop_device">loop device</a> as follows.</p>
<pre class="screen"># losetup -v -f partition.img
Loop device is /dev/loop0
# mkdir -p /mnt/loop0
# mount -t auto /dev/loop0 /mnt/loop0
...hack...hack...hack
# umount /dev/loop0
# losetup -d /dev/loop0</pre>
<p>This can be simplified as follows.</p>
<pre class="screen"># mkdir -p /mnt/loop0
# mount -t auto -o loop partition.img /mnt/loop0
...hack...hack...hack
# umount partition.img</pre>
<p>Each partition of the disk image "<code class="literal">disk.img</code>" containing multiple partitions can be mounted by using the <a class="ulink" href="http://en.wikipedia.org/wiki/Loop_device">loop device</a>. Since the loop device does not manage partitions by default, we need to reset it as follows.</p>
<pre class="screen"># modinfo -p loop # verify kernel capability
max_part:Maximum number of partitions per loop device
max_loop:Maximum number of loop devices
# losetup -a # verify nothing using the loop device
# rmmod loop
# modprobe loop max_part=16</pre>
<p>Now, the loop device can manage up to 16 partitions.</p>
<pre class="screen"># losetup -v -f disk.img
Loop device is /dev/loop0
# fdisk -l /dev/loop0
Disk /dev/loop0: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x452b6464
Device Boot Start End Blocks Id System
/dev/loop0p1 1 600 4819468+ 83 Linux
/dev/loop0p2 601 652 417690 83 Linux
# mkdir -p /mnt/loop0p1
# mount -t ext4 /dev/loop0p1 /mnt/loop0p1
# mkdir -p /mnt/loop0p2
# mount -t ext4 /dev/loop0p2 /mnt/loop0p2
...hack...hack...hack
# umount /dev/loop0p1
# umount /dev/loop0p2
# losetup -d /dev/loop0</pre>
<p>Alternatively, similar effects can be done by using the <a class="ulink" href="http://en.wikipedia.org/wiki/Device_mapper">device mapper</a> devices created by <span class="citerefentry"><span class="refentrytitle">kpartx</span>(8)</span> from the <code class="literal">kpartx</code> package as follows.</p>
<pre class="screen"># kpartx -a -v disk.img
...
# mkdir -p /mnt/loop0p2
# mount -t ext4 /dev/mapper/loop0p2 /mnt/loop0p2
...
...hack...hack...hack
# umount /dev/mapper/loop0p2
...
# kpartx -d /mnt/loop0</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>You can mount a single partition of such disk image with <a class="ulink" href="http://en.wikipedia.org/wiki/Loop_device">loop device</a> using offset to skip <a class="ulink" href="http://en.wikipedia.org/wiki/Master_boot_record">MBR</a> etc., too. But this is more error prone.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_cleaning_a_disk_image_file"/>9.6.4. Cleaning a disk image file</h3>
</div>
</div>
</div>
<p>A disk image file, "<code class="literal">disk.img</code>" can be cleaned of all removed files into clean sparse image "<code class="literal">new.img</code>" by the following.</p>
<pre class="screen"># mkdir old; mkdir new
# mount -t auto -o loop disk.img old
# dd bs=1 count=0 if=/dev/zero of=new.img seek=5G
# mount -t auto -o loop new.img new
# cd old
# cp -a --sparse=always ./ ../new/
# cd ..
# umount new.img
# umount disk.img</pre>
<p>If "<code class="literal">disk.img</code>" is in ext2, ext3 or ext4, you can also use <span class="citerefentry"><span class="refentrytitle">zerofree</span>(8)</span> from the <code class="literal">zerofree</code> package as follows.</p>
<pre class="screen"># losetup -f -v disk.img
Loop device is /dev/loop3
# zerofree /dev/loop3
# cp --sparse=always disk.img new.img</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_making_the_empty_disk_image_file"/>9.6.5. Making the empty disk image file</h3>
</div>
</div>
</div>
<p>The empty disk image "<code class="literal">disk.img</code>" which can grow up to 5GiB can be made using <span class="citerefentry"><span class="refentrytitle">dd</span>(1)</span> as follows.</p>
<pre class="screen">$ dd bs=1 count=0 if=/dev/zero of=disk.img seek=5G</pre>
<p>You can create an ext4 filesystem on this disk image "<code class="literal">disk.img</code>" using the <a class="ulink" href="http://en.wikipedia.org/wiki/Loop_device">loop device</a> as follows.</p>
<pre class="screen"># losetup -f -v disk.img
Loop device is /dev/loop1
# mkfs.ext4 /dev/loop1
...hack...hack...hack
# losetup -d /dev/loop1
$ du --apparent-size -h disk.img
5.0G disk.img
$ du -h disk.img
83M disk.img</pre>
<p>For "<code class="literal">disk.img</code>", its file size is 5.0 GiB and its actual disk usage is mere 83MiB. This discrepancy is possible since <a class="ulink" href="http://en.wikipedia.org/wiki/Ext4">ext4</a> can hold <a class="ulink" href="http://en.wikipedia.org/wiki/Sparse_file">sparse file</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>The actual disk usage of <a class="ulink" href="http://en.wikipedia.org/wiki/Sparse_file">sparse file</a> grows with data which are written to it.</p>
</td>
</tr>
</table>
</div>
<p>Using similar operation on devices created by the <a class="ulink" href="http://en.wikipedia.org/wiki/Loop_device">loop device</a> or the <a class="ulink" href="http://en.wikipedia.org/wiki/Device_mapper">device mapper</a> devices as <a class="xref" href="ch09.en.html#_mounting_the_disk_image_file" title="9.6.3. Mounting the disk image file">Section 9.6.3, “Mounting the disk image file”</a>, you can partition this disk image "<code class="literal">disk.img</code>" using <span class="citerefentry"><span class="refentrytitle">parted</span>(8)</span> or <span class="citerefentry"><span class="refentrytitle">fdisk</span>(8)</span>, and can create filesystem on it using <span class="citerefentry"><span class="refentrytitle">mkfs.ext4</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">mkswap</span>(8)</span>, etc.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_making_the_iso9660_image_file"/>9.6.6. Making the ISO9660 image file</h3>
</div>
</div>
</div>
<p>The <a class="ulink" href="http://en.wikipedia.org/wiki/ISO_9660">ISO9660</a> image file, "<code class="literal">cd.iso</code>", from the source directory tree at "<code class="literal">source_directory</code>" can be made using <span class="citerefentry"><span class="refentrytitle">genisoimage</span>(1)</span> provided by <a class="ulink" href="http://en.wikipedia.org/wiki/Cdrkit">cdrkit</a> by the following.</p>
<pre class="screen"># genisoimage -r -J -T -V volume_id -o cd.iso source_directory</pre>
<p>Similarly, the bootable ISO9660 image file, "<code class="literal">cdboot.iso</code>", can be made from <code class="literal">debian-installer</code> like directory tree at "<code class="literal">source_directory</code>" by the following.</p>
<pre class="screen"># genisoimage -r -o cdboot.iso -V volume_id \
-b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table source_directory</pre>
<p>Here <a class="ulink" href="http://en.wikipedia.org/wiki/SYSLINUX">Isolinux boot loader</a> (see <a class="xref" href="ch03.en.html#_stage_2_the_boot_loader" title="3.1.2. Stage 2: the boot loader">Section 3.1.2, “Stage 2: the boot loader”</a>) is used for booting.</p>
<p>You can calculate the md5sum value and make the ISO9660 image directly from the CD-ROM device as follows.</p>
<pre class="screen">$ isoinfo -d -i /dev/cdrom
CD-ROM is in ISO 9660 format
...
Logical block size is: 2048
Volume size is: 23150592
...
# dd if=/dev/cdrom bs=2048 count=23150592 conv=notrunc,noerror | md5sum
# dd if=/dev/cdrom bs=2048 count=23150592 conv=notrunc,noerror > cd.iso</pre>
<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>You must carefully avoid ISO9660 filesystem read ahead bug of Linux as above to get the right result.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_writing_directly_to_the_cd_dvd_r_rw"/>9.6.7. Writing directly to the CD/DVD-R/RW</h3>
</div>
</div>
</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>DVD is only a large CD to <span class="citerefentry"><span class="refentrytitle">wodim</span>(1)</span> provided by <a class="ulink" href="http://en.wikipedia.org/wiki/Cdrkit">cdrkit</a>.</p>
</td>
</tr>
</table>
</div>
<p>You can find a usable device by the following.</p>
<pre class="screen"># wodim --devices</pre>
<p>Then the blank CD-R is inserted to the CD drive, and the ISO9660 image file, "<code class="literal">cd.iso</code>" is written to this device, e.g., "<code class="literal">/dev/hda</code>", using <span class="citerefentry"><span class="refentrytitle">wodim</span>(1)</span> by the following.</p>
<pre class="screen"># wodim -v -eject dev=/dev/hda cd.iso</pre>
<p>If CD-RW is used instead of CD-R, do this instead by the following.</p>
<pre class="screen"># wodim -v -eject blank=fast dev=/dev/hda cd.iso</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 your desktop system mounts CDs automatically, unmount it by "<code class="literal">sudo umount /dev/hda</code>" from console before using <span class="citerefentry"><span class="refentrytitle">wodim</span>(1)</span>.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_mounting_the_iso9660_image_file"/>9.6.8. Mounting the ISO9660 image file</h3>
</div>
</div>
</div>
<p>If "<code class="literal">cd.iso</code>" contains an ISO9660 image, then the following manually mounts it to "<code class="literal">/cdrom</code>".</p>
<pre class="screen"># mount -t iso9660 -o ro,loop cd.iso /cdrom</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>Modern desktop system may mount removable media such as ISO9660 formatted CD automatically (see <a class="xref" href="ch10.en.html#_removable_storage_device" title="10.1.7. Removable storage device">Section 10.1.7, “Removable storage device”</a>).</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_the_binary_data"/>9.7. The binary data</h2>
</div>
</div>
</div>
<p>Here, we discuss direct manipulations of the binary data on storage media.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_viewing_and_editing_binary_data"/>9.7.1. Viewing and editing binary data</h3>
</div>
</div>
</div>
<p>The most basic viewing method of binary data is to use "<code class="literal">od -t x1</code>" command.</p>
<div class="table">
<a id="listofpackageswhndeditbinarydata"/>
<p class="title">
<strong>Table 9.20. List of packages which view and edit binary data</strong>
</p>
<div class="table-contents">
<table summary="List of packages which view and edit binary data" 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/coreutils">
<code class="literal">coreutils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=coreutils">V:866, I:999</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/c/coreutils.html">13844</a>
</td>
<td style="text-align: left">
basic package which has <span class="citerefentry"><span class="refentrytitle">od</span>(1)</span> to dump files (HEX, ASCII, OCTAL, …)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/bsdmainutils">
<code class="literal">bsdmainutils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=bsdmainutils">V:846, I:999</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/b/bsdmainutils.html">571</a>
</td>
<td style="text-align: left">
utility package which has <span class="citerefentry"><span class="refentrytitle">hd</span>(1)</span> to dump files (HEX, ASCII, OCTAL, …)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/hexedit">
<code class="literal">hexedit</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=hexedit">V:1, I:13</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/h/hexedit.html">89</a>
</td>
<td style="text-align: left">
binary editor and viewer (HEX, ASCII)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/bless">
<code class="literal">bless</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=bless">V:0, I:4</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/b/bless.html">991</a>
</td>
<td style="text-align: left">
full featured hexadecimal editor (GNOME)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/okteta">
<code class="literal">okteta</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=okteta">V:4, I:35</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/o/okteta.html">303</a>
</td>
<td style="text-align: left">
full featured hexadecimal editor (KDE4)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/ncurses-hexedit">
<code class="literal">ncurses-hexedit</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=ncurses-hexedit">V:0, I:3</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/n/ncurses-hexedit.html">152</a>
</td>
<td style="text-align: left">
binary editor and viewer (HEX, ASCII, EBCDIC)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/beav">
<code class="literal">beav</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=beav">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/b/beav.html">164</a>
</td>
<td style="text-align: left">
binary editor and viewer (HEX, ASCII, EBCDIC, OCTAL, …)
</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>HEX is used as an acronym for <a class="ulink" href="http://en.wikipedia.org/wiki/Hexadecimal">hexadecimal</a> format with <a class="ulink" href="http://en.wikipedia.org/wiki/Radix">radix</a> 16. OCTAL is for <a class="ulink" href="http://en.wikipedia.org/wiki/Octal">octal</a> format with <a class="ulink" href="http://en.wikipedia.org/wiki/Radix">radix</a> 8. ASCII is for <a class="ulink" href="http://en.wikipedia.org/wiki/ASCII">American Standard Code for Information Interchange</a>, i.e., normal English text code. EBCDIC is for <a class="ulink" href="http://en.wikipedia.org/wiki/Extended_Binary_Coded_Decimal_Interchange_Code">Extended Binary Coded Decimal Interchange Code</a> used on <a class="ulink" href="http://en.wikipedia.org/wiki/IBM_mainframe">IBM mainframe</a> operating systems.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_manipulating_files_without_mounting_disk"/>9.7.2. Manipulating files without mounting disk</h3>
</div>
</div>
</div>
<p>There are tools to read and write files without mounting disk.</p>
<div class="table">
<a id="listofpackagestohoutmountingdisk"/>
<p class="title">
<strong>Table 9.21. List of packages to manipulate files without mounting disk</strong>
</p>
<div class="table-contents">
<table summary="List of packages to manipulate files without mounting disk" 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/mtools">
<code class="literal">mtools</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=mtools">V:23, I:202</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/m/mtools.html">292</a>
</td>
<td style="text-align: left">
utilities for MSDOS files without mounting them
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/hfsutils">
<code class="literal">hfsutils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=hfsutils">V:1, I:13</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/h/hfsutils.html">182</a>
</td>
<td style="text-align: left">
utilities for HFS and HFS+ files without mounting them
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_data_redundancy"/>9.7.3. Data redundancy</h3>
</div>
</div>
</div>
<p>Software <a class="ulink" href="http://en.wikipedia.org/wiki/RAID">RAID</a> systems offered by the Linux kernel provide data redundancy in the kernel filesystem level to achieve high levels of storage reliability.</p>
<p>There are tools to add data redundancy to files in application program level to achieve high levels of storage reliability, too.</p>
<div class="table">
<a id="listoftoolstoaddedundancytofiles"/>
<p class="title">
<strong>Table 9.22. List of tools to add data redundancy to files</strong>
</p>
<div class="table-contents">
<table summary="List of tools to add data redundancy to files" 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/par2">
<code class="literal">par2</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=par2">V:4, I:14</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/p/par2.html">218</a>
</td>
<td style="text-align: left">
Parity Archive Volume Set, for checking and repair of files
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/dvdisaster">
<code class="literal">dvdisaster</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=dvdisaster">V:0, I:3</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/d/dvdisaster.html">1481</a>
</td>
<td style="text-align: left">
data loss/scratch/aging protection for CD/DVD media
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/dvbackup">
<code class="literal">dvbackup</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=dvbackup">V:0, I:0</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/d/dvbackup.html">392</a>
</td>
<td style="text-align: left">
backup tool using MiniDV camcorders (providing <span class="citerefentry"><span class="refentrytitle">rsbep</span>(1)</span>)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/vdmfec">
<code class="literal">vdmfec</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=vdmfec">V:0, I:0</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/v/vdmfec.html">88</a>
</td>
<td style="text-align: left">
recover lost blocks using Forward Error Correction
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_data_file_recovery_and_forensic_analysis"/>9.7.4. Data file recovery and forensic analysis</h3>
</div>
</div>
</div>
<p>There are tools for data file recovery and forensic analysis.</p>
<div class="table">
<a id="listofpackagesfoforensicanalysis"/>
<p class="title">
<strong>Table 9.23. List of packages for data file recovery and forensic analysis</strong>
</p>
<div class="table-contents">
<table summary="List of packages for data file recovery and forensic analysis" 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/testdisk">
<code class="literal">testdisk</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=testdisk">V:4, I:39</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/t/testdisk.html">1248</a>
</td>
<td style="text-align: left">
utilities for partition scan and disk recovery
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/magicrescue">
<code class="literal">magicrescue</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=magicrescue">V:0, I:3</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/m/magicrescue.html">344</a>
</td>
<td style="text-align: left">
utility to recover files by looking for magic bytes
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/scalpel">
<code class="literal">scalpel</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=scalpel">V:0, I:3</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/scalpel.html">124</a>
</td>
<td style="text-align: left">
frugal, high performance file carver
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/myrescue">
<code class="literal">myrescue</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=myrescue">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/m/myrescue.html">84</a>
</td>
<td style="text-align: left">
rescue data from damaged harddisks
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/extundelete">
<code class="literal">extundelete</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=extundelete">V:0, I:7</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/e/extundelete.html">153</a>
</td>
<td style="text-align: left">
utility to undelete files on the ext3/4 filesystem
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/ext4magic">
<code class="literal">ext4magic</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=ext4magic">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/e/ext4magic.html">258</a>
</td>
<td style="text-align: left">
utility to undelete files on the ext3/4 filesystem
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/ext3grep">
<code class="literal">ext3grep</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=ext3grep">V:0, I:3</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/e/ext3grep.html">286</a>
</td>
<td style="text-align: left">
tool to help recover deleted files on the ext3 filesystem
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/scrounge-ntfs">
<code class="literal">scrounge-ntfs</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=scrounge-ntfs">V:0, I:3</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/scrounge-ntfs.html">80</a>
</td>
<td style="text-align: left">
data recovery program for NTFS filesystems
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/gzrt">
<code class="literal">gzrt</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=gzrt">V:0, I:0</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/g/gzrt.html">57</a>
</td>
<td style="text-align: left">
gzip recovery toolkit
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/sleuthkit">
<code class="literal">sleuthkit</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=sleuthkit">V:0, I:4</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/sleuthkit.html">1062</a>
</td>
<td style="text-align: left">
tools for forensics analysis. (Sleuthkit)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/autopsy">
<code class="literal">autopsy</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=autopsy">V:0, I:2</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/a/autopsy.html">1372</a>
</td>
<td style="text-align: left">
graphical interface to SleuthKit
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/foremost">
<code class="literal">foremost</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=foremost">V:0, I:7</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/f/foremost.html">123</a>
</td>
<td style="text-align: left">
forensics application to recover data
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/guymager">
<code class="literal">guymager</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=guymager">V:0, I:0</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/g/guymager.html">1045</a>
</td>
<td style="text-align: left">
forensic imaging tool based on Qt
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/dcfldd">
<code class="literal">dcfldd</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=dcfldd">V:0, I:3</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/d/dcfldd.html">121</a>
</td>
<td style="text-align: left">
enhanced version of <code class="literal">dd</code> for forensics and security
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/rdd">
<code class="literal">rdd</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=rdd">V:0, I:0</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/r/rdd.html">200</a>
</td>
<td style="text-align: left">
forensic copy program
</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 can undelete files on the ext2 filesystem using <code class="literal">list_deleted_inodes</code> and <code class="literal">undel</code> commands of <span class="citerefentry"><span class="refentrytitle">debugfs</span>(8)</span> in the <code class="literal">e2fsprogs</code> package.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_splitting_a_large_file_into_small_files"/>9.7.5. Splitting a large file into small files</h3>
</div>
</div>
</div>
<p>When a data is too big to backup as a single file, you can backup its content after splitting it into, e.g. 2000MiB chunks and merge those chunks back into the original file later.</p>
<pre class="screen">$ split -b 2000m large_file
$ cat x* >large_file</pre>
<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>Please make sure you do not have any files starting with "<code class="literal">x</code>" to avoid name crashes.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_clearing_file_contents"/>9.7.6. Clearing file contents</h3>
</div>
</div>
</div>
<p>In order to clear the contents of a file such as a log file, do not use <span class="citerefentry"><span class="refentrytitle">rm</span>(1)</span> to delete the file and then create a new empty file, because the file may still be accessed in the interval between commands. The following is the safe way to clear the contents of the file.</p>
<pre class="screen">$ :>file_to_be_cleared</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_dummy_files"/>9.7.7. Dummy files</h3>
</div>
</div>
</div>
<p>The following commands create dummy or empty files.</p>
<pre class="screen">$ dd if=/dev/zero of=5kb.file bs=1k count=5
$ dd if=/dev/urandom of=7mb.file bs=1M count=7
$ touch zero.file
$ : > alwayszero.file</pre>
<p>You should find following files.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
"<code class="literal">5kb.file</code>" is 5KB of zeros.
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">7mb.file</code>" is 7MB of random data.
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">zero.file</code>" may be a 0 byte file. If it existed, its <code class="literal">mtime</code> is updated while its content and its length are kept.
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">alwayszero.file</code>" is always a 0 byte file. If it existed, its <code class="literal">mtime</code> is updated and its content is reset.
</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_erasing_an_entire_hard_disk"/>9.7.8. Erasing an entire hard disk</h3>
</div>
</div>
</div>
<p>There are several ways to completely erase data from an entire hard disk like device, e.g., USB memory stick at "<code class="literal">/dev/sda</code>".</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>Check your USB memory stick location with <span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> first before executing commands here. The device pointed by "<code class="literal">/dev/sda</code>" may be SCSI hard disk or serial-ATA hard disk where your entire system resides.</p>
</td>
</tr>
</table>
</div>
<p>Erase all the disk content by resetting data to 0 with the following.</p>
<pre class="screen"># dd if=/dev/zero of=/dev/sda</pre>
<p>Erase everything by overwriting with random data as follows.</p>
<pre class="screen"># dd if=/dev/urandom of=/dev/sda</pre>
<p>Erase everything by overwriting with random data very efficiently as follows.</p>
<pre class="screen"># shred -v -n 1 /dev/sda</pre>
<p>Since <span class="citerefentry"><span class="refentrytitle">dd</span>(1)</span> is available from the shell of many bootable Linux CDs such as Debian installer CD, you can erase your installed system completely by running an erase command from such media on the system hard disk, e.g., "<code class="literal">/dev/hda</code>", "<code class="literal">/dev/sda</code>", etc.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_erasing_unused_area_of_an_hard_disk"/>9.7.9. Erasing unused area of an hard disk</h3>
</div>
</div>
</div>
<p>Unused area on an hard disk (or USB memory stick), e.g. "<code class="literal">/dev/sdb1</code>" may still contain erased data themselves since they are only unlinked from the filesystem. These can be cleaned by overwriting them.</p>
<pre class="screen"># mount -t auto /dev/sdb1 /mnt/foo
# cd /mnt/foo
# dd if=/dev/zero of=junk
dd: writing to `junk': No space left on device
...
# sync
# umount /dev/sdb1</pre>
<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>This is usually good enough for your USB memory stick. But this is not perfect. Most parts of erased filenames and their attributes may be hidden and remain in the filesystem.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_undeleting_deleted_but_still_open_files"/>9.7.10. Undeleting deleted but still open files</h3>
</div>
</div>
</div>
<p>Even if you have accidentally deleted a file, as long as that file is still being used by some application (read or write mode), it is possible to recover such a file.</p>
<p>For example, try the following</p>
<pre class="screen">$ echo foo > bar
$ less bar
$ ps aux | grep ' less[ ]'
bozo 4775 0.0 0.0 92200 884 pts/8 S+ 00:18 0:00 less bar
$ rm bar
$ ls -l /proc/4775/fd | grep bar
lr-x------ 1 bozo bozo 64 2008-05-09 00:19 4 -> /home/bozo/bar (deleted)
$ cat /proc/4775/fd/4 >bar
$ ls -l
-rw-r--r-- 1 bozo bozo 4 2008-05-09 00:25 bar
$ cat bar
foo</pre>
<p>Execute on another terminal (when you have the <code class="literal">lsof</code> package installed) as follows.</p>
<pre class="screen">$ ls -li bar
2228329 -rw-r--r-- 1 bozo bozo 4 2008-05-11 11:02 bar
$ lsof |grep bar|grep less
less 4775 bozo 4r REG 8,3 4 2228329 /home/bozo/bar
$ rm bar
$ lsof |grep bar|grep less
less 4775 bozo 4r REG 8,3 4 2228329 /home/bozo/bar (deleted)
$ cat /proc/4775/fd/4 >bar
$ ls -li bar
2228302 -rw-r--r-- 1 bozo bozo 4 2008-05-11 11:05 bar
$ cat bar
foo</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_searching_all_hardlinks"/>9.7.11. Searching all hardlinks</h3>
</div>
</div>
</div>
<p>Files with hardlinks can be identified by "<code class="literal">ls -li</code>".</p>
<pre class="screen">$ ls -li
total 0
2738405 -rw-r--r-- 1 root root 0 2008-09-15 20:21 bar
2738404 -rw-r--r-- 2 root root 0 2008-09-15 20:21 baz
2738404 -rw-r--r-- 2 root root 0 2008-09-15 20:21 foo</pre>
<p>Both "<code class="literal">baz</code>" and "<code class="literal">foo</code>" have link counts of "2" (>1) showing them to have hardlinks. Their <a class="ulink" href="http://en.wikipedia.org/wiki/Inode">inode</a> numbers are common "2738404". This means they are the same hardlinked file. If you do not happen to find all hardlinked files by chance, you can search it by the <a class="ulink" href="http://en.wikipedia.org/wiki/Inode">inode</a>, e.g., "2738404" as the following.</p>
<pre class="screen"># find /path/to/mount/point -xdev -inum 2738404</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_invisible_disk_space_consumption"/>9.7.12. Invisible disk space consumption</h3>
</div>
</div>
</div>
<p>All deleted but open files consume disk space although they are not visible from normal <span class="citerefentry"><span class="refentrytitle">du</span>(1)</span>. They can be listed with their size by the following.</p>
<pre class="screen"># lsof -s -X / |grep deleted</pre>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_data_encryption_tips"/>9.8. Data encryption tips</h2>
</div>
</div>
</div>
<p>With physical access to your PC, anyone can easily gain root privilege and access all the files on your PC (see <a class="xref" href="ch04.en.html#_securing_the_root_password" title="4.7.4. Securing the root password">Section 4.7.4, “Securing the root password”</a>). This means that login password system can not secure your private and sensitive data against possible theft of your PC. You must deploy data encryption technology to do it. Although <a class="ulink" href="http://en.wikipedia.org/wiki/GNU_Privacy_Guard">GNU privacy guard</a> (see <a class="xref" href="ch10.en.html#_data_security_infrastructure" title="10.3. Data security infrastructure">Section 10.3, “Data security infrastructure”</a>) can encrypt files, it takes some user efforts.</p>
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt">dm-crypt</a> and <a class="ulink" href="http://ecryptfs.sourceforge.net/">eCryptfs</a> facilitates automatic data encryption natively via Linux kernel modules with minimal user efforts.</p>
<div class="table">
<a id="listofdataencryptionutilities"/>
<p class="title">
<strong>Table 9.24. List of data encryption utilities</strong>
</p>
<div class="table-contents">
<table summary="List of data encryption utilities" 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/cryptsetup">
<code class="literal">cryptsetup</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=cryptsetup">V:34, I:61</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/c/cryptsetup.html">365</a>
</td>
<td style="text-align: left">
utilities for encrypted block device (<a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt">dm-crypt</a> / <a class="ulink" href="http://en.wikipedia.org/wiki/Linux_Unified_Key_Setup">LUKS</a>)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/cryptmount">
<code class="literal">cryptmount</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=cryptmount">V:2, I:4</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/c/cryptmount.html">228</a>
</td>
<td style="text-align: left">
utilities for encrypted block device (<a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt">dm-crypt</a> / <a class="ulink" href="http://en.wikipedia.org/wiki/Linux_Unified_Key_Setup">LUKS</a>) with focus on mount/unmount by normal users
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/ecryptfs-utils">
<code class="literal">ecryptfs-utils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=ecryptfs-utils">V:5, I:7</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/e/ecryptfs-utils.html">333</a>
</td>
<td style="text-align: left">
utilities for encrypted stacked filesystem (<a class="ulink" href="http://ecryptfs.sourceforge.net/">eCryptfs</a>)
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt">Dm-crypt</a> is a cryptographic filesystem using <a class="ulink" href="http://en.wikipedia.org/wiki/Device_mapper">device-mapper</a>. <a class="ulink" href="http://en.wikipedia.org/wiki/Device_mapper">Device-mapper</a> maps one block device to another.</p>
<p><a class="ulink" href="http://ecryptfs.sourceforge.net/">eCryptfs</a> is another cryptographic filesystem using stacked filesystem. Stacked filesystem stacks itself on top of an existing directory of a mounted filesystem.</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>Data encryption costs CPU time etc. Please weigh its benefits and costs.</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>Entire Debian system can be installed on a encrypted disk by the <a class="ulink" href="http://en.wikipedia.org/wiki/Debian-Installer">debian-installer</a> (lenny or newer) using <a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt">dm-crypt</a>/<a class="ulink" href="http://en.wikipedia.org/wiki/Linux_Unified_Key_Setup">LUKS</a> and initramfs.</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>See <a class="xref" href="ch10.en.html#_data_security_infrastructure" title="10.3. Data security infrastructure">Section 10.3, “Data security infrastructure”</a> for user space encryption utility: <a class="ulink" href="http://en.wikipedia.org/wiki/GNU_Privacy_Guard">GNU Privacy Guard</a>.</p>
</td>
</tr>
</table>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_removable_disk_encryption_with_dm_crypt_luks"/>9.8.1. Removable disk encryption with dm-crypt/LUKS</h3>
</div>
</div>
</div>
<p>You can encrypt contents of removable mass devices, e.g. USB memory stick on "<code class="literal">/dev/sdx</code>", using <a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt">dm-crypt</a>/<a class="ulink" href="http://en.wikipedia.org/wiki/Linux_Unified_Key_Setup">LUKS</a>. You simply format it as the following.</p>
<pre class="screen"># badblocks -c 1024 -s -w -t random -v /dev/sdx
# fdisk /dev/sdx
... "n" "p" "1" "return" "return" "w"
# cryptsetup luksFormat /dev/sdx1
...
# cryptsetup open --type luks /dev/sdx1 sdx1
...
# ls -l /dev/mapper/
total 0
crw-rw---- 1 root root 10, 60 2008-10-04 18:44 control
brw-rw---- 1 root disk 254, 0 2008-10-04 23:55 sdx1
# mkfs.vfat /dev/mapper/sdx1
...
# cryptsetup luksClose sdx1</pre>
<p>Then, it can be mounted just like normal one on to "<code class="literal">/media/<disk_label></code>", except for asking password (see <a class="xref" href="ch10.en.html#_removable_storage_device" title="10.1.7. Removable storage device">Section 10.1.7, “Removable storage device”</a>) under modern desktop environment, such as GNOME using <span class="citerefentry"><span class="refentrytitle">gnome-mount</span>(1)</span>. The difference is that every data written to it is encrypted. You may alternatively format media in different filesystem, e.g., ext4 with "<code class="literal">mkfs.ext4 /dev/mapper/sdx1</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>If you are really paranoid for the security of data, you may need to overwrite multiple times (the "<code class="literal">badblocks</code>" command in the above example). This operation is very time consuming though.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_encrypted_swap_partition_with_dm_crypt"/>9.8.2. Encrypted swap partition with dm-crypt</h3>
</div>
</div>
</div>
<p>Let's assume that your original "<code class="literal">/etc/fstab</code>" contains the following.</p>
<pre class="screen">/dev/sda7 swap sw 0 0</pre>
<p>You can enable encrypted swap partition using <a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt">dm-crypt</a> by as the following.</p>
<pre class="screen"># aptitude install cryptsetup
# swapoff -a
# echo "cswap /dev/sda7 /dev/urandom swap" >> /etc/crypttab
# perl -i -p -e "s/\/dev\/sda7/\/dev\/mapper\/cswap/" /etc/fstab
# /etc/init.d/cryptdisks restart
...
# swapon -a</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_mounting_encrypted_disk_with_dm_crypt_luks"/>9.8.3. Mounting encrypted disk with dm-crypt/LUKS</h3>
</div>
</div>
</div>
<p>An encrypted disk partition created with dm-crypt/LUKS on "<code class="literal">/dev/sdc5</code>" can be mounted onto "<code class="literal">/mnt</code>" as follows:</p>
<pre class="screen">$ sudo cryptsetup open /dev/sdc5 ninja --type luks
Enter passphrase for /dev/sdc5: ****
$ sudo lvm
lvm> lvscan
inactive '/dev/ninja-vg/root' [13.52 GiB] inherit
inactive '/dev/ninja-vg/swap_1' [640.00 MiB] inherit
ACTIVE '/dev/goofy/root' [180.00 GiB] inherit
ACTIVE '/dev/goofy/swap' [9.70 GiB] inherit
lvm> lvchange -a y /dev/ninja-vg/root
lvm> exit
Exiting.
$ sudo mount /dev/ninja-vg/root /mnt</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_automatically_encrypting_files_with_ecryptfs"/>9.8.4. Automatically encrypting files with eCryptfs</h3>
</div>
</div>
</div>
<p>You can encrypt files written under "<code class="literal">~/Private/</code>" automatically using <a class="ulink" href="http://ecryptfs.sourceforge.net/">eCryptfs</a> and the <code class="literal">ecryptfs-utils</code> package.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Run <span class="citerefentry"><span class="refentrytitle">ecryptfs-setup-private</span>(1)</span> and set up "<code class="literal">~/Private/</code>" by following prompts.
</p>
</li>
<li class="listitem">
<p>
Activate "<code class="literal">~/Private/</code>" by running <span class="citerefentry"><span class="refentrytitle">ecryptfs-mount-private</span>(1)</span>.
</p>
</li>
<li class="listitem">
<p>
Move sensitive data files to "<code class="literal">~/Private/</code>" and make symlinks as needed.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Candidates: "<code class="literal">~/.fetchmailrc</code>", "<code class="literal">~/.ssh/identity</code>", "<code class="literal">~/.ssh/id_rsa</code>", "<code class="literal">~/.ssh/id_dsa</code>" and other files with "<code class="literal">go-rwx</code>"
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Move sensitive data directories to a subdirectory in "<code class="literal">~/Private/</code>" and make symlinks as needed.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Candidates: "<code class="literal">~/.gnupg</code>" and other directories with "<code class="literal">go-rwx</code>"
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Create symlink from "<code class="literal">~/Desktop/Private/</code>" to "<code class="literal">~/Private/</code>" for easier desktop operations.
</p>
</li>
<li class="listitem">
<p>
Deactivate "<code class="literal">~/Private/</code>" by running <span class="citerefentry"><span class="refentrytitle">ecryptfs-umount-private</span>(1)</span>.
</p>
</li>
<li class="listitem">
<p>
Activate "<code class="literal">~/Private/</code>" by issuing "<code class="literal">ecryptfs-mount-private</code>" as you need encrypted data.
</p>
</li>
</ul>
</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>Since <a class="ulink" href="http://ecryptfs.sourceforge.net/">eCryptfs</a> selectively encrypt only the sensitive files, its system cost is much less than using <a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt">dm-crypt</a> on the entire root or "<code class="literal">/home</code>" device. It does not require any special on-disk storage allocation effort but cannot keep all filesystem metadata confidential.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_automatically_mounting_ecryptfs"/>9.8.5. Automatically mounting eCryptfs</h3>
</div>
</div>
</div>
<p>If you use your login password for wrapping encryption keys, you can automate mounting eCryptfs via
<a class="ulink" href="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules">PAM (Pluggable Authentication Modules)</a>.</p>
<p>Insert the following line just before "<code class="literal">pam_permit.so</code>" in "<code class="literal">/etc/pam.d/common-auth</code>".</p>
<pre class="screen">auth required pam_ecryptfs.so unwrap</pre>
<p>Insert the following line just at the last line in "<code class="literal">/etc/pam.d/common-session</code>".</p>
<pre class="screen">session optional pam_ecryptfs.so unwrap</pre>
<p>Insert the following line at first active line in "<code class="literal">/etc/pam.d/common-password</code>".</p>
<pre class="screen">password required pam_ecryptfs.so</pre>
<p>This is quite convenient.</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>Configuration errors of <a class="ulink" href="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules">PAM</a> may lock you out of your own system. See <a class="xref" href="ch04.en.html" title="Chapter 4. Authentication">Chapter 4, <em>Authentication</em></a>.</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>If you use your login password for wrapping encryption keys, your encrypted data are as secure as your user login password (see <a class="xref" href="ch04.en.html#_good_password" title="4.3. Good password">Section 4.3, “Good password”</a>). Unless you are careful to set up a <a class="ulink" href="http://en.wikipedia.org/wiki/Password_strength">strong password</a>, your data is at risk when someone runs <a class="ulink" href="http://en.wikipedia.org/wiki/Password_cracking">password cracking</a> software after stealing your laptop (see <a class="xref" href="ch04.en.html#_securing_the_root_password" title="4.7.4. Securing the root password">Section 4.7.4, “Securing the root password”</a>).</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_the_kernel"/>9.9. The kernel</h2>
</div>
</div>
</div>
<p>Debian distributes modularized <a class="ulink" href="http://en.wikipedia.org/wiki/Linux_kernel">Linux kernel</a> as packages for supported architectures.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_linux_kernel_2_6_3_x"/>9.9.1. Linux kernel 2.6/3.x</h3>
</div>
</div>
</div>
<p>There are few notable features on Linux kernel 2.6/3.x compared to 2.4.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Devices are created by the udev system (see <a class="xref" href="ch03.en.html#_the_udev_system" title="3.3. The udev system">Section 3.3, “The udev system”</a>).
</p>
</li>
<li class="listitem">
<p>
Read/write accesses to IDE CD/DVD devices do not use the <code class="literal">ide-scsi</code> module.
</p>
</li>
<li class="listitem">
<p>
Network packet filtering functions use <code class="literal">iptables</code> kernel modules.
</p>
</li>
</ul>
</div>
<p>The version bump from Linux 2.6.39 to Linux 3.0 is not about major technological changes but about the 20th anniversary.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_kernel_parameters"/>9.9.2. Kernel parameters</h3>
</div>
</div>
</div>
<p>Many Linux features are configurable via kernel parameters as follows.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Kernel parameters initialized by the bootloader (see <a class="xref" href="ch03.en.html#_stage_2_the_boot_loader" title="3.1.2. Stage 2: the boot loader">Section 3.1.2, “Stage 2: the boot loader”</a>)
</p>
</li>
<li class="listitem">
<p>
Kernel parameters changed by <span class="citerefentry"><span class="refentrytitle">sysctl</span>(8)</span> at runtime for ones accessible via sysfs (see <a class="xref" href="ch01.en.html#_procfs_and_sysfs" title="1.2.12. procfs and sysfs">Section 1.2.12, “procfs and sysfs”</a>)
</p>
</li>
<li class="listitem">
<p>
Module parameters set by arguments of <span class="citerefentry"><span class="refentrytitle">modprobe</span>(8)</span> when a module is activated (see <a class="xref" href="ch09.en.html#_mounting_the_disk_image_file" title="9.6.3. Mounting the disk image file">Section 9.6.3, “Mounting the disk image file”</a>)
</p>
</li>
</ul>
</div>
<p>See "<code class="literal">kernel-parameters.txt(.gz)</code>" and other related documents in the Linux kernel documentation ("<code class="literal">/usr/share/doc/linux-doc-3.*/Documentation/filesystems/*</code>") provided by the <code class="literal">linux-doc-3.*</code> package.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_kernel_headers"/>9.9.3. Kernel headers</h3>
</div>
</div>
</div>
<p>Most <span class="strong"><strong>normal programs</strong></span> don't need kernel headers and in fact may break if you use them directly for compiling. They should be compiled against the headers in "<code class="literal">/usr/include/linux</code>" and "<code class="literal">/usr/include/asm</code>" provided by the <code class="literal">libc6-dev</code> package (created from the <code class="literal">glibc</code> source package) on the Debian system.</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 compiling some kernel-specific programs such as the kernel modules from the external source and the automounter daemon (<code class="literal">amd</code>), you must include path to the corresponding kernel headers, e.g. "<code class="literal">-I/usr/src/linux-particular-version/include/</code>", to your command line. <span class="citerefentry"><span class="refentrytitle">module-assistant</span>(8)</span> (or its short form <code class="literal">m-a</code>) helps users to build and install module package(s) easily for one or more custom kernels.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_compiling_the_kernel_and_related_modules"/>9.9.4. Compiling the kernel and related modules</h3>
</div>
</div>
</div>
<p>Debian has its own method of compiling the kernel and related modules.</p>
<div class="table">
<a id="listofkeypackagenthedebiansystem"/>
<p class="title">
<strong>Table 9.25. List of key packages to be installed for the kernel recompilation on the Debian system</strong>
</p>
<div class="table-contents">
<table summary="List of key packages to be installed for the kernel recompilation on the Debian system" 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/build-essential">
<code class="literal">build-essential</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=build-essential">I:484</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/b/build-essential.html">37</a>
</td>
<td style="text-align: left">
essential packages for building Debian packages: <code class="literal">make</code>, <code class="literal">gcc</code>, …
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/bzip2">
<code class="literal">bzip2</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=bzip2">V:405, I:904</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/b/bzip2.html">119</a>
</td>
<td style="text-align: left">
compress and decompress utilities for bz2 files
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libncurses5-dev">
<code class="literal">libncurses5-dev</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libncurses5-dev">V:15, I:172</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libn/libncurses5-dev.html">1035</a>
</td>
<td style="text-align: left">
developer's libraries and docs for ncurses
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/git">
<code class="literal">git</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=git">V:162, I:415</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/g/git.html">21596</a>
</td>
<td style="text-align: left">
git: distributed revision control system used by the Linux kernel
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/fakeroot">
<code class="literal">fakeroot</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=fakeroot">V:41, I:544</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/f/fakeroot.html">252</a>
</td>
<td style="text-align: left">
provide fakeroot environment for building package as non-root
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/initramfs-tools">
<code class="literal">initramfs-tools</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=initramfs-tools">V:199, I:988</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/i/initramfs-tools.html">340</a>
</td>
<td style="text-align: left">
tool to build an initramfs (Debian specific)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/dkms">
<code class="literal">dkms</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=dkms">V:80, I:242</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/d/dkms.html">339</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support">dynamic kernel module support (DKMS)</a> (generic)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/devscripts">
<code class="literal">devscripts</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=devscripts">V:10, I:74</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/d/devscripts.html">1807</a>
</td>
<td style="text-align: left">
helper scripts for a Debian Package maintainer (Debian specific)
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>If you use <code class="literal">initrd</code> in <a class="xref" href="ch03.en.html#_stage_2_the_boot_loader" title="3.1.2. Stage 2: the boot loader">Section 3.1.2, “Stage 2: the boot loader”</a>, make sure to read the related information in <span class="citerefentry"><span class="refentrytitle">initramfs-tools</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">update-initramfs</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">mkinitramfs</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">initramfs.conf</span>(5)</span>.</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 put symlinks to the directories in the source tree (e.g. "<code class="literal">/usr/src/linux*</code>") from "<code class="literal">/usr/include/linux</code>" and "<code class="literal">/usr/include/asm</code>" when compiling the Linux kernel source. (Some outdated documents suggest this.)</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>When compiling the latest Linux kernel on the Debian <code class="literal">stable</code> system, the use of backported latest tools from the Debian <code class="literal">unstable</code> may be needed.</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 <a class="ulink" href="http://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support">dynamic kernel module support (DKMS)</a> is a new distribution independent framework designed to allow individual kernel modules to be upgraded without changing the whole kernel. This is used for the maintenance of out-of-tree modules. This also makes it very easy to rebuild modules as you upgrade kernels.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_compiling_the_kernel_source_debian_kernel_team_recommendation"/>9.9.5. Compiling the kernel source: Debian Kernel Team recommendation</h3>
</div>
</div>
</div>
<p>For building custom kernel binary packages from the upstream kernel source, you should use the "<code class="literal">deb-pkg</code>" target provided by it.</p>
<pre class="screen">$ sudo apt-get build-dep linux
$ cd /usr/src
$ wget http://www.kernel.org/pub/linux/kernel/v3.11/linux-<version>.tar.bz2
$ tar -xjvf linux-<version>.tar.bz2
$ cd linux-<version>
$ cp /boot/config-<version> .config
$ make menuconfig
...
$ make deb-pkg</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 linux-source-<version> package provides the Linux kernel source with Debian patches as "<code class="literal">/usr/src/linux-<version>.tar.bz2</code>".</p>
</td>
</tr>
</table>
</div>
<p>For building specific binary packages from the Debian kernel source package, you should use the "<code class="literal">binary-arch_<architecture>_<featureset>_<flavour></code>" targets in "<code class="literal">debian/rules.gen</code>".</p>
<pre class="screen">$ sudo apt-get build-dep linux
$ apt-get source linux
$ cd linux-3.*
$ fakeroot make -f debian/rules.gen binary-arch_i386_none_686</pre>
<p>See further information:</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Debian Wiki: <a class="ulink" href="http://wiki.debian.org/KernelFAQ">KernelFAQ</a>
</p>
</li>
<li class="listitem">
<p>
Debian Wiki: <a class="ulink" href="http://wiki.debian.org/DebianKernel">DebianKernel</a>
</p>
</li>
<li class="listitem">
<p>
Debian Linux Kernel Handbook: <a class="ulink" href="http://kernel-handbook.alioth.debian.org">http://kernel-handbook.alioth.debian.org</a>
</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_hardware_drivers_and_firmware"/>9.9.6. Hardware drivers and firmware</h3>
</div>
</div>
</div>
<p>The hardware driver is the code running on the target system. Most hardware drivers are available as free software now and are included in the normal Debian kernel packages in the <code class="literal">main</code> area.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Graphics_processing_unit">GPU</a> driver
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Intel GPU driver (<code class="literal">main</code>)
</p>
</li>
<li class="listitem">
<p>
AMD/ATI GPU driver (<code class="literal">main</code>)
</p>
</li>
<li class="listitem">
<p>
NVIDIA GPU driver (<code class="literal">main</code> for <a class="ulink" href="http://en.wikipedia.org/wiki/Nouveau_(software)">nouveau</a> driver, and <code class="literal">non-free</code> for binary-only drivers supported by the vendor.)
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Softmodem">Softmodem</a> driver
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
martian-modem and sl-modem-dkms packages (<code class="literal">non-free</code>)
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
<p>The firmware is the code or data loaded on the device (e.g., CPU <a class="ulink" href="http://en.wikipedia.org/wiki/Microcode">microcode</a>, rendering code running on GPU, or <a class="ulink" href="http://en.wikipedia.org/wiki/FPGA">FPGA</a> / <a class="ulink" href="http://en.wikipedia.org/wiki/Complex_programmable_logic_device">CPLD</a> data, …). Some firmware packages are available as free software but many firmware packages are not available as free software since they contain sourceless binary data.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
firmware-linux-free (<code class="literal">main</code>)
</p>
</li>
<li class="listitem">
<p>
firmware-linux-nonfree (<code class="literal">non-free</code>)
</p>
</li>
<li class="listitem">
<p>
firmware-linux-* (<code class="literal">non-free</code>)
</p>
</li>
<li class="listitem">
<p>
*-firmware (<code class="literal">non-free</code>)
</p>
</li>
<li class="listitem">
<p>
intel-microcode (<code class="literal">non-free</code>)
</p>
</li>
<li class="listitem">
<p>
amd64-microcode (<code class="literal">non-free</code>)
</p>
</li>
</ul>
</div>
<p>Please note that <code class="literal">non-free</code> and <code class="literal">contrib</code> packages are not part of the Debian system. The access configuration to enable and to disable the <code class="literal">non-free</code> and <code class="literal">contrib</code> areas is described in <a class="xref" href="ch02.en.html#_debian_archive_basics" title="2.1.4. Debian archive basics">Section 2.1.4, “Debian archive basics”</a>. You should be aware of negatives associated with the use of the <code class="literal">non-free</code> and <code class="literal">contrib</code> packages as described in <a class="xref" href="ch02.en.html#_debian_is_100_free_software" title="2.1.5. Debian is 100% free software">Section 2.1.5, “Debian is 100% free software”</a>.</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_virtualized_system"/>9.10. Virtualized system</h2>
</div>
</div>
</div>
<p>Use of virtualized system enables us to run multiple instances of system simultaneously on a single hardware.</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="ulink" href="http://wiki.debian.org/SystemVirtualization">http://wiki.debian.org/SystemVirtualization</a>.</p>
</td>
</tr>
</table>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_virtualization_tools"/>9.10.1. Virtualization tools</h3>
</div>
</div>
</div>
<p>There are several system <a class="ulink" href="http://en.wikipedia.org/wiki/Virtualization">virtualization</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/Emulator">emulation</a> related packages in Debian beyond simple <a class="ulink" href="http://en.wikipedia.org/wiki/Chroot">chroot</a>. Some packages also help you to setup such system.</p>
<div class="table">
<a id="listofvirtualizationtools"/>
<p class="title">
<strong>Table 9.26. List of virtualization tools</strong>
</p>
<div class="table-contents">
<table summary="List of virtualization tools" 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/schroot">
<code class="literal">schroot</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=schroot">V:8, I:12</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/schroot.html">2576</a>
</td>
<td style="text-align: left">
specialized tool for executing Debian binary packages in chroot
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/sbuild">
<code class="literal">sbuild</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=sbuild">V:0, I:2</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/s/sbuild.html">471</a>
</td>
<td style="text-align: left">
tool for building Debian binary packages from Debian sources
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/pbuilder">
<code class="literal">pbuilder</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=pbuilder">V:3, I:21</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/p/pbuilder.html">998</a>
</td>
<td style="text-align: left">
personal package builder for Debian packages
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/debootstrap">
<code class="literal">debootstrap</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=debootstrap">V:9, I:76</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/d/debootstrap.html">229</a>
</td>
<td style="text-align: left">
bootstrap a basic Debian system (written in sh)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/cdebootstrap">
<code class="literal">cdebootstrap</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=cdebootstrap">V:0, I:6</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/c/cdebootstrap.html">87</a>
</td>
<td style="text-align: left">
bootstrap a Debian system (written in C)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/rootstrap">
<code class="literal">rootstrap</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=rootstrap">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/r/rootstrap.html">97</a>
</td>
<td style="text-align: left">
tool for building complete Linux filesystem images
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/virt-manager">
<code class="literal">virt-manager</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=virt-manager">V:6, I:26</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/v/virt-manager.html">7236</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Virtual_Machine_Manager">Virtual Machine Manager</a>: desktop application for managing virtual machines
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libvirt-bin">
<code class="literal">libvirt-bin</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libvirt-bin">V:22, I:48</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libv/libvirt-bin.html">73</a>
</td>
<td style="text-align: left">
programs for the <a class="ulink" href="http://en.wikipedia.org/wiki/Libvirt">libvirt</a> library
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/user-mode-linux">
<code class="literal">user-mode-linux</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=user-mode-linux">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/u/user-mode-linux.html">31164</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/User-mode_Linux">User-mode Linux</a> (kernel)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/bochs">
<code class="literal">bochs</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=bochs">V:0, I:1</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/b/bochs.html">3953</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Bochs">Bochs</a>: IA-32 PC emulator
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/qemu">
<code class="literal">qemu</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=qemu">I:54</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/q/qemu.html">398</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a>: fast generic processor emulator
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/qemu-system">
<code class="literal">qemu-system</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=qemu-system">V:16, I:56</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/q/qemu-system.html">53</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a>: full system emulation binaries
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/qemu-user">
<code class="literal">qemu-user</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=qemu-user">V:3, I:55</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/q/qemu-user.html">47919</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a>: user mode emulation binaries
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/qemu-utils">
<code class="literal">qemu-utils</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=qemu-utils">V:7, I:90</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/q/qemu-utils.html">2641</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a>: utilities
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/qemu-kvm">
<code class="literal">qemu-kvm</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=qemu-kvm">V:26, I:64</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/q/qemu-kvm.html">57</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine">KVM</a>: full virtualization on x86 hardware with the <a class="ulink" href="http://en.wikipedia.org/wiki/Hardware-assisted_virtualization">hardware-assisted virtualization</a></td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/virtualbox">
<code class="literal">virtualbox</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=virtualbox">V:57, I:70</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/v/virtualbox.html">58732</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/VirtualBox">VirtualBox</a>: x86 virtualization solution on i386 and amd64
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/xen-tools">
<code class="literal">xen-tools</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=xen-tools">V:0, I:9</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/x/xen-tools.html">620</a>
</td>
<td style="text-align: left">
tools to manage debian <a class="ulink" href="http://en.wikipedia.org/wiki/Xen">XEN</a> virtual server
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/wine">
<code class="literal">wine</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=wine">V:14, I:118</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/w/wine.html">101</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/Wine_(software)">Wine</a>: Windows API Implementation (standard suite)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/dosbox">
<code class="literal">dosbox</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=dosbox">V:3, I:21</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/d/dosbox.html">2745</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/DOSBox">DOSBox</a>: x86 emulator with Tandy/Herc/CGA/EGA/VGA/SVGA graphics, sound and DOS
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/dosemu">
<code class="literal">dosemu</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=dosemu">V:1, I:6</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/d/dosemu.html">4820</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/DOSEMU">DOSEMU</a>: The Linux DOS Emulator
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/vzctl">
<code class="literal">vzctl</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=vzctl">V:4, I:7</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/v/vzctl.html">1072</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/OpenVZ">OpenVZ</a> server virtualization solution - control tools
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/vzquota">
<code class="literal">vzquota</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=vzquota">V:4, I:7</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/v/vzquota.html">210</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://en.wikipedia.org/wiki/OpenVZ">OpenVZ</a> server virtualization solution - quota tools
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/lxc">
<code class="literal">lxc</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=lxc">V:4, I:11</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/l/lxc.html">2597</a>
</td>
<td style="text-align: left"><a class="ulink" href="http://lxc.sourceforge.net/">Linux containers</a> user space tools
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>See Wikipedia article <a class="ulink" href="http://en.wikipedia.org/wiki/Comparison_of_platform_virtual_machines">Comparison of platform virtual machines</a> for detail comparison of different platform virtualization solutions.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_virtualization_work_flow"/>9.10.2. Virtualization work flow</h3>
</div>
</div>
</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>Some functionalities described here are only available in <code class="literal">squeeze</code> or later.</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>Default Debian kernels support <a class="ulink" href="http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine">KVM</a> since <code class="literal">lenny</code>.</p>
</td>
</tr>
</table>
</div>
<p>Typical work flow for <a class="ulink" href="http://en.wikipedia.org/wiki/Virtualization">virtualization</a> involves several steps.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Create an empty filesystem (a file tree or a disk image).
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
The file tree can be created by "<code class="literal">mkdir -p /path/to/chroot</code>".
</p>
</li>
<li class="listitem">
<p>
The raw disk image file can be created with <span class="citerefentry"><span class="refentrytitle">dd</span>(1)</span> (see <a class="xref" href="ch09.en.html#_making_the_disk_image_file" title="9.6.1. Making the disk image file">Section 9.6.1, “Making the disk image file”</a> and <a class="xref" href="ch09.en.html#_making_the_empty_disk_image_file" title="9.6.5. Making the empty disk image file">Section 9.6.5, “Making the empty disk image file”</a>).
</p>
</li>
<li class="listitem">
<p><span class="citerefentry"><span class="refentrytitle">qemu-img</span>(1)</span> can be used to create and convert disk image files supported by <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a>.
</p>
</li>
<li class="listitem">
<p>
The raw and <a class="ulink" href="http://en.wikipedia.org/wiki/VMDK">VMDK</a> file format can be used as common format among virtualization tools.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Mount the disk image with <span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> to the filesystem (optional).
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
For the raw disk image file, mount it as <a class="ulink" href="http://en.wikipedia.org/wiki/Loop_device">loop device</a> or <a class="ulink" href="http://en.wikipedia.org/wiki/Device_mapper">device mapper</a> devices (see <a class="xref" href="ch09.en.html#_mounting_the_disk_image_file" title="9.6.3. Mounting the disk image file">Section 9.6.3, “Mounting the disk image file”</a>).
</p>
</li>
<li class="listitem">
<p>
For disk images supported by <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a>, mount them as <a class="ulink" href="http://en.wikipedia.org/wiki/Network_block_device">network block device</a> (see <a class="xref" href="ch09.en.html#_mounting_the_virtual_disk_image_file" title="9.10.3. Mounting the virtual disk image file">Section 9.10.3, “Mounting the virtual disk image file”</a>).
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Populate the target filesystem with required system data.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
The use of programs such as <code class="literal">debootstrap</code> and <code class="literal">cdebootstrap</code> helps with this process (see <a class="xref" href="ch09.en.html#_chroot_system" title="9.10.4. Chroot system">Section 9.10.4, “Chroot system”</a>).
</p>
</li>
<li class="listitem">
<p>
Use installers of OSs under the full system emulation.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Run a program under a virtualized environment.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Chroot">chroot</a> provides basic virtualized environment enough to compile programs, run console applications, and run daemons in it.
</p>
</li>
<li class="listitem">
<p><a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a> provides cross-platform CPU emulation.
</p>
</li>
<li class="listitem">
<p><a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a> with <a class="ulink" href="http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine">KVM</a> provides full system emulation by the <a class="ulink" href="http://en.wikipedia.org/wiki/Hardware-assisted_virtualization">hardware-assisted virtualization</a>.
</p>
</li>
<li class="listitem">
<p><a class="ulink" href="http://en.wikipedia.org/wiki/VirtualBox">VirtualBox</a> provides full system emulation on i386 and amd64 with or without the <a class="ulink" href="http://en.wikipedia.org/wiki/Hardware-assisted_virtualization">hardware-assisted virtualization</a>.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_mounting_the_virtual_disk_image_file"/>9.10.3. Mounting the virtual disk image file</h3>
</div>
</div>
</div>
<p>For the raw disk image file, see <a class="xref" href="ch09.en.html#_the_disk_image" title="9.6. The disk image">Section 9.6, “The disk image”</a>.</p>
<p>For other virtual disk image files, you can use <span class="citerefentry"><span class="refentrytitle">qemu-nbd</span>(8)</span> to export them using <a class="ulink" href="http://en.wikipedia.org/wiki/Network_block_device">network block device</a> protocol and mount them using the <code class="literal">nbd</code> kernel module.</p>
<p><span class="citerefentry"><span class="refentrytitle">qemu-nbd</span>(8)</span> supports disk formats supported by <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a>: <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a> supports following disk formats: raw, <a class="ulink" href="http://en.wikipedia.org/wiki/Qcow">qcow2, qcow</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/VMDK">vmdk</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/VirtualBox#Virtual_Desktop_Image">vdi</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/Bochs">bochs</a>, cow (user-mode Linux copy-on-write), <a class="ulink" href="http://en.wikipedia.org/wiki/Parallels_Workstation">parallels</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/Apple_Disk_Image">dmg</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/Cloop">cloop</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/VHD_(file_format)">vpc</a>, vvfat (virtual VFAT), and host_device.</p>
<p>The <a class="ulink" href="http://en.wikipedia.org/wiki/Network_block_device">network block device</a> can support partitions in the same way as the <a class="ulink" href="http://en.wikipedia.org/wiki/Loop_device">loop device</a> (see <a class="xref" href="ch09.en.html#_mounting_the_disk_image_file" title="9.6.3. Mounting the disk image file">Section 9.6.3, “Mounting the disk image file”</a>). You can mount the first partition of "<code class="literal">disk.img</code>" as follows.</p>
<pre class="screen"># modprobe nbd max_part=16
# qemu-nbd -v -c /dev/nbd0 disk.img
...
# mkdir /mnt/part1
# mount /dev/nbd0p1 /mnt/part1</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 may export only the first partition of "<code class="literal">disk.img</code>" using "<code class="literal">-P 1</code>" option to <span class="citerefentry"><span class="refentrytitle">qemu-nbd</span>(8)</span>.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_chroot_system"/>9.10.4. Chroot system</h3>
</div>
</div>
</div>
<p><span class="citerefentry"><span class="refentrytitle">chroot</span>(8)</span> offers most basic way to run different instances of the GNU/Linux environment on a single system simultaneously without rebooting.</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>Examples below assumes both parent system and chroot system share the same CPU architecture.</p>
</td>
</tr>
</table>
</div>
<p>You can learn how to setup and use <span class="citerefentry"><span class="refentrytitle">chroot</span>(8)</span> by running <span class="citerefentry"><span class="refentrytitle">pbuilder</span>(8)</span> program under <span class="citerefentry"><span class="refentrytitle">script</span>(1)</span> as follows.</p>
<pre class="screen">$ sudo mkdir /sid-root
$ sudo pbuilder --create --no-targz --debug --buildplace /sid-root</pre>
<p>You see how <span class="citerefentry"><span class="refentrytitle">debootstrap</span>(8)</span> or <span class="citerefentry"><span class="refentrytitle">cdebootstrap</span>(1)</span> populate system data for <code class="literal">sid</code> environment under "<code class="literal">/sid-root</code>".</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>These <span class="citerefentry"><span class="refentrytitle">debootstrap</span>(8)</span> or <span class="citerefentry"><span class="refentrytitle">cdebootstrap</span>(1)</span> are used to <a class="ulink" href="http://www.debian.org/releases/stable/installmanual">install Debian</a> by the Debian Installer. These can also be used to install Debian to a system without using a Debian install disk, but instead from another GNU/Linux distribution.</p>
</td>
</tr>
</table>
</div>
<pre class="screen">$ sudo pbuilder --login --no-targz --debug --buildplace /sid-root</pre>
<p>You see how a system shell running under <code class="literal">sid</code> environment is created as the following.</p>
<div class="orderedlist">
<ol class="orderedlist">
<li class="listitem">
<p>
Copy local configuration (<code class="literal">"/etc/hosts</code>", <code class="literal">"/etc/hostname</code>", <code class="literal">"/etc/resolv.conf</code>")
</p>
</li>
<li class="listitem">
<p>
Mount "<code class="literal">/proc</code>" filesystem
</p>
</li>
<li class="listitem">
<p>
Mount "<code class="literal">/dev/pts</code>" filesystem
</p>
</li>
<li class="listitem">
<p>
Create "<code class="literal">/usr/sbin/policy-rc.d</code>" which always exits with 101
</p>
</li>
<li class="listitem">
<p>
Run "<code class="literal">chroot /sid-root bin/bash -c 'exec -a -bash bin/bash'</code>"
</p>
</li>
</ol>
</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>Some programs under chroot may require access to more files from the parent system to function than <code class="literal">pbuilder</code> provides. For example, "<code class="literal">/sys</code>", "<code class="literal">/etc/passwd</code>", "<code class="literal">/etc/group</code>", "<code class="literal">/var/run/utmp</code>", "<code class="literal">/var/log/wtmp</code>", etc. may need to be bind-mounted or copied.</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">/usr/sbin/policy-rc.d</code>" file prevents daemon programs to be started automatically on the Debian system. See "<code class="literal">/usr/share/doc/sysv-rc/README.policy-rc.d.gz</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>The original purpose of the specialized chroot package, <code class="literal">pbuilder</code> is to construct a chroot system and builds a package inside the chroot. It is an ideal system to use to check that a package's build-dependencies are correct, and to be sure that unnecessary and wrong build dependencies do not exist in the resulting package.</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>Similar <code class="literal">schroot</code> package may give you an idea to run <code class="literal">i386</code> chroot system under <code class="literal">amd64</code> parent system.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_multiple_desktop_systems"/>9.10.5. Multiple desktop systems</h3>
</div>
</div>
</div>
<p>I recommend you to use <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a> or <a class="ulink" href="http://en.wikipedia.org/wiki/VirtualBox">VirtualBox</a> on a Debian <code class="literal">stable</code> system to run multiple desktop systems safely using <a class="ulink" href="http://en.wikipedia.org/wiki/Virtualization">virtualization</a>. These enable you to run desktop applications of Debian <code class="literal">unstable</code> and <code class="literal">testing</code> without usual risks associated with them.</p>
<p>Since pure <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a> is very slow, it is recommended to accelerate it with <a class="ulink" href="http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine">KVM</a> when the host system support it.</p>
<p>The virtual disk image "<code class="literal">virtdisk.qcow2</code>" containing a Debian system for <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU">QEMU</a> can be created using <a class="ulink" href="http://www.debian.org/distrib/netinst">debian-installer: Small CDs</a> as follows.</p>
<pre class="screen">$ wget http://cdimage.debian.org/debian-cd/5.0.3/amd64/iso-cd/debian-503-amd64-netinst.iso
$ qemu-img create -f qcow2 virtdisk.qcow2 5G
$ qemu -hda virtdisk.qcow2 -cdrom debian-503-amd64-netinst.iso -boot d -m 256
...</pre>
<p>See more tips at <a class="ulink" href="http://wiki.debian.org/QEMU">Debian wiki: QEMU</a>.</p>
<p><a class="ulink" href="http://en.wikipedia.org/wiki/VirtualBox">VirtualBox</a> comes with <a class="ulink" href="http://en.wikipedia.org/wiki/Qt_(toolkit)">Qt</a> GUI tools and quite intuitive. Its GUI and command line tools are explained in <a class="ulink" href="http://www.virtualbox.org/manual/UserManual.html">VirtualBox User Manual</a> and <a class="ulink" href="http://download.virtualbox.org/virtualbox/UserManual.pdf">VirtualBox User Manual (PDF)</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>Running other GNU/Linux distributions such as <a class="ulink" href="http://www.ubuntu.com/">Ubuntu</a> and <a class="ulink" href="http://fedoraproject.org/">Fedora</a> under <a class="ulink" href="http://en.wikipedia.org/wiki/Virtualization">virtualization</a> is a great way to learn configuration tips. Other proprietary OSs may be run nicely under this GNU/Linux <a class="ulink" href="http://en.wikipedia.org/wiki/Virtualization">virtualization</a>, too.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="navfooter">
<hr/>
<table width="100%" summary="Navigation footer">
<tr>
<td align="left"><a accesskey="p" href="ch08.en.html"><img src="images/prev.png" alt="Prev"/></a> </td>
<td align="center"> </td>
<td align="right"> <a accesskey="n" href="ch10.en.html"><img src="images/next.png" alt="Next"/></a></td>
</tr>
<tr>
<td align="left" valign="top">Chapter 8. I18N and L10N </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 10. Data management</td>
</tr>
</table>
</div>
</body>
</html>
|