Introduction to Bash
The command line is provided by a program called the shell. Over the long history of UNIX-like system, many shells have been developed. The default shell for users in Red Hat Enterprise Linux is bash, the GNU Bourne-Again Shell. The bash shell is an improved version of one of the most successful shells used on UNIX-like system, the Bourne Shell (sh).
Note: The bash shell is similar like cmd.exe in windows.
Using the Command Line
Commands are entered in terminal at the shell prompt. The standard prompt lists the login name of the current user, the short hostname of the machine, the name of the current directory in square brackets, followed by a $ prompt.
[student@host ~]$
The $ is replaced by a # if the shell is running as the superuser, root, to make it more obvious that it is a superuser shell (which helps to avoid accidents and mistakes in that very powerful account).
[root@host ~]#
Commands entered at the shell prompt have three basic parts:
1. Command
2. Options
3. Arguments
The Commands is the name of the program to run. It may be followed by one or more Option which adjust the behavior of the command or what it will do. Options normally start with one or two dashes(-a or --all, for example) to distinguish them from arguments. Commands may also be followed by one or more Arguments which often indicate a target that the command should operate on.
usermod -1 naresh
Here usermod is a Command, -1 is a Option, and naresh is a Argument.
At first glance, usage statements may seem complicated and difficult to read. However, they became much simpiler to understand once is familar with a few basic conventions.
1. Anything in square braces ([]) is Optional.
2. Anything followed by ... represented an arbitrary-length list of that thing.
3. If you see multiple Option s separated by pipes (|) it means you can choose any one of them.
4. Text in angle brackets (<>) represented variable data. So <filename> means "insert the filename you wish to use here". Sometimes such varibles are simply written in all caps (e.g. FILENAME).
So, looking at the first usage statement for the date command.
date --help
date [option]... [+FORMAT]
The command line is provided by a program called the shell. Over the long history of UNIX-like system, many shells have been developed. The default shell for users in Red Hat Enterprise Linux is bash, the GNU Bourne-Again Shell. The bash shell is an improved version of one of the most successful shells used on UNIX-like system, the Bourne Shell (sh).
Note: The bash shell is similar like cmd.exe in windows.
Using the Command Line
Commands are entered in terminal at the shell prompt. The standard prompt lists the login name of the current user, the short hostname of the machine, the name of the current directory in square brackets, followed by a $ prompt.
[student@host ~]$
The $ is replaced by a # if the shell is running as the superuser, root, to make it more obvious that it is a superuser shell (which helps to avoid accidents and mistakes in that very powerful account).
[root@host ~]#
Commands entered at the shell prompt have three basic parts:
1. Command
2. Options
3. Arguments
The Commands is the name of the program to run. It may be followed by one or more Option which adjust the behavior of the command or what it will do. Options normally start with one or two dashes(-a or --all, for example) to distinguish them from arguments. Commands may also be followed by one or more Arguments which often indicate a target that the command should operate on.
usermod -1 naresh
Here usermod is a Command, -1 is a Option, and naresh is a Argument.
At first glance, usage statements may seem complicated and difficult to read. However, they became much simpiler to understand once is familar with a few basic conventions.
1. Anything in square braces ([]) is Optional.
2. Anything followed by ... represented an arbitrary-length list of that thing.
3. If you see multiple Option s separated by pipes (|) it means you can choose any one of them.
4. Text in angle brackets (<>) represented variable data. So <filename> means "insert the filename you wish to use here". Sometimes such varibles are simply written in all caps (e.g. FILENAME).
So, looking at the first usage statement for the date command.
date --help
date [option]... [+FORMAT]
Comments
Post a Comment