ls: Lists the contents of the current lsĬheck_plaindrome.sh count_odd.sh env log temp.Let's discuss a few basic bash commands and see their outputs.
Generally, commands follow this syntax: command arguments You can enter any command after the $ sign and see the output on the terminal. How to Get Started with Bash Scripting Running Bash commands from the command lineĪs mentioned earlier, the shell prompt looks something like this: ~]$
Note: In this tutorial, we will be using the "bash" shell. In summary, while "shell" is a broad term that refers to any program that provides a command-line interface, "Bash" is a specific type of shell that is widely used in Unix/Linux systems. Here is the output for me: Checking the shell type. You can determine your shell type using the ps command: ps Each shell has its own syntax and set of features, but they all share the common purpose of providing a command-line interface for interacting with the operating system. The superuser shell prompt looks like this: ~]#Īlthough Bash is a type of shell, there are other shells available as well, such as Korn shell (ksh), C shell (csh), and Z shell (zsh). If the shell is running as root (a user with administrative rights), the prompt is changed to #. When a shell is used interactively, it displays a $ when it is waiting for a command from the user. In the above output, is the shell prompt. Bash (Bourne-Again SHell) is one of the most commonly used Unix/Linux shells and is the default shell in many Linux distributions.Ī shell or command-line interface looks like this: The shell accepts commands from the user and displays the output The term "shell" refers to a program that provides a command-line interface for interacting with an operating system. But there is a subtle difference between the two. The terms "shell" and "bash" are used interchangeably. Overview of Bash shell and command line interface
To follow along with this tutorial, you should have the following accesses: Resources for learning more about Bash scripting.
How to Debug and Troubleshoot Bash Scripts.How to Run Bash Commands from the Command Line.Overview of Bash shell and command line interface.We'll also see examples of each along the way. In this article, we'll start with the basics of bash scripting which includes variables, commands, inputs/ outputs, and debugging. This involves creating a file containing a series of commands that can be executed together. In Linux, process automation relies heavily on shell scripting.