Using Directories and Listing Files

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we will practice moving through directories and listing files. Becoming comfortable changing directories, and listing files is a necessary step in moving through a Linux file system.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Determine Which File Is the Oldest
  1. To list the directory and sort by date, we use -l for "long listing", -A for "almost all", and -t for "sort by time".
    ls -lAt ~/Practice/Test/var/log/
Determine Which File Is the Largest
  1. To list the directory and sort by file size, we use -l ("long listing") and -S ("sort by file size").
    ls -lS ~/Practice/Test/var/log/
Determine When the File `~/Practice/Test/sos_commands/networking/netstat_-W_-neopa` Was Last Modified
  1. We use a simple -l for "long listing" to view the last modified time and date.
    ls -l ~/Practice/Test/sos_commands/networking/netstat_-W_-neopa
Determine When the File `~/Practice/Test/sos_commands/networking/netstat_-W_-neopa` Was Last Accessed
  1. To view access times, we use -l ("long listing") and-u` (access time).
    ls -lu ~/Practice/Test/sos_commands/networking/netstat_-W_-neopa

Additional Resources

Within cloud_user's home directory, there is a folder named Practice. Within this folder, there is a directory named Test. You will need to view the contents of the Test directory to answer the following questions:

  • What is the oldest file located in ~/Practice/Test/var/log/ ?

  • What is the largest file in ~/Practice/Test/var/log/ ?

  • When was the file ~/Practice/Test/sos_commands/networking/netstat_-W_-neopa last modified?

  • When was the file ~/Practice/Test/sos_commands/networking/netstat_-W_-neopa last accessed?

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?