summaryrefslogtreecommitdiffstats
path: root/shell/file_and_directory.rst
blob: 1f9da63d8cb012a36cb69db2399e0770d16e8756 (plain) (blame)
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
.. comment SPDX-License-Identifier: CC-BY-SA-4.0

.. COMMENT: COPYRIGHT (c) 1988-2008.
.. COMMENT: On-Line Applications Research Corporation (OAR).
.. COMMENT: All rights reserved.

File and Directory Commands
***************************

Introduction
============

The RTEMS shell has the following file and directory commands:

- blksync_ - sync the block driver

- cat_ - display file contents

- cd_ - alias for chdir

- chdir_ - change the current directory

- chmod_ - change permissions of a file

- chroot_ - change the root directory

- cp_ - copy files

- dd_ - convert and copy a file

- debugrfs_ - debug RFS file system

- df_ - display file system disk space usage

- dir_ - alias for ls_

- fdisk_ - format disks

- hexdump_ - format disks

- ln_ - make links

- ls_ - list files in the directory

- md5_ - display file system disk space usage

- mkdir_ - create a directory

- mkdos_ - DOSFS disk format

- mknod_ - make device special file

- mkrfs_ - format RFS file system

- mount_ - mount disk

- mv_ - move files

- pwd_ - print work directory

- rmdir_ - remove empty directories

- rm_ - remove files

- umask_ - Set file mode creation mask

- unmount_ - unmount disk

Commands
========

This section details the File and Directory Commands available.  A subsection
is dedicated to each of the commands and describes the behavior and
configuration of that command as well as providing an example usage.

.. raw:: latex

   \clearpage

.. _blksync:

blksync - sync the block driver
-------------------------------
.. index:: blksync

SYNOPSYS:
    .. code-block:: shell

        blksync driver

DESCRIPTION:
    This command issues a block driver sync call to the driver. The driver is a
    path to a device node. The sync call will flush all pending writes in the
    cache to the media and block until the writes have completed.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``blksync``:

    .. code-block:: c

        blksync /dev/hda1

.. index:: CONFIGURE_SHELL_NO_COMMAND_BLKSYNC
.. index:: CONFIGURE_SHELL_COMMAND_BLKSYNC

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_BLKSYNC`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_BLKSYNC`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_blksync

PROGRAMMING INFORMATION:
    The ``blksync`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_blksync(
            int    argc,
            char **argv
        );

    The configuration structure for the ``blksync`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_BLKSYNC_Command;

.. raw:: latex

   \clearpage

.. _cat:

cat - display file contents
---------------------------
.. index:: cat

SYNOPSYS:
    .. code-block:: shell

        cat file1 [file2 .. fileN]

DESCRIPTION:
    This command displays the contents of the specified files.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    It is possible to read the input from a device file using ``cat``.

EXAMPLES:
    The following is an example of how to use ``cat``:

    .. code-block:: shell

        SHLL [/] # cat /etc/passwd
        root:*:0:0:root::/:/bin/sh
        rtems:*:1:1:RTEMS Application::/:/bin/sh
        tty:!:2:2:tty owner::/:/bin/false

.. index:: CONFIGURE_SHELL_NO_COMMAND_CAT
.. index:: CONFIGURE_SHELL_COMMAND_CAT

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_CAT`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_CAT`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_cat

PROGRAMMING INFORMATION:
    The ``cat`` is implemented by a C language function which has the following
    prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_cat(
            int    argc,
            char **argv
        );

    The configuration structure for the ``cat`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_CAT_Command;

.. raw:: latex

   \clearpage

.. _cd:

cd - alias for chdir
--------------------
.. index:: cd

SYNOPSYS:
    .. code-block:: shell

        cd directory

DESCRIPTION:
    This command is an alias or alternate name for the ``chdir``.  See `ls -
    list files in the directory` for more information.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``cd``:

    .. code-block:: shell

        SHLL [/] $ cd etc
        SHLL [/etc] $ cd /
        SHLL [/] $ cd /etc
        SHLL [/etc] $ pwd
        /etc
        SHLL [/etc] $ cd /
        SHLL [/] $ pwd
        /
        SHLL [/] $ cd etc
        SHLL [/etc] $ cd ..
        SHLL [/] $ pwd
        /

.. index:: CONFIGURE_SHELL_NO_COMMAND_CD
.. index:: CONFIGURE_SHELL_COMMAND_CD

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_CD`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_CD`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_cd

PROGRAMMING INFORMATION:
    The ``cd`` is implemented by a C language function which has the following
    prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_cd(
            int    argc,
            char **argv
        );

    The configuration structure for the ``cd`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_CD_Command;

.. raw:: latex

   \clearpage

.. _chdir:

chdir - change the current directory
------------------------------------
.. index:: chdir

SYNOPSYS:
    .. code-block:: shell

        chdir [dir]

DESCRIPTION:
    This command is used to change the current working directory to the
    specified directory.  If no arguments are given, the current working
    directory will be changed to ``/``.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``chdir``:

    .. code-block:: shell

        SHLL [/] $ pwd
        /
        SHLL [/] $ chdir etc
        SHLL [/etc] $ pwd
        /etc

.. index:: CONFIGURE_SHELL_NO_COMMAND_CHDIR
.. index:: CONFIGURE_SHELL_COMMAND_CHDIR

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_CHDIR`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_CHDIR`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_chdir

PROGRAMMING INFORMATION:
    The ``chdir`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_chdir(
            int    argc,
            char **argv
        );

    The configuration structure for the ``chdir`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_CHDIR_Command;

.. raw:: latex

   \clearpage

.. _chmod:

chmod - change permissions of a file
------------------------------------
.. index:: chmod

SYNOPSYS:
    .. code-block:: shell

        chmod permissions file1 [file2...]

DESCRIPTION:
    This command changes the permissions on the files specified to the
    indicated ``permissions``.  The permission values are POSIX based with
    owner, group, and world having individual read, write, and executive
    permission bits.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    The ``chmod`` command only takes numeric representations of the
    permissions.

EXAMPLES:
    The following is an example of how to use ``chmod``:

    .. code-block:: shell

        SHLL [/] # cd etc
        SHLL [/etc] # ls
        -rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
        -rw-r--r--   1   root   root          42 Jan 01 00:00 group
        -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
        -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
        4 files 202 bytes occupied
        SHLL [/etc] # chmod 0777 passwd
        SHLL [/etc] # ls
        -rwxrwxrwx   1   root   root         102 Jan 01 00:00 passwd
        -rw-r--r--   1   root   root          42 Jan 01 00:00 group
        -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
        -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
        4 files 202 bytes occupied
        SHLL [/etc] # chmod 0322 passwd
        SHLL [/etc] # ls
        --wx-w--w-   1 nouser   root         102 Jan 01 00:00 passwd
        -rw-r--r--   1 nouser   root          42 Jan 01 00:00 group
        -rw-r--r--   1 nouser   root          30 Jan 01 00:00 issue
        -rw-r--r--   1 nouser   root          28 Jan 01 00:00 issue.net
        4 files 202 bytes occupied
        SHLL [/etc] # chmod 0644 passwd
        SHLL [/etc] # ls
        -rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
        -rw-r--r--   1   root   root          42 Jan 01 00:00 group
        -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
        -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
        4 files 202 bytes occupied

.. index:: CONFIGURE_SHELL_NO_COMMAND_CHMOD
.. index:: CONFIGURE_SHELL_COMMAND_CHMOD

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_CHMOD`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_CHMOD`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_chmod

PROGRAMMING INFORMATION:
    The ``chmod`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_chmod(
            int    argc,
            char **argv
        );

    The configuration structure for the ``chmod`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_CHMOD_Command;

.. raw:: latex

   \clearpage

.. _chroot:

chroot - change the root directory
----------------------------------
.. index:: chroot

SYNOPSYS:
    .. code-block:: shell

        chroot [dir]

DESCRIPTION:
    This command changes the root directory to ``dir`` for subsequent commands.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

    The destination directory ``dir`` must exist.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``chroot`` and the impact it has
    on the environment for subsequent command invocations:

    .. code-block:: shell

        SHLL [/] $ cat passwd
        cat: passwd: No such file or directory
        SHLL [/] $ chroot etc
        SHLL [/] $ cat passwd
        root:*:0:0:root::/:/bin/sh
        rtems:*:1:1:RTEMS Application::/:/bin/sh
        tty:!:2:2:tty owner::/:/bin/false
        SHLL [/] $ cat /etc/passwd
        cat: /etc/passwd: No such file or directory

.. index:: CONFIGURE_SHELL_NO_COMMAND_CHROOT
.. index:: CONFIGURE_SHELL_COMMAND_CHROOT

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_CHROOT`` to have this
    command included. Additional to that you have to add one POSIX key value
    pair for each thread where you want to use the command.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_CHROOT`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_chroot

PROGRAMMING INFORMATION:
    The ``chroot`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_chroot(
            int    argc,
            char **argv
        );

    The configuration structure for the ``chroot`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_CHROOT_Command;

.. raw:: latex

   \clearpage

.. _cp:

cp - copy files
---------------
.. index:: cp

SYNOPSYS:
    .. code-block:: shell

        cp [-R [-H | -L | -P]] [-f | -i] [-pv] src target
        cp [-R [-H | -L] ] [-f | -i] [-NpPv] source_file ... target_directory

DESCRIPTION:
    In the first synopsis form, the cp utility copies the contents of the
    source_file to the target_file. In the second synopsis form, the contents
    of each named source_file is copied to the destination
    target_directory. The names of the files themselves are not changed. If cp
    detects an attempt to copy a file to itself, the copy will fail.

    The following options are available:

    *-f*
        For each existing destination pathname, attempt to overwrite it. If
        permissions do not allow copy to succeed, remove it and create a new
        file, without prompting for confirmation. (The -i option is ignored if
        the -f option is specified.)

    *-H*
        If the -R option is specified, symbolic links on the command line are
        followed.  (Symbolic links encountered in the tree traversal are not
        followed.)

    *-i*
        Causes cp to write a prompt to the standard error output before copying
        a file that would overwrite an existing file. If the response from the
        standard input begins with the character 'y', the file copy is
        attempted.

    *-L*
        If the -R option is specified, all symbolic links are followed.

    *-N*
        When used with -p, do not copy file flags.

    *-P*
        No symbolic links are followed.

    *-p*
        Causes cp to preserve in the copy as many of the modification time,
        access time, file flags, file mode, user ID, and group ID as allowed by
        permissions.  If the user ID and group ID cannot be preserved, no error
        message is displayed and the exit value is not altered.  If the source
        file has its set user ID bit on and the user ID cannot be preserved,
        the set user ID bit is not preserved in the copy's permissions. If the
        source file has its set group ID bit on and the group ID cannot be
        preserved, the set group ID bit is not preserved in the copy's
        permissions. If the source file has both its set user ID and set group
        ID bits on, and either the user ID or group ID cannot be preserved,
        neither the set user ID or set group ID bits are preserved in the
        copy's permissions.

    *-R*
        If source_file designates a directory, cp copies the directory and the
        entire subtree connected at that point. This option also causes
        symbolic links to be copied, rather than indirected through, and for cp
        to create special files rather than copying them as normal
        files. Created directories have the same mode as the corresponding
        source directory, unmodified by the process's umask.

    *-v*
        Cause cp to be verbose, showing files as they are copied.

    For each destination file that already exists, its contents are overwritten
    if permissions allow, but its mode, user ID, and group ID are unchanged.

    In the second synopsis form, target_directory must exist unless there is
    only one named source_file which is a directory and the -R flag is
    specified.

    If the destination file does not exist, the mode of the source file is used
    as modified by the file mode creation mask (umask, see csh(1)). If the
    source file has its set user ID bit on, that bit is removed unless both the
    source file and the destination file are owned by the same user. If the
    source file has its set group ID bit on, that bit is removed unless both
    the source file and the destination file are in the same group and the user
    is a member of that group.  If both the set user ID and set group ID bits
    are set, all of the above conditions must be fulfilled or both bits are
    removed.

    Appropriate permissions are required for file creation or overwriting.

    Symbolic links are always followed unless the -R flag is set, in which case
    symbolic links are not followed, by default. The -H or -L flags (in
    conjunction with the -R flag), as well as the -P flag cause symbolic links
    to be followed as described above. The -H and -L options are ignored unless
    the -R option is specified. In addition, these options override
    eachsubhedading other and the command's actions are determined by the last
    one specified.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    NONE

EXAMPLES:
    The following is an example of how to use ``cp`` to copy a file to a new
    name in the current directory:

    .. code-block:: shell

        SHLL [/] # cat joel
        cat: joel: No such file or directory
        SHLL [/] # cp etc/passwd joel
        SHLL [/] # cat joel
        root:*:0:0:root::/:/bin/sh
        rtems:*:1:1:RTEMS Application::/:/bin/sh
        tty:!:2:2:tty owner::/:/bin/false
        SHLL [/] # ls
        drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
        drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
        -rw-r--r--   1   root   root         102 Jan 01 00:00 joel
        3 files 1710 bytes occupied

    The following is an example of how to use ``cp`` to copy one or more files
    to a destination directory and use the same ``basename`` in the destination
    directory:

    .. code-block:: shell

        SHLL [/] # mkdir tmp
        SHLL [/] # ls tmp
        0 files 0 bytes occupied
        SHLL [/] # cp /etc/passwd tmp
        SHLL [/] # ls /tmp
        -rw-r--r--   1   root   root         102 Jan 01 00:01 passwd
        1 files 102 bytes occupied
        SHLL [/] # cp /etc/passwd /etc/group /tmp
        SHLL [/] # ls /tmp
        -rw-r--r--   1   root   root         102 Jan 01 00:01 passwd
        -rw-r--r--   1   root   root          42 Jan 01 00:01 group
        2 files 144 bytes occupied
        SHLL [/] #

.. index:: CONFIGURE_SHELL_NO_COMMAND_CP
.. index:: CONFIGURE_SHELL_COMMAND_CP

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define``CONFIGURE_SHELL_COMMAND_CP`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_CP`` when all shell commands have been
    configured.

.. index:: rtems_shell_main_cp

PROGRAMMING INFORMATION:
    The ``cp`` command is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_main_cp(
            int    argc,
            char **argv
        );

    The configuration structure for the ``cp`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_CP_Command;

ORIGIN:
    The implementation and portions of the documentation for this command are
    from NetBSD 4.0.

.. raw:: latex

   \clearpage

.. _dd:

dd - convert and copy a file
----------------------------
.. index:: dd

SYNOPSYS:
    .. code-block:: shell

        dd [operands ...]

DESCRIPTION:
    The dd utility copies the standard input to the standard output.  Input
    data is read and written in 512-byte blocks.  If input reads are short,
    input from multiple reads are aggregated to form the output block.  When
    finished, dd displays the number of complete and partial input and output
    blocks and truncated input records to the standard error output.

    The following operands are available:

    *bs=n*
        Set both input and output block size, superseding the ibs and obs
        operands.  If no conversion values other than noerror, notrunc or sync
        are specified, then each input block is copied to the output as a
        single block without any aggregation of short blocks.

    *cbs=n*
        Set the conversion record size to n bytes.  The conversion record size
        is required by the record oriented conversion values.

    *count=n*
        Copy only n input blocks.

    *files=n*
        Copy n input files before terminating.  This operand is only applicable
        when the input device is a tape.

    *ibs=n*
        Set the input block size to n bytes instead of the default 512.

    *if=file*
        Read input from file instead of the standard input.

    *obs=n*
        Set the output block size to n bytes instead of the default 512.

    *of=file*
        Write output to file instead of the standard output.  Any regular
        output file is truncated unless the notrunc conversion value is
        specified.  If an initial portion of the output file is skipped (see
        the seek operand) the output file is truncated at that point.

    *seek=n*
        Seek n blocks from the beginning of the output before copying.  On
        non-tape devices, a *lseek* operation is used.  Otherwise, existing
        blocks are read and the data discarded.  If the seek operation is past
        the end of file, space from the current end of file to the specified
        offset is filled with blocks of NUL bytes.

    *skip=n*
        Skip n blocks from the beginning of the input before copying.  On input
        which supports seeks, a *lseek* operation is used.  Otherwise, input
        data is read and discarded.  For pipes, the correct number of bytes is
        read.  For all other devices, the correct number of blocks is read
        without distinguishing between a partial or complete block being read.

    *progress=n*
        Switch on display of progress if n is set to any non-zero value.  This
        will cause a "." to be printed (to the standard error output) for every
        n full or partial blocks written to the output file.

    *conv=value[,value...]*
        Where value is one of the symbols from the following list.

        *ascii, oldascii*
            The same as the unblock value except that characters are translated
            from EBCDIC to ASCII before the records are converted.  (These
            values imply unblock if the operand cbs is also specified.)  There
            are two conversion maps for ASCII.  The value ascii specifies the
            recom- mended one which is compatible with AT&T System V UNIX.  The
            value oldascii specifies the one used in historic AT&T and pre
            4.3BSD-Reno systems.

        *block*
            Treats the input as a sequence of newline or end-of-file terminated
            variable length records independent of input and output block
            boundaries.  Any trailing newline character is discarded.  Each
            input record is converted to a fixed length output record where the
            length is specified by the cbs operand.  Input records shorter than
            the conversion record size are padded with spaces.  Input records
            longer than the conversion record size are truncated.  The number
            of truncated input records, if any, are reported to the standard
            error output at the completion of the copy.

        *ebcdic, ibm, oldebcdic, oldibm*
            The same as the block value except that characters are translated
            from ASCII to EBCDIC after the records are converted.  (These
            values imply block if the operand cbs is also specified.)  There
            are four conversion maps for EBCDIC.  The value ebcdic specifies
            the recommended one which is compatible with AT&T System V UNIX.
            The value ibm is a slightly different mapping, which is compatible
            with the AT&T System V UNIX ibm value.  The values oldebcdic and
            oldibm are maps used in historic AT&T and pre 4.3BSD-Reno systems.

        *lcase*
            Transform uppercase characters into lowercase characters.

        *noerror*
            Do not stop processing on an input error.  When an input error
            occurs, a diagnostic message followed by the current input and
            output block counts will be written to the standard error output in
            the same format as the standard completion message.  If the sync
            conversion is also specified, any missing input data will be
            replaced with NUL bytes (or with spaces if a block oriented
            conversion value was specified) and processed as a normal input
            buffer.  If the sync conversion is not specified, the input block
            is omitted from the output.  On input files which are not tapes or
            pipes, the file offset will be positioned past the block in which
            the error occurred using lseek(2).

        *notrunc*
            Do not truncate the output file.  This will preserve any blocks in
            the output file not explicitly written by dd.  The notrunc value is
            not supported for tapes.

        *osync*
            Pad the final output block to the full output block size.  If the
            input file is not a multiple of the output block size after
            conversion, this conversion forces the final output block to be the
            same size as preceding blocks for use on devices that require
            regularly sized blocks to be written.  This option is incompatible
            with use of the bs=n block size specification.

        *sparse*
            If one or more non-final output blocks would consist solely of NUL
            bytes, try to seek the output file by the required space instead of
            filling them with NULs.  This results in a sparse file on some file
            systems.

        *swab*
            Swap every pair of input bytes.  If an input buffer has an odd
            number of bytes, the last byte will be ignored during swapping.

        *sync*
            Pad every input block to the input buffer size.  Spaces are used
            for pad bytes if a block oriented conversion value is specified,
            otherwise NUL bytes are used.

        *ucase*
            Transform lowercase characters into uppercase characters.

        *unblock*
            Treats the input as a sequence of fixed length records independent
            of input and output block boundaries.  The length of the input
            records is specified by the cbs operand.  Any trailing space
            characters are discarded and a newline character is appended.

    Where sizes are specified, a decimal number of bytes is expected.  Two or
    more numbers may be separated by an "x" to indicate a product.  Each number
    may have one of the following optional suffixes:

    *b*
        Block; multiply by 512

    *k*
        Kibi; multiply by 1024 (1 KiB)

    *m*
        Mebi; multiply by 1048576 (1 MiB)

    *g*
        Gibi; multiply by 1073741824 (1 GiB)

    *t*
        Tebi; multiply by 1099511627776 (1 TiB)

    *w*
        Word; multiply by the number of bytes in an integer

    When finished, dd displays the number of complete and partial input and
    output blocks, truncated input records and odd-length byte-swapping ritten.
    Partial output blocks to tape devices are considered fatal errors.
    Otherwise, the rest of the block will be written.  Partial output blocks to
    character devices will produce a warning message.  A truncated input block
    is one where a variable length record oriented conversion value was
    specified and the input line was too long to fit in the conversion record
    or was not newline terminated.

    Normally, data resulting from input or conversion or both are aggregated
    into output blocks of the specified size.  After the end of input is
    reached, any remaining output is written as a block.  This means that the
    final output block may be shorter than the output block size.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    NONE

EXAMPLES:
    The following is an example of how to use ``dd``:

    .. code-block:: shell

        SHLL [/] $ dd if=/nfs/boot-image of=/dev/hda1

.. index:: CONFIGURE_SHELL_NO_COMMAND_DD
.. index:: CONFIGURE_SHELL_COMMAND_DD

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_DD`` to have this
    command included.

    This command can be excluded from the shell command set by
    defining``CONFIGURE_SHELL_NO_COMMAND_DD`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_dd

PROGRAMMING INFORMATION:
    The ``dd`` command is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_dd(
            int    argc,
            char **argv
        );

    The configuration structure for the ``dd`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_DD_Command;

.. raw:: latex

   \clearpage

.. _debugrfs:

debugrfs - debug RFS file system
--------------------------------
.. index:: debugrfs

SYNOPSYS:
    .. code-block:: shell

        debugrfs [-hl] path command [options]

DESCRIPTION:
    The command provides debugging information for the RFS file system.

    The options are:

    *-h*
        Print a help message.

    *-l*
        List the commands.

    *path*
        Path to the mounted RFS file system. The file system has to be mounted
        to view to use this command.

    The commands are:

    *block start [end]*
        Display the contents of the blocks from start to end.

    *data*
        Display the file system data and configuration.

    *dir bno*
        Process the block as a directory displaying the entries.

    *group start [end]*
        Display the group data from the start group to the end group.

    *inode [-aef] [start] [end]*
        Display the inodes between start and end. If no start and end is
        provides all inodes are displayed.

        *-a*
            Display all inodes. That is allocated and unallocated inodes.

        *-e*
            Search and display on inodes that have an error.

        *-f*
            Force display of inodes, even when in error.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    NONE

EXAMPLES:
    The following is an example of how to use ``debugrfs``:

    .. code-block:: shell

        SHLL [/] $ debugrfs /c data

.. index:: CONFIGURE_SHELL_NO_COMMAND_DEBUGRFS
.. index:: CONFIGURE_SHELL_COMMAND_DEBUGRFS

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_DEBUGRFS`` to have
    this command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_DEBUGRFS`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_debugrfs

PROGRAMMING INFORMATION:
    The ``debugrfs`` command is implemented by a C language function which has
    the following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_debugrfs(
            int    argc,
            char **argv
        );

    The configuration structure for ``debugrfs`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_DEBUGRFS_Command;

.. raw:: latex

   \clearpage

.. _df:

df - display file system disk space usage
-----------------------------------------
.. index:: df

SYNOPSYS:
    .. code-block:: shell

        df [-h] [-B block_size]

DESCRIPTION:
    This command print disk space usage for mounted file systems.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    NONE

EXAMPLES:
    The following is an example of how to use ``df``:

    .. code-block:: shell

        SHLL [/] $ df -B 4K
        Filesystem     4K-blocks        Used   Available       Use%     Mounted on
        /dev/rda               124         1         124         0%   /mnt/ramdisk
        SHLL [/] $ df
        Filesystem     1K-blocks        Used   Available       Use%     Mounted on
        /dev/rda               495         1         494         0%   /mnt/ramdisk
        SHLL [/] $ df -h
        Filesystem     Size             Used   Available       Use%     Mounted on
        /dev/rda              495K        1K        494K         0%   /mnt/ramdisk

.. index:: CONFIGURE_SHELL_NO_COMMAND_DF
.. index:: CONFIGURE_SHELL_COMMAND_DF

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_DF`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_DF`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_df

PROGRAMMING INFORMATION:
    The ``df`` is implemented by a C language function which has the following
    prototype:

    .. code-block:: c

        int rtems_shell_main_df(
            int    argc,
            char **argv
        );

    The configuration structure for the ``df`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_DF_Command;

.. raw:: latex

   \clearpage

.. _dir:

dir - alias for ls
------------------
.. index:: dir

SYNOPSYS:
    .. code-block:: shell

        dir [dir]

DESCRIPTION:
    This command is an alias or alternate name for the ``ls``.  See `ls - list
    files in the directory` for more information.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    NONE

EXAMPLES:
    The following is an example of how to use ``dir``:

    .. code-block:: shell

        SHLL [/] $ dir
        drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
        drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
        2 files 1608 bytes occupied
        SHLL [/] $ dir etc
        -rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
        -rw-r--r--   1   root   root          42 Jan 01 00:00 group
        -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
        -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
        4 files 202 bytes occupied

.. index:: CONFIGURE_SHELL_NO_COMMAND_DIR
.. index:: CONFIGURE_SHELL_COMMAND_DIR

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define``CONFIGURE_SHELL_COMMAND_DIR`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_DIR`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_dir

PROGRAMMING INFORMATION:
    The ``dir`` is implemented by a C language function which has the following
    prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_dir(
            int    argc,
            char **argv
        );

    The configuration structure for the ``dir`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_DIR_Command;

.. raw:: latex

   \clearpage

.. _fdisk:

fdisk - format disk
-------------------
.. index:: fdisk

SYNOPSYS:
    .. code-block:: shell

        fdisk

.. index:: CONFIGURE_SHELL_NO_COMMAND_FDISK
.. index:: CONFIGURE_SHELL_COMMAND_FDISK

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_FDISK`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_FDISK`` when all shell commands have been
    configured.

.. raw:: latex

   \clearpage

.. _hexdump:

hexdump - ascii/dec/hex/octal dump
----------------------------------
.. index:: hexdump

SYNOPSYS:
    .. code-block:: shell

        hexdump [-bcCdovx] [-e format_string] [-f format_file] [-n length] [-s skip] file ...

DESCRIPTION:
    The hexdump utility is a filter which displays the specified files, or the
    standard input, if no files are specified, in a user specified format.

    The options are as follows:

    *-b*
        One-byte octal display.  Display the input offset in hexadecimal,
        followed by sixteen space-separated, three column, zero-filled, bytes
        of input data, in octal, per line.

    *-c*
        One-byte character display.  Display the input offset in hexadecimal,
        followed by sixteen space-separated, three column, space-filled,
        characters of input data per line.

    *-C*
        Canonical hex+ASCII display.  Display the input offset in hexadecimal,
        followed by sixteen space-separated, two column, hexadecimal bytes,
        followed by the same sixteen bytes in %_p format enclosed in "|"
        characters.

    *-d*
        Two-byte decimal display.  Display the input offset in hexadecimal,
        followed by eight space-separated, five column, zero-filled, two-byte
        units of input data, in unsigned decimal, per line.

    *-e format_string*
        Specify a format string to be used for displaying data.

    *-f format_file*
        Specify a file that contains one or more newline separated format
        strings.  Empty lines and lines whose first non-blank character is a
        hash mark (#) are ignored.

    *-n length*
        Interpret only length bytes of input.

    *-o*
        Two-byte octal display.  Display the input offset in hexadecimal,
        followed by eight space-separated, six column, zerofilled, two byte
        quantities of input data, in octal, per line.

    *-s offset*
        Skip offset bytes from the beginning of the input.  By default, offset
        is interpreted as a decimal number.  With a leading 0x or 0X, offset is
        interpreted as a hexadecimal number, otherwise, with a leading 0,
        offset is interpreted as an octal number.  Appending the character b,
        k, or m to offset causes it to be interpreted as a multiple of 512,
        1024, or 1048576, respectively.

    *-v*
        The -v option causes hexdump to display all input data.  Without the -v
        option, any number of groups of output lines, which would be identical
        to the immediately preceding group of output lines (except for the
        input offsets), are replaced with a line containing a single asterisk.

    *-x*
        Two-byte hexadecimal display.  Display the input offset in hexadecimal,
        followed by eight, space separated, four column, zero-filled, two-byte
        quantities of input data, in hexadecimal, per line.

    For each input file, hexdump sequentially copies the input to standard
    output, transforming the data according to the format strings specified by
    the -e and -f options, in the order that they were specified.

    *Formats*

    A format string contains any number of format units, separated by
    whitespace.  A format unit contains up to three items: an iteration count,
    a byte count, and a format.

    The iteration count is an optional positive integer, which defaults to one.
    Each format is applied iteration count times.

    The byte count is an optional positive integer.  If specified it defines
    the number of bytes to be interpreted by each iteration of the format.

    If an iteration count and/or a byte count is specified, a single slash must
    be placed after the iteration count and/or before the byte count to
    disambiguate them.  Any whitespace before or after the slash is ignored.

    The format is required and must be surrounded by double quote (" ") marks.
    It is interpreted as a fprintf-style format string (see*fprintf*), with the
    following exceptions:

    - An asterisk (*) may not be used as a field width or precision.

    - A byte count or field precision is required for each "s" con- version
      character (unlike the fprintf(3) default which prints the entire string
      if the precision is unspecified).

    - The conversion characters "h", "l", "n", "p" and "q" are not supported.

    - The single character escape sequences described in the C standard are
      supported:

          NUL                  \0
          <alert character>    \a
          <backspace>          \b
          <form-feed>          \f
          <newline>            \n
          <carriage return>    \r
          <tab>                \t
          <vertical tab>       \v

    Hexdump also supports the following additional conversion strings:

    *_a[dox]*
        Display the input offset, cumulative across input files, of the next
        byte to be displayed.  The appended characters d, o, and x specify the
        display base as decimal, octal or hexadecimal respectively.

    *_A[dox]*
        Identical to the _a conversion string except that it is only performed
        once, when all of the input data has been processed.

    *_c*
        Output characters in the default character set.  Nonprinting characters
        are displayed in three character, zero-padded octal, except for those
        representable by standard escape notation (see above), which are
        displayed as two character strings.

    *_p*
        Output characters in the default character set.  Nonprinting characters
        are displayed as a single ".".

    *_u*
        Output US ASCII characters, with the exception that control characters
        are displayed using the following, lower-case, names.  Characters
        greater than 0xff, hexadecimal, are displayed as hexadecimal strings.

        +-----------+-----------+-----------+-----------+-----------+-----------+
        |``000`` nul|``001`` soh|``002`` stx|``003`` etx|``004`` eot|``005`` enq|
        +-----------+-----------+-----------+-----------+-----------+-----------+
        |``006`` ack|``007`` bel|``008`` bs |``009`` ht |``00A`` lf |``00B`` vt |
        +-----------+-----------+-----------+-----------+-----------+-----------+
        |``00C`` ff |``00D`` cr |``00E`` so |``00F`` si |``010`` dle|``011`` dc1|
        +-----------+-----------+-----------+-----------+-----------+-----------+
        |``012`` dc2|``013`` dc3|``014`` dc4|``015`` nak|``016`` syn|``017`` etb|
        +-----------+-----------+-----------+-----------+-----------+-----------+
        |``018`` can|``019`` em |``01A`` sub|``01B`` esc|``01C`` fs |``01D`` gs |
        +-----------+-----------+-----------+-----------+-----------+-----------+
        |``01E`` rs |``01F`` us |``07F`` del|           |           |           |
        +-----------+-----------+-----------+-----------+-----------+-----------+

    The default and supported byte counts for the conversion characters are as
    follows:

        +----------------------+---------------------------------+
        |%_c, %_p, %_u, %c     |One byte counts only.            |
        +----------------------+---------------------------------+
        |%d, %i, %o, %u, %X, %x|Four byte default, one, two, four|
        |                      |and eight byte counts supported. |
        +----------------------+---------------------------------+
        |%E, %e, %f, %G, %g    |Eight byte default, four byte    |
        |                      |counts supported.                |
        +----------------------+---------------------------------+

    The amount of data interpreted by each format string is the sum of the data
    required by each format unit, which is the iteration count times the byte
    count, or the iteration count times the number of bytes required by the
    format if the byte count is not specified.

    The input is manipulated in "blocks", where a block is defined as the
    largest amount of data specified by any format string.  Format strings
    interpreting less than an input block's worth of data, whose last format
    unit both interprets some number of bytes and does not have a specified
    iteration count, have the iteration count incremented until the entire
    input block has been processed or there is not enough data remaining in the
    block to satisfy the format string.

    If, either as a result of user specification or hexdump modifying the
    iteration count as described above, an iteration count is greater than one,
    no trailing whitespace characters are output during the last iteration.

    It is an error to specify a byte count as well as multiple conversion
    characters or strings unless all but one of the conversion characters or
    strings is _a or _A.

    If, as a result of the specification of the -n option or end-of-file being
    reached, input data only partially satisfies a format string, the input
    block is zero-padded sufficiently to display all available data (i.e. any
    format units overlapping the end of data will display some num- ber of the
    zero bytes).

    Further output by such format strings is replaced by an equivalent number
    of spaces.  An equivalent number of spaces is defined as the number of
    spaces output by an s conversion character with the same field width and
    precision as the original conversion character or conversion string but
    with any "+", " ", "#" conversion flag characters removed, and ref-
    erencing a NULL string.

    If no format strings are specified, the default display is equivalent to
    specifying the -x option.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    NONE

EXAMPLES:
    The following is an example of how to use ``hexdump``:

    .. code-block:: shell

        SHLL [/] $ hexdump -C -n 512 /dev/hda1

.. index:: CONFIGURE_SHELL_NO_COMMAND_HEXDUMP
.. index:: CONFIGURE_SHELL_COMMAND_HEXDUMP

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_HEXDUMP`` to have this
    command included.

    This command can be excluded from the shell command set by
    defining``CONFIGURE_SHELL_NO_COMMAND_HEXDUMP`` when all shell commands have
    been configured.

.. index:: rtems_shell_rtems_main_hexdump

PROGRAMMING INFORMATION:
    The ``hexdump`` command is implemented by a C language function which has
    the following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_hexdump(
            int    argc,
            char **argv
        );

    The configuration structure for the ``hexdump`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_HEXDUMP_Command;

.. raw:: latex

   \clearpage

.. _ln:

ln - make links
---------------
.. index:: ln

SYNOPSYS:
    .. code-block:: c

        ln [-fhinsv] source_file [target_file]
        ln [-fhinsv] source_file ... target_dir

DESCRIPTION:
    The ln utility creates a new directory entry (linked file) which has the
    same modes as the original file.  It is useful for maintaining multiple
    copies of a file in many places at once without using up storage for the
    "copies"; instead, a link "points" to the original copy.  There are two
    types of links; hard links and symbolic links.  How a link "points" to a
    file is one of the differences between a hard or symbolic link.

    The options are as follows:

    *-f*
        Unlink any already existing file, permitting the link to occur.

    *-h*
        If the target_file or target_dir is a symbolic link, do not follow it.
        This is most useful with the -f option, to replace a symlink which may
        point to a directory.

    *-i*
        Cause ln to write a prompt to standard error if the target file exists.
        If the response from the standard input begins with the character 'y'
        or 'Y', then unlink the target file so that the link may occur.
        Otherwise, do not attempt the link.  (The -i option overrides any
        previous -f options.)

    *-n*
        Same as -h, for compatibility with other ln implementations.

    *-s*
        Create a symbolic link.

    *-v*
        Cause ln to be verbose, showing files as they are processed.

    By default ln makes hard links.  A hard link to a file is indistinguishable
    from the original directory entry; any changes to a file are effective
    independent of the name used to reference the file.  Hard links may not
    normally refer to directories and may not span file systems.

    A symbolic link contains the name of the file to which it is linked.  The
    referenced file is used when an *open* operation is performed on the link.
    A *stat* on a symbolic link will return the linked-to file; an *lstat* must
    be done to obtain information about the link.  The *readlink* call may be
    used to read the contents of a symbolic link.  Symbolic links may span file
    systems and may refer to directories.

    Given one or two arguments, ln creates a link to an existing file
    source_file.  If target_file is given, the link has that name; target_file
    may also be a directory in which to place the link; otherwise it is placed
    in the current directory.  If only the directory is specified, the link
    will be made to the last component of source_file.

    Given more than two arguments, ln makes links in target_dir to all the
    named source files.  The links made will have the same name as the files
    being linked to.

EXIT STATUS:
    The ``ln`` utility exits 0 on success, and >0 if an error occurs.

NOTES:
    None.

EXAMPLES:
    .. code-block:: shell

        SHLL [/] ln -s /dev/console /dev/con1

.. index:: CONFIGURE_SHELL_NO_COMMAND_LN
.. index:: CONFIGURE_SHELL_COMMAND_LN

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_LN`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_LN`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_ln

PROGRAMMING INFORMATION:
    The ``ln`` command is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_ln(
            int    argc,
            char **argv
        );

    The configuration structure for the ``ln`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_LN_Command;

ORIGIN:
    The implementation and portions of the documentation for this command are
    from NetBSD 4.0.

.. raw:: latex

   \clearpage

.. _ls:

ls - list files in the directory
--------------------------------
.. index:: ls

SYNOPSYS:
    .. code-block:: shell

        ls [dir]

DESCRIPTION:
    This command displays the contents of the specified directory.  If no
    arguments are given, then it displays the contents of the current working
    directory.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    This command currently does not display information on a set of files like
    the POSIX ls(1).  It only displays the contents of entire directories.

EXAMPLES:
    The following is an example of how to use ``ls``:

    .. code-block:: shell

        SHLL [/] $ ls
        drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
        drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
        2 files 1608 bytes occupied
        SHLL [/] $ ls etc
        -rw-r--r--   1   root   root         102 Jan 01 00:00 passwd
        -rw-r--r--   1   root   root          42 Jan 01 00:00 group
        -rw-r--r--   1   root   root          30 Jan 01 00:00 issue
        -rw-r--r--   1   root   root          28 Jan 01 00:00 issue.net
        4 files 202 bytes occupied
        SHLL [/] $ ls dev etc
        -rwxr-xr-x   1  rtems   root           0 Jan 01 00:00 console
        -rwxr-xr-x   1   root   root           0 Jan 01 00:00 console_b

.. index:: CONFIGURE_SHELL_NO_COMMAND_LS
.. index:: CONFIGURE_SHELL_COMMAND_LS

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_LS`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_LS`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_ls

PROGRAMMING INFORMATION:
    The ``ls`` is implemented by a C language function which has the following
    prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_ls(
            int    argc,
            char **argv
        );

    The configuration structure for the ``ls`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_LS_Command;

.. raw:: latex

   \clearpage

.. _md5:

md5 - compute the Md5 hash of a file or list of files
-----------------------------------------------------
.. index:: md5

SYNOPSYS:
    .. code-block:: shell

        md5 <files>

DESCRIPTION:
    This command prints the MD5 of a file. You can provide one or more files on
    the command line and a hash for each file is printed in a single line of
    output.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``md5``:

    .. code-block:: shell

        SHLL [/] $ md5 shell-init
        MD5 (shell-init) = 43b4d2e71b47db79eae679a2efeacf31

.. index:: CONFIGURE_SHELL_NO_COMMAND_MD5
.. index:: CONFIGURE_SHELL_COMMAND_MD5

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define``CONFIGURE_SHELL_COMMAND_MD5`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_MD5`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_md5

PROGRAMMING INFORMATION:
    The ``md5`` is implemented by a C language function which has the following
    prototype:

    .. code-block:: c

        int rtems_shell_main_md5(
            int    argc,
            char **argv
        );

    The configuration structure for the ``md5`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_MD5_Command;

.. raw:: latex

   \clearpage

.. _mkdir:

mkdir - create a directory
--------------------------
.. index:: mkdir

SYNOPSYS:
    .. code-block:: c

        mkdir  dir [dir1 .. dirN]

DESCRIPTION:
    This command creates the set of directories in the order they are specified
    on the command line.  If an error is encountered making one of the
    directories, the command will continue to attempt to create the remaining
    directories on the command line.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    If this command is invoked with no arguments, nothing occurs.

    The user must have sufficient permissions to create the directory.  For the
    ``fileio`` test provided with RTEMS, this means the user must login as
    ``root`` not ``rtems``.

EXAMPLES:
    The following is an example of how to use ``mkdir``:

    .. code-block:: shell

        SHLL [/] # ls
        drwxr-xr-x   1   root   root         536 Jan 01 00:00 dev/
        drwxr-xr-x   1   root   root        1072 Jan 01 00:00 etc/
        2 files 1608 bytes occupied
        SHLL [/] # mkdir joel
        SHLL [/] # ls joel
        0 files 0 bytes occupied
        SHLL [/] # cp etc/passwd joel
        SHLL [/] # ls joel
        -rw-r--r--   1   root   root         102 Jan 01 00:02 passwd
        1 files 102 bytes occupied

.. index:: CONFIGURE_SHELL_NO_COMMAND_MKDIR
.. index:: CONFIGURE_SHELL_COMMAND_MKDIR

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_MKDIR`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_MKDIR`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_mkdir

PROGRAMMING INFORMATION:
    The ``mkdir`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_mkdir(
            int    argc,
            char **argv
        );

    The configuration structure for the ``mkdir`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_MKDIR_Command;

.. raw:: latex

   \clearpage

.. _mkdos:

mkdos - DOSFS file system format
--------------------------------
.. index:: mkdos

SYNOPSYS:
    .. code-block:: shell

        mkdos [-V label] [-s sectors/cluster] [-r size] [-v] path

DESCRIPTION:
    This command formats a block device entry with the DOSFS file system.

    *-V label*
        Specify the volume label.

    *-s sectors/cluster*
        Specify the number of sectors per cluster.

    *-r size*
        Specify the number  of entries in the root directory.

    *-v*
        Enable verbose output mode.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``mkdos``:

    .. code-block:: shell

        SHLL [/] $ mkdos /dev/rda1

.. index:: CONFIGURE_SHELL_NO_COMMAND_MKDOS
.. index:: CONFIGURE_SHELL_COMMAND_MKDOS

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_MKDOS`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_MKDOS`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_mkdos

PROGRAMMING INFORMATION:
    The ``mkdos`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_mkdos(
            int    argc,
            char **argv
        );

    The configuration structure for the ``mkdos`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_MKDOS_Command;

.. raw:: latex

   \clearpage

.. _mknod:

mknod - make device special file
--------------------------------
.. index:: mknod

SYNOPSYS:
    .. code-block:: shell

        mknod [-rR] [-F fmt] [-g gid] [-m mode] [-u uid] name [c | b] [driver | major] minor
        mknod [-rR] [-F fmt] [-g gid] [-m mode] [-u uid] name [c | b] major unit subunit
        mknod [-rR] [-g gid] [-m mode] [-u uid] name [c | b] number
        mknod [-rR] [-g gid] [-m mode] [-u uid] name p

DESCRIPTION:
    The mknod command creates device special files, or fifos.  Normally the
    shell script /dev/MAKEDEV is used to create special files for commonly
    known devices; it executes mknod with the appropriate arguments and can
    make all the files required for the device.

    To make nodes manually, the arguments are:

    *-r*
        Replace an existing file if its type is incorrect.

    *-R*
        Replace an existing file if its type is incorrect.  Correct the mode,
        user and group.

    *-g gid*
        Specify the group for the device node.  The gid operand may be a
        numeric group ID or a group name.  If a group name is also a numeric
        group ID, the operand is used as a group name.  Precede a numeric group
        ID with a # to stop it being treated as a name.

    *-m mode*
        Specify the mode for the device node.  The mode may be absolute or
        symbolic, see *chmod*.

    *-u uid*
        Specify the user for the device node.  The uid operand may be a numeric
        user ID or a user name.  If a user name is also a numeric user ID, the
        operand is used as a user name.  Precede a numeric user ID with a # to
        stop it being treated as a name.

    *name*
        Device name, for example "tty" for a termios serial device or "hd" for
        a disk.

    *b | c | p*
        Type of device.  If the device is a block type device such as a tape or
        disk drive which needs both cooked and raw special files, the type
        is b.  All other devices are character type devices, such as terminal
        and pseudo devices, and are type c.  Specifying p creates fifo files.

    *driver | major*
        The major device number is an integer number which tells the kernel
        which device driver entry point to use.  If the device driver is
        configured into the current kernel it may be specified by driver name
        or major number.

    *minor*
        The minor device number tells the kernel which one of several similar
        devices the node corresponds to; for example, it may be a specific
        serial port or pty.

    *unit and subunit*
        The unit and subunit numbers select a subset of a device; for example,
        the unit may specify a particular disk, and the subunit a partition on
        that disk.  (Currently this form of specification is only supported by
        the bsdos format, for compatibility with the BSD/OS mknod).

    *number*
        A single opaque device number.  Useful for netbooted computers which
        require device numbers packed in a format that isn't supported by -F.

EXIT STATUS:
    The ``mknod`` utility exits 0 on success, and >0 if an error occurs.

NOTES:
    None.

EXAMPLES:
    .. code-block:: shell

        SHLL [/] mknod c 3 0 /dev/ttyS10

.. index:: CONFIGURE_SHELL_NO_COMMAND_MKNOD
.. index:: CONFIGURE_SHELL_COMMAND_MKNOD

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_MKNOD`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_MKNOD`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_mknod

PROGRAMMING INFORMATION:
    The ``mknod`` command is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_mknod(
            int    argc,
            char **argv
        );

    The configuration structure for the ``mknod`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_MKNOD_Command;

ORIGIN:
    The implementation and portions of the documentation for this command are
    from NetBSD 4.0.

.. raw:: latex

   \clearpage

.. _mkrfs:

mkrfs - format RFS file system
------------------------------
.. index:: mkrfs

SYNOPSYS:
    .. code-block:: shell

        mkrfs [-vsbiIo] device

DESCRIPTION:
    Format the block device with the RTEMS File System (RFS). The default
    configuration with not parameters selects a suitable block size based on
    the size of the media being formatted.

    The media is broken up into groups of blocks. The number of blocks in a
    group is based on the number of bits a block contains. The large a block
    the more blocks a group contains and the fewer groups in the file system.

    The following options are provided:

    *-v*
        Display configuration and progress of the format.

    *-s*
        Set the block size in bytes.

    *-b*
        The number of blocks in a group. The block count must be equal or less
        than the number of bits in a block.

    *-i*
        Number of inodes in a group. The inode count must be equal or less than
        the number of bits in a block.

    *-I*
        Initialise the inodes. The default is not to initialise the inodes and
        to rely on the inode being initialised when allocated. Initialising the
        inode table helps recovery if a problem appears.

    *-o*
        Integer percentage of the media used by inodes. The default is 1%.

    *device*
        Path of the device to format.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``mkrfs``:

    .. code-block:: shell

        SHLL [/] $ mkrfs /dev/fdda

.. index:: CONFIGURE_SHELL_NO_COMMAND_MKRFS
.. index:: CONFIGURE_SHELL_COMMAND_MKRFS

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_MKRFS`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_MKRFS`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_mkrfs

PROGRAMMING INFORMATION:
    The ``mkrfs`` command is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_mkrfs(
            int    argc,
            char **argv
        );

    The configuration structure for ``mkrfs`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_MKRFS_Command;

.. raw:: latex

   \clearpage

.. _mount:

mount - mount disk
------------------
.. index:: mount

SYNOPSYS:
    .. code-block:: shell

        mount [-t fstype] [-r] [-L] device path

DESCRIPTION:
    The ``mount`` command will mount a block device to a mount point using the
    specified file system. The files systems are:

    - msdos - MSDOS File System

    - tftp  - TFTP Network File System

    - ftp   - FTP Network File System

    - nfs   - Network File System

    - rfs   - RTEMS File System

    When the file system type is 'msdos' or 'rfs' the driver is a "block device
    driver" node present in the file system. The driver is ignored with the
    'tftp' and 'ftp' file systems. For the 'nfs' file system the driver is the
    'host:/path' string that described NFS host and the exported file system
    path.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    The mount point must exist.

    The services offered by each file-system vary. For example you cannot list
    the directory of a TFTP file-system as this server is not provided in the
    TFTP protocol. You need to check each file-system's documentation for the
    services provided.

EXAMPLES:
    Mount the Flash Disk driver to the '/fd' mount point:

    .. code-block:: shell

        SHLL [/] $ mount -t msdos /dev/flashdisk0 /fd

    Mount the NFS file system exported path 'bar' by host 'foo':

    .. code-block:: shell

        $ mount -t nfs foo:/bar /nfs

    Mount the TFTP file system on '/tftp':

    .. code-block:: shell

        $ mount -t tftp /tftp

    To access the TFTP files on server '10.10.10.10':
    .. code-block:: shell

        $ cat /tftp/10.10.10.10/test.txt

.. index:: CONFIGURE_SHELL_NO_COMMAND_MOUNT
.. index:: CONFIGURE_SHELL_COMMAND_MOUNT

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_MOUNT`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_MOUNT`` when all shell commands have been
    configured.

    The mount command includes references to file-system code. If you do not
    wish to include file-system that you do not use do not define the mount
    command support for that file-system. The file-system mount command defines
    are:

    - msdos - CONFIGURE_SHELL_MOUNT_MSDOS

    - tftp - CONFIGURE_SHELL_MOUNT_TFTP

    - ftp - CONFIGURE_SHELL_MOUNT_FTP

    - nfs - CONFIGURE_SHELL_MOUNT_NFS

    - rfs - CONFIGURE_SHELL_MOUNT_RFS

    An example configuration is:

    .. code-block:: c

        #define CONFIGURE_SHELL_MOUNT_MSDOS
        #ifdef RTEMS_NETWORKING
        #define CONFIGURE_SHELL_MOUNT_TFTP
        #define CONFIGURE_SHELL_MOUNT_FTP
        #define CONFIGURE_SHELL_MOUNT_NFS
        #define CONFIGURE_SHELL_MOUNT_RFS
        #endif

.. index:: rtems_shell_rtems_main_mount

PROGRAMMING INFORMATION:
    The ``mount`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_mount(
            int    argc,
            char **argv
        );

    The configuration structure for the ``mount`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_MOUNT_Command;

.. raw:: latex

   \clearpage

.. _mv:

mv - move files
---------------
.. index:: mv

SYNOPSYS:
    .. code-block:: shell

        mv [-fiv] source_file target_file
        mv [-fiv] source_file... target_file

DESCRIPTION:
    In its first form, the mv utility renames the file named by the source
    operand to the destination path named by the target operand.  This form is
    assumed when the last operand does not name an already existing directory.

    In its second form, mv moves each file named by a source operand to a
    destination file in the existing directory named by the directory operand.
    The destination path for each operand is the pathname produced by the
    concatenation of the last operand, a slash, and the final pathname
    component of the named file.

    The following options are available:

    *-f*
        Do not prompt for confirmation before overwriting the destination path.

    *-i*
        Causes mv to write a prompt to standard error before moving a file that
        would overwrite an existing file.  If the response from the standard
        input begins with the character 'y', the move is attempted.

    *-v*
        Cause mv to be verbose, showing files as they are processed.

    The last of any -f or -i options is the one which affects mv's behavior.

    It is an error for any of the source operands to specify a nonexistent file
    or directory.

    It is an error for the source operand to specify a directory if the target
    exists and is not a directory.

    If the destination path does not have a mode which permits writing, mv
    prompts the user for confirmation as specified for the -i option.

    Should the *rename* call fail because source and target are on different
    file systems, ``mv`` will remove the destination file, copy the source file
    to the destination, and then remove the source.  The effect is roughly
    equivalent to:

    .. code-block:: shell

        rm -f destination_path && \
        cp -PRp source_file destination_path && \
        rm -rf source_file

EXIT STATUS:
    The ``mv`` utility exits 0 on success, and >0 if an error occurs.

NOTES:
    None.

EXAMPLES:
    .. code-block:: shell

        SHLL [/] mv /dev/console /dev/con1

.. index:: CONFIGURE_SHELL_NO_COMMAND_MV
.. index:: CONFIGURE_SHELL_COMMAND_MV

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_MV`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_MV`` when all shell commands have been
    configured.

.. index:: rtems_shell_main_mv

PROGRAMMING INFORMATION:
    The ``mv`` command is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_main_mv(
            int    argc,
            char **argv
        );

    The configuration structure for the ``mv`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_MV_Command;

ORIGIN:
    The implementation and portions of the documentation for this command are
    from NetBSD 4.0.

.. raw:: latex

   \clearpage

.. _pwd:

pwd - print work directory
--------------------------
.. index:: pwd

SYNOPSYS:
    .. code-block:: shell

        pwd

DESCRIPTION:
    This command prints the fully qualified filename of the current working
    directory.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``pwd``:

    .. code-block:: shell

        SHLL [/] $ pwd
        /
        SHLL [/] $ cd dev
        SHLL [/dev] $ pwd
        /dev

.. index:: CONFIGURE_SHELL_NO_COMMAND_PWD
.. index:: CONFIGURE_SHELL_COMMAND_PWD

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_PWD`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_PWD`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_pwd

PROGRAMMING INFORMATION:
    The ``pwd`` is implemented by a C language function which has the following
    prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_pwd(
            int    argc,
            char argv
        );

    The configuration structure for the ``pwd`` has the following prototype:

    .. code-block:: c

    extern rtems_shell_cmd_t rtems_shell_PWD_Command;

.. raw:: latex

   \clearpage

.. _rmdir:

rmdir - remove empty directories
--------------------------------
.. index:: rmdir

SYNOPSYS:
    .. code-block:: shell

        rmdir  [dir1 .. dirN]

DESCRIPTION:
    This command removes the specified set of directories.  If no directories
    are provided on the command line, no actions are taken.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    This command is a implemented using the ``rmdir(2)`` system call and all
    reasons that call may fail apply to this command.

EXAMPLES:
    The following is an example of how to use ``rmdir``:

    .. code-block:: shell

        SHLL [/] # mkdir joeldir
        SHLL [/] # rmdir joeldir
        SHLL [/] # ls joeldir
        joeldir: No such file or directory.

.. index:: CONFIGURE_SHELL_NO_COMMAND_RMDIR
.. index:: CONFIGURE_SHELL_COMMAND_RMDIR

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_RMDIR`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_RMDIR`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_rmdir

PROGRAMMING INFORMATION:
    The ``rmdir`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_rmdir(
            int    argc,
            char **argv
        );

    The configuration structure for the ``rmdir`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_RMDIR_Command;

.. raw:: latex

   \clearpage

.. _rm:

rm - remove files
-----------------
.. index:: rm

SYNOPSYS:
    .. code-block:: shell

        rm file1 [file2 ... fileN]

DESCRIPTION:
    This command deletes a name from the filesystem.  If the specified file
    name was the last link to a file and there are no ``open`` file descriptor
    references to that file, then it is deleted and the associated space in the
    file system is made available for subsequent use.

    If the filename specified was the last link to a file but there are open
    file descriptor references to it, then the file will remain in existence
    until the last file descriptor referencing it is closed.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    None.

EXAMPLES:
    The following is an example of how to use ``rm``:

    .. code-block:: shell

        SHLL [/] # cp /etc/passwd tmpfile
        SHLL [/] # cat tmpfile
        root:*:0:0:root::/:/bin/sh
        rtems:*:1:1:RTEMS Application::/:/bin/sh
        tty:!:2:2:tty owner::/:/bin/false
        SHLL [/] # rm tmpfile
        SHLL [/] # cat tmpfile
        cat: tmpfile: No such file or directory

.. index:: CONFIGURE_SHELL_NO_COMMAND_RM
.. index:: CONFIGURE_SHELL_COMMAND_RM

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_RM`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_RM`` when all shell commands have been
    configured.

.. index:: rtems_shell_main_rm

PROGRAMMING INFORMATION:
    The ``rm`` is implemented by a C language function which has the following
    prototype:

    .. code-block:: c

        int rtems_shell_main_rm(
            int    argc,
            char **argv
        );

    The configuration structure for the ``rm`` has the
    following prototype:
    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_RM_Command;

.. raw:: latex

   \clearpage

.. _umask:

umask - set file mode creation mask
-----------------------------------
.. index:: umask

SYNOPSYS:
    .. code-block:: shell

        umask [new_umask]

DESCRIPTION:
    This command sets the user file creation mask to ``new_umask``.  The
    argument ``new_umask`` may be octal, hexadecimal, or decimal.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    This command does not currently support symbolic mode masks.

EXAMPLES:
    The following is an example of how to use ``umask``:

    .. code-block:: shell

        SHLL [/] $ umask
        022
        SHLL [/] $ umask 0666
        0666
        SHLL [/] $ umask
        0666

.. index:: CONFIGURE_SHELL_NO_COMMAND_UMASK
.. index:: CONFIGURE_SHELL_COMMAND_UMASK

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_UMASK`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_UMASK`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_umask

PROGRAMMING INFORMATION:
    The ``umask`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_umask(
            int    argc,
            char **argv
        );

    The configuration structure for the ``umask`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_UMASK_Command;

.. raw:: latex

   \clearpage

.. _unmount:

unmount - unmount disk
----------------------
.. index:: unmount

SYNOPSYS:
    .. code-block:: shell

        unmount path

DESCRIPTION:
    This command unmounts the device at the specified ``path``.

EXIT STATUS:
    This command returns 0 on success and non-zero if an error is encountered.

NOTES:
    TBD - Surely there must be some warnings to go here.

EXAMPLES:
    The following is an example of how to use ``unmount``:

    .. code-block:: shell

        # unmount /mnt

.. index:: CONFIGURE_SHELL_NO_COMMAND_UNMOUNT
.. index:: CONFIGURE_SHELL_COMMAND_UNMOUNT

CONFIGURATION:
    This command is included in the default shell command set.  When building a
    custom command set, define ``CONFIGURE_SHELL_COMMAND_UNMOUNT`` to have this
    command included.

    This command can be excluded from the shell command set by defining
    ``CONFIGURE_SHELL_NO_COMMAND_UNMOUNT`` when all shell commands have been
    configured.

.. index:: rtems_shell_rtems_main_unmount

PROGRAMMING INFORMATION:
    The ``unmount`` is implemented by a C language function which has the
    following prototype:

    .. code-block:: c

        int rtems_shell_rtems_main_unmount(
            int    argc,
            char **argv
        );

    The configuration structure for the ``unmount`` has the following prototype:

    .. code-block:: c

        extern rtems_shell_cmd_t rtems_shell_UNMOUNT_Command;