Command Line Basics

Hands-On Lab

 

Photo of Michael Christian

Michael Christian

Course Development Director in Content

Length

00:15:00

Difficulty

Beginner

In this hands-on lab we will try out some command line basics. Becoming comfortable with the command line is an important step in a career using and managing Linux systems, and in this excersize we will review the currently logged in users, as well as users that have logged in previously.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Command Line Basics

Introduction

In this hands-on lab we will try out some command line basics.

Connecting to the Lab

  1. Open your terminal application, and run the following command (remember to replace <PUBLIC_IP> with the public IP you were provided on the lab instructions page):
    ssh cloud_user@<PUBLIC_IP>
  2. Enter yes at the prompt.
  3. Enter your cloud_user password at the prompt.

Determine the Current Working Directory

  1. Use the following command to determine the current working directory:
    pwd
  2. Change your working directory to your user's home directory.
    cd ~
  3. Verify that we are now in the /home/cloud_user directory.
    pwd

Determine Which Users Are Currently on the System and the Last Users to Log In

  1. Determine if any other users are currently logged in to the system.
    w
  2. Determine which users last logged in to the system and when the system was last booted.
    last

Record Your Findings in /home/cloud_user

  1. Write the output of the previous commands into a new file in the cloud_user home directory.
    w > log.txt
    last >> log.txt
  2. View the contents of the file we just created.
    cat log.txt

Conclusion

Congratulations, you've successfully completed this hands-on lab!