JTerm desktop

A Java environment with Linux shell

Using JTerm desktop

JTerm is a desktop with major Linux commands implemented in Java. It is available for any platform where Java can be used. Running the JTerm desktop on Windows will give you Unix/Linux-like work environment. The program is fully integrated with Java and BeanShell.


JTerm supports basic Unix/Linux commands

List files and directories

ls [dir] - list files and directories (+Linux options). Example:
> ls -la /home   # show output in terminal
> ls -la >  a.txt # redirect output to a.txt   
> ls -la >> a.txt # append output to a.txt
> ls /home |      # put to memory (pipe) 
> printPipe       # print memory pipe  


ed - start a simple editor. Argument is a file or URL. Example:
>ed a.txt
- open a txt file in editor. The editor has a syntax highlighting for all major file types.

Show current directory

pwd - show the current directory

Changing directory

cd - change the current directory

Moving files

mv [file1] [file2] - move file to another file

Copy files

cp [file1] [file2] - copy from file1 to file2

Removing files /directories

rm [file] - file or directory
rm -r [dir] - delete folder (and sub-folters) recursively (attention!)
You can use the option "v" for some verbose printout. Be careful with the option "-r".


cat [file]- print the content of the file
echo "text" - print the content of the String
print "text"- print the content of the String

Print newline, word and character counts

wc [OPTION] FILE - Print newline, word, and number of characters for each FILE. Example:
wc file.txt- print the number of lines in the file.txt

The options can be:

-l - number of lines
-w - number of words
-m - number of characters

Copying from the Web

wget URL - download a file from the web using URL

Find files and directories

find - search for files in a directory hierarchy.

find [option] [dir] [pattern] - find a file or directory recursively. Examples:

> find -d *         # all directories starting from the current
> find -f *.jar        # all files in the current directory
> file -f /user/ *.jar # all files starting from directory user. 
> file -i /user/ *.jar # all found entries ignoring the case 
The following standard Unix/Linux options can be used:
-i (--ignoreCase)    -z (--print0)    -r (--regex) 
-d (--typeDirectory) -f (--typeFile)  -s (--typeSymlink)
-m (--timeModified)  -o (--timeOlder)
No mixing options is currently allowed. One can also use > file and >> file to redirect the outputs to files. You can also keep the ouputs in pipe using | command. This is an example:
> find *.jar >> file # append all outputs to file
> find *.jar |       # put the output to pipe
> printPipe          # print the pipe 

Grep command

grep searches the named input FILEs for lines containing a match to the given PATTERN.
Options are:

-i --ignoreCase - match lines ignoring the case when comparing the strings

-v --invertMatch - invert the match result, that is, a non-matching line is written to the output and a matching line is not

-n --lineNumber - prefix each line of output with the line number within its input file

-c --count - suppress normal output; instead print a count of matching lines for each input file

-l --matchingFiles - suppress normal output; instead print the name of each input file

-x --wholeLine - select only those matches that exactly match the whole line

The options can be mixed (2 levels). Examples:

grep -i "test" build.xml
searches for word "test" inside the file "build.xml" You can redirect the outputs to files using > and >> operands.

Running jar files

To execute self-contained Java jar file, simply type the name of the jar file and press enter:
file.jar which will run Java program from the given Jar file. Example:
> wget http://jwork.org/jterm/ekit.jar 
> ekit.jar  
Press enter to launch this jar file. It will start an HTML editor from the file "ekit.jar". As you can see, JTerm treat jar files as executable "exe" files.

All such commands should work under Windows, since they are mapped to the corresponding bsh commands.

Updating JTerm

To update JTerm without downloading zip file, type
> update
It will download the updated version and exit the application. Then you can start it again.

External commands

Use ! in front of any external program. Examples:
!latex - will execute latex
!make - will execute make file
!gv - will start gv

Beanshell commands

To execute a BeanShell script, just type "script.bsh". This will execute this script (i.e. you do not need to use the standard BeanShell source command).

User scripts written in BeanShell can be put to the "macros" directory. For example, there is a script test.bsh. Run it as: test();

Working with BeanShell

JTerm supports BeanShell Java scripting. Look at BeanShell documentstion.

Posted by jwork.org on Jun 01, 2015
Tags: JTerm