Skip to main content
Share Your Experience: Take the 2024 Developer Survey

A script is a program or sequence of instructions written in a plain text file. The script interpreter (for example Bash, Python, Perl etc.) reads the file and carries out the instructions as if they had been entered at the command prompt. Use this tag for all questions related to creating, troubleshooting and running scripts.

A script is a series of instructions written in a plain text file. The script interpreter (another installed program) reads the file and carries out the instructions, as opposed to a compiled program which are run directly by the CPU instructions.

A common feature of scripts running on Ubuntu (and other Linux and Unix distributions) is that the first line of the script file can contain a "Shebang" (also known as a "Hashbang"). The Shebang consists of the string #! followed by the path of the interpreter.

For instance, a Bash script will have #!/bin/bash as the Shebang, while a Python script will have #!/usr/bin/python3. By including the Shebang, the correct interpreter will be used when the script file is executed directly.

A Linux system contains many installed scripts by default, especially shell scripts, used to carry out basic tasks, such as package management and updating configurations.

Bash and Dash shells, Awk, Python and Perl are some of the commonly used script interpreters/languages used in Ubuntu. For users, writing scripts makes it possible to achieve complex tasks and automate simple ones.

Code Language (used for syntax highlighting): lang-bash