Dot Before Slash
Many Linux beginners stumble over the fact that you need to precede any calls to your own scripts or programs with a ./ combination. What's up with these dot-slashes?
|
Computec Media GmbH
Many Linux beginners stumble over the fact that you need to precede any calls to your own scripts or programs with a ./ combination. What's up with these dot-slashes?
The ./ character duo – a dot-slash – should be familiar to most experienced Linux users as a command prefix. However, Linux beginners may have a tough time getting used to it when running a program or script from the current shell directory. What's behind this cryptic practice, and why is it always necessary? I will shed a little light on the topic in this article.
Before I dive into the matter, I'll step back and talk a little about the Linux shell and the $PATH environment variable. A shell is essentially a simple program providing a text interface for entering commands that the shell ultimately executes. Apart from the widespread Bash Bourne shell, there are other, simpler ones such as the Zsh shell. However, I will be focusing on the Bash shell exclusively.
When calling a command, the shell executes either a built-in one or starts an executable program or script that's located somewhere on your hard drive. The first group includes command such as cd , echo , kill , or alias . These are part of the shell itself and don't require an independent program file. In contrast, executable programs such as mv and less or larger applications such as gedit or firefox are mostly included as program files in the /usr/bin/ directory.
[...]
Pages: 2
From simple queries to complex menus: Using dialog, you can create a graphical interface for shell scripts with only a few extra lines of code.
A simple script is usually enough to automate a knotty task in Linux, but with some simple shell commands and a little effort, you can convert a simple batch file into a robust shell program.
Does the ingenious script your wrote last month look like confusing spaghetti code today? We show some proven style guidelines that can provide order and readability.
The Ruby tool Shelr transforms the command line into a motion picture, and you can even copy the commands to the clipboard.
In Linux, the need for text processing programs is a big one: System configuration, system management, and data exchange all use text-based files. With Awk, you have a powerful tool at your fingertips for text editing and targeted modification.
© 2025 Linux New Media USA, LLC – Legal Notice