To help you get started with our Cloud Playground feature, we’re putting together a series of guides for various skill levels. This guide is the first in the series and is for complete IT beginners with no prior experience needed.

By the end of this guide, you will have:
  1. Started an Ubuntu server
  2. Used basic Linux commands on that server
  3. Installed and played the iconic snake game on the server

All of this will be using our resources, and at no additional cost to you — it is included in your paid membership! If you don’t have an account yet, sign up for a 7-day free trial!

Step 1 – Create Your First Server

To get started, click on the Cloud Playground icon in the top navigation menu.
Follow the instructions on-screen to create your first server. Please select Ubuntu 14 Trusty Tahr LTS as the distribution, otherwise, some of the commands used in this guide won’t work properly.
Once you’ve completed the rest of the steps in the on-screen walkthrough, your server will be launching. Once the server is “READY” we can go ahead and log into it to complete the rest of this guide.
Linux Academy Cloud Playground Server in the ready state

Step 2 – Log into the server

Click on the server you just launched, and you will find a “Terminal” button towards the bottom. This will open an in-browser terminal for you to log into this server, so go ahead and click it. The great thing about this in-browser terminal is that it bypasses restrictions that corporate firewalls typically have, so you can learn on the job without restriction.
Once your in-browser terminal loads, it will ask you for your username and then for your password. You will find your credentials under the “Credentials” section, as pictured below:
Please keep in mind that your temporary password will be different than the one pictured above, so copy it directly from your screen.
Also note that even though you don’t see it on the screen, keystrokes are being registered when you type in your password. It’s not visible for extra security measures, because that way you can’t see the letters or the length of the password being typed. So again, don’t worry if you are typing your password and nothing appears to be happening — it’s definitely registering the keystrokes!
Once you log in, it will immediately ask you to change your password. It does this by asking you to first enter the current password (the one you just entered from the “Temp. Password.”). Only then will it ask you to enter the new password, and it will ask you to confirm a second time.
That’s it! You’ve now created your own custom password which you will use to login and to access admin privileges on this server going forward. Don’t forget this password!
Great, we’re now ready to type commands and play around!

Step 3 – Typing your first commands

The first command we will review is:
whoami
Type that command in the terminal and press enter. 
This command displays the currently logged in user, so in this case, it will be cloud_user.
This can be useful if you forget what user you logged in with, and it can also be useful when writing scripts, which is a more advanced topic.
The next command we will type is:
pwd
Pwd prints the working directory, also known as the directory you are working out of.
If you come from a Windows environment, your directory might look something like
C:/Users/Christophe/Desktop
Whereas here when you type the command, you will see:
/home/cloud_user
This makes the command useful for understanding where you currently are.
If you want to change directories, you can use the command:
cd 
For example, on Windows, if you just downloaded something from the internet — like a file — you would navigate to your Downloads folder to retrieve that file. In this case, we can change directories like this:
cd /home
Which will navigate us to the /home directory.
Now, if you run pwd, you will see /home instead of /home/cloud_user
Type cd again and press enter, and it will take you back to your user’s home directory.
Type cd .. and it will take you back to /home, simply because /home is one level above /cloud_user. So if we were in /home/example/cloud_user and you typed cd .., it would instead take you to /home/example.
Make sure you are in the /home directory, and then let’s look at some other commands:
ls
Ls is used to list a directory. Back to the example of being on Windows and going to find a file in your Downloads directory, you can use cd to navigate to a directory, and then ls to list that directory’s contents.
Now, type:
ls -lh
This is still the ls command, but we’ve now passed in 2 parameters:
  1. -l
  2. -h
You could also type:
ls -l -h
But instead we’re able to chain those parameters together, which is why this works:
ls -lh 
ls by itself lists the directory, but adding the -l and -h parameters changes the output. 
-l puts the information in a listing format, which can be easier on the eyes, and -h puts it in a human-readable format which also helps us humans read the information more easily.
While we won’t go over all of the information outputted with this command, check out the Linux Essentials course if you are interested in learning what all of that information means.
Essentially, this command will list the directory, and provide information such as:
  • The user and group that own the file or directory
  • The size this file or directory takes up on disk
  • When the file or directory was last edited
  • and more
Now that we’re more familiar with basic commands on Ubuntu, let’s take it up a notch.

Step 4 – Downloading files and gaining administrative access

We’re going to download a file from the internet. This is a simple text file which contains — you guessed it — text!
First, let’s navigate back to your home directory with the cd command.
Second, run this command:
curl https://raw.githubusercontent.com/linuxacademy/content-lpi-linux-essentials/master/cicero_disputations.txt -o cicero_disputations.txt 
To download this file, all you have to do is use the curl command. We append -o and the file name in order to save the file to disk instead of simply displaying its contents.
Except…we run into an error.
“Failed to create the file: Permission denied” and “Failed writing body.”
Similar to how Windows often asks to confirm before installing software or doing other administrative tasks, Linux distributions oftentimes require administrative access to perform actions. In this case, we need to elevate our permissions in order to download the file. We do this by simply adding sudo in front of our command.
A quick shortcut to do this is to type
sudo !!
This command runs the prior command but with sudo.
It will ask you to input your password, which we set at the beginning of this guide.
The full command would have looked like this:
sudo curl https://raw.githubusercontent.com/linuxacademy/content-lpi-linux-essentials/master/cicero_disputations.txt -o cicero_disputations.txt 
They are equivalent.
So in the future, if you ever get an access denied error message, and you’re sure you want to execute that command, type sudo in front of the command.

Step 5 – Viewing documents

With our downloaded file, let’s go ahead and read what’s inside of it. There are a few ways of achieving this. One way is to type:
cat cicero_disputations.txt 
Except when you run that command, it just outputs out a lot of text. That’s not very nice.
A better way to read long text documents from the command line is with a command called less.
less cicero_disputations.txt 
This will open up the text document in an interactive way — starting from the top of the text file.
From here, you can navigate up and down using your up arrow and down arrows on your keyboard. You can also use your scroll wheel on your mouse.
Once you’re done reading, simply type the letter q”. You are now back to your command line.
You’re doing awesome! Great work.

Step 6 – Installing the Snake game and playing it

Time to kick it up a notch one more time. This time, instead of just downloading a text file, we’re going to install a game called snake, so that we can play this game on our server.
But before we do that, let’s check how much disk space we have on our server to make sure we have enough room to download and play the game.
We can check this with the following command:
df -h
The output should look something similar to this:
Ignore everything except for this line:
/dev/xvda1       15G  6.9G  7.1G  50% /
Again, if you’re interested in learning more, please take our Linux Essentials course, but that line is the main volume mounted to our server which provides us with access to physically store our files. Since mine is saying 50% used out of 15GB, we have plenty of space to install the Snake game. Let’s do that now!
Type this command:
sudo apt-get update
(Notice we’re using sudo?)
Followed by this command (once the other command is done running, which can take a few seconds):
sudo apt-get install nsnake
The previous command will install the nsnake package, and once the command finishes running, you can type this command to start the game:
nsnake
You can read the on-screen instructions to learn how to play, but the gist is:
  • Press enter or space on your keyboard to start the game
  • Use your keyboard arrows to control the snake
  • Press the letter q on your keyboard to quit the game.

Playing nsnake on Ubuntu with Linux Academy's Cloud Playground

 

Congratulations!

You’ve now successfully launched an Ubuntu 14 distribution server on our Cloud Playground, you have learned and used basic Linux commands on that server, and you’ve installed a snake game.
This is just scratching the surface of what you can do with our Cloud Playground Servers. Imagine downloading software to host websites, configuring servers to be secure, and other much more advanced topics. 
Don’t let it overwhelm you — take it one step at a time and you’ll get there! Most importantly, have fun!

Recommendations for next steps:

  • Take your learning further with the Linux Essentials course
  • Stay tuned for guide #2 where we will walk through a more advanced scenario.

3 Comments

Image of Bernard Tanwarong
Bernard Tanwarong
3 weeks ago

Great initial step!
Thank you for all you do.

Image of ashish
ashish
2 weeks ago

good job thank you

Image of ashish
ashish
2 weeks ago

good guide for new users

Leave a Reply

Your email address will not be published. Required fields are marked *