1. Topic: Create file in a directory

1.1. Introduction

During this section you will learn how to work with directories and files

1.2. Learning objectives

During this section you will learn the following
  • Create a directory

  • Create a file in that directory

  • Give sufficient rights to the file in that directory

1.3. Exercise: Create file

Prerequisites
  • Have a proper login for the Linux machine

  • Have a group on the Linux machine we are working on

  • Have the knowledge to work with Vi or Vim or Nano

Roadmap
  • Create a directory test

  • Move into that directory

  • Create two files

    • guest and local

  • Modify the file guest so that it is only readable by your team-mates

1.3.1. Validation

During this validation step you will check that your exercise is correctly performed

Validation steps
  • Add a line to the guest file

  • Login as another user from the group you are in

  • Validate that you can read the file but cannot add a line to that file

1.4. Takeaway

In this exercise, you heave learned
  • creating a directory

  • creating a file in that directory

  • set proper privileges to a file in a directory

2. Topic: Redirect content to a file

2.1. Introduction

In the previous module we learned
  • To create directory

  • To create a directory

  • To set proper privileges

In the upcoming section we will learn to redirect content to a file in a directory

Redirecting in Linux is a very widely and wildly used feature

It helps us to forward the output of one process to the input of an other process

2.2. Learning objectives

By the end of this module, learners will be able to:
  • How to work with redirecting in Linux

    • from local content

    • from remote content

    • How to troubleshoot redirecting

2.3. Exercise: Redirect content

Prerequisites
  • Make an appointment with some other groupmember that you are bilaterally sharing files

Target
  • To learn working with redirecting in Linux

  • To learn to copy a file from an other directory

  • To learn how to fetch content from Internet and put that in a file

Roadmap I
  • Use a Linux command to list the content of a directory and put that in the file local

  • Use the same command but now append the result of the list to the file local

Roadmap II
  1. Use a command to fetch data from internet and put that in the file internetData

What happens when curl finds an url which is sending a redirect?

2.3.1. Validation

Check the content of the file(s) and check that the content is in the file or changed after your instructions.

2.4. Takeaway

During this module we learned how to fetch content and remote content and redirect that content to a file.

That all was quite a job. Wouldn’t it be handy to have a way to do it all in one swell loop. Yes, we can make a script for that.

In the following module we will learn that we can (also) make use of scripts to make our live easier

3. Topic: Scripting

3.1. Introduction

In the previous module we learned that we can redirect content using the >, >> and copy command.

Now it is time to place that commands in some scripts

What is the advantage of using scripts
  • Plenair discussion

3.2. Learning objectives

By the end of this module, learners will be able to:
  • Describe the pros of using scriptsinteractions and responsibilities of the containers that serve UCP

  • When to make scripts

  • How to make valid scripts

3.3. Instructor Demo: Scripting

In this demo, we’ll illustrate
  • The trainer will demo some scripting

3.4. Exercise: Scripting

Pre-requisites
  • Know what the she-bang principle is

    • #! /bin/bash

Target
  • During this exercise you will learn to work with scripts

Roadmap
  • Create with your teammates a bash script of all steps mentioned in the above exercise

3.5. Takeaway

In this module, we learned how to work and troubleshoot(?) scripts

3.6. Discussion

Discuss the results with your team and trainers
  • What was the hardest part of making the script?

  • Where did you bump in to?

  • What are the security issues regarding scripting?

    • Think about the setuid, setgid and somewhat related the sticky bit