• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How To Create And Run Bash script on Linux mint 20.2

  • 00:30 lsb_release -a
  • 00:46 touch testscript.sh
  • 01:00 chmod 755 testscript.sh
  • 01:05 ls -la
  • 01:16 nano testscript.sh
  • 02:32 ./testscript.sh
6812

To Create and Bash Script On Linux Mint

Introduction:

It is convention to give files that are Bash scripts an extension of .sh (myscript.sh for example). As you would be aware Linux is an extensionless system so a script doesn't necessarily have to have this characteristic in order to work.

Installation procedure :

Step 1 : To Check the os version

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Linuxmint
Description:	Linux Mint 20.2
Release:	20.2
Codename:	uma

Step 2 : Creating the touch file by uding the following command

root@linuxhelp:~# touch testscript.sh

Step 3 : Changing the permission to the below file

root@linuxhelp:~# chmod 755 testscript.sh

Step 4 : Long list the file by using the following command

root@linuxhelp:~# ls -la
total 49784
drwx------  5 root root     4096 Jan  6 06:32 .
drwxr-xr-x 19 root root     4096 Jan  4 09:07 ..
-rw-------  1 root root     4467 Jan  6 06:03 .bash_history
-rw-r--r--  1 root root     3106 Dec  5  2019 .bashrc
drwx------  3 root root     4096 Jul  3  2021 .cache
drwx------  3 root root     4096 Jan  4 04:36 .dbus
-rw-r--r--  1 root root    19666 Jan  6 04:35 index.html
drwxr-xr-x  3 root root     4096 Jan  5 04:28 .local
-rw-r--r--  1 root root      161 Dec  5  2019 .profile
-rw-r--r--  1 root root 50916586 Sep 30 02:59 rstudio-server-2021.09.0-351-amd64.deb
-rwxr-xr-x  1 root root        0 Jan  6 06:32 testscript.sh
-rw-r--r--  1 root root      168 Jan  6 04:35 .wget-hsts

Step 5 : Editing the testscript.sh file

root@linuxhelp:~# nano testscript.sh 
#!/bin/bash
echo bash script is started
ping -c 7 192.168.6.180
ls –la
echo bash script completed

Step 6 : Running the testscript.sh by using the following command

root@linuxhelp:~# ./testscript.sh
bash script is started
PING 192.168.7.200 (192.168.7.200) 56(84) bytes of data.
64 bytes from 192.168.7.200: icmp_seq=1 ttl=64 time=3.82 ms
64 bytes from 192.168.7.200: icmp_seq=2 ttl=64 time=0.499 ms
64 bytes from 192.168.7.200: icmp_seq=3 ttl=64 time=1.16 ms
64 bytes from 192.168.7.200: icmp_seq=4 ttl=64 time=1.09 ms
64 bytes from 192.168.7.200: icmp_seq=5 ttl=64 time=0.593 ms
64 bytes from 192.168.7.200: icmp_seq=6 ttl=64 time=1.45 ms
64 bytes from 192.168.7.200: icmp_seq=7 ttl=64 time=1.40 ms

--- 192.168.7.200 ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6018ms
rtt min/avg/max/mdev = 0.499/1.429/3.819/1.032 ms
total 49788
drwx------  5 root root     4096 Jan  6 06:34 .
drwxr-xr-x 19 root root     4096 Jan  4 09:07 ..
-rw-------  1 root root     4467 Jan  6 06:03 .bash_history
-rw-r--r--  1 root root     3106 Dec  5  2019 .bashrc
drwx------  3 root root     4096 Jul  3  2021 .cache
drwx------  3 root root     4096 Jan  4 04:36 .dbus
-rw-r--r--  1 root root    19666 Jan  6 04:35 index.html
drwxr-xr-x  3 root root     4096 Jan  5 04:28 .local
-rw-r--r--  1 root root      161 Dec  5  2019 .profile
-rw-r--r--  1 root root 50916586 Sep 30 02:59 rstudio-server-2021.09.0-351-amd64.deb
-rwxr-xr-x  1 root root      107 Jan  6 06:34 testscript.sh
-rw-r--r--  1 root root      168 Jan  6 04:35 .wget-hsts
bash script completed

Snap 1

With this process of creating and Running bash script On Linux mint 20.2 has comes to an end.

Tags:
liam
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

Is shell scripting and bash scripting are the same?

A

Bash is the acronym for "Bourne Again Shell", which is also considered to be a subset of the shell scripting.
Shell scripting is scripting in any shell and eases the interaction between the user and operating system, while bash scripting can be done only for the bash.

Q

Is bash a terminal or shell?

A

Image result for bash vs shell
The GUI window refers to the terminal and it can also be seen on the screen as it requires commands and shows the output.
The bash is particularly a shell and the primary example for it is sh(bourne shell), csh(c shell), and tcsh(turbo c shell).

Q

What is the difference between C shell and bash?

A

CSH is a C shell while BASH stands for Bourne Again shell. The two are both Unix and Linux shells. whereas the C-shell commands start with '#' and for bash it is ‘;’. The CSH also its own set of features and the BASH unites the features of other shells.

Q

What language is Linux terminal?

A

The language that is commonly used is a shell script that is sometimes referred to as “shebang”.
Shell scripts are usually implemented by interpreters present in the Linux kernel.

Q

Can Python replace bash?

A

The answer is yes as using python provides various benefits and it can be also installed by default on all the major Linux distributions.

Related Tutorials in How To Create And Run Bash script on Linux mint 20.2

Related Tutorials in How To Create And Run Bash script on Linux mint 20.2

How to install WinRAR 5.11 on Linuxmint 18.03
How to install WinRAR 5.11 on Linuxmint 18.03
May 22, 2018
How to Setup VNC Server on Linux Mint 20
How to Setup VNC Server on Linux Mint 20
Dec 22, 2020
How to install and configure samba setup in Linux mint - 18.3
How to install and configure samba setup in Linux mint - 18.3
Mar 26, 2018
Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache
Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache
Sep 19, 2018
How to Install and Configure Samba on Linux Mint 20
How to Install and Configure Samba on Linux Mint 20
Nov 9, 2020
How to Install NextCloud on Linux Mint 18.3
How to Install NextCloud on Linux Mint 18.3
Feb 27, 2018
How To Install And Update OpenSSL On Linuxmint 18.3
How To Install And Update OpenSSL On Linuxmint 18.3
Jun 8, 2018
How To Install AnyDesk on Linux Mint 18.3
How To Install AnyDesk on Linux Mint 18.3
Apr 11, 2018

Related Forums in How To Create And Run Bash script on Linux mint 20.2

Related Forums in How To Create And Run Bash script on Linux mint 20.2

Linux
isaac class=
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/mysql-client-core-8.0_8.0.21-0ubuntu0.20.04.4_amd64.deb 404 Not Found
Dec 4, 2020
Linux Mint
AlxH class=
Complete beginner, install bluegriffon
Jul 1, 2020
Linux
AadrikaAnshu class=
How to add timestamps to history On Any Linux Machine
Jun 18, 2019
Linux Mint
bz0 class=
How to change a function of a key
Jun 7, 2019
Linux Mint
who class=
How to compare multiple files
Nov 10, 2019
NFS (Network File System)
Mike class=
Linux Mint 18.3 - NFS Shares - Only Root Can Mount Share
Oct 4, 2019
Command Line Tools
wayne class=
Deleting windows files booting from mint(usb)
Sep 16, 2017
CentOS
hobbs class=
bash : ll command not working on server
Apr 21, 2018

Related News in How To Create And Run Bash script on Linux mint 20.2

Related News in How To Create And Run Bash script on Linux mint 20.2

A Newer and a Faster Window Manager for Tina (Linux Mint 19.2)
A Newer and a Faster Window Manager for Tina (Linux Mint 19.2)
Apr 9, 2019
Linux Mint 18.2 Ubuntu based Operating System is named Sonya
Linux Mint 18.2 Ubuntu based Operating System is named Sonya
May 2, 2017
Refreshed Linux Mint Debian Edition (LMDE) 2 'Betsy' ISO images now available
Refreshed Linux Mint Debian Edition (LMDE) 2 'Betsy' ISO images now available
Mar 14, 2017
The Best Linux Operating System is in the house: Mint 18.2
The Best Linux Operating System is in the house: Mint 18.2
Aug 12, 2017
Linux Mint 18.1 released with smooth features and offers long-term support
Linux Mint 18.1 released with smooth features and offers long-term support
Apr 11, 2017
Linux Mint 18.2 Sonya Beta version now available for download
Linux Mint 18.2 Sonya Beta version now available for download
Jun 7, 2017
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Elijah ?
Remote Desktop Connection Has Stopped Working

When accessing my remote machine server using remote desktop on a windows machine I am getting this error

forum (1)

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.