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

How to create Shell Script on Debian 12

  • 00:49 cat /etc/os-release
  • 01:06 touch script
  • 01:23 vim script
  • 04:09 ./script
  • 04:20 chmod +x script
  • 04:31 ls -la
  • 05:07 ls -la
  • 05:19 cd directory
  • 05:31 ls -la
7647

To Create Shell Script On Debian 12

Introduction:

The shell script is a text file with the execution bit set and contains the commands in the following format. The first line specifies the shell interpreter which reads and executes this file contents. Reading shell scripts is the best way to understand how a Unix-like system works.

Creation Steps:

Step 1: Check the OS version by using following command.

root@linuxhelp:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL=https://bugs.debian.org/

Step 2: Create a file by using following command.

root@linuxhelp:~# touch script

Step 3: Edit the file for Create Script by using following command.

root@linuxhelp:~# vim script
#!/bin/bash
mkdir /root/directory
echo "directory created"
touch /root/directory/scriptfile
echo "script file created inside the directory"
chmod +x /root/directory/scriptfile
echo "script file executable permission created"

Step 4: Make executable permission to script file by using following command.

root@linuxhelp:~# chmod +x script 

Step 5: Check the Script file permission by using following command.

root@linuxhelp:~# ls -la
total 27604
drwx------  7 root root     4096 Sep 16 01:56 .
drwxr-xr-x 19 root root     4096 Sep 12 00:28 ..
drwxrwxr-x 32 root root     4096 Sep 12 02:14 asterisk-20.4.0
-rw-r--r--  1 root root 28187580 Jul 20 18:35 asterisk-20-current.tar.gz
-rw-------  1 root root      954 Sep 12 03:59 .asterisk_history
-rw-------  1 root root        3 Sep 12 00:55 .bash_history
-rw-r--r--  1 root root      571 Apr 11  2021 .bashrc

drwx------  2 root root     4096 Sep 12 00:35 .cache
-rw-------  1 root root       20 Sep 12 02:17 .lesshst
-rw-r--r--  1 root root      161 Jul  9  2019 .profile
-rwxr-xr-x  1 root root      226 Sep 16 01:56 script
drwx------  2 root root     4096 Sep 12 00:17 .ssh
drwxr-xr-x  3 root root     4096 Sep 12 00:42 .subversion
drwxr-xr-x  2 root root     4096 Sep 12 03:29 .vim
-rw-------  1 root root    16443 Sep 16 01:56 .viminfo
-rw-r--r--  1 root root      180 Sep 12 00:45 .wget-hsts

Step 6: Run the Script file by using following command.

root@linuxhelp:~# ./script
directory created
script file created inside the directory
script file executable permission created

Step 7: Check the output of the script by using following commands.

root@linuxhelp:~# ls -la
total 27608
drwx------  8 root root     4096 Sep 16 01:57 .
drwxr-xr-x 19 root root     4096 Sep 12 00:28 ..
drwxrwxr-x 32 root root     4096 Sep 12 02:14 asterisk-20.4.0
-rw-r--r--  1 root root 28187580 Jul 20 18:35 asterisk-20-current.tar.gz
-rw-------  1 root root      954 Sep 12 03:59 .asterisk_history
-rw-------  1 root root        3 Sep 12 00:55 .bash_history
-rw-r--r--  1 root root      571 Apr 11  2021 .bashrc
drwx------  2 root root     4096 Sep 12 00:35 .cache
drwxr-xr-x  2 root root     4096 Sep 16 01:57 directory
-rw-------  1 root root       20 Sep 12 02:17 .lesshst
-rw-r--r--  1 root root      161 Jul  9  2019 .profile
-rwxr-xr-x  1 root root      226 Sep 16 01:56 script
drwx------  2 root root     4096 Sep 12 00:17 .ssh
drwxr-xr-x  3 root root     4096 Sep 12 00:42 .subversion
drwxr-xr-x  2 root root     4096 Sep 12 03:29 .vim
-rw-------  1 root root    16443 Sep 16 01:56 .viminfo
-rw-r--r--  1 root root      180 Sep 12 00:45 .wget-hsts

root@linuxhelp:~# cd directory

root@linuxhelp:~/directory# ls -la
total 8
drwxr-xr-x 2 root root 4096 Sep 16 01:57 .
drwx------ 8 root root 4096 Sep 16 01:57 ..
-rwxr-xr-x 1 root root    0 Sep 16 01:57 scriptfile

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to Create Shell Script on Debian 12. Your feedback is much welcome.

Tags:
grayson
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

1. What is a superblock in shell scripting?

A

A superblock is a program containing specific file systems' records. The characteristics available in the block are size, counts of filled and empty blocks, usage information, size of block groups, and location and size of inode tables.

Q

2. What do you understand by a shell?

A

Shell is a command-line interpreter that translates user-entered commands into kernel-understandable language. The shell interprets the command typed in at the terminal and calls the required program.

Q

3. Name commonly used shells on a typical Linux system.

A

There are mainly two kinds of Linux shells- C-shell and Bourne shell. Their derivatives are as follows:
• C-shell: TENEX C-Shell, Z-Shell
• Bourne shell: Korn Shell, POSIX Shell, Bourne-Again Shell

Q

4. What are the four stages of the Linux Process?

A

The four stages include:
• Waiting- The Linux process is waiting for the resource
• Running- The Linux process is currently running
• Stopped- The Linux process has been stopped after successful execution
• Zombie- The Linux process is still active in the process table, but it has stopped.

Q

5. How can you connect to a database server?

A

To connect to a database server from Linux, use the isql utility that comes with the open client driver. Here is how:
isql –S serverName –U username –P password

Related Tutorials in How to create Shell Script on Debian 12

Related Tutorials in How to create Shell Script on Debian 12

How to install Gparted on Debian 9.0
How to install Gparted on Debian 9.0
Sep 13, 2017
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 Xrdp Server (Remote Desktop) on Oracle Linux 8.5
How to install Xrdp Server (Remote Desktop) on Oracle Linux 8.5
Oct 17, 2022
How to install and update OpenSSL on Debian 11.3
How to install and update OpenSSL on Debian 11.3
Oct 21, 2022
How to install qBittorrent on Debian 9.0
How to install qBittorrent on Debian 9.0
Sep 8, 2017
How to Install FileZilla in Debian
How to Install FileZilla in Debian
Nov 29, 2016
How to Install and Configure Mega in Linux
How to Install and Configure Mega in Linux
Jul 19, 2016
How to install Nmap on Debian 9.0
How to install Nmap on Debian 9.0
Sep 9, 2017

Related Forums in How to create Shell Script on Debian 12

Related Forums in How to create Shell Script on Debian 12

Linux
jayce class=
shasum command not found
May 5, 2017
Linux
stephan class=
How to list all samba users
Jan 12, 2018
pv command
muhammad class=
pvcreate command not found error
May 9, 2017
Linux
henry class=
Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
Apr 25, 2017
ifconfig command
jackbrookes class=
what is the location of the ifconfig program on your machine?
Jan 4, 2018
Linux
baseer class=
single command to apply setfacl for multiple user at a time
Jan 23, 2018
Linux
beulah class=
What does mean by 0 0 value in fstab file
Jan 2, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018

Related News in How to create Shell Script on Debian 12

Related News in How to create Shell Script on Debian 12

Anbox, the Android-to-Linux tool the developers have been waiting for
Anbox, the Android-to-Linux tool the developers have been waiting for
Apr 17, 2017
Linus Torvalds stops signing Linux kernel RC tarballs
Linus Torvalds stops signing Linux kernel RC tarballs
May 17, 2017
Capsule8 Launches Linux-Based Container Security Platform
Capsule8 Launches Linux-Based Container Security Platform
Feb 14, 2017
Symantec updates Management console product
Symantec updates Management console product
Nov 22, 2017
Latest Linux driver release feature seven AMD Vega
Latest Linux driver release feature seven AMD Vega
Mar 23, 2017
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
Microsoft makes its Azure App service now available on Linux Systems
Microsoft makes its Azure App service now available on Linux Systems
Sep 7, 2017
Docker friendly Alpine Linux gets hardened Node.js
Docker friendly Alpine Linux gets hardened Node.js
Apr 19, 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 Ganesh Konka ?
Zentya 6.1 http proxy configuration

please send link for creating zentyal 6.1 for http proxy and firewall as gateway.

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.