
Introduction
In a world full of windows/mac operating systems, we still have many users working on Linux/Unix operating systems. There could be various reasons as Linux is comparatively more secure, fast, and highly customizable. This article will quickly understand how to implement the shell script's directory management functions. But, Before learning how to implement directory management using shell script, we must get familiar with the critical concepts of shell and shell scripting.
Let us begin by understanding what a shell is.
Also see, Multiprogramming vs Multitasking and Open Source Operating System
Shell
In the windows operating system, the system services are not accessible for the user, but in Linux/Unix, we get an option to do it. The Linux Shell is a particular user program that acts as an interface between the operating system and the user to use the system services.
It is an interpreter that inputs human-readable commands from the user and converts them into something that the operating system's kernel can understand.
The shell can be divided into two parts.
- Graphical shell
- Command-line shell
Let us now understand the shell scripts and shell scripting language.
Shell Scripting
We learned that a shell is a kind of interpreter that inputs command from the user. Sometimes, We may need to write so much of repetitive codes to execute the desired program. To avoid writing redundant codes, we create scripts, store the required code, and implement it in the shell according to our requirements. This method of using scripts in the shell is known as shell scripting.
There are many benefits of using shell scripting. Some of them are mentioned below.
- To avoid writing redundant code
- To monitor the system
- To add new functionality in the shell,
shell scripting can be understood as any other programming language, which helps in saving our time and many other things.
The syntax of shell scripts is similar to other programming languages and involves keywords, conditional statements, and functions.
The shell script files are stored in .sh extensions.
Let us now discuss the directory management functions.
Directory Management
The Directory is where the files and their details are stored. We have two types of directories, the first is the root directory, and then another one is the subdirectory. Manipulating directories like navigating, creating, and deleting a directory constitutes the management functions.
Let us look at the directory management functions given below.
- Navigation
- Listing directories
- Creating directories
- Modifying directories
- Absolute/Relative pathnames
Let us see a shell script that implements the directory management functions.
You can also read about the Multilevel Feedback Queue Scheduling.