Exploring the Linux File Types

30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

UNIX and Linux systems have a variety of file types, and do not require extensions. This situation seems designed to cause confusion for anyone having to manage system files. Even worse is attempting to determine what is the type of a file that has been created by another administrator of the system, or that was installed and has no further documentation.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Use the ls, file, and stat Commands on Various Files on Your System to Determine File Type Information

Commands used to examine files on the system.

Move into the /dev directory

cd /dev

In this directory determine file types.

ls -l
cd /etc
file * | less

locate the aliases files.
cat the DB file

cat aliases.db

clear the terminal of non std characters.

reset

read the file in octal or hex format

od aliases.db

hexdump aliases.db
Understand the Important Differences Between Regular Files, Directory Files and Hard and Soft Links Using Various Commands

View file and directory details using the ls command, create a regular file, and then create a hard link and a soft link that the file. Display the differences between the hard and soft links using ls -l options for more information and lastly view more information about the files with the stat command, including their types as defined in the magic number files.

Additional Resources

As the inheritor of an existing SUSE Linux Enterprise Server system, we frequently come across files that have names and no extensions. But the names seem to indicate that they are important files. Attempting to identify the files using the cat command causes terminal issues and plenty of frustration.

In this lab we'll use the ls and file commands to learn more about SUSE Linux file types, and how they are set to be a particular file type. We'll also look at terminal-safe methods of displaying the contents of all file types, including binaries. We'll then use stat to see how the magic number definitions are used by that command.

Then we'll look at the differences between files and directories, and create and manipulate hard and symbolic links to files.

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?