Filenames and pathnames

To access any file or directory, you must specify a pathname, a symbolic name that tells a program where to find a file within the directory hierarchy based at root (/). A typical BlackBerry 10 OS pathname looks like this:


In this example, .profile is found in the fred directory, which in turn resides in the home directory, which is found in /, the root directory:

Diagram showing sample filenames.

Like Linux and other UNIX-like operating systems, BlackBerry 10 OS pathname components are separated by a forward slash (/). This is unlike Microsoft operating systems, which use a backslash (\).

To explore the files and directories on your system, use the ls utility. This is the equivalent of dir in MS-DOS. For more information, see Basic commands in Using the command line, or ls in Utilities.

Absolute and relative pathnames

There are two types of pathname:

Absolute paths
Pathnames that begin with a slash specify locations that are relative to the root of the pathname space (/). For example, /usr/lib/
Relative paths
Pathnames that don't begin with / specify locations relative to your current working directory.

For example, if your current directory is /home/fred, a relative path of my_apps/favs is the same as an absolute path of /home/fred/my_apps/favs.

You can't tell by looking at a pathname whether the path points to a regular file, a directory, a symbolic link, or some other file type. To determine the type of a file, use ls -ld .

The one exception to this is a pathname that ends with /, which always indicates a directory. If you use the -F option to ls, the utility displays a slash at the end of a directory name.

Dot and dot-dot directories

Most directories contain two special links, . (dot) and .. (dot dot).

. (dot)
The current directory.
.. (dot dot)
The directory that this directory appears in.

So, for example, you could list the contents of the directory above your current working directory by typing:

ls ..

If your current directory is /home/fred/my_apps/favs, you could list the contents of the root directory by typing:

ls ../../../..

but the absolute path (/) is much shorter, and you don't have to figure out how many dot dots you need.

Flash file systems don't support . and .. entries, but the shell might resolve them before passing the path to the file system. You can also set up hard links with these names on a flash file system.

A note about cd

In some traditional UNIX systems, the cd (change directory) command modifies the pathname given to it if that pathname contains symbolic links. As a result, the pathname of the new current working directory—which you can display with pwd—may differ from the one given to cd. In BlackBerry 10 OS, however, cd doesn't modify the pathname—aside from collapsing .. references. For example:

cd /home/dan/test/../doc

results in a current working directory of /home/dan/doc, even if some of the elements in the pathname were symbolic links.

No drive letters

Unlike Microsoft Windows, which represents drives as letters that precede pathnames (for example, C:\), BlackBerry 10 OS represents disk drives as regular directories within the pathname space. Directories that access another file system, such as one on a second hard disk partition, are called mountpoints. For more information on where to find things in a typical BlackBerry 10 OS pathname space, see Where everything is stored. To learn more about mounting filesystems, see Working with file systems.

Pathnames that begin with a dot

When you list the contents of a directory, the ls utility usually hides files and directories whose names begin with a period. Programs precede configuration files and directories with a period to hide them from view. The files (not surprisingly) are called hidden files. Other than the special treatment by ls and some other programs, nothing else is special about hidden files. Use ls -a to list all files, including any hidden ones.


Filename extensions (. something at the end of a filename) tell programs and users what type of data a file contains. In BlackBerry 10 OS file systems, extensions are just an ordinary part of the filename and can be any length, as long as the total filename size stays within the 505-byte filename length limit.

Most of the time, file extensions are simply naming conventions, but some utilities base their behavior on the extension. See Filename extensions for a list of some of the common extensions used in a BlackBerry 10 OS system.

Pathname-space mapping

You may have noticed that we've talked about files and directories appearing in their parent directories, rather than just saying that the parent directories contain these files. This is because in BlackBerry 10 OS, the pathname space is virtual, dictated not just by the file system that resides on media mounted at root, but rather by the paths and pathname aliases registered by the process manager. For example, let's take a small portion of the pathname space:

Daigram showing the /dev/ser pathname space.

In a typical disk-based BlackBerry 10 OS system, the directory / maps to the root of a file system on a physical hard drive partition. This file system on disk doesn't actually contain a /dev directory, which exists virtually, adopted via the process manager. In turn, the filename ser1 doesn't exist on a disk file system either; it has been adopted by the serial port driver.

This capability allows virtual directory unions to be created. This happens when multiple resource managers adopt files that lie in a common directory within the pathname space.

In the interests of creating a maintainable system, we suggest that you create directory unions as rarely as possible.

For more information on pathname-space management, see Pathname management in System architecture.

Filename rules

BlackBerry 10 OS supports a variety of file systems, each of which has different capabilities and rules for valid filenames. For information about file system capabilities, see Working with file systems; for file system limits, see Understanding system limits.

If you're using UTF-8 representations of Unicode characters to represent international characters, the limit on the filename length will be lower, depending on your use of characters in the extended range.

You can also use the ISO-Latin1 supplemental and PC character sets for international characters; however, the appearance of these 8-bit characters depends on the display settings of your terminal, and might not appear as you expect in other operating systems that access the files via a network.

All our disk file systems, that is,,, the Power-Safe file system (, and, use UTF-8 encoding for presentation of their filenames; attempts to specify a filename not using UTF-8 encoding will fail (with an error of EILSEQ) on these file systems.

Last modified: 2014-11-17

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus