Bash Hello World! Script Tutorial

As with any Programming or Scripting Language, let us take a look at the very basic two lines script called "Hello World!" in Bash!

The best way to learn and write Shell Scripts is by making use of editors like vi or nano, in this example, we will make use of nano,

Step by Step Hello World! Bash Scripting Example

  1. Open Terminal,
    Step 1 - Open Terminal
  2. Type nano and press enter, this will open Nano Editor for you,
    Step 2 - Open Nano
  3. Write the below code,
    echo Hello World!
    Step 3 - Write Hello World code
  4. Press Control + X and then Y to save.
  5. Now run command chmod +x just to make sure we can execute this script,
  6. Type ./
Result of running bash hello world script

Congratulations! You ran you first bash script successfully!

Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.