Close
Register
Close Window

OpenDSA Modules Collection with Slides

Chapter 3 Programming Tutorials

Show Source |    | About   «  2.2. Spotlight: Francis Bacon   ::   Contents   ::   3.2. Parsing Command Line Parameters In Your Progam  »

3.1. Command Line Basics

3.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 exectued.

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, in these directories executables will be located. Common directories are /bin/, /usr/bin/

2. When you execute a command, you often will need to provide additional information. These are called arguments.

Common Arguments Meanings
-h displays help information
-v increases information output, v is for verbosity, or in some cases displays version information

-h is commonly called the help switch. It displays basic help informatio

Figure 3.1.1: The -h switch is often used to display basic help information

3. If you can not get enough information from the -h argument you can make use of the man command. The man command brings up the man page for information and is a more in depth explanation of the command. Below is an example of running

man ls

4. 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.

An example of the man command

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

*Note: 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.


   «  2.2. Spotlight: Francis Bacon   ::   Contents   ::   3.2. Parsing Command Line Parameters In Your Progam  »

nsf
Close Window