RTEMS 4.10.2 On-Line Library

File and Directory Commands ls - list files in the directory

PREV UP NEXT Bookshelf RTEMS Shell User's Guide

3.2.5: ls - list files in the directory


ls [dir]


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


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


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.


The following is an example of how to use ls:

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


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.


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

int rtems_shell_rtems_main_ls(
  int    argc,
  char **argv

The configuration structure for the ls has the following prototype:

extern rtems_shell_cmd_t rtems_shell_LS_Command;

PREV UP NEXT Bookshelf RTEMS Shell User's Guide

Copyright © 1988-2008 OAR Corporation