Troubleshooting

Here are some common problems you might encounter while working on the command line.

Why can't I run my program called test ?
The shell has a builtin command called test. When the shell parses the command line, it matches any builtin commands before it looks for executable files.

You have two choices: rename your program, or specify the path to it (e.g., ./test).

Why do I get a "not found" message when I try to run my program?
The program is likely in a directory that isn't listed in your PATH. In particular, your current directory isn't in your PATH for security reasons.

Either add the executable's directory to your PATH or specify the path to the command (e.g., ./my_program). For more information, see Utilities, earlier in this chapter.

Why does root have access to different commands?
The root user has a different PATH setting that includes such directories as /sbin and /usr/sbin. These directories contain executables and managers that (typically) only root can use.

If you aren't logged in as root, you can still run some of the utilities in /sbin if you have the right permission, but you'll have to specify the full path (e.g., /sbin/logger) or add the directory to your PATH.

When I list a directory, I don't see files that start with a dot.
Files whose names start with a dot (.) are called hidden files. To list them, use the -a option to ls .
Why am I getting a "No such file or directory" message?
The shell can't find the file or directory that you specified. Here are some things to check:
  • Have you typed the name correctly? In BlackBerry 10 OS, the names of files and directories are case-sensitive.
  • Does the name contain spaces or other special characters?

    If you have a file called my file and you don't escape the meaning of the space, the shell uses the space when breaking the command line into tokens, so the command looks for one file called my and another called file.

    Use quoting to escape the meaning of the special characters (e.g., less "my file" or less my\ file). For information about the other characters that you need to quote, see Quoting special characters.

How do I work with a file whose name starts with a hyphen?
BlackBerry 10 OS utilities use the hyphen (-) to denote an option (e.g., head -n 10 some_file). If you create a file whose name starts with a hyphen, and you pass that filename as an argument to a utility, the utility parses the filename as one or more options.

Most utilities recognize a double hyphen (--) to mean end of options. Put this before your filename:

head -- -my_file

For more information, see the Utility Conventions chapter in the Utilities Reference.

Why do I get a "Unrecognized TERM type" message when I start programs such as vi ?
Either your TERM environment variable isn't set correctly, or there isn't an entry for your terminal type in /usr/lib/terminfo/ (or possibly /etc/termcap); see Terminal support, earlier in this chapter.

Last modified: 2013-12-21

comments powered by Disqus