Skip to content
Snippets Groups Projects
NuttShell.html 32 KiB
Newer Older
patacongo's avatar
patacongo committed
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
<html>
<head>
<title>NuttX</title>
</head>
<body background="backgd.gif">
<hr><hr>
<table width ="100%">
  <tr align="center" bgcolor="#e4e4e4">
    <td>
      <h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1>
      <p>Last Updated: September 3, 2008</p>
    </td>
  </tr>
</table>
<hr><hr>
<table width ="100%">
  <tr bgcolor="#e4e4e4">
    <td>
  <h1>Table of Contents</h1>
    </td>
  </tr>
</table>

<center><table width ="80%">
<tr>
<td>
<table>
<tr>
  <td><img src="favicon.ico"></td>
  <td>
    <a href="#overview">1.0 Overview</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#frontend">1.1 Console/NSH Front End</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdoverview">1.2 Command Overview</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#conditional">1.3 Conditional Command Execution</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#builtinvars">1.4 Built-In Variables</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#currentwd">1.5 Current Working Directory</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#environvars">1.6 Environment Variables</a>
  </td>
</tr>

<tr>
  <td><img src="favicon.ico"></td>
  <td>
    <a href="#commands">2.0 Commands</a>.
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdtest">2.1 Evaluate Expression (test)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdcat">2.2 Concatenate Files (cat)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdcd">2.3 Change Current Working Directory (cd)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdcp">2.4 Copy Files (cp)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdecho">2.5 Echo Strings and Variables (echo)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdexec">2.6 Execute User Code (exec)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdexit">2.7 Exit NSH (exit)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdhelp">2.8 Show Usage Command Usage (help)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdifconfig">2.9 Show Network Configuration (ifconfig)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdls">2.10 List Directory Contents (ls)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdmbhw">2.11 Access Memory (mb, mh, and mw)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdmem">2.12 Show Memory Manager Status (mem)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdps">2.13 Show Current Tasks and Threads (ps)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdmkdir">2.14 Create a Directory (mkdir)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdmkfatfs">2.15 Create a FAT Filesystem (mkfatfs)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdmkfifo">2.16 Create a FIFO (mkfifo)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdmount">2.17 Mount a File System (mount)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdping">2.18 Check Network Peer (ping)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdpwd">2.19 Show Current Working Directory (pwd)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdrm">2.20 Remove a File (rm)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdrmdir">2.21 Remove a Directory (rmdir)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdset">2.22 Set an Environment Variable (set)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdsh">2.23 Execute an NSH Script (sh)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdsleep">2.24 Wait for Seconds (sleep)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdunmount">2.25 Unmount a File System (umount)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdunset">2.26 Unset an Environment Variable (unset)</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmdusleep">2.27 Wait for Microseconds (usleep)</a>
  </td>
</tr>
<tr>
  <td><img src="favicon.ico"></td>
  <td>
    <a href="#configuration">3.0 Configuration Settings</a>
</td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#cmddependencies">3.1 Command Dependencies on Configuration Settings</a>
  </td>
</tr>
<tr>
  <td><br></td>
  <td>
    <a href="#nshconfiguration">3.2  NSH-Specific Configuration Settings</a>
  </td>
</tr>
</table>
</td>
</tr>
</table></center>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="overview"><h1>1.0 Overview</h1></a>
  </td>
  </tr>
</table>

<p>
  The <code>examples/nsh</code> sub-directory contains the NuttShell (NSH).
  NSH is a simple shell application for NuttX.
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="frontend"><h2>1.1 Console/NSH Front End</h2></a>
  </td>
  </tr>
</table>

<p>
  Using settings in the configuration file, NSH may be configured to
  use either the serial stdin/out or a telnet connection as the console
  or BOTH.  When NSH is started, you will see the following welcome on
  either console:
  <ul><pre>
NuttShell (NSH)
nsh&gt;
</pre></ul>
  <code>nsh&gt;</code> is the NSH prompt and indicates that you may enter a command
   from the console.
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdoverview"><h2>1.2 Command Overview</h2></a>
  </td>
  </tr>
</table>

<p>
  <b>Simple, Re-directed, and Background Commands</b>.
  The NuttShell (NSH) is a simple shell application.
  NSH supports the following commands forms:
</p>
<ul><table>
  <tr>
     <td>Simple command:</td>
     <td><code>&lt;cmd&gt;</code></td>
  </tr>
  <tr>
     <td>Command with re-directed output:</td>
     <td><code>
         &lt;cmd&gt; &gt; &lt;file&gt;<br>
         &lt;cmd&gt; &gt;&gt; &lt;file&gt;
     </code></td>
  </tr>
  <tr>
     <td>Background command:</td>
     <td><code>&lt;cmd&gt; &amp;</code></td>
  </tr>
  <tr>
     <td>Re-directed background command:</td>
     <td><code>
       &lt;cmd&gt; &gt; &lt;file&gt; &amp;<br>
       &lt;cmd&gt; &gt;&gt; &lt;file&gt; &amp;
     </code></td>
  </tr>
</table></ul>
<p>Where:</p>
<ul><table>
  <tr>
    <td><code>&lt;cmd&gt;</code></td>
    <td>
      is any one of the simple commands listed later.
    </td>
  </tr>
  <tr>
    <td><code>&lt;file&gt;</code></td>
    <td>
      is the full or relative path to any writable object
      in the filesystem name space (file or character driver).
      Such objects will be referred to simply as files throughout
      this document.
    </td>
  </tr>
</table></ul>
<p>
  <b><big><code>nice</code></big>'d Background Commands</b>
  NSH executes at the mid-priority (128).  Backgrounded commands can
  be made to execute at higher or lower priorities using <code>nice</code>:
</p>
<ul><code>
  [nice [-d &lt;niceness&gt;&gt;]] &lt;cmd&gt; [&gt; &lt;file&gt;|&gt;&gt; &lt;file&gt;] [&amp;]
</code></ul>
<p>
  Where <code>&lt;niceness&gt;</code> is any value between -20 and 19 where lower
  (more negative values) correspond to higher priorities.
  The default niceness is 10.
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="conditional"><h2>1.3 Conditional Command Execution</h2></a>
  </td>
  </tr>
</table>

<p>
  An <code>if-then[-else]-fi</code> construct is also supported in order to
  support conditional execution of commands.  This works from the
  command line but is primarily intended for use within NSH scripts
  (see the <a href="#cmdsh"><code>sh</code></a> commnd).  The syntax is as follows:
</p>
<ul><pre>
if &lt;cmd&gt;
then
  [sequence of &lt;cmd&gt;]
else
  [sequence of &lt;cmd&gt;]
fi
</pre></ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="builtinvars"><h2>1.4 Built-In Variables</h2></a>
  </td>
  </tr>
</table>

<ul><table>
  <tr>
    <td valign="top"><b><code>$?</code></b></td>
    <td>
      The result of the last simple command execution.
      On backgrounded commands, this variable holds only the result of spawning the background command.
    </td>
  </tr>
</table></ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="currentwd"><h2>1.5 Current Working Directory</h2></a>
  </td>
  </tr>
</table>

<p>
  <b><code>cd</code> and <code>pwd</code></b>.
  All path arguments to commands may be either an absolute path or a
  path relative to the current working directory.  The current working
  directory is set using the 'cd' command and can be queried either
  by using the <a href="#cmdpwd"><code>pwd</code></a> command or by
  using the <a href="#cmdecho"><code>echo</code></a> <a href="#environvars"><code>$PWD</code></a>
  command.
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="environvars"><h2>1.6 Environment Variables</h2></a>
  </td>
  </tr>
</table>

<p>
  <b>Environment Variables:</b>
</p>
<ul><table>
  <tr>
    <td><b><code>PWD</code></b></td><td>The current working directory</td>
  </tr>
  <tr>
    <td><b><code>OLDPWD</code></b></td><td>The previous working directory</td>
  </tr>
</table></ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="commands"><h1>2.0 Commands</h1></a>
  </td>
  </tr>
</table>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdtest"><h2>2.1 Evaluate Expression (test)</h2></a>
  </td>
  </tr>
</table>

<p><b>Command Syntax:</b></p>
<ul><pre>
[ &lt;expression&gt; ]
test &lt;expression&gt;
</pre></ul>
<p>
   <b>Synopsis</b>.
   These are two alternative forms of the same command.  They support
   evaluation of a boolean expression which sets <a href="#builtinvars"><code>$?</code></a>.
   This command is used most frequently as the conditional command following the
   <code>if</code> in the <a href="#conditional"><code>if-then[-else]-fi</code></a> construct.
</p>
<p><b>Expression Syntax:</b></p>
<ul>
  <p>
     expression = simple-expression | !expression | expression -o expression | expression -a expression
  </p>
  <p>
     simple-expression = unary-expression | binary-expression
  </p>
  <p>
     unary-expression = string-unary | file-unary
  </p>
  <p>
     string-unary = -n string | -z string
  </p>
  <p>
     file-unary = -b file | -c file | -d file | -e file | -f file | -r file | -s file | -w file
  </p>
  <p>
     binary-expression = string-binary | numeric-binary
  </p>
  <p>
     string-binary = string = string | string == string | string != string
  </p>
  <p>
     numeric-binary = integer -eq integer | integer -ge integer | integer -gt integer | integer -le integer |
                      integer -lt integer | integer -ne integer
  </p>
</ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdcat"><h2>2.2 Concatenate Files (cat)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
cat <code>&lt;path&gt;</code> [<code>&lt;path&gt;</code> [<code>&lt;path&gt;</code> ...]]
</pre></ul>
<p>
  <b>Synopsis</b>.
  This command copies and concatentates all of the files at <code>&lt;path&gt;</code>
  to the console (or to another file if the output is redirected).
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdcd"><h2>2.3 Change Current Working Directory (cd)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
cd [&lt;dir-path&gt;|-|~|..]
</pre></ul>
<p>
  <b>Synopsis</b>.
  Changes the current working directory (<code>PWD</code>).  Also sets the
  previous working directory environment variable (<code>OLDPWD</code>).
<p>
<p><b>Forms:</b></p>
<ul><table>
  <tr>
    <td><b><code>cd &lt;dir-path&gt;</code></b></td>
    <td>sets the current working directory to <code>&lt;dir-path&gt;</code>.</td>
  </tr>
  <tr>
    <td><b><code>cd -</code></b></td>
    <td>sets the current working directory to the previous
       working directory ($<a href="#environvars"><code>OLDPWD</code></a>).
      Equivalent to <code><a href="#cmdcd">cd</a> $<a href="#environvars">OLDPWD</a></code>.</td>
  </tr>
  <tr>
    <td><b><code>cd</code> or <b><code>cd ~</code></b></td>
    <td>set the current working directory to the 'home'
       directory.  The <i>home</i> directory can be configured by setting
       <code>CONFIG_LIB_HOMEDIR</code> in the configuration file.  The default
       <i>home</i> directory is <code>/</code>.</td>
  </tr>
  <tr>
    <td><b><code>cd ..</code></td>
    <td>sets the current working directory to the parent directory.</td>
  </tr>
</table></ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdcp"><h2>2.4 Copy Files (cp)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
cp &lt;source-path&gt; &lt;dest-path&gt;
</pre></ul>
<p>
  <b>Synopsis</b>.
  Copy of the contents of the file at <code>&lt;source-path&lt;</code> to the location
  in the filesystem indicated by <code>&lt;path-path&gt;</code>.
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdecho"><h2>2.5 Echo Strings and Variables (echo)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
echo [&lt;string|$name&gt; [&lt;string|$name&gt;...]]
</pre></ul>
<p>
  <b>Synopsis</b>.
  Copy the sequence of strings and expanded environment variables to
  console output (or to a file if the output is re-directed).
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdexec"><h2>2.6 Execute User Code (exec)</h2></a>
  </td>
  </tr>
</table>

<p><b>Command Syntax:</b></p>
<ul><pre>
exec &lt;hex-address&gt;
</pre></ul>
<p>
  <b>Synopsis</b>.
  Execute the user logic at address <code>&lt;hex-address&gt;</code>.  NSH will pause
  until the execution unless the user logic is executed in background
  via <code><a href="#cmdexec">exec</a> &lt;hex-address&gt; &amp;</code>.
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdexit"><h2>2.7 Exit NSH (exit)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
exit
</pre></ul>
<p>
  <b>Synopsis</b>.
  Exit NSH.  Only useful for the serial front end if you have started some other tasks (perhaps
  using the <code><a href="#cmdexec">exec</a></code> command) and you would like to have NSH out of the
  way.  For the telnet front-end, <code>exit</code> terminates the telenet session.
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdhelp"><h2>2.8 Show Usage Command Usage (help)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
help
</pre></ul>
<p>
  <b>Synopsis</b>.
  Presents summary information about each command to console.
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdifconfig"><h2>2.9 Show Network Configuration (ifconfig)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
ifconfig
</pre></ul>
<p>
  <b>Synopsis</b>.
  Show the current configuration of the network, for example:
</p>
<ul><pre>
nsh&gt; ifconfig
eth0    HWaddr 00:18:11:80:10:06
        IPaddr:10.0.0.2 DRaddr:10.0.0.1 Mask:255.255.255.0
</pre></ul>
<p>
  if uIP statistics are enabled (<code>CONFIG_NET_STATISTICS</code>), then
  this command will also show the detailed state of uIP.
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdls"><h2>2.10 List Directory Contents (ls)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
ls [-lRs] &lt;dir-path&gt;
</pre></ul>
<p>
  <b>Synopsis</b>.
  Show the contents of the directory at <code>&lt;dir-path&gt;</code>.  NOTE:
  <code>&lt;dir-path&gt;</code> must refer to a directory and no other filesystem
  object.
</p>
<p><b>Options:</b></p>
<ul><table>
  <tr>
    <td><b><code>-R</code></b></td>
    <td>Show the constents of specified directory and all of its
        sub-directories.</td>
  </tr>
  <tr>
    <td><b><code>-s</code></b></td>
    <td>Show the size of the files along with the filenames in the
        listing</td>
  </tr>
  <tr>
    <td><b><code>-l</code></b></td>
    <td>Show size and mode information along with the filenames
        in the listing.</td>
  </tr>
</table></ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdmbhw"><h2>2.11 Access Memory (mb, mh, and mw)</h2></a>
  </td>
  </tr>
</table>

<p><b>Command Syntax:</b></p>
<ul><pre>
mb &lt;hex-address&gt;[=&lt;hex-value&gt;][ &lt;hex-byte-count&gt;]
mh &lt;hex-address&gt;[=&lt;hex-value&gt;][ &lt;hex-byte-count&gt;]
mw &lt;hex-address&gt;[=&lt;hex-value&gt;][ &lt;hex-byte-count&gt;]
</pre></ul>
<p>
  <b>Synopsis</b>.
  Access memory using byte size access (mb), 16-bit accesses (mh),
  or 32-bit access (mw).  In each case,
</p>
<ul><table>
  <tr>
    <td><code>&lt;hex-address&gt;</code>.</td>
    <td>Specifies the address to be accessed.  The current
      value at that address will always be read and displayed.
  </tr>
  <tr>
    <td><code>&lt;hex-address&gt;=&lt;hex-value&gt;</code>.</td>
    <td>Read the value, then write <code>&lt;hex-value&gt;</code>
      to the location.
  </tr>
  <tr>
    <td><code>&lt;hex-byte-count&gt;</code>.</td>
    <td>Perform the mb, mh, or mw operation on a total
      of <code>&lt;hex-byte-count&gt;</code> bytes, increment the <code>&lt;hex-address&gt;</code> appropriately
      after each access
  </tr>
</table></ul>
<p><b>Example:</b><p>
<ul><pre>
nsh&gt; mh 0 16
  0 = 0x0c1e
  2 = 0x0100
  4 = 0x0c1e
  6 = 0x0110
  8 = 0x0c1e
  a = 0x0120
  c = 0x0c1e
  e = 0x0130
  10 = 0x0c1e
  12 = 0x0140
  14 = 0x0c1e
nsh&gt;
</pre></ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdmem"><h2>2.12 Show Memory Manager Status (mem)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
mem
</pre></ul>
<p>
  <b>Synopsis</b>.
  Show the current state of the memory allocator.  For example,
</p>
<ul><pre>
nsh&gt; mem
  arena:      fe2560
  ordblks:         1
  mxordblk:   fdc3e0
  uordblks:     6180
  fordblks:   fdc3e0
nsh&gt;
</pre></ul>
<p><b>Where:</b></p>
<ul><table>
  <tr>
    <td><b><code>arena</code></b></td>
    <td>This is the total size of memory allocated for use by malloc in bytes.</td>
  </tr>
  <tr>
    <td><b><code>ordblks</code></b></td>
    <td>This is the number of free (not in use) chunks.</td>
  </tr>
  <tr>
    <td><b><code>mxordblk</code></b></td>
    <td>Size of the largest free (not in use) chunk.</td>
  </tr>
  <tr>
    <td><b><code>uordblks</code></b></td>
    <td>This is the total size of memory occupied by chunks handed out by malloc.</td>
  </tr>
  <tr>
    <td><b><code>fordblks</code></b></td>
    <td>This is the total size of memory occupied by free (not in use) chunks.</td>
  </tr>
</table></ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdps"><h2>2.13 Show Current Tasks and Threads (ps)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
ps
</pre></ul>
<p>
  <b>Synopsis</b>.
  Show the currently active threads and tasks.  For example,
</p>
<ul><pre>
nsh&gt; ps
PID   PRI SCHD TYPE   NP STATE    NAME
    0   0 FIFO TASK      READY    Idle Task()
    1 128 RR   TASK      RUNNING  init()
    2 128 FIFO TASK      WAITSEM  nsh_telnetmain()
    3 100 RR   PTHREAD   WAITSEM  &lt;pthread&gt;(21)
nsh&gt;
</pre></ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdmkdir"><h2>2.14 Create a Directory (mkdir)</h2></a>
  </td>
</tr>
</table>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdmkfatfs"><h2>2.15 Create a FAT Filesystem (mkfatfs)</h2></a>
  </td>
</tr>
</table>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdmkfifo"><h2>2.16 Create a FIFO (mkfifo)</h2></a>
  </td>
</tr>
</table>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdmount"><h2>2.17 Mount a File System (mount)</h2></a>
  </td>
</tr>
</table>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdping"><h2>2.18 Check Network Peer (ping)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
ping [-c &lt;count&gt;] [-i &lt;interval&gt;] &lt;ip-address&gt;
</pre></ul>
<p>
  <b>Synopsis</b>.
  Test the network communication with a remote peer.  Example,
</p>
<ul><pre>
nsh&gt; 10.0.0.1
PING 10.0.0.1 56 bytes of data
56 bytes from 10.0.0.1: icmp_seq=1 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=2 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=3 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=4 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=5 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=6 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=7 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=8 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=9 time=0 ms
56 bytes from 10.0.0.1: icmp_seq=10 time=0 ms
10 packets transmitted, 10 received, 0% packet loss, time 10190 ms
nsh&gt;
</pre></ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdpwd"><h2>2.19 Show Current Working Directory (pwd)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
pwd
</pre></ul>
<p>
  <b>Synopsis</b>.
  Show the current working directory.
</p>
<ul><pre>
nsh&gt; cd /dev
nsh&gt; pwd
/dev
nsh&gt;
</pre></ul>

<p>Same as <code><a href="#cmdecho">echo</a> <a href="#environvars">$PWD</a></code>.</p>
<ul><pre>
nsh&gt; echo $PWD
/dev
nsh&gt;
</pre></ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdrm"><h2>2.20 Remove a File (rm)</h2></a>
  </td>
</tr>
</table>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdrmdir"><h2>2.21 Remove a Directory (rmdir)</h2></a>
  </td>
</tr>
</table>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdset"><h2>2.22 Set an Environment Variable (set)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
set &lt;name&gt; &lt;value&gt;
</pre></ul>
<p>
  <b>Synopsis</b>.
  Set the environment variable <code>&lt;name&gt;</code> to the string <code>&lt;value&gt;</code>.
  For example,
</p>
<ul><pre>
nsh&gt; echo $foobar

nsh&gt; set foobar foovalue
nsh&gt; echo $foobar
foovalue
nsh&gt;
</pre></ul>

<table width ="100%">
  <tr bgcolor="#e4e4e4">
  <td>
    <a name="cmdsh"><h2>2.23 Execute an NSH Script (sh)</h2></a>
  </td>
  </tr>
</table>

<a <p><b>Command Syntax:</b></p>
<ul><pre>
sh &lt;script-path&gt;
</pre></ul>
<p>
  <b>Synopsis</b>.
  Execute the sequence of NSH commands in the file referred
  to by <code>&lt;script-path&gt;.
</p>

<table width ="100%">
  <tr bgcolor="#e4e4e4">