Skip to content

Tutorial 06

Lee Burton edited this page Jul 13, 2025 · 3 revisions

⚙️ Options, Symbols & Outputs

In many of the earlier tutorials, we used optional flags with commands. For example, with cp -r, the -r flag enabled recursive mode so it could copy folders, not just files.

As you gain more Linux experience, you'll want to do more complex tasks — and for that, learning how to use options, symbols, and outputs is essential.


📘 Options (Command Flags)

📖 man – Manual Pages

Almost every command has its own manual page, which you can access using the man command.

Example:

$ man ls

This shows a description of the command and a list of options (flags) you can use with it. Most options are accessed with a - followed by one or more letters.


➖ Dash Options

Most command options are specified using a dash (-) followed by a letter or group of letters.

Examples using ls:

  • -l : show detailed information
  • -t : sort by modification time (newest first)
  • -r : reverse the order

You can combine them:

$ ls -ltr

🧠 Common Linux Symbols

Linux makes heavy use of symbolic characters. Here are the most important ones:


📍 . and ..

  • . refers to the current directory
  • .. refers to the parent directory (one level up)
$ ls .
$ cd ..

? – Single-Character Wildcard

Matches any single character in a filename.

Example:
If you have FolderA, FolderB, FolderC, this command matches them all:

$ ls Folder?/

* – Multi-Character Wildcard

Matches zero or more characters.

Example:

$ ls Fol*/

Will match FolderA, FolderB, FolderC, etc.


🏠 ~ – Home Directory

The ~ symbol is shorthand for your home directory.

$ cd ~

Use this when you want to quickly return to your main user folder.


📤 Output Redirection

By default, Linux commands display output to the terminal screen. But often, you may want to save or process that output.


📄 > – Redirect Output to File

Saves command output to a file (overwrites if it exists):

$ ls > list.txt

📎 >> – Append Output to File

Appends output to the end of a file without overwriting:

$ ls >> list.txt

🧪 | – Pipe Output to Another Command

The pipe symbol (|) sends the output of one command into another.

Example: Count how many files/folders are in the current directory:

$ ls | wc -l

This uses ls to list files and wc -l to count the lines (i.e. number of items).


🎉 Congratulations!

You've now learned how to use flags, wildcards, symbolic shortcuts, and how to redirect or pipe command output — powerful tools that will make your Linux experience much more flexible and efficient! 🚀

➡️ Continue to Tutorial 7

Clone this wiki locally