The purpose of this article is to provide the reader with a fast and simple introduction to using
the Linux command shell and some of its basic utilities. It is assumed that the reader has zero or
very limited exposure to the Linux command prompt.
- A program that interprets commands
- Allows a user to execute commands by typing them manually at a terminal, or automatically in programs called shell scripts.
- A shell is not an operating system. It is a way to interface with the operating system and run commands.
What is BASH?
BASH = Bourne Again SHell
- Bash is a shell written as a free replacement to the standard Bourne Shell (/bin/sh) originally written by Steve Bourne for UNIX systems.
- It has all of the features of the original Bourne Shell, plus additions that make it easier to program with and use from the command line.
- Since it is Free Software, it has been adopted as the default shell on most Linux systems.
BASH different from the DOS command prompt in following areas
- Case Sensitivity: In Linux/UNIX, commands and filenames are case sensitive, meaning that typing “EXIT” instead of the proper “exit” is a mistake.
- “” vs. “/”: In DOS, the forward-slash “/” is the command argument delimiter, while the backslash “” is a directory separator. In Linux/UNIX, the “/” is the directory separator, and the “” is an escape character. More about these special characters in a minute!
- Filenames: The DOS world uses the “eight dot three” filename convention, meaning that all files followed a format that allowed up to 8 characters in the filename, followed by a period (“dot”), followed by an option extension, up to 3 characters long (e.g. FILENAME.TXT). In UNIX/Linux, there is no such thing as a file extension. Periods can be placed at any part of the filename, and “extensions” may be interpreted differently by all programs, or not at all.
Lets check out the command path and command syntax with examples
The Command PATH:
Most common commands are located in your shell’s “PATH”, meaning that you can just type the name of the program to execute it.
Example: Typing “ ls” will execute the “ ls” command.
Your shell’s “PATH” variable includes the most common program locations, such as
/bin, /usr/bin, /usr/X11R6/bin, and others.
To execute commands that are not in your current PATH, you have to give the complete
location of the command.
./program (Execute a program in the current directory)
~/bin/program (Execute program from a personal bin directory)
Commands can be run by themselves, or you can pass in additional arguments to make them do different things. Typical command syntax can look something like this:
command [-argument] [-argument] [–argument] [file]
Examples: ls List files in current directory
ls -l Lists files in “long” format
ls -l –color As above, with colourized output
cat filename Show contents of a file
cat -n filename Show contents of a file, with line numbers.
Hope you liked this article.
Stay tuned for more.