From 55966a541b15429012e02ec044aab8df5368bd44 Mon Sep 17 00:00:00 2001 From: Veritia Date: Thu, 27 Nov 2025 17:19:02 +0000 Subject: [PATCH 1/8] Add Intro to command line turotial --- docs/intro_to_command_line_tutorial.md | 230 +++++++++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 docs/intro_to_command_line_tutorial.md diff --git a/docs/intro_to_command_line_tutorial.md b/docs/intro_to_command_line_tutorial.md new file mode 100644 index 0000000000..ed746aab85 --- /dev/null +++ b/docs/intro_to_command_line_tutorial.md @@ -0,0 +1,230 @@ +# Command Line Basics + +This tutorial introduces the minimal set of command line concepts needed to use or develop **Click-based command line interfaces (CLIs)**. +It is written for beginners who may have little or no command line experience. +All examples provide commands for both macOS/Linux (Bash) and Windows (PowerShell). + +```{contents} +:depth: 2 +:local: +``` + +## Understanding Your System + +Before using the command line, it's important to know which operating system and shell you are running. +Different systems have slightly different commands, so this knowledge will help you follow tutorials and avoid errors. + +**macOS / Linux** +```bash +uname -a # Display OS version and system information +```` + +**Windows (PowerShell)** +```powershell +Get-ComputerInfo | Select-Object WindowsVersion, OsName, OsBuildNumber +```` + +> **Tip** +> +> Knowing your OS helps you troubleshoot problems more effectively. + + +> **Common mistake:** +> +> Trying to run a Linux command on Windows without an appropriate shell like WSL. + + +## Files, Directories, and Paths +Command-line tools interact with files and directories: +- **File**: A piece of stored data (text, code, image, etc.). +- **Directory (folder)**: A container for files or other directories. +- **Path**: A reference to a file or directory location, either relative or absolute. + +**macOS / Linux** +```bash +pwd # Print working directory +ls # List files and directories +```` + +**Windows (PowerShell)** +```powershell +Get-Location +Get-ChildItem +```` + +> **Tip** +> +>Relative paths start from your current directory; absolute paths start from the root. + + +> **Common mistake:** +> +> Confusing relative and absolute paths, which can cause “file not found” errors. + + +## Navigating the Filesystem +You can move around directories using the `cd` command: + +**macOS / Linux** +```bash +cd /tmp # Go to /tmp +cd ~ # Go to your home directory +cd .. # Go up one directory level +```` + +**Windows (PowerShell)** +```powershell +cd C:\Temp +cd $HOME +cd .. +```` + +> **Tip** +> +> Use `pwd` (Linux/macOS) or `Get-Location` (Windows) to check your current directory. + + +> **Common mistake:** +> +> Forgetting that commands like `cd` are case-sensitive on Linux/macOS. + + +## Creating Directories +To organize your files, create a directory using: + +**macOS / Linux** +```bash +mkdir myproject # Make a new directory called myproject +```` + +**Windows (PowerShell)** +```powershell +New-Item -ItemType Directory -Name myproject +```` + +> **Tip** +> +>You can create nested directories with `mkdir -p myproject/subdir` on Linux/macOS. + + +> **Common mistake:** +> +> Trying to create a directory that already exists will fail unless using the `-p` flag. + + +## Creating Files +Create an empty file inside a directory: + +**macOS / Linux** +```bash +touch myproject/hello.txt +```` + +**Windows (PowerShell)** +```powershell +New-Item -ItemType File myproject/hello.txt +```` + +> **Tip** +> +>Files can be created in any directory you have write permissions for. + + +> **Common mistake:** +> +> Forgetting to specify the directory and ending up creating the file in the wrong place. + + +## Editing Files +You can open and edit files with a text editor of your choice: + +**macOS / Linux** +```bash +nano myproject/hello.txt +```` + +**Windows (PowerShell)** +```powershell +notepad myproject/hello.txt +```` + +Add the following line to the file: + +``` +Hello from the command line! +``` + +> **Tip** +> +>Try a simple editor like nano or notepad first; later you can use VS Code for larger projects. + + +> **Common mistake:** +> +> Forgetting to save the file before exiting the editor. + + +## Viewing File Contents +Check the contents of a file using these commands: + +**macOS / Linux** +```bash +cat myproject/hello.txt +```` + +**Windows (PowerShell)** +```powershell +Get-Content myproject/hello.txt +```` + +> **Tip** +> +>Use these commands to quickly verify your edits. + + +> **Common mistake:** +> +> Using `cat` on very large files can flood the terminal; use `less` instead. + + +## Searching Within Files +Search for specific text inside a file: + +**macOS / Linux** +```bash +grep "Hello" myproject/hello.txt +```` + +**Windows (PowerShell)** +```powershell +Select-String -Pattern "Hello" -Path myproject/hello.txt +```` +> **Tip** +> +> Use search to verify that text exists or to debug issues in configuration files. + + +> **Common mistake:** +> +> Forgetting to quote search patterns with spaces, which can break the command. + + +## Getting Help for a CLI + +Click-based CLIs support the `--help` option, which lists commands and options: +``` +mycli --help +``` + +If the CLI is implemented as a Python module: + +``` +python -m mycli --help +``` + +## Further Reading + +- [SW Carpentry](https://swcarpentry.github.io/shell-novice/) +- [Microsoft Powershell](https://learn.microsoft.com/powershell/) +- [Ubuntu](https://ubuntu.com/tutorials/command-line-for-beginners) +- [Python](https://docs.python.org/3/tutorial/venv.html) From 7fe35074006319b9b15b4e0eed19c31077cd46ae Mon Sep 17 00:00:00 2001 From: Veritia Date: Thu, 27 Nov 2025 17:27:33 +0000 Subject: [PATCH 2/8] Trigger CI rebuild From 7eb012d731819403a8f5042e55274b308b1d9a5c Mon Sep 17 00:00:00 2001 From: Veritia Date: Thu, 27 Nov 2025 17:34:48 +0000 Subject: [PATCH 3/8] Trigger CI rebuild From 06967f0dc1ce9a2f165ca7701d9495fb88f53b52 Mon Sep 17 00:00:00 2001 From: Veritia Date: Thu, 27 Nov 2025 17:50:04 +0000 Subject: [PATCH 4/8] Add command line tutorial to toctree --- docs/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.rst b/docs/index.rst index a6bcd84166..e3eccfa891 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -71,6 +71,7 @@ Tutorials quickstart virtualenv + intro_to_command_line_tutorial How to Guides --------------- From 8d50e71c23f0ce59f9e0b41f73ee5061c2847c2d Mon Sep 17 00:00:00 2001 From: Veritia Date: Thu, 27 Nov 2025 17:52:10 +0000 Subject: [PATCH 5/8] Trigger Read the Docs rebuild From 28b9bc1c66a065183631e280ee7366421047c432 Mon Sep 17 00:00:00 2001 From: HanslettTheDev Date: Fri, 19 Dec 2025 19:31:55 +0100 Subject: [PATCH 6/8] docs: edited and improved the sample cli tutorial. I also renamed the file to fit the original docs folder naming convention --- docs/command-line-tutorial.md | 224 ++++++++++++++++++++++++ docs/index.rst | 2 +- docs/intro_to_command_line_tutorial.md | 230 ------------------------- 3 files changed, 225 insertions(+), 231 deletions(-) create mode 100644 docs/command-line-tutorial.md delete mode 100644 docs/intro_to_command_line_tutorial.md diff --git a/docs/command-line-tutorial.md b/docs/command-line-tutorial.md new file mode 100644 index 0000000000..1a623768f0 --- /dev/null +++ b/docs/command-line-tutorial.md @@ -0,0 +1,224 @@ +# Command line basics — Introduction to command line interfaces (CLIs) + +This short, hands-on tutorial gives developers the minimal set of command-line skills needed to start using or building Click-based CLIs. +It is written for beginners who may have little or no command line experience. +All examples provide commands for both macOS/Linux (Bash) and Windows (PowerShell). + +```{contents} +:depth: 2 +:local: +``` + +First Let's understand what a command line interface is. + +## What is a Command Line Interface (CLI)? + +A Command Line Interface (CLI) is a text-based way to interact with your computer. +Instead of clicking icons or buttons, you type commands into a terminal or console window. +CLIs are powerful tools for developers and system administrators because they allow for automation, scripting, and remote access to systems. +Examples of popular CLIs include: + +- **Bash** (Bourne Again SHell): Common on macOS and Linux systems. +- **PowerShell**: A powerful CLI for Windows systems. +- **cmd.exe**: The traditional command prompt on Windows. + +## How does it work? + +Users type commands into a CLI shell (e.g., Bash, PowerShell), which interprets and executes them: + +**Shell Role:** Acts as an intermediary between the user and the operating system
+**Command Process:** +The shell parses the command, identifying the action, options, and arguments. It locates the command in the system’s PATH and executes it. The system returns output (e.g., data, error messages) to the CLI. + +## What you will learn + +By the end of this tutorial, you will be able to: + +- Identify your OS and shell +- See the difference between files and directories, and how paths work +- Move around the filesystem, create a directory and a file +- Edit the file and print its contents in the terminal +- Search inside a file (grep-style) +- View a CLI's help output + +## Prerequisites + +- A computer with a shell (macOS / Linux / Windows). +- A text editor you can run from the terminal (nano, vi, notepad, code, etc.). + +## Interacting with your command line + +Before using the command line, it's helpful to know which operating system and shell you are running. Different systems have slightly different commands; the examples below are grouped by platform so you can copy the commands that match your environment. + +### macOS / Linux +```bash +# Show OS/version information +uname -a + +# Print working directory and list files +pwd +ls -la + +# Move around the filesystem +cd /tmp +cd ~ +cd .. + +# Create a directory and an empty file +mkdir -p myproject +touch myproject/hello.txt + +# Edit the file (simple editor) +nano myproject/hello.txt + +# Print file contents +cat myproject/hello.txt + +# Search inside the file +grep "Hello" myproject/hello.txt + +# Show a CLI's help message (mycli here refers to any command line program e.g git, python, etc.) +mycli --help +python -m mycli --help +``` + +### Windows (PowerShell) + +```powershell +# Show OS/version information +Get-ComputerInfo | Select-Object OsName, WindowsVersion, OsBuildNumber + +# See current directory and list files +Get-Location +Get-ChildItem + +# Move around: go to C:\Temp, then home, then up a level +Set-Location C:\Temp +Set-Location $HOME +Set-Location .. + +# Create a project directory and an empty file +New-Item -ItemType Directory -Name myproject -Force +New-Item -ItemType File -Path myproject\hello.txt -Force + +# Edit the file with notepad (or code) +notepad myproject\hello.txt + +# Print the file contents to the terminal +Get-Content myproject\hello.txt + +# Search (Select-String) for the word Hello +Select-String -Pattern "Hello" -Path myproject\hello.txt + +# Show help for a CLI (mycli here refers to any command line program e.g git, python, etc.) +mycli --help +python -m mycli --help +``` + +### Windows (cmd.exe) +```bat +REM Show OS/version information +ver + +REM Current directory and list files +echo %CD% +dir + +REM Move around +cd /d C:\Temp +cd /d %USERPROFILE% +cd .. + +REM Create directory and file +mkdir myproject +type nul > myproject\hello.txt + +REM Edit with notepad +notepad myproject\hello.txt + +REM Print file contents +type myproject\hello.txt + +REM Search for Hello (findstr) +findstr "Hello" myproject\hello.txt + +REM Show help for a CLI (mycli here refers to any command line program e.g git, python, etc.) +mycli --help +python -m mycli --help +``` + +### What to put in the file + +Open the file you created (`myproject/hello.txt`) and add a single line: + +``` +Hello from the command line! +``` + +Save and exit the editor, then verify with `cat` / `Get-Content` / `type` depending on your shell. + +## Short explanations (why these commands matter) + +- Operating system information helps you choose the right commands and troubleshoot issues. +- Directories (folders) contain files and other directories. Paths can be absolute (start at the filesystem root) or relative (start from your current directory). +- Moving around with `cd` changes your working directory; many commands operate relative to it. +- Creating and editing small files is how you try things quickly from the terminal without opening a full IDE. +- Grep-style searching is essential for finding text in logs, configs, or code. +- Most CLIs expose `--help` (or `-h`) which documents commands, options, and usage. + + +## Quick reference (cheat sheet) + +macOS / Linux +```bash +pwd # print working directory +ls -la # list files +cd # change directory +mkdir -p # make directory +touch # create empty file +nano # edit +cat # print contents +grep # search +mycli --help # CLI help (mycli here refers to any command line program e.g git, python, etc.) +``` + +Windows (PowerShell) +```powershell +Get-Location +Get-ChildItem +Set-Location +New-Item -ItemType Directory -Name +New-Item -ItemType File -Path +notepad +Get-Content +Select-String -Pattern -Path +mycli --help +``` + +Windows (cmd.exe) +```bat +echo %CD% +dir +cd /d +mkdir +type nul > +notepad +type +findstr +mycli --help +``` + +## Conclusion +Congratulations! You've completed the command line basics tutorial. +You now have the foundational skills to navigate and interact with your computer using the command line. And you are ready to explore Click-based CLIs and build your own! + +## Next steps and further reading + +These resources will take you deeper: + +- Shell basics tutorial: https://swcarpentry.github.io/shell-novice/ +- Bash manual: https://www.gnu.org/software/bash/manual/ +- Windows PowerShell: https://learn.microsoft.com/powershell/ +- Grep manual (GNU): https://www.gnu.org/software/grep/manual/grep.html +- Filesystem hierarchy (Linux): https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard +- Windows filesystem and paths: https://learn.microsoft.com/windows/win32/fileio/file-paths \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 578a285dda..6b3eb00c9d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -71,7 +71,7 @@ Tutorials quickstart virtualenv - intro_to_command_line_tutorial + command-line-tutorial How to Guides --------------- diff --git a/docs/intro_to_command_line_tutorial.md b/docs/intro_to_command_line_tutorial.md deleted file mode 100644 index ed746aab85..0000000000 --- a/docs/intro_to_command_line_tutorial.md +++ /dev/null @@ -1,230 +0,0 @@ -# Command Line Basics - -This tutorial introduces the minimal set of command line concepts needed to use or develop **Click-based command line interfaces (CLIs)**. -It is written for beginners who may have little or no command line experience. -All examples provide commands for both macOS/Linux (Bash) and Windows (PowerShell). - -```{contents} -:depth: 2 -:local: -``` - -## Understanding Your System - -Before using the command line, it's important to know which operating system and shell you are running. -Different systems have slightly different commands, so this knowledge will help you follow tutorials and avoid errors. - -**macOS / Linux** -```bash -uname -a # Display OS version and system information -```` - -**Windows (PowerShell)** -```powershell -Get-ComputerInfo | Select-Object WindowsVersion, OsName, OsBuildNumber -```` - -> **Tip** -> -> Knowing your OS helps you troubleshoot problems more effectively. - - -> **Common mistake:** -> -> Trying to run a Linux command on Windows without an appropriate shell like WSL. - - -## Files, Directories, and Paths -Command-line tools interact with files and directories: -- **File**: A piece of stored data (text, code, image, etc.). -- **Directory (folder)**: A container for files or other directories. -- **Path**: A reference to a file or directory location, either relative or absolute. - -**macOS / Linux** -```bash -pwd # Print working directory -ls # List files and directories -```` - -**Windows (PowerShell)** -```powershell -Get-Location -Get-ChildItem -```` - -> **Tip** -> ->Relative paths start from your current directory; absolute paths start from the root. - - -> **Common mistake:** -> -> Confusing relative and absolute paths, which can cause “file not found” errors. - - -## Navigating the Filesystem -You can move around directories using the `cd` command: - -**macOS / Linux** -```bash -cd /tmp # Go to /tmp -cd ~ # Go to your home directory -cd .. # Go up one directory level -```` - -**Windows (PowerShell)** -```powershell -cd C:\Temp -cd $HOME -cd .. -```` - -> **Tip** -> -> Use `pwd` (Linux/macOS) or `Get-Location` (Windows) to check your current directory. - - -> **Common mistake:** -> -> Forgetting that commands like `cd` are case-sensitive on Linux/macOS. - - -## Creating Directories -To organize your files, create a directory using: - -**macOS / Linux** -```bash -mkdir myproject # Make a new directory called myproject -```` - -**Windows (PowerShell)** -```powershell -New-Item -ItemType Directory -Name myproject -```` - -> **Tip** -> ->You can create nested directories with `mkdir -p myproject/subdir` on Linux/macOS. - - -> **Common mistake:** -> -> Trying to create a directory that already exists will fail unless using the `-p` flag. - - -## Creating Files -Create an empty file inside a directory: - -**macOS / Linux** -```bash -touch myproject/hello.txt -```` - -**Windows (PowerShell)** -```powershell -New-Item -ItemType File myproject/hello.txt -```` - -> **Tip** -> ->Files can be created in any directory you have write permissions for. - - -> **Common mistake:** -> -> Forgetting to specify the directory and ending up creating the file in the wrong place. - - -## Editing Files -You can open and edit files with a text editor of your choice: - -**macOS / Linux** -```bash -nano myproject/hello.txt -```` - -**Windows (PowerShell)** -```powershell -notepad myproject/hello.txt -```` - -Add the following line to the file: - -``` -Hello from the command line! -``` - -> **Tip** -> ->Try a simple editor like nano or notepad first; later you can use VS Code for larger projects. - - -> **Common mistake:** -> -> Forgetting to save the file before exiting the editor. - - -## Viewing File Contents -Check the contents of a file using these commands: - -**macOS / Linux** -```bash -cat myproject/hello.txt -```` - -**Windows (PowerShell)** -```powershell -Get-Content myproject/hello.txt -```` - -> **Tip** -> ->Use these commands to quickly verify your edits. - - -> **Common mistake:** -> -> Using `cat` on very large files can flood the terminal; use `less` instead. - - -## Searching Within Files -Search for specific text inside a file: - -**macOS / Linux** -```bash -grep "Hello" myproject/hello.txt -```` - -**Windows (PowerShell)** -```powershell -Select-String -Pattern "Hello" -Path myproject/hello.txt -```` -> **Tip** -> -> Use search to verify that text exists or to debug issues in configuration files. - - -> **Common mistake:** -> -> Forgetting to quote search patterns with spaces, which can break the command. - - -## Getting Help for a CLI - -Click-based CLIs support the `--help` option, which lists commands and options: -``` -mycli --help -``` - -If the CLI is implemented as a Python module: - -``` -python -m mycli --help -``` - -## Further Reading - -- [SW Carpentry](https://swcarpentry.github.io/shell-novice/) -- [Microsoft Powershell](https://learn.microsoft.com/powershell/) -- [Ubuntu](https://ubuntu.com/tutorials/command-line-for-beginners) -- [Python](https://docs.python.org/3/tutorial/venv.html) From 1f78625de0efe3e38a4eca72e59678f4515203c7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Fri, 19 Dec 2025 18:43:42 +0000 Subject: [PATCH 7/8] [pre-commit.ci lite] apply automatic fixes --- docs/command-line-tutorial.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/command-line-tutorial.md b/docs/command-line-tutorial.md index 1a623768f0..af32cc3419 100644 --- a/docs/command-line-tutorial.md +++ b/docs/command-line-tutorial.md @@ -2,7 +2,7 @@ This short, hands-on tutorial gives developers the minimal set of command-line skills needed to start using or building Click-based CLIs. It is written for beginners who may have little or no command line experience. -All examples provide commands for both macOS/Linux (Bash) and Windows (PowerShell). +All examples provide commands for both macOS/Linux (Bash) and Windows (PowerShell). ```{contents} :depth: 2 @@ -205,12 +205,12 @@ type nul > notepad type findstr -mycli --help +mycli --help ``` ## Conclusion Congratulations! You've completed the command line basics tutorial. -You now have the foundational skills to navigate and interact with your computer using the command line. And you are ready to explore Click-based CLIs and build your own! +You now have the foundational skills to navigate and interact with your computer using the command line. And you are ready to explore Click-based CLIs and build your own! ## Next steps and further reading @@ -221,4 +221,4 @@ These resources will take you deeper: - Windows PowerShell: https://learn.microsoft.com/powershell/ - Grep manual (GNU): https://www.gnu.org/software/grep/manual/grep.html - Filesystem hierarchy (Linux): https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard -- Windows filesystem and paths: https://learn.microsoft.com/windows/win32/fileio/file-paths \ No newline at end of file +- Windows filesystem and paths: https://learn.microsoft.com/windows/win32/fileio/file-paths From 804b78a918a2d88b098899823928e7fc82bdcccd Mon Sep 17 00:00:00 2001 From: HanslettTheDev Date: Fri, 19 Dec 2025 19:55:02 +0100 Subject: [PATCH 8/8] docs: removed powershell from the tutorials as recommended by the review --- docs/command-line-tutorial.md | 80 ++++++++--------------------------- 1 file changed, 18 insertions(+), 62 deletions(-) diff --git a/docs/command-line-tutorial.md b/docs/command-line-tutorial.md index af32cc3419..88fcce157b 100644 --- a/docs/command-line-tutorial.md +++ b/docs/command-line-tutorial.md @@ -2,7 +2,7 @@ This short, hands-on tutorial gives developers the minimal set of command-line skills needed to start using or building Click-based CLIs. It is written for beginners who may have little or no command line experience. -All examples provide commands for both macOS/Linux (Bash) and Windows (PowerShell). +All examples provide commands for both macOS/Linux (Bash) and Windows (cmd). ```{contents} :depth: 2 @@ -18,13 +18,12 @@ Instead of clicking icons or buttons, you type commands into a terminal or conso CLIs are powerful tools for developers and system administrators because they allow for automation, scripting, and remote access to systems. Examples of popular CLIs include: -- **Bash** (Bourne Again SHell): Common on macOS and Linux systems. -- **PowerShell**: A powerful CLI for Windows systems. -- **cmd.exe**: The traditional command prompt on Windows. +- **Bash** (Bourne Again SHell): Common on macOS and Linux systems. +- **cmd.exe**: The traditional command prompt on Windows. ## How does it work? -Users type commands into a CLI shell (e.g., Bash, PowerShell), which interprets and executes them: +Users type commands into a CLI shell (e.g., Bash, cmd), which interprets and executes them: **Shell Role:** Acts as an intermediary between the user and the operating system
**Command Process:** @@ -34,23 +33,24 @@ The shell parses the command, identifying the action, options, and arguments. It By the end of this tutorial, you will be able to: -- Identify your OS and shell -- See the difference between files and directories, and how paths work -- Move around the filesystem, create a directory and a file -- Edit the file and print its contents in the terminal -- Search inside a file (grep-style) -- View a CLI's help output +- Identify your OS and shell +- See the difference between files and directories, and how paths work +- Move around the filesystem, create a directory and a file +- Edit the file and print its contents in the terminal +- Search inside a file (grep-style) +- View a CLI's help output ## Prerequisites -- A computer with a shell (macOS / Linux / Windows). -- A text editor you can run from the terminal (nano, vi, notepad, code, etc.). +- A computer with a shell (macOS / Linux / Windows). +- A text editor you can run from the terminal (nano, vi, notepad, code, etc.). ## Interacting with your command line Before using the command line, it's helpful to know which operating system and shell you are running. Different systems have slightly different commands; the examples below are grouped by platform so you can copy the commands that match your environment. ### macOS / Linux + ```bash # Show OS/version information uname -a @@ -82,40 +82,8 @@ mycli --help python -m mycli --help ``` -### Windows (PowerShell) - -```powershell -# Show OS/version information -Get-ComputerInfo | Select-Object OsName, WindowsVersion, OsBuildNumber - -# See current directory and list files -Get-Location -Get-ChildItem - -# Move around: go to C:\Temp, then home, then up a level -Set-Location C:\Temp -Set-Location $HOME -Set-Location .. - -# Create a project directory and an empty file -New-Item -ItemType Directory -Name myproject -Force -New-Item -ItemType File -Path myproject\hello.txt -Force - -# Edit the file with notepad (or code) -notepad myproject\hello.txt - -# Print the file contents to the terminal -Get-Content myproject\hello.txt - -# Search (Select-String) for the word Hello -Select-String -Pattern "Hello" -Path myproject\hello.txt - -# Show help for a CLI (mycli here refers to any command line program e.g git, python, etc.) -mycli --help -python -m mycli --help -``` - ### Windows (cmd.exe) + ```bat REM Show OS/version information ver @@ -155,7 +123,7 @@ Open the file you created (`myproject/hello.txt`) and add a single line: Hello from the command line! ``` -Save and exit the editor, then verify with `cat` / `Get-Content` / `type` depending on your shell. +Save and exit the editor, then verify with `cat` / `type` depending on your shell. ## Short explanations (why these commands matter) @@ -166,10 +134,10 @@ Save and exit the editor, then verify with `cat` / `Get-Content` / `type` depend - Grep-style searching is essential for finding text in logs, configs, or code. - Most CLIs expose `--help` (or `-h`) which documents commands, options, and usage. - ## Quick reference (cheat sheet) macOS / Linux + ```bash pwd # print working directory ls -la # list files @@ -182,20 +150,8 @@ grep # search mycli --help # CLI help (mycli here refers to any command line program e.g git, python, etc.) ``` -Windows (PowerShell) -```powershell -Get-Location -Get-ChildItem -Set-Location -New-Item -ItemType Directory -Name -New-Item -ItemType File -Path -notepad -Get-Content -Select-String -Pattern -Path -mycli --help -``` - Windows (cmd.exe) + ```bat echo %CD% dir @@ -209,6 +165,7 @@ mycli --help ``` ## Conclusion + Congratulations! You've completed the command line basics tutorial. You now have the foundational skills to navigate and interact with your computer using the command line. And you are ready to explore Click-based CLIs and build your own! @@ -218,7 +175,6 @@ These resources will take you deeper: - Shell basics tutorial: https://swcarpentry.github.io/shell-novice/ - Bash manual: https://www.gnu.org/software/bash/manual/ -- Windows PowerShell: https://learn.microsoft.com/powershell/ - Grep manual (GNU): https://www.gnu.org/software/grep/manual/grep.html - Filesystem hierarchy (Linux): https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard - Windows filesystem and paths: https://learn.microsoft.com/windows/win32/fileio/file-paths