# Shell Scope

The commands within the shell: scope are used to provide terminal window commands in the OSGi shell.

Shell Scope commandsShell Scope commands

| Command | Parameters | Description |
| --- | --- | --- |
| shell:alias | command | Creates an alias to a command. |
| shell:cat | [options] [paths or urls] | Displays the content of a file or URL. Where paths or<br>urls is a list of file paths or urls to display separated by<br>whitespace (use - for STDIN) |
| shell:clear |  | Clears the console buffer. |
| shell:completion | [mode] | Displays or changes the completion mode on the current console<br>session. Where mode is the completion mode to set. The<br>valid completion modes are: global,<br>first, subshell. |
| shell:date | [options] [format] | Displays the current time in the given FORMAT. |
| shell:each | values function | Executes a closure on a list of arguments. Where:<br><br><ul> <li> <span>values</span> is the collection of arguments to iterate                                on</li> <li> <span>function</span> is the function to execute</li> </ul> |
| shell:echo | [options] [arguments] | Echoes or prints arguments to STDOUT, separated by<br>whitespaces. |
| edit |  |  |
| shell:env | variable [value] | Gets/sets the value of a console session variable. |
| shell:exec | command | Executes system processes. |
| shell:grep | [options] pattern | Prints lines matching the given pattern, in regular<br>expression. |
| shell:head | [options] [paths or urls] | Displays the first lines of a file. Where paths or urls<br>is a list of file paths or urls to display separated by<br>whitespaces. |
| shell:history |  | Prints commands history. |
| shell:if | condition ifTrue [ifFalse] | If/Then/Else block. |
| shell:info |  | Prints system information. |
| shell:java | [options] className [arguments] | Executes a Java standard application. |
| less |  |  |
| shell:logout |  | Disconnects shell from current session. |
| more |  |  |
| shell:new | class [args] | Creates a new java object. |
| shell:printf | format arguments | Formats and prints arguments. |
| shell:sleep | [options] duration | Sleeps for a defined duration then wakes up. The default<br>time unit is millisecond, use -s option to use second<br>instead. |
| shell:sort | [options] [files] | Writes sorted concatenation of all files to standard output,<br>separated by whitespaces. |
| shell:source | script [args] | Runs a script. Where:<br><br><ul> <li> <span>script</span> is a URI pointing to the script </li> <li> <span>args</span> are arguments for the script </li> </ul> |
| shell:stack-traces-print | [print] | Prints the full stack trace in the console when the execution of a<br>command throws an exception. |
| shell:tac | [options] | Captures the STDIN and returns it as a string. Optionally writes the<br>content to a file. |
| shell:tail | [options] [path or url] | Displays the last lines of a file. Where path or url is<br>a file path or url to display. |
| shell:threads | [options] [id] | Prints the current threads (optionally with stacktraces). |
| shell:watch | [options] command | Watches & refreshes the output of a command. |
| shell:wc | [options] [files] | Prints newline, word, and byte counts for each file. |
| shell:while | condition function | Loops while the condition is true.Where:<br><br><ul> <li> <span>condition</span> is the condition of the loop</li> <li> <span>function</span> is the function to execute</li> </ul> |