Ubuntu 20.04 - Exercises

Ubuntu Exercises - Files and Directories

Goal: Learn simple Ubuntu processes in the desktop environment (GUI), then replicate everything using only the terminal command line (CLI).

Graphical User Interface (GUI)

The GUI is what most people think of when they interact with a computer. It's simple to use because you can interact visually, and you don't need to know any terminal commands.

When you open File Viewer, it will automatically bring you to the Home directory.

Text Editor

You can open a text file by clicking the applications button and searching "text"

Use Ctrl + S to save files

Trash Bin

You can highlight documents and use the Delete key, or right click and "Move to Trash"

Command Line Interface (CLI)

Now let's complete the same exercises using only command line interface through the terminal.

Open the Terminal and File Viewer

Open the file viewer alongside the terminal as shown below so you to see how CLI affects GUI in real time.

Exercise Overview

  • Create a new directory called fishing-tips in Home

  • Create a text file fish.txt in the fishing-tips directory

  • Delete fish.txt

  • Delete the fishing-tips directory

Open a new Terminal with Ctrl + Alt + T

If at any point you'd like a clean terminal window, you can use the clear command

Create new directory called fishing-tips

1) Start by running the ls command to see the contents of the Home folder

ls

Result

Create fishing-tips directory (make directory):

mkdir fishing-tips

Use ls to list Home directory contents

ls

Result

Notice how both the CLI and GUI now show fishing-tips as a folder within Home.

Create fish.txt within fishing-tips

1) Double click on the fishing-tips folder in the GUI to enter the directory. It should be empty.

2) Use the cd command to enter the fishing-tips folder in CLI:

cd fishing-tips

Notice how your working directory (in blue) has been updated to ~/fishing-tips

This indicates that your terminal session is now working within the fishing-tips directory.

Use nano to create fish.txt

The nano command is used to create and edit files through the terminal

nano fish.txt

Because the file fish.txt doesn't already exist, a blank file with that name will be created.

If fish.txt already exists, then nano fish.txt will open the file to be edited.

Nano File Editor

1) Type some fishing advice into the file, then use Ctrl + X to Exit

2) Press Y to save changes

3) Press ENTER to save the file as fish.txt

4) Use ls to show contents of fishing-tips

ls

Results

Notice how fish.txt now appears in both CLI and GUI

Open fish.txt in the GUI

If you double click fish.txt, you'll see the files are identical whether created using text editor or nano

Close fish.txt by clicking the X in the upper right corner.

Delete fish.txt

1) Use rm to remove the fish.txt file

rm fish.txt

2) Use ls to list files within fishing-tips

ls

Running ls will not show any results because the folder is empty

Result

Notice how fish.txt no longer appears in the CLI or GUI windows.

1) Navigate back to the Home directory in the File Viewer using the GUI

2) Navigate back to Home directory in CLI by entering cd ~ in the terminal:

cd ~

3) Use ls to show contents of Home directory

ls

Result

Delete fishing-tips folder

1) Run rm -r to remove an entire directory and all contents

rm -r fishing-tips

2) Run ls to show contents of Home directory

ls

Result

The fishing-tips directory has been removed from both the CLI and GUI.

Congratulations, you can now create files and directories using the terminal and CLI!

Ethereum Staking - Prater Testnet

Now that you understand the basics of Ubuntu, you can try running a validator on the Prater testnet!

The Ethereum testnets use Goerli ETH which has no value, which means you can test everything out before risking any of your ETH.

You should try everything on testnet before making a mainnet deposit.

Learn how to run a testnet validator: Prater || Lighthouse Eth2 Staking Guide

Last updated