From 53c74530d0eb78176847dddd8559ee40ecc18076 Mon Sep 17 00:00:00 2001 From: Takeno-hito <18237819+Takeno-hito@users.noreply.github.com> Date: Wed, 1 May 2024 11:10:09 +0900 Subject: [PATCH] =?UTF-8?q?hello=20shell=20=E3=81=AE=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/text/chapter-1/practice/hello-shell.md | 44 ++++++++++++++++++++- docs/text/chapter-1/practice/index.md | 4 ++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/docs/text/chapter-1/practice/hello-shell.md b/docs/text/chapter-1/practice/hello-shell.md index 0fdaf56..fb1dfb6 100644 --- a/docs/text/chapter-1/practice/hello-shell.md +++ b/docs/text/chapter-1/practice/hello-shell.md @@ -10,6 +10,8 @@ そういえば `ls` ってコマンドでファイル一覧を見れた気がするけど、実行してみても全く見当が付きません。 `find` コマンドを使わないと難しいなぁ……。 +それと、見つけたファイルは `cat [FILE]` で開けるそうです。 + ## 問題ファイルのダウンロード方法 ```sh @@ -31,6 +33,44 @@ sudo apt install zip curl -y ::: +## 今いるフォルダを Finder / エクスプローラーで開いてみる方法 + +### Mac + +```sh +open . +``` + +### Windows + +```sh +explorer.exe . +``` + +`ls` を実行したときと同じ場所が開かれているはず! + +## 試しにファイルを開いてみる + +`ls` を実行したときに `index.txt` があったはず。以下のコマンドで `index.txt` の中身を見てみましょう。 + +```sh +cat index.txt +``` + +## いざ実践 + +この状態から目標のファイルを探してみましょう。 + +::: tip おさらい コマンドいろいろ + +- `pwd` : 現在の自分の場所 (**P**rint **W**orking **D**irectory) +- `ls` : 今いるディレクトリにあるファイル (**L**ist **S**egments) +- `cd <...>` : ディレクトリを移動する (**C**hange **D**irectory) +- `cd ../` 一つ親のディレクトリに移動する (`/home/trap` なら `/home` に移動) +- `mkdir <...>` : ディレクトリを作成する (**M**a**k**e **Dir**ectory) + +::: + ::: spoiler hint 1 ファイルの検索は `find` コマンドを使います。 `man find` で find コマンドについて調べることができます。ただし英語。 @@ -50,12 +90,12 @@ sudo apt install zip curl -y ::: spoiler hint 3 - `find . -name '*.txt'` でファイルを見つけることができます。 -- `cat 6db1b5a2e7/08dc869896/memo.txt` と入力してみましょう。 `TAB` キーを押すと、候補を選んでくれます。 +- `cat [FILE]` でファイルを開くことができます。 `TAB` キーを押すと、候補を選んでくれます。 ::: ::: spoiler answer - にあるらしいです。 +`cat 6db1b5a2e7/08dc869896/memo.txt` でファイルを開いてみましょう。 ::: diff --git a/docs/text/chapter-1/practice/index.md b/docs/text/chapter-1/practice/index.md index 71ffb78..73fca34 100644 --- a/docs/text/chapter-1/practice/index.md +++ b/docs/text/chapter-1/practice/index.md @@ -1,4 +1,8 @@ # 練習問題 - Chapter 1 +::: tip +おまけ問題たちです 解けなくても OK +::: + - [はじめてのプログラミング vim 編](vim-test) - [Hello shell](hello-shell)