Are you receiving a exit code 127 error when trying to execute a Bash script? In this tutorial, we’ll explain what causes this “command not found” error and show you how to fix it.
Environment variables in the Bash shell can be accessed or set using a C++ program. This is facilitated by the
putenv() functions defined in the C/C++
stdlib.h library. Environmental variable expansion is a great feature of a Linux shell as it enables programmers and users to rely on the environment settings of each user separately. C++
getenv() will read all exported environmental variables and
putenv() will set existing or create new variables.
The ability to create secure shell scripts is essential not only for system administrators, but also for users who wants to automate repetitive tasks. Sometimes, from our shell scripts, we need to provide the user with some kind of information, ask him/her to provide some input, choose from a set of alternatives, or just ask for his/her confirmation before performing a potentially dangerous operation. All those actions, can be performed from the command line, of course, but to make our scripts more user-friendly, we can use of Whiptail to customize and display textual widgets.
If you need to use FTP to upload some files to a server every so often and want to save yourself some time, you can make a simple Bash script to transfer the files quickly. Rather than entering the username, password, and directory manually, we can get our Bash script to do this tedious legwork for us. In this tutorial, you will see an example script to make FTP transfers a cinch on a Linux system.
A file name with a single quote in its name can cause a lot of problems when used with a Bash script or used on the command line. Single quotes are special characters and instruct the Bash shell to interpret the text between them literally. Most users would, ideally, prefer to work with files that do not have quotes in the file name.
When a script or process exits or is terminated by some other means, it will have an exit code, which gives some indication about how or why the script or process ended. For example, an exit code of
0 means that the process exited without error – in other words, it completed its task and exited as expected. On the other hand, an exit code of
1 means that the process encountered some kind of error upon exiting.
Creating an alias is a good way to make commands easier to remember and quicker to type. In case you want to extend the functionality of your aliases even further, it is possible to have them accept arguments and parameters. This gives users the ability to execute complex and lengthy commands in only a few keystrokes on the command line.
PCManFM is a free and open source file manager which is meant to be a lightweight alternative to applications like Thunar (the default Xfce4 file manager) or Nautilus/Files (the GNOME counterpart). Although designed to by easy on resources, PCManFM doesn’t lack functionalities, and it can be extended with custom actions.
The Bash shell is one of the most powerful components of a Linux system, as well as one of the most compelling reasons to use Linux. Users can interact with Bash through the command line, and write scripts to automate tasks. Although this may sound intimidating to beginning users, it is not hard to get started with Bash scripting.
There are many different text editor choices for a Linux system. Your choice of which text editor to use will depend on the type of work you plan on doing. For example, writing basic documents vs. coding websites or programs. Whatever your case, there are a lot of nice text editors available.
As a Linux user, you’re likely already familiar with using the
mv command to rename a file on a Linux system. The task becomes a little more difficult when you need to rename multiple files at the same time on Linux.
One of the most common batch renaming jobs that are performed is to change all file names to lowercase letters. There are several different ways to do this on Linux. One way is with the native
mv utility and a bit of Bash scripting, and the other methods involve the
mmv tools, which may or may not already be installed on your Linux distro by default.
In this guide, we’ll go over various command line examples to rename all files from uppercase to lowercase letters on Linux. Some commands will work only for files, some for directories, and some commands work recursively. Take a look at all the different examples below to decide which command(s) to use that would best suit your needs.
In this tutorial you will learn:
- How to rename all files from uppercase to lowercase using mv, rename, or mmv commands
- How to install rename and mmv on major Linux distros