Skip to main content

Posts

Showing posts with the label Scripting

Dragons - Exam Review 3.1

Dragon's Den Conquering Challenges in the Linux Caverns navigate: 2.12 << -- >> 3.2 The Story Introduction Having successfully found the exit to the labyrinth, our intrepid adventurer's journey takes an unexpected turn as they step out into a cavern teeming with dragons. Each dragon presents a unique challenge in the form of riddles or quizzes, testing the adventurer's knowledge and skills in different domains of Linux command line mastery. In this blog post, we will explore the thrilling encounters with these dragons and delve into the topics of archiving files, searching and extracting data, and transforming commands into powerful scripts. Archiving Files on the Command Line In this treacherous domain, the adventurer encounters a wise dragon well-versed in the art of file compression and archiving. The dragon poses challenges related to the utilization of command line tools such as tar and gzip. Through understanding the intricacies of creating, extracting,...

LPI E - vi or nano

LPI E - Scripting 3.3 Turning Commands into a Script  Review of Topics- Part 2 of 2 Part One: Scripting Editors to use with Linux Command Line Interface (CLI) Vi Editor  The Vi editor is a powerful and versatile text editor that is included with most Linux distributions. It can be accessed from the terminal by typing vi followed by the name of the file you want to edit. For example, to edit a file called "test.txt", you would enter the command $ vi test.txt Once you have opened a file in vi, you can begin editing it by pressing the "i" key to enter insert mode. In insert mode, you can type and edit text as you normally would in any other text editor. When you are finished editing, press the "Esc" key to return to command mode. From here, you can save your changes and exit the editor by typing :wq and pressing Enter. This command will save your changes and exit the editor. If you want to exit the editor without saving your changes, type :q! and press E...

LPI E - Scripting

LPI E - Scripting 3.3 Turning Commands into a Script  Review of Topics- Part 1 of 2 Part Two: Editors Linux Command Line Interface (CLI) is a powerful tool that allows users to execute commands in a text-based interface. One of the most useful features of the Linux CLI is the ability to turn a series of commands into a Bash script. This can be particularly useful when performing repetitive tasks or automating complex processes. In this blog post, we will provide in-depth instructions on how to use Linux Command Line Interface for turning commands into a Bash script.  We will cover topics such as using  "/bin/bash" variables arguments "for loops" echo the exit status.  We will also provide snippet examples to help illustrate each of these concepts. Using "/bin/bash" The first step in creating a Bash script is to define the interpreter that will be used to run the script. This is done using the shebang line at the beginning of the script. The shebang line co...