Skip to main content

Getting Hardware Information from the Command Line

Hands-On Lab

 

Photo of Michael Christian

Michael Christian

Course Development Director in Content

Length

00:45:00

Difficulty

Beginner

Being able to locate hardware information can help us ensure that hardware is being used appropriately and is helpful if we need to install additional drivers. In this hands-on lab, we will practice answering questions about host hardware.

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.

Getting Hardware Information from the Command Line

Introduction

Being able to locate hardware information can help us ensure that hardware is being used appropriately and is helpful if we need to install additional drivers. In this hands-on lab, we will practice answering questions about host hardware.

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 How Much Storage Is Available

  1. List the current working directory.
    pwd
  2. List the contents of the file hw_questions.txt.
    cat hw_questions.txt
  3. Determine the amount of available storage space.
    df -h
  4. Copy the amount of available space to your clipboard.
  5. Open the file hw_questions.txt with the vim text editor.
    vim hw_questions.txt
  6. Paste the answer we just copied on the line beneath the first question.
  7. Press Esc to exit Insert mode, and type :wq to save and exit the file.

Determine the Number of CPUs/Cores

  1. List the contents of /proc/cpuinfo.
    cat /proc/cpuinfo
  2. Open the file hw_questions.txt.
    vim hw_questions.txt
  3. Paste the answer we just copied on the line beneath the second question.
  4. Press Esc to exit Insert mode, and type :wq to save and exit the file.

Determine the CPU Speed

  1. In the output of the cat /proc/cpuinfo command, locate the line that begins with model name.
  2. Copy the CPU speed (the value that ends in GHz) to your clipboard.
  3. Open the file hw_questions.txt.
    vim hw_questions.txt
  4. Paste the answer we just copied on the line beneath the third question.
  5. Press Esc to exit Insert mode, and type :wq to save and exit the file.

Determine How Much RAM Is Installed

  1. Run the following command:
    sudo dmidecode
  2. Enter your cloud_user password at the prompt.
  3. Scroll down to the Memory Device section, and copy the value for Size to your clipboard.
  4. Open the file hw_questions.txt.
    vim hw_questions.txt
  5. Paste the answer we just copied on the line beneath the fourth question.
  6. Press Esc to exit Insert mode, and type :wq to save and exit the file.

Determine How Much Swap Is Being Used

  1. Run the following command:
    free -m
  2. Open the file hw_questions.txt.
    vim hw_questions.txt
  3. Paste the answer we just copied on the line beneath the fifth question.
  4. Press Esc to exit Insert mode, and type :wq to save and exit the file.

Determine the BIOS Version

  1. Run the following command:
    sudo lshw
  2. Locate the firmware section, and copy the value for version.
  3. Open the file hw_questions.txt.
    vim hw_questions.txt
  4. Paste the answer we just copied on the line beneath the fifth question.
  5. Press Esc to exit Insert mode, and type :wq to save and exit the file.
  6. List the contents of the file hw_questions.txt.
    cat hw_questions.txt

Conclusion

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