Basic Terminal Commands

Understanding Directories and Folders

Quick note: The terms "directory" and "folder" are often used interchangeably, so let's treat them as synonyms in the context of operating systems.

Now.. firstly, when using the terminal, it's important to understand that you are always operating within a specific folder - similar to navigating through directories using Finder on macOS or File Explorer on Windows.

Whether you're creating new folders, moving files, or performing other tasks, knowing your current directory is essential.

Practical Example: Suppose you've just downloaded a training video and need to move it from your 'Downloads' folder to a project-specific directory named 'Training Materials', you ought to firstly know where are relative to either of those two locations.

Here are two fundamental commands for that:

  1. pwd (Print Working Directory): This command reveals your current directory path in the terminal.
  2. ls (List): This command lists all the files and folders within your current directory, enabling you to see the contents without using a graphical interface.

By mastering these commands, you can efficiently manage files and navigate through directories right from your terminal.

While using the terminal, it's essential to understand that you are always operating within a specific folder - or directory.

Structure of a Terminal Command

Commands in the terminal have a simple structure:

$ yourcommand argument1 argument2

The first word is the command itself, which instructs the computer what to do. The following words, separated by spaces, are arguments that provide more details or modifications to the command.

For example:

cd (Change Directory): This command changes your current directory. Without arguments, cd does nothing because it doesn't know where you want to go.

Try this:

  1. Use ls to list directories.
  2. Change to a directory by using cd {foldername} (replace {foldername} with a real directory name from your list).
  3. Check your new directory with pwd.

Navigating directories in a computing environment often requires a basic understanding of how paths are structured and referenced. When you're in a command-line interface, you might find yourself needing to move out of the current directory and into its parent directory. In this context, the single dot (.) represents the current directory, while the double dot (..) refers to the directory one level up, or the parent directory.

To move out of your current directory and into the parent directory, you can use the command cd ... This command changes the directory to the one that contains the current folder, effectively moving you up one level in the directory hierarchy. After executing this command, you can verify your new location by using the pwd command, which stands for "print working directory." This will display the path of your current directory, showing that you have successfully moved out of the previous folder and into its parent. This basic navigation technique is essential for managing files and directories efficiently, especially when working within a complex directory structure.

Additional Commands

Using the Terminal Efficiently

Understanding these commands and how to navigate the directory structure using the terminal can significantly enhance your productivity and familiarity with deeper computer systems. The terminal is a powerful tool that offers direct control over your operating system, and mastering it can help you automate tasks and manage your system more efficiently.