|
|||
Prex Home >
Document Index >
CmdBox User's Guide
|
CmdBox (Command Box) is a small application which includes tiny versions of many UNIX utilities - A.K.A. the Swiss Army Knife of Prex.
This document describes the usage of each command and how to customize commands.
The CmdBox utility can execute the specific command with the following syntax.
cmdbox [command] [arguments...]
The first argument for CmdBox is the name of the command. Or, if the command is invoked under CmdBox's shell, we can use as follows.
command [arguments...]
The following example shows the usage of the some major UNIX commands.
[prex:/]# cd boot
[prex:/boot]# cmdbox pwd
/boot
[prex:/boot]# cmdbox ps
PID TIME CMD
0 5 proc
3 20 exec
2 25 fs
1 2 init
4 4 cmdbox
6 6 cmdbox
[prex:/boot]# cmdbox sh
[prex:/boot]# uname -?
usage: uname [-amnsrv]
[prex:/boot]# uname -a
Prex 0.8.2 Feb 4 2009 i386-pc preky
[prex:/boot]# exit
[prex:/boot]# _
You can select the available commands included in CmdBox utility. This can be done by changing 'command' options in the configuration file - /conf/$(arch)/$(platform). You must change this file before running the configure script to compile the Prex source tree.
command cat command clear command cp command date command dmesg command echo command free command head command hostname command kill command ls command mkdir ...
The 'help' command will display the list of supported built-in commands. So, you can identify which commands are included in CmdBox.
[prex:/]# help
usage: cmdbox [command] [arguments]...
builtin commands:
cat, clear, cp, date, dmesg, echo, free, head, help, hostname,
kill, ls, mkdir, more, mv, nice, printenv, ps, pwd, rm,
rmdir, sleep, sync, touch, uname, cd, exec, exit, export,
mem, set, unset
use `-?` to find out more about each command.
[prex:/]# _
Most of CmdBox commands support the "-?" argument to provide an usage description of their command.
cat [-u] [-] [file ...]
The cat utility reads files sequentially, writing them to the standard output. The file operands are processed in command-line order. If file is a single dash (`-') or absent, cat reads from the standard input.
The options are as follows:
The cat utility exits 0 on success, and >0 if an error occurs.
clear
The clear utility clears the terminal screen if this is possible.
cp [-i] src target cp [-i] src1 ... srcN directory
In the first synopsis form, the cp utility copies the contents of the src to the target. In the second synopsis form, the contents of each named srcN is copied to the destination 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 options are as follows:
date
The date utility displays the current date and time.
NOTE: There is no function to change date or time.
dmesg
The dmesg utility displays the contents of the system message buffer.
echo [-n] [string ...]
The echo utility writes any specified operands, separated by single blank (` ') characters and followed by a newline (`\n') character, to the standard output.
The following option is available:
The echo utility exits 0 on success, and >0 if an error occurs.
free
The free utility displays the total amount of free and used physical memory.
head [-n lines] [file ...]
This filter displays the first count lines or bytes of each of the specified files, or of the standard input if no files are specified. If count is omitted it defaults to 10.
If more than a single file is specified, each file is preceded by a header consisting of the string ``==> XXX <=='' where ``XXX'' is the name of the file.
The head utility exits 0 on success, and >0 if an error occurs.
hostname
The hostname utility prints the name of the current host.
NOTE: There is no function to change the host name.
kill [-s signal_name] pid ... kill -l [exit_status] kill -signal_name pid ... kill -signal_number pid ...
The kill utility sends a signal to the processes specified by the pid operands.
Only the super-user may send signals to other users' processes.
The options are as follows:
The following PIDs have special meanings:
-1 ... If superuser, broadcast the signal to all processes; otherwise broadcast to all processes belonging to the user.The kill utility exits 0 on success, and >0 if an error occurs.
ls [-1CFAal] [file ...]
For each operand that names a file of a type other than directory, ls displays its name as well as any requested, associated information. For each operand that names a file of type directory, ls displays the names of files contained within that directory, as well as any requested, associated information.
If no operands are given, the contents of the current directory are displayed.
The following options are available:
The ls utility exits 0 on success, and >0 if an error occurs.
mkdir [-p] directory ...
The mkdir utility creates the directories named as operands.
The following option is available:
The mkdir utility exits 0 on success, and >0 if an error occurs.
more [FILE...]
View FILE or standard input one screenful at a time.
mv source target
The mv utility renames the file named by the source operand to the destination path named by the target operand. It assumes the last operand does not name an already existing directory.
The mv utility exits 0 on success, and >0 if an error occurs.
nice [ -n increment ] utility [ argument ...]
The nice utility runs utility at an altered scheduling priority, by incrementing its ``nice'' value by the specified increment, or a default value of 10. The lower the nice value of a process, the higher its scheduling priority.
The superuser may specify a negative increment in order to run a utility with a higher scheduling priority.
If utility is invoked, the exit status of nice is the exit status of utility. An exit status of 126 indicates utility was found, but could not be executed. An exit status of 127 indicates utility could not be found.
printenv [name]
printenv prints out the values of the variables in the environment. If a variable is specified, only its value is printed.
ps [-lx]
The ps utility displays a header line, followed by lines containing information about all of your processes that have controlling terminals.
pwd
The pwd utility writes the absolute pathname of the current working directory to the standard output.
The pwd utility exits 0 on success, and >0 if an error occurs.
rm file...
The rm utility attempts to remove the non-directory type files specified on the command line.
The rm utility exits 0 if all of the named files or file hierarchies were removed. If an error occurs, rm exits with a value >0.
rmdir dirname...
The rmdir utility removes the directory entry specified by each directory argument, provided it is empty.
The rmdir utility exits 0 if all of the directories are removed. If an error occurs, rmdir exits with a value >0.
sh
The sh utility is the standard command interpreter for the system.
sleep seconds
The sleep command suspends execution for a minimum of seconds.
If the sleep command receives a signal, it takes the standard action.
The sleep utility exits 0 on success, and >0 if an error occurs.
sync
The sync utility can be called to ensure that all disk writes have been completed before the processor is halted in a way not suitably done by reboot.
test expression
The test utility evaluates the expression and, if it evaluates to true, returns a zero (true) exit status; otherwise it returns 1 (false). If there is no expression, test also returns 1 (false).
touch file
The touch utility creates the file if it does not exist.
NOTE: There is no function to change the modification time of the existing file.
uname [-amnpsrv]
The uname command writes the name of the operating system implementation to standard output. When options are specified, strings representing one or more system characteristics are written to standard output.
The options are as follows:
The uname utility exits 0 on success, and >0 if an error occurs.