Package Torello.Java

Class Shell


  • public class Shell
    extends java.lang.Object
    Shell - Documentation.

    This class simply converts many of the old UNIX-BASH shell commands into a Java usable interface. These are text-book examples of "Helper Functions" - in that they only save the end-user Java-Programmer a few lines of code, but they can be very useful in a Java-BASH or Java-UNIX environment, from time to time.

    See Wikipedia:



    Do note that one of the motivating forces for writing this methods is merely to serve as explanation and example of using Java's class 'Process'. Quite a bit of work was done writing the reader and monitor threads to ensure that the output of executing a UNIX command is collected and returned in a simple return class (class OSResponse). The returned class OSResponse contains three fields each containing information that is produced by executing a UNIX command.

    Pipes & File Redirects: This class does not handle any redirected input or output. There is actually somewhat a 'tiered' amount of complexity when it comes to either redirecting input or output from a command issued to the O/S via the class 'Process'. Java's class ProcessBuilder is actually quite usable, and further reading should definitely include the documentation for it. The first tier of complexity is that needed for basic File-System 'File Redirects.' These are handled quite easily using the inner-class 'ProcessBuilder.Redirect' which has three or four static (factory) methods for generating an instance of class 'Redirect' using a file-system file (java.io.File) as input.

    The inner-class 'Shell.XL' (short for extra-long) is actually a good addition / wrapper to the Java class java.lang.ProcessBuilder and can hopefully save a user quite a bit of time since the reader / monitor threads are still maintained for scanning the output - dependent upon which file-redirects are used. Note, however, that the methods inside Shell.XL will only handle file-redirects (for input, standard-output, and error-output). This means that other streams or pipes that are *not* associated with a file-system file cannot be handled by that class. For example, in UNIX it was common to 'pipe the output of one command into the input of another.' However, even when using class Shell.XL, such an feat is not possible.

    Generally, since this is largely a wrapper to a standard Java A.P.I. which has been around since early Java (Java 1.5) - and since the Java class java.lang.Process is itself just a wrapper around O/S native invocations - the level of complexity in writing such a generic and simple class in this JAR Library produces a situation where the wrapper becomes more complex than simply using the original class methods provided by the JDK.

    In Short: If the user would like to redirect input or output to / from the file-system, visit the class Shell.XL . However, if it is necessary to employ more complex pipes or redirects that don't involve piping input and output from a simple text or data-file, re-read Java's documentation for invoking operating system methods in the package java.lang.*; The classes listed below should be of use:

    • class java.lang.Runtime
    • class java.lang.Process
    • class java.lang.ProcessBuilder
    • class java.lang.ProcessBuilder.Redirect


    Other Commands: Using the COMMAND method provides a simple way for the user to invoke UNIX / Shell commands which are not listed or provided by class Shell (this class). It ought to be of note, that the primary reason for writing this class is to merely provide explanation, and additional example use of Java's A.P.I. for executing Shell Processes from within the Java Virtual Machine. Though quite a bit of effort was spent writing wrappers that read all of the output stream generated when invoking a process, these are for the large part, just wrapper methods that surround the already existing Java java.lang.Runtime and java.lang.Process classes.

    For example, the UNIX command 'cron' - a task scheduler that was commonly used way back - does not actually have a method listed in this class. If a situation where the 'cron' command suddenly needed to be called from within the JRE, simply invoking this method passing the value "cron" to input parameter 'COMMAND_NAME' (along with any required parameters to input-parameter 'args') would be how to do this.

    Example:
    1
    2
    3
    // This should start the cron service, and log level 1
    // Make sure the necessary configuration files have been created.
    Shell.COMMAND("cron", "-L", "1");
    

    Any number of other UNIX / Shell commands not available through the methods in this class may be invoked using this simple COMMAND method.

    Wildcard Issue: On most UNIX platforms, whenever a command is issued to the O/S (by typing it, for example, inside a terminal or terminal-window) there is an execution-stage before the process is spawned where file-name and / or directory-name wildcards (usually: '*' and '?') are expanded. When a UNIX command receives a parameter list, if the file and/or directories specified by the user contain a wild-card, those wild-cards shall have already been eliminated and replaced by the O/S before the actual command receives its parameter list. The arguments that the terminal command "sees" are the actual files and/or directories from which the wild-card expression expanded. A wild-card expression (like a "reg-ex expression") is replaced by the complete list of files before the command ever see that expression (usually!)

    Because of this situation, if a user would like, for instance, to copy or move a group of files (for example) - and use Java to do it, then a native Java A.P.I. such as the package java.nio.* (or the class FileNode A.P.I) is really the only way to ensure that wild-card expressions actually work. It is usually easiest to request an array (or a java.util.Stream) of files using the FileNode.flatten(...) routines, and then pass that to the UNIX command.

    Below is an example that uses this class 'TAR' command to create an archive of all '.java' files in the NodeSearch package of this jar-library. Please note that, at the UNIX command line, a simple wild-card would suffice, but when invoking a shell command from Java, the file-names will not be expanded.

    Example:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    import Torello.Java.*;
    import Torello.Java.FileNode.RetTypeChoice;
    import java.util.stream.*;
    import java.io.IOException;
    
    public class WildCards
    {
        public static void main(String[] argv) throws IOException
        {
            // This uses the 'FileNode' class to retrieve all '.java' source-files
            // that are located in directory "NodeSearch/", and any sub-directories it has.
            Stream<String> fileNames = FileNode
                .createRoot("Torello/HTML/NodeSearch/")
                .loadTree()
                .flattenJustFiles(RetTypeChoice.FULLPATH_STREAM, -1, (FileNode fn) -> fn.name.endsWith(".java"));
    
            // These are the rest of the parameters for the UNIX 'tar' (file-archive) command
            Stream<String> command = Stream.of("-cvf", "MySourceFiles.tar");
    
            // Creates a '.tar' of all java source files that were found.
            Shell.TAR(Stream.concat(command, fileNames).toArray(String[]::new));
        }
    }
    

    As long as the appendable static-field has not been reset of modified, the above code print the following output to terminal.

    UNIX or DOS Shell Command:
    tar -cvf MySourceFiles.tar Torello/HTML/NodeSearch/CSSStrException.java Torello/HTML/NodeSearch/TagNodePeekInclusive.java Torello/HTML/NodeSearch/TagNodeIterator.java Torello/HTML/NodeSearch/CommentNodeFind.java Torello/HTML/NodeSearch/InnerTagRemove.java Torello/HTML/NodeSearch/TagNodeGetInclusive.java Torello/HTML/NodeSearch/TextNodePoll.java Torello/HTML/NodeSearch/SecondModificationException.java Torello/HTML/NodeSearch/TagNodeGet.java Torello/HTML/NodeSearch/CommentNodePoll.java Torello/HTML/NodeSearch/TagNodePeekL1Inclusive.java Torello/HTML/NodeSearch/TextNodeFind.java Torello/HTML/NodeSearch/CommentNodeCount.java Torello/HTML/NodeSearch/TextNodePeek.java Torello/HTML/NodeSearch/TagNodeFind.java Torello/HTML/NodeSearch/IteratorOutOfBoundsException.java Torello/HTML/NodeSearch/AVT.java Torello/HTML/NodeSearch/package-info.java Torello/HTML/NodeSearch/InnerTagInclusiveIterator.java Torello/HTML/NodeSearch/InnerTagFindInclusive.java Torello/HTML/NodeSearch/InnerTagGetInclusive.java Torello/HTML/NodeSearch/TextNodeIterator.java Torello/HTML/NodeSearch/JS.java Torello/HTML/NodeSearch/HTMLNotFoundException.java Torello/HTML/NodeSearch/TagNodeFindL1Inclusive.java Torello/HTML/NodeSearch/TagNodeGetL1Inclusive.java Torello/HTML/NodeSearch/CommentNodeRemove.java Torello/HTML/NodeSearch/InnerTagRemoveInclusive.java Torello/HTML/NodeSearch/InnerTagPollInclusive.java Torello/HTML/NodeSearch/InnerTagFind.java Torello/HTML/NodeSearch/TextNodeGet.java Torello/HTML/NodeSearch/TagNodeCount.java Torello/HTML/NodeSearch/CommentNodePeek.java Torello/HTML/NodeSearch/InnerTagPeek.java Torello/HTML/NodeSearch/CommentNodeGet.java Torello/HTML/NodeSearch/InnerTagCount.java Torello/HTML/NodeSearch/InclusiveException.java Torello/HTML/NodeSearch/TagNodeRemove.java Torello/HTML/NodeSearch/TagNodeFindInclusive.java Torello/HTML/NodeSearch/HNLIInclusive.java Torello/HTML/NodeSearch/TextNodeCount.java Torello/HTML/NodeSearch/TCCompareStrException.java Torello/HTML/NodeSearch/CursorException.java Torello/HTML/NodeSearch/TagNodeRemoveInclusive.java Torello/HTML/NodeSearch/TextComparitor.java Torello/HTML/NodeSearch/CommentNodeIterator.java Torello/HTML/NodeSearch/InnerTagGet.java Torello/HTML/NodeSearch/TagNodeInclusiveIterator.java Torello/HTML/NodeSearch/ARGCHECK.java Torello/HTML/NodeSearch/InnerTagPoll.java Torello/HTML/NodeSearch/InnerTagPeekInclusive.java Torello/HTML/NodeSearch/AbstractHNLI.java Torello/HTML/NodeSearch/TagNodePeek.java Torello/HTML/NodeSearch/TagNodePoll.java Torello/HTML/NodeSearch/InnerTagIterator.java Torello/HTML/NodeSearch/HNLI.java Torello/HTML/NodeSearch/TagNodePollInclusive.java Torello/HTML/NodeSearch/TextNodeRemove.java Torello/HTML/NodeSearch/searchLoops/TNRemove.java Torello/HTML/NodeSearch/searchLoops/ITFind.java Torello/HTML/NodeSearch/searchLoops/CmtNPoll.java Torello/HTML/NodeSearch/searchLoops/ITGetIncl.java Torello/HTML/NodeSearch/searchLoops/ITFindIncl.java Torello/HTML/NodeSearch/searchLoops/TNFindL1Incl.java Torello/HTML/NodeSearch/searchLoops/TNGetL1Incl.java Torello/HTML/NodeSearch/searchLoops/TNPeekL1Incl.java Torello/HTML/NodeSearch/searchLoops/ITGet.java Torello/HTML/NodeSearch/searchLoops/TxNPeek.java Torello/HTML/NodeSearch/searchLoops/TNPeek.java Torello/HTML/NodeSearch/searchLoops/TxNGet.java Torello/HTML/NodeSearch/searchLoops/TNCount.java Torello/HTML/NodeSearch/searchLoops/TNPoll.java Torello/HTML/NodeSearch/searchLoops/TNGetIncl.java Torello/HTML/NodeSearch/searchLoops/TNFindIncl.java Torello/HTML/NodeSearch/searchLoops/CmtNFind.java Torello/HTML/NodeSearch/searchLoops/TxNFind.java Torello/HTML/NodeSearch/searchLoops/TNFind.java Torello/HTML/NodeSearch/searchLoops/TxNCount.java Torello/HTML/NodeSearch/searchLoops/TNGet.java Torello/HTML/NodeSearch/searchLoops/TNRemoveIncl.java Torello/HTML/NodeSearch/searchLoops/ITPeek.java Torello/HTML/NodeSearch/searchLoops/ITCount.java Torello/HTML/NodeSearch/searchLoops/TNPeekIncl.java Torello/HTML/NodeSearch/searchLoops/ITPeekIncl.java Torello/HTML/NodeSearch/searchLoops/TxNPoll.java Torello/HTML/NodeSearch/searchLoops/ITPollIncl.java Torello/HTML/NodeSearch/searchLoops/TNPollIncl.java Torello/HTML/NodeSearch/searchLoops/ITRemoveIncl.java Torello/HTML/NodeSearch/searchLoops/TxNRemove.java Torello/HTML/NodeSearch/searchLoops/CmtNRemove.java Torello/HTML/NodeSearch/searchLoops/CmtNGet.java Torello/HTML/NodeSearch/searchLoops/CmtNCount.java Torello/HTML/NodeSearch/searchLoops/ITPoll.java Torello/HTML/NodeSearch/searchLoops/CmtNPeek.java Torello/HTML/NodeSearch/searchLoops/ITRemove.java Torello/HTML/NodeSearch/CSSStrException.java Torello/HTML/NodeSearch/TagNodePeekInclusive.java Torello/HTML/NodeSearch/TagNodeIterator.java Torello/HTML/NodeSearch/CommentNodeFind.java Torello/HTML/NodeSearch/InnerTagRemove.java Torello/HTML/NodeSearch/TagNodeGetInclusive.java Torello/HTML/NodeSearch/TextNodePoll.java Torello/HTML/NodeSearch/SecondModificationException.java Torello/HTML/NodeSearch/TagNodeGet.java Torello/HTML/NodeSearch/CommentNodePoll.java Torello/HTML/NodeSearch/TagNodePeekL1Inclusive.java Torello/HTML/NodeSearch/TextNodeFind.java Torello/HTML/NodeSearch/CommentNodeCount.java Torello/HTML/NodeSearch/TextNodePeek.java Torello/HTML/NodeSearch/TagNodeFind.java Torello/HTML/NodeSearch/IteratorOutOfBoundsException.java Torello/HTML/NodeSearch/AVT.java Torello/HTML/NodeSearch/package-info.java Torello/HTML/NodeSearch/InnerTagInclusiveIterator.java Torello/HTML/NodeSearch/InnerTagFindInclusive.java Torello/HTML/NodeSearch/InnerTagGetInclusive.java Torello/HTML/NodeSearch/TextNodeIterator.java Torello/HTML/NodeSearch/JS.java Torello/HTML/NodeSearch/HTMLNotFoundException.java Torello/HTML/NodeSearch/TagNodeFindL1Inclusive.java Torello/HTML/NodeSearch/TagNodeGetL1Inclusive.java Torello/HTML/NodeSearch/CommentNodeRemove.java Torello/HTML/NodeSearch/InnerTagRemoveInclusive.java Torello/HTML/NodeSearch/InnerTagPollInclusive.java Torello/HTML/NodeSearch/InnerTagFind.java Torello/HTML/NodeSearch/TextNodeGet.java Torello/HTML/NodeSearch/TagNodeCount.java Torello/HTML/NodeSearch/CommentNodePeek.java Torello/HTML/NodeSearch/InnerTagPeek.java Torello/HTML/NodeSearch/CommentNodeGet.java Torello/HTML/NodeSearch/InnerTagCount.java Torello/HTML/NodeSearch/InclusiveException.java Torello/HTML/NodeSearch/TagNodeRemove.java Torello/HTML/NodeSearch/TagNodeFindInclusive.java Torello/HTML/NodeSearch/HNLIInclusive.java Torello/HTML/NodeSearch/TextNodeCount.java Torello/HTML/NodeSearch/TCCompareStrException.java Torello/HTML/NodeSearch/CursorException.java Torello/HTML/NodeSearch/TagNodeRemoveInclusive.java Torello/HTML/NodeSearch/TextComparitor.java Torello/HTML/NodeSearch/CommentNodeIterator.java Torello/HTML/NodeSearch/InnerTagGet.java Torello/HTML/NodeSearch/TagNodeInclusiveIterator.java Torello/HTML/NodeSearch/ARGCHECK.java Torello/HTML/NodeSearch/InnerTagPoll.java Torello/HTML/NodeSearch/InnerTagPeekInclusive.java Torello/HTML/NodeSearch/AbstractHNLI.java Torello/HTML/NodeSearch/TagNodePeek.java Torello/HTML/NodeSearch/TagNodePoll.java Torello/HTML/NodeSearch/InnerTagIterator.java Torello/HTML/NodeSearch/HNLI.java Torello/HTML/NodeSearch/TagNodePollInclusive.java Torello/HTML/NodeSearch/TextNodeRemove.java Torello/HTML/NodeSearch/searchLoops/TNRemove.java Torello/HTML/NodeSearch/searchLoops/ITFind.java Torello/HTML/NodeSearch/searchLoops/CmtNPoll.java Torello/HTML/NodeSearch/searchLoops/ITGetIncl.java Torello/HTML/NodeSearch/searchLoops/ITFindIncl.java Torello/HTML/NodeSearch/searchLoops/TNFindL1Incl.java Torello/HTML/NodeSearch/searchLoops/TNGetL1Incl.java Torello/HTML/NodeSearch/searchLoops/TNPeekL1Incl.java Torello/HTML/NodeSearch/searchLoops/ITGet.java Torello/HTML/NodeSearch/searchLoops/TxNPeek.java Torello/HTML/NodeSearch/searchLoops/TNPeek.java Torello/HTML/NodeSearch/searchLoops/TxNGet.java Torello/HTML/NodeSearch/searchLoops/TNCount.java Torello/HTML/NodeSearch/searchLoops/TNPoll.java Torello/HTML/NodeSearch/searchLoops/TNGetIncl.java Torello/HTML/NodeSearch/searchLoops/TNFindIncl.java Torello/HTML/NodeSearch/searchLoops/CmtNFind.java Torello/HTML/NodeSearch/searchLoops/TxNFind.java Torello/HTML/NodeSearch/searchLoops/TNFind.java Torello/HTML/NodeSearch/searchLoops/TxNCount.java Torello/HTML/NodeSearch/searchLoops/TNGet.java Torello/HTML/NodeSearch/searchLoops/TNRemoveIncl.java Torello/HTML/NodeSearch/searchLoops/ITPeek.java Torello/HTML/NodeSearch/searchLoops/ITCount.java Torello/HTML/NodeSearch/searchLoops/TNPeekIncl.java Torello/HTML/NodeSearch/searchLoops/ITPeekIncl.java Torello/HTML/NodeSearch/searchLoops/TxNPoll.java Torello/HTML/NodeSearch/searchLoops/ITPollIncl.java Torello/HTML/NodeSearch/searchLoops/TNPollIncl.java Torello/HTML/NodeSearch/searchLoops/ITRemoveIncl.java Torello/HTML/NodeSearch/searchLoops/TxNRemove.java Torello/HTML/NodeSearch/searchLoops/CmtNRemove.java Torello/HTML/NodeSearch/searchLoops/CmtNGet.java Torello/HTML/NodeSearch/searchLoops/CmtNCount.java Torello/HTML/NodeSearch/searchLoops/ITPoll.java Torello/HTML/NodeSearch/searchLoops/CmtNPeek.java Torello/HTML/NodeSearch/searchLoops/ITRemove.java Command exit with return value 0


    WORA Pledge: Although Java has always tried to maintain a "Write Once, Run Anywhere" (WORA) motto, there are cases where Java Byte-Codes are very Operating System dependent. Hopefully by the now, the reader understands that the methods in this class are in no way "Java-ized" versions of the listed UNIX System commands. The methods here are just wrappers that allow a programmer to make Operating System calls more easily - and retrieve their output. (And in fact, these wrappers are themselves just wrappers around the standard JDK java.lang.Process and java.lang.ProcessBuilder) classes.

    The bulk-work of the classes in this JAR Library were written and tested in a UNIX environment, but almost all of them are perfectly O/S independent, and running an HTML Parser in an MS DOS or an Apple environment should not present any problems. However, since this class is just a set of hooks into native Operating system calls, any invocation of these methods on a non-UNIX computer, or even a UNIX computer that does not have the indicated functions installed will just throw exceptions.

    Static (Functional) API: The methods in this class are all (100%) defined with the Java Key-Word / Key-Concept 'static'. Furthermore, there is no way to obtain an instance of this class, because there are no public (nor private) constructors. Java's Spring-Boot, MVC feature is *not* utilized because it flies directly in the face of the light-weight data-classes philosophy. This has many advantages over the rather ornate Component Annotations (@Component, @Service, @AutoWired, etc... 'Java Beans') syntax:

    • The methods here use the key-word 'static' which means (by implication) that there is no internal-state. Without any 'internal state' there is no need for constructors in the first place! (This is often the complaint by MVC Programmers).
    • A 'Static' (Functional-Programming) API expects to use fewer data-classes, and light-weight data-classes, making it easier to understand and to program.
    • The Vectorized HTML data-model allows more user-control over HTML parse, search, update & scrape. Also, memory management, memory leakage, and the Java Garbage Collector ought to be intelligible through the 'reuse' of the standard JDK class Vector for storing HTML Web-Page data.

    The power that object-oriented programming extends to a user is (mostly) limited to data-representation. Thinking of "Services" as "Objects" (Spring-MVC, 'Java Beans') is somewhat 'over-applying' the Object Oriented Programming Model. Like most classes in the Java-HTML JAR Library, this class backtracks to a more C-Styled Functional Programming Model (no Objects) - by re-using (quite profusely) the key-word static with all of its methods, and by sticking to Java's well-understood class Vector

    Static Fields: The methods in this class do not create any internal state that is maintained - however there are a few private & static fields defined. These fields are instantiated only once during the Class Loader phase (and only if this class shall be used), and serve as data 'lookup' fields (static constants). View this class' source-code in the link provided below to see internally used data.

    There is one public, static, final boolean constant that is informs the user whether this class has been loaded onto a UNIX platform.

    There is also public, static Appendable for directing text-output from the invocation of these methods to terminal, or a logger (such as a StorageWriter).
    See Also:
    Shell.XL, OSResponse, OSResponse.stdOut, OSResponse.stdErr, OSResponse.response, FileNode



    • Field Detail

      • unix

        public static final boolean unix
        If Java is not running on a UNIX machine, the terminal output that contains "color" will not function. If it does not, then the Shell color commands will default to empty, zero-length strings.
        Code:
        Exact Field Declaration Expression:
        1
        public static final boolean unix;
        
      • appendable

        public static java.lang.Appendable appendable
        This is an instance of java.lang.Appendable that will accept log text generated from the methods in this class. Following the static API principle does result in one drawback, thus far. This class contains 100% static methods and fields. There are no instantiations or constructed instances of this class. However, since this class has the ability to send text to a terminal (like System.out, for instance); a global, static field (this field) has been created to make it easy for the output from these Operating System commands to printed to the screen, or just about anywhere (using this Appendable).

        ISSUE: Though this global, static 'log' is automatically used for printing by the methods in this class, and although this log may be configured using any Object that implements the interface java.lang.Appendable, this does have one ramification. If multiple java Thread's are making calls to the methods in this class, and the JVM changes the Thread that is running - the output that is sent to the 'log' (if it were being printed to the screen, for instance) might look like it has suddenly 'jumped' from one java.lang.Process to another.

        RETURN-VALUES NOT-AFFECTED: The primary feature to think about is that the values (instances of OSResponse) are all very Thread-safe. Quite a bit of care has been taken to ensure that when invoking an Operating-System level process, there are no potential hangs, locks, or other problems from this multi-threaded method calling. It is only the "general log" that will not look so nice if multiple threads are making calls to the methods in this class at the same time.

        HOW TO SOLVE:

        1. Don't make invocations to this class from different Java Thread's, and expect terminal-output (or wherever the text is sent) to look so nice.
        2. Register a non-printing Appendable to this field, and accept that the output being sent to this log will not look so great if multiple Thread's are writing to this same log at the same time.
        3. If multiple threads need to make O/S calls at the same time, *AND*, you would like to be able to log the text-output that would normally be sent to the screen, use the OSResponse instances returned by the methods to retrieve the Standard Output and Standard-Error text; and send that text to a log of your own devices. The actual return values from the methods in this class are all 100% Thread Safe. (Again, it is just this global log-Appendable field that is not).
        4. Write the String[] array commands without using this class, and make direct invocations to OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT, and control all the output printing in your code.

        This parameter expects an implementation of Java's interface java.lang.Appendable which allows for a wide range of options when logging intermediate messages.
        Class or Interface InstanceUse & Purpose
        'System.out'Sends text to the standard-out terminal
        Torello.Java.StorageWriterSends text to System.out, and saves it, internally.
        FileWriter, PrintWriter, StringWriterGeneral purpose java text-output classes
        FileOutputStream, PrintStreamMore general-purpose java text-output classes

        IMPORTANT: The interface Appendable requires that the check exception IOException must be caught when using its append(CharSequence) methods.
        See Also:
        StorageWriter
        Code:
        Exact Field Declaration Expression:
        1
        public static Appendable appendable = System.out;
        
    • Method Detail

      • CP

        public static OSResponse CP​(java.lang.String src,
                                    java.lang.String target)
                             throws java.io.IOException
        UNIX Shell Command: Copy

        UNIX or DOS Shell Command:
        $ cp <src> <target>
        Parameters:
        src - UNIX/Linux/BASH-Shell 'cp' command's "source" argument
        target - The 'cp' command "target" argument
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(String[], Appendable)
        Code:
        Exact Method Body:
        1
         return OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(new String[] { "cp", src, target }, appendable);
        
      • CP

        public static OSResponse CP​(java.util.Vector<java.lang.String> src,
                                    java.lang.String target)
                             throws java.io.IOException
        UNIX Shell Command: Copy

        UNIX or DOS Shell Command:
        $ cp <src.elementAt(0)> <src.elementAt(1)> ... <src.elementAt(src.size()-1)> <target>
        Parameters:
        src - This may be a list of files to be copied to a target directory
        target - This is the target directory for the files listed.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(String[], Appendable)
        Code:
        Exact Method Body:
        1
        2
        3
        4
        5
        6
         String[] command = new String[src.size() + 2];
         command[0] = "cp";
         command[src.size() + 1] = target;
         for (int i=0; i < src.size(); i++) command[1 + i] = src.elementAt(i);
        
         return OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(command, appendable);
        
      • CP

        public static OSResponse CP​(java.lang.String[] src,
                                    java.lang.String target)
                             throws java.io.IOException
        UNIX Shell Command: Copy

        UNIX or DOS Shell Command:
        $ cp <src[0]> <src[1]> ... <src[src.length-1]> <target>
        Parameters:
        src - This may be a list of files to be copied to a target directory
        target - This is the target directory for the files listed.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(String[], Appendable)
        Code:
        Exact Method Body:
        1
        2
        3
        4
        5
        6
         String[] command = new String[src.length + 2];
         command[0] = "cp";
         command[src.length + 1] = target;
         for (int i=0; i < src.length; i++) command[1 + i] = src[i];
        
         return OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(command, appendable);
        
      • LS

        public static OSResponse LS​(java.lang.String fileOrDir)
                             throws java.io.IOException
        UNIX Shell Command: List

        UNIX or DOS Shell Command:
        $ ls <fileOrDir>
        Parameters:
        fileOrDir - This is the file OR directory to be searched.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(String[], Appendable)
        Code:
        Exact Method Body:
        1
         return OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(new String[] { "ls", fileOrDir }, appendable);
        
      • LS

        public static OSResponse LS​(java.lang.String fileOrDir,
                                    java.lang.String switches)
                             throws java.io.IOException
        UNIX Shell Command: List

        UNIX or DOS Shell Command:
        $ ls <switches> <fileOrDir>
        Parameters:
        fileOrDir - This is the file OR directory to be searched.
        switches - These are switches that are added to the command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(String[], Appendable)
        Code:
        Exact Method Body:
        1
         return OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(new String[] { "ls", switches, fileOrDir }, appendable);
        
      • MV

        public static OSResponse MV​(java.lang.String src,
                                    java.lang.String target)
                             throws java.io.IOException
        UNIX Shell Command: Move

        UNIX or DOS Shell Command:
        $ mv <src> <target>
        Parameters:
        src - The first String in a typical UNIX 'move' command. It is the "source file"
        target - The second String for a "move." This is the destination or target.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(String[], Appendable)
        Code:
        Exact Method Body:
        1
         return OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(new String[] { "mv", src, target }, appendable);
        
      • MV

        public static OSResponse MV​(java.util.Vector<java.lang.String> src,
                                    java.lang.String target)
                             throws java.io.IOException
        UNIX Shell Command: Move

        UNIX or DOS Shell Command:
        $ mv <src.elementAt(0)> <src.elementAt(1)> ... <src.elementAt(src.size()-1)> <target>
        Parameters:
        src - The first String in a typical UNIX 'move' command. It is the "source file" - In this method, it is a list of files and expressions saved as a Vector.
        target - The second String for a 'move' UNIX command, and it is the target destination of the source-file.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(String[], Appendable)
        Code:
        Exact Method Body:
        1
        2
        3
        4
        5
        6
         String[] command = new String[src.size() + 2];
         command[0] = "mv";
         command[src.size() + 1] = target;
         for (int i=0; i < src.size(); i++) command[1 + i] = src.elementAt(i);
        
         return OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(command, appendable);
        
      • MV

        public static OSResponse MV​(java.lang.String[] src,
                                    java.lang.String target)
                             throws java.io.IOException
        UNIX Shell Command: Move

        UNIX or DOS Shell Command:
        $ mv <src[0]> <src[1]> ... <src[src.length-1]> <target>
        Parameters:
        src - The first String in a typical UNIX 'move' command. It is the "source file" - In this method, it is a list of files and expressions saved as an array.
        target - The second String for a UNIX 'move' command, and it is the target destination
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(String[], Appendable)
        Code:
        Exact Method Body:
        1
        2
        3
        4
        5
        6
         String[] command = new String[src.length + 2];
         command[0] = "mv";
         command[src.length + 1] = target;
         for (int i=0; i < src.length; i++) command[1 + i] = src[i];
        
         return OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(command, appendable);
        
      • RM

        public static OSResponse RM​(java.lang.String s1)
                             throws java.io.IOException
        UNIX Shell Command: Remove

        UNIX or DOS Shell Command:
        $ rm <s1>
        Parameters:
        s1 - The item to be removed, using a UNIX operating-system command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(String[], Appendable)
        Code:
        Exact Method Body:
        1
         return OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(new String[] { "rm", s1 }, appendable);
        
      • RM

        public static OSResponse RM​(java.lang.String[] sArr)
                             throws java.io.IOException
        UNIX Shell Command: Remove

        UNIX or DOS Shell Command:
        $ rm <sArr[0]> <sArr[1]> ... <sArr[sArr.length-1]>
        Parameters:
        sArr - An String[] array which is added to the end of this UNIX command. These will be the item(s) removed by the UNIX 'RM' command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(String[], Appendable)
        Code:
        Exact Method Body:
        1
        2
        3
        4
        5
         String[] command = new String[sArr.length + 1];
         command[0] = "rm";
         for (int i=0; i < sArr.length; i++) command[i + 1] = sArr[i];
        
         return OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(command, appendable);
        
      • RM

        public static OSResponse RM​(java.util.Vector<java.lang.String> v)
                             throws java.io.IOException
        UNIX Shell Command: Remove

        UNIX or DOS Shell Command:
        $ rm <src.elementAt(0)> <src.elementAt(1)> ... <src.elementAt(src.size()-1)>
        Parameters:
        v - A Vector<String> that contains command-line-parameters which are added, sequentially, to the end of this UNIX command. The String's in this Vector are the item(s) to be removed by the UNIX 'RM' command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(String[], Appendable)
        Code:
        Exact Method Body:
        1
        2
        3
        4
        5
         String[] command = new String[v.size() + 1];
         command[0] = "rm";
         for (int i=0; i < v.size(); i++) command[i + 1] = v.elementAt(i);
        
         return OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(command, appendable);
        
      • RM

        public static OSResponse RM​(java.lang.String s1,
                                    java.lang.String switches)
                             throws java.io.IOException
        UNIX Shell Command: Remove

        UNIX or DOS Shell Command:
        $ rm <switches> <s1>
        Parameters:
        s1 - A file or directory parameter passed to 'RM'
        switches - These are switches (for-instance: -R, recursive).
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(String[], Appendable)
        Code:
        Exact Method Body:
        1
         return OSResponse.PRINT_CMD_RUN_CMD_PRINT_OUTPUT(new String[] { "rm", switches, s1 }, appendable);
        
      • TAR

        public static OSResponse TAR​(java.lang.String... args)
                              throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: tar

        UNIX or DOS Shell Command:
        $ tar <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("tar", args);
        
      • JAR

        public static OSResponse JAR​(java.lang.String... args)
                              throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: jar

        UNIX or DOS Shell Command:
        $ jar <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("jar", args);
        
      • GREP

        public static OSResponse GREP​(java.lang.String... args)
                               throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: grep

        UNIX or DOS Shell Command:
        $ grep <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("grep", args);
        
      • FIND

        public static OSResponse FIND​(java.lang.String... args)
                               throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: find

        UNIX or DOS Shell Command:
        $ find <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("find", args);
        
      • DU

        public static OSResponse DU​(java.lang.String... args)
                             throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: du

        UNIX or DOS Shell Command:
        $ du <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("du", args);
        
      • DF

        public static OSResponse DF​(java.lang.String... args)
                             throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: df

        UNIX or DOS Shell Command:
        $ df <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("df", args);
        
      • SED

        public static OSResponse SED​(java.lang.String... args)
                              throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: sed

        UNIX or DOS Shell Command:
        $ sed <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("sed", args);
        
      • WHATIS

        public static OSResponse WHATIS​(java.lang.String... args)
                                 throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: whatis

        UNIX or DOS Shell Command:
        $ whatis <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("whatis", args);
        
      • WHEREIS

        public static OSResponse WHEREIS​(java.lang.String... args)
                                  throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: whereis

        UNIX or DOS Shell Command:
        $ whereis <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("whereis", args);
        
      • VMSTAT

        public static OSResponse VMSTAT​(java.lang.String... args)
                                 throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: vmstat

        UNIX or DOS Shell Command:
        $ vmstat <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("vmstat", args);
        
      • PS

        public static OSResponse PS​(java.lang.String... args)
                             throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: ps

        UNIX or DOS Shell Command:
        $ ps <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("ps", args);
        
      • DIFF

        public static OSResponse DIFF​(java.lang.String... args)
                               throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: diff

        UNIX or DOS Shell Command:
        $ diff <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("diff", args);
        
      • CMP

        public static OSResponse CMP​(java.lang.String... args)
                              throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: cmp

        UNIX or DOS Shell Command:
        $ cmp <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("CMP", args);
        
      • FREE

        public static OSResponse FREE​(java.lang.String... args)
                               throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: free

        UNIX or DOS Shell Command:
        $ free <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("free", args);
        
      • CHOWN

        public static OSResponse CHOWN​(java.lang.String... args)
                                throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: chown

        UNIX or DOS Shell Command:
        $ chown <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("chown", args);
        
      • CHMOD

        public static OSResponse CHMOD​(java.lang.String... args)
                                throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: chmod

        UNIX or DOS Shell Command:
        $ chmod <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("chmod", args);
        
      • UNZIP

        public static OSResponse UNZIP​(java.lang.String... args)
                                throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: unzip

        UNIX or DOS Shell Command:
        $ unzip <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("unzip", args);
        
      • GZIP

        public static OSResponse GZIP​(java.lang.String... args)
                               throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: gzip

        UNIX or DOS Shell Command:
        $ gzip <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("gzip", args);
        
      • SORT

        public static OSResponse SORT​(java.lang.String... args)
                               throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: sort

        UNIX or DOS Shell Command:
        $ sort <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("sort", args);
        
      • JAVAC

        public static OSResponse JAVAC​(java.lang.String... args)
                                throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: javac

        UNIX or DOS Shell Command:
        $ javac <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("javac", args);
        
      • JAVADOC

        public static OSResponse JAVADOC​(java.lang.String... args)
                                  throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: javadoc

        UNIX or DOS Shell Command:
        $ javadoc <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("javadoc", args);
        
      • JAVA

        public static OSResponse JAVA​(java.lang.String... args)
                               throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: java

        UNIX or DOS Shell Command:
        $ java <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("java", args);
        
      • TIME

        public static OSResponse TIME​(java.lang.String... args)
                               throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: time

        UNIX or DOS Shell Command:
        $ time <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("java", args);
        
      • DATE

        public static OSResponse DATE​(java.lang.String... args)
                               throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: date

        UNIX or DOS Shell Command:
        $ date <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("java", args);
        
      • TRACEROUTE

        public static OSResponse TRACEROUTE​(java.lang.String... args)
                                     throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: traceroute

        UNIX or DOS Shell Command:
        $ traceroute <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("traceroute", args);
        
      • FSCK

        public static OSResponse FSCK​(java.lang.String... args)
                               throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: fsck

        UNIX or DOS Shell Command:
        $ fsck <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("fsck", args);
        
      • NSLOOKUP

        public static OSResponse NSLOOKUP​(java.lang.String... args)
                                   throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: nslookup

        UNIX or DOS Shell Command:
        $ nslookup <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("nslookup", args);
        
      • PING

        public static OSResponse PING​(java.lang.String... args)
                               throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command: ping

        UNIX or DOS Shell Command:
        $ ping <args[0]> <args[1]> ... <args[args.length-1]>
        Parameters:
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE("ping", args);
        
      • COMMAND

        public static OSResponse COMMAND​(java.lang.String COMMAND_NAME,
                                         java.lang.String... args)
                                  throws java.io.IOException
        Runs the UNIX / BASH / LINUX 'shell' command named by the input parameter COMMAND_NAME.

        UNIX or DOS Shell Command:
        $ java <args[0]> <args[1]> ... <args[args.length-1]>


        Other Commands: Using the COMMAND method provides a simple way for the user to invoke UNIX / Shell commands which are not listed or provided by class Shell (this class). It ought to be of note, that the primary reason for writing this class is to merely provide explanation, and additional example use of Java's A.P.I. for executing Shell Processes from within the Java Virtual Machine. Though quite a bit of effort was spent writing wrappers that read all of the output stream generated when invoking a process, these are for the large part, just wrapper methods that surround the already existing Java java.lang.Runtime and java.lang.Process classes.

        For example, the UNIX command 'cron' - a task scheduler that was commonly used way back - does not actually have a method listed in this class. If a situation where the 'cron' command suddenly needed to be called from within the JRE, simply invoking this method passing the value "cron" to input parameter 'COMMAND_NAME' (along with any required parameters to input-parameter 'args') would be how to do this.

        Example:
        1
        2
        3
        // This should start the cron service, and log level 1
        // Make sure the necessary configuration files have been created.
        Shell.COMMAND("cron", "-L", "1");
        

        Any number of other UNIX / Shell commands not available through the methods in this class may be invoked using this simple COMMAND method.
        Parameters:
        COMMAND_NAME - This is the name of any UNIX command not already listed inside this class.
        args - Any set of switches and/or arguments to this BASH command.
        Returns:
        Returns an instance of OSResponse. This response-Object (data-record) class holds three public, final fields:
        Process response-code
        Text sent to Standard-Output (as a java.lang.String)
        Text sent to Error-Output (also as a String)

        This OSResponse instance may be discarded without any effect on Process Execution. It is only provided as a convenience in case more information is required about the results of the O/S command invocation.

        Process Status: Upon completion of this method, the Operating-System java.lang.Process is guaranteed to have run to completion.
        Throws:
        java.io.IOException
        See Also:
        ARGS_PLUS_ONE(String, String[])
        Code:
        Exact Method Body:
        1
         return ARGS_PLUS_ONE(COMMAND_NAME, args);