≡ Menu

Bash

Readline also provides you with the ability to map your own custom keybindings by editing the .inputrc configuration file in your home directory. The following are two types of custom keybindings you can define: Macros Functions Macros You can define a keybinding that will, when executed, fill in a string of characters at the cursor’s [...]

{ 5 comments }

In Linux, while typing a command if you press TAB twice, it would list all available commands that starts with typed characters. This is nothing new, probably you already know about this. This functionality is called bash completion. The basic file and directory name completion are available by default in bash command line. But, we [...]

{ 16 comments }

5 Standard Completion Available in Linux Bash Command Line

In Linux, by default Bash provides the following standard completion for users to use in the command line: Variablename completion Username completion Executable completion Filename and directory completion Hostname completion 1. Variablename Completion After typing $ in terminal, pressing tab twice will display all available shell variables as shown below. $ echo $[TAB][TAB] $_ $COMP_POINT [...]

{ 7 comments }

How to Encrypt Your Bash Shell Script on Linux Using SHC

Q: How do I encrypt my bash shell script on Linux environment? The shell script contains password, and I don’t want others who have execute access to view the shell script and get the password. Is there a way to encrypt my shell script? A: First, as a best practice you should not be encrypting [...]

{ 37 comments }

15 Linux Bash History Expansion Examples You Should Know

Bash history is very powerful. Understanding how to effectively use the bash history expansions will make you extremely productive on the Linux command line. This article explains 15 examples that uses the following bash history expansion features: Event designators – Refers to a particular command in the history. It starts with a ! Word designators [...]

{ 20 comments }

12 Bash For Loop Examples for Your Linux Shell Scripting

There are two types of bash for loops available. One using the “in” keyword with list of values, another using the C programming like syntax. This article is part of our on-going bash tutorial series. This explains both of the bash for loop methods, and provides 12 different examples on how to use the bash [...]

{ 54 comments }

Bash has several commands that comes with the shell (i.e built inside the bash shell). When you execute a built-in command, bash shell executes it immediately, without invoking any other program. Bash shell built-in commands are faster than external commands, because external commands usually fork a process to execute it. In this article let us [...]

{ 13 comments }

In bash shell, when you use a dollar sign followed by a variable name, shell expands the variable with its value. This feature of shell is called parameter expansion. But parameter expansion has numerous other forms which allow you to expand a parameter and modify the value or substitute other values in the expansion process. [...]

{ 25 comments }