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:

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...
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!
Many Linux commands deal with sensitive data like system hardware, passwords or operate under exceptional circumstances. Prevents regular users from executing these commands by mistakes and helps to protect data and system integrity. By logging in as root enab...
Linux Directory Map / Structure Root   Path  Description bin/ ( -> usr/bin) Files that can be executed (binary files) used to troubleshot or debug the operating system. boot/ Contains a minimum number of files needed by the operating system to boo...