Close
Register
Close Window

Programming Basics: Background and Repetition

Chapter 1 Java Programming, repetition

Show Source |    | About   «  Chapter 1 Java Programming, repetition   ::   Contents   ::   1.2. Parsing Command Line Parameters In Your Program  »

1.1. Command Line Basics

1.1.1. What’s A CLI?

A Command Line Interface or CLI is a simple text only interface. A user provides a command with or without some additional information and then the command is executed.

Basics:

1. When you execute a command you must type the name of the command. In addition the command must be located in your PATH.

  • What’s a PATH? A PATH is a list of directories where executables will be located. Common directories in PATH are /bin/ and /usr/bin/.

2. When you execute a command, you often will need to provide additional information in the form of arguments.

Common arguments

Meanings

-h

displays help information

-v

increases information output, v is for verbosity

--version

displays version information


Below is an example of running

file -h
The argument -h usually displays basic help information

Figure 1.2.1: The argument -h is often used to display basic help information

  1. If you can not get enough information from the -h argument you can make use of the man (for manual) command (*). The man command takes the name of a command as an argument and brings up its manual page. This contains a more in depth explanation of the command and its usage.

    Below is an example of running

    man ls
    
    An example of the man command

    Figure 1.2.2: The man command is extremely useful for learning about the syntax/usage of a command

Further reading:

This was a very brief introduction to the terminal. It was included only to give some context to further chapters that make use of arguments. For more information feel free to check this resource.

*

The man command should be available in any GNU-style terminal. If you are using Windows the native Command Prompt does not have a man command.


   «  Chapter 1 Java Programming, repetition   ::   Contents   ::   1.2. Parsing Command Line Parameters In Your Program  »

nsf
Close Window