Everyday Guidebooks
Cover of Linux for Beginners

Cybersecurity & IT

Linux for Beginners: Finding Your Way Through the Filesystem

A Command-Line Guide to Directories, Paths, Symbolic Links, and File Metadata

by Todd Michael

Available now

The Linux command line becomes less intimidating when you know where you are, what you are looking at, and how to explore without changing anything by accident.

This linux for beginners book turns the filesystem into a place you can navigate with confidence. Starting with a small practice directory, you will learn to move between folders, interpret absolute and relative paths, read directory listings, and inspect permissions, ownership, timestamps, and other file metadata. Clear examples show how symbolic links work, why a path may not lead where you expect, and how to investigate unfamiliar directory trees safely.

Short exercises and troubleshooting scenarios help you put each skill to work before moving on. Whether you are preparing for an entry-level IT certification or simply learning Linux on your own, you will finish with a practical foundation for finding your way around.

Contents
  1. 1. Getting Comfortable at the Command Line
  2. 2. The Filesystem as a Tree
  3. 3. Knowing Where You Are
  4. 4. Reading Directory Listings
  5. 5. Absolute and Relative Paths
  6. 6. Exploring Your Home Directory
  7. 7. Getting Help and Handling Unfamiliar Commands
  8. 8. File Types and What Listings Reveal
  9. 9. Permissions and Ownership
  10. 10. Sizes, Timestamps, and Detailed Metadata
  11. 11. Symbolic Links and Where They Lead
  12. 12. Finding Entries Without Getting Lost
  13. 13. A Safe Tour of Unfamiliar Trees
  14. 14. Filesystem Navigation in Practice
  15. Exercise 1: Find Your Bearings
  16. Exercise 2: Read Paths Before Running Them
  17. Exercise 3: Inspect Names and Types
  18. Exercise 4: Trace Two Links
  19. Exercise 5: Compare Metadata Without Guessing
  20. Exercise 6: Search Within a Boundary
  21. Exercise 7: Diagnose a Misleading Route
  22. Common Mistakes to Catch
  23. A Checklist for Your Next Exploration
  24. Other Books by Todd Michael

Read a sample: 1. Getting Comfortable at the Command Line

A Linux command line can look like a blank page with a blinking cursor. That sparseness is useful: you ask the system a question or give it an instruction, and it responds with text. It can also feel unfamiliar at first, especially when you are not yet sure which parts of the screen are yours to type and which parts came from the computer.

You do not need to memorize a long list of commands to begin. In this chapter, you will open a terminal, recognize a prompt, enter a few small commands, and create a disposable directory for practice. Along the way, you will build a habit that matters more than typing quickly: pause long enough to understand what a command will do before pressing Enter.

The examples use an ordinary user account, not an administrator account. They assume a Linux system with a terminal and common command-line utilities available. Your screen may look different from the examples, and that is normal.

A terminal is the window or interface where you type commands and see text responses. The shell is the program that reads those commands and arranges for them to run. On many Linux systems, the shell is Bash, although others are common too.

If you are using a graphical desktop, look in the application menu for Terminal. Some desktops provide a keyboard shortcut such as Ctrl+Alt+T, but shortcuts vary. If you are connected to a remote Linux system, you may already be looking at a terminal session. If you are using a shared, managed, or training system, follow its instructions for opening a session and storing practice files.

When the shell is ready, it displays a prompt. A prompt might look like this:

text morgan@linuxbox:~$

Your username, machine name, symbols, and colors may be different. A prompt often ends with $ for an ordinary user. A prompt ending in # commonly indicates a root shell, although prompts can be customized and are not a reliable identity test by themselves.

In this book, command examples appear in code blocks without the prompt:

bash whoami

Type the command itself and press Enter. Do not type a $ that appears as part of a prompt shown in an example. When the command finishes, the shell normally displays another prompt, indicating that it is ready for your next instruction.

If you are unsure which account you are using, run:

bash whoami

The output is typically your current username. If it says root, switch to an ordinary user account before continuing, or ask the person responsible for the system how to do so. The exercises in this chapter do not require root access.

Try this command:

bash printf 'Hello, Linux!\n'

You should see:

text Hello, Linux!

The command name is printf. A space separates it from the text that follows. The single quotes tell the shell to treat the enclosed characters as one piece of text. The \n tells printf to start a new line after the message.

You do not have to master quoting today. For now, notice that punctuation can have a purpose. Copy commands carefully, including spaces and quotation marks. Straight single quotes, as shown above, are different from the curved quotation marks sometimes inserted by word processors.

A command line generally has a command name followed by any options or other inputs the command needs. The shell reads the line after you press Enter. For example:

bash date

This asks the system to display its current date and time. Your output will differ from anyone else’s. The important observation is the sequence: you enter a command, the system responds, and the prompt returns.

Not every successful command prints a message. Some do their work quietly and return you to the prompt. Conversely, an error message is not a verdict on your ability; it is information about something the system could not do. Read it, check what you typed, and avoid guessing at a more powerful command.

Before executing a line, look at the command name, its spaces, and anything that names a file or directory. If you spot a mistake, fix it while the line is still at the prompt.

The Backspace key usually removes the character to the left of the cursor. The left and right arrow keys usually move through the line so you can make a correction. On many shells, the up arrow recalls a previous command; review it before pressing Enter again rather than assuming it is still appropriate.

If you start typing a command and decide not to run it, press Ctrl+C. This normally cancels the current input and gives you a fresh prompt. Ctrl+C can also interrupt many running commands, though a program may handle the interruption in its own way.

Sometimes the shell shows a different prompt after Enter instead of running the command. For example, an opening quote without a matching closing quote can make the shell wait for more input. If that happens during an exercise, Ctrl+C is a straightforward way to cancel the unfinished line and start again.

The shell has a current working directory: the location it uses as the starting point for many file and directory names. Think of it as your current position while exploring, not as a restriction on where you can go.

To ask where you are, enter:

bash pwd

A possible result is:

text /home/morgan

Your result will almost certainly contain different…

More Cybersecurity & IT

Cover of The White Hat Bible, Volume 1The White Hat Bible, Volume 1Available nowCover of The White Hat Bible, Volume 2The White Hat Bible, Volume 2Available nowCover of The White Hat Bible, Volume 3The White Hat Bible, Volume 3Available nowCover of The White Hat Bible, Volume 4The White Hat Bible, Volume 4Available nowThe White Hat Bible, Volume 5Available nowCover of The White Hat Pocket GuideThe White Hat Pocket GuideAvailable now

About Todd Michael

Todd Michael is an American author and the founder of ToddMichael.tv. He writes practical, plain-English books on money, health, preparedness, technology, games, humor and more.

About the author Todd Michael · Todd Michael’s author site

Part of the ToddMichael.tv network.