Simple Linux Script

a minute read

Linux_logo_errorbits.com

First Linux Script

In this first script I will show you all the details and preparations that you will need to do prior creating an running your first Linux script. I will use VIM text editor (see the tutorial in the link), but you can use any editor that you might like.

Go to the folder in which you want to create the file for the script and type:

vim test.sh

The editor will create a new file called test.sh (if the file already exist, it will be opened for editing), then input the following commands in the file:

#!/bin/sh
echo “This is my first Linux script”
echo “I will learn more advanced Linux scripts…”
echo “… but a little bit later”

Save your script and exit editor.

Make sure that your file is allowed to run by running chmod command (see the permissions tutorials: File permissions in Linux and Permissions in Linux: Octal/Absolute mode):

chmod +x test.sh

Run the script file with:

./test.sh

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

Related Posts:

Microsoft loves Linux so much that its latest operating system is based on Linux. Azure Sphere OS is designed to run on embedded devices and IoT. Source: Microsoft’s Newest OS is Based on Linux – OMG! Ubuntu!
In terms of stability and security, Linux is ranked the most stable operating system and at the same time, it’s quite easy to maintain and support. One of the reasons why Linux web hosting has gained popularity is its easily accessible configuration files and ...
Ubuntu is an open-source operating system developed by the San microsystems. Linux allows users and in this case developers to make changes to the program without prior authorization from the creator. You can gather a deeper understanding of Ubuntu Linux from ...
A Linux operating system is quite different from a Windows operating system. They run off of different open-source operating systems such as Fedora and many more. Although they are not popular amongst regular users, many developers feel that a Linux laptop can...
The Linux operating system has the highest rate of popularity for PCs. It is an open-source code that allows anybody to create their unique operating system. There are many benefits of using the Linux system, including that it is free and stable. Many corporat...
Linux Fedora, often referred to simply as Fedora, is a popular open-source Linux-based operating system that is known for its focus on innovation, community-driven development, and cutting-edge features. Fedora is a free and open-source operating system that i...