Book Image

Linux Mint System Administrator's Beginner's Guide

By : Arturo Fernandez Montoro
Book Image

Linux Mint System Administrator's Beginner's Guide

By: Arturo Fernandez Montoro

Overview of this book

<p>System administrators are responsible for keeping servers and workstations working properly. They perform actions to get a secure, stable, and robust operating system. In order to do that, system administrators perform actions such as monitoring, accounts maintenance, restoring backups, and software installation. All these actions and tasks are crucial to business success.<br /><br />"Linux Mint System Administrator’s Beginner’s Guide" is a practical and concise guide that offers you clear step-by-step exercises to learn good practices, commands, tools, and tips and tricks to convert users into system administrators in record time.<br /><br />You’ll learn how to perform basic operations, such as create user accounts and install software. Moving forward, we’ll find out more about important tasks executed daily by system administrators.</p> <p><br />Data and information are very important so you’ll learn how to create and restore backups. You will also learn about one of the most important points of an operating system: security.</p> <p><br />Thanks to "Linux Mint System Administrator’s Beginner’s Guide", you’ll learn all the basics you need to install and keep a robust and reliable Linux Mint operating system up to date.</p>
Table of Contents (18 chapters)
Linux Mint System Administration Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – creating and executing a shell script


We need to use a text editor; of course, you can use your favorite one. Linux Mint offers us several text editors such as Vim, Emacs, and Pluma. The latter has a graphical user interface and is installed by default, so we'll use it for our work. Here's how to get started:

  1. Click on the Menu button, and then click on the Text Editor menu option, as shown in the following screenshot:

  2. A new window will be displayed, and you'll be ready to use Pluma. Enter the following lines, and save the file as myscript.sh when you're ready:

    #!/bin/bash
    if [ -f "myfile.txt" ]
    then
        echo "Sorry, file already exists."
    else
        echo "Content for file" > myfile.txt
    fi
    ls -l myfile.txt
    
  3. Give execution permissions to your new shell script:

    $ chmod +x myscript.txt
    
  4. Launch your script:

    $ ./myscript.sh
    
  5. The output of the last command should be something like the following:

    -rw-rw-r--. 1 arturo arturo 17 Oct 20 11:12 myfile.txt
    
  6. Also, you can check the content...