How to use the command console on macOS

Configurare noua (How To)

Situatie

The command console, known as the Terminal on macOS, is a simple yet powerful tool that lets you interact with your computer using text commands instead of clicking menus and buttons. While it might look intimidating at first, Terminal can actually make some tasks faster, more precise, and more flexible once you get the hang of it.

As a beginner, you don’t need to know everything right away. Think of the Terminal like a translator: you type in instructions (commands), and macOS follows them exactly. This guide will walk you through the basics step by step, using clear explanations and real examples.

Solutie

  • Step 1: Open the Terminal

Option A: Use Spotlight Search

1. Press Command ([Cmd]) + Spacebar to open Spotlight.

2. Type Terminal and press Return.

Option B: Use Finder

1. Open Finder.

2. Go to Applications > Utilities.

3. Double-click on Terminal.

  • Step 2: Understand the Terminal Interface

When Terminal opens, you’ll see a prompt like:

Davids-MacBook:~ david$

– Davids-MacBook: hostname

– ~: home directory

– david: username

– $: standard user shell

  • Step 3: Run Basic Commands

pwd # View current directory

ls # List files

cd /path/to/dir # Change directory

mkdir myfolder # Make new directory

touch myfile.txt # Create new file

nano myfile.txt # Edit file

cat myfile.txt # View file contents

  • Step 4: Use Commands With Options

Example: ls -la

– -l: Long format

– -a: Include hidden files

  • Step 5: Use Command History and Autocomplete

– Use up/down arrows to scroll through commands

– Press Tab to autocomplete

  • Step 6: Get Help

man ls # manual page for ‘ls’

ls –help # help options

(Press ‘q’ to exit man)

  • Step 7: Understand File Permissions

ls -l

Example output:

-rw-r–r– 1 david staff 0 Jul 14 12:00 myfile.txt

– r, w, x = read, write, execute

– Owner, group, others

  • Step 8: Install and Use Homebrew (Optional)

Install:

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

Use:

brew install wget

  • Step 9: Exit the Terminal

Type: exit

Or close the window.

Tip solutie

Permanent

Voteaza

(3 din 10 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?