bashコマンド入門🧑🏿💻
4614 ワード
私はちょうど基本的なターミナルコマンドについて学びました、そして、それはすばらしい経験でした!
グラフィカルユーザインタフェースとして本能的ではないかもしれませんが、まだ端末を使い始める理由がいくつかあります.
🔷 ハイパフォーマンス
🔷 フードの下で起こっていることの本当の制御
🔷 タスクオートメーション
注意: Linux/MacOS端末の基本的なコマンドだけを歩きます.
始める
グラフィカルユーザインタフェースとして本能的ではないかもしれませんが、まだ端末を使い始める理由がいくつかあります.
🔷 ハイパフォーマンス
🔷 フードの下で起こっていることの本当の制御
🔷 タスクオートメーション
注意: Linux/MacOS端末の基本的なコマンドだけを歩きます.
始める
LinuxやMacOSをオペレーティングシステムとして使っているなら、最も広く使われているシェルであるbash shellを使うことが非常に多いでしょう.
端末を開くと、次のようになります.
ナビゲーション
CD(Change Directory)コマンドを使用すると、コンピュータのファイルシステムをナビゲートできます.
# Go to target folder
cd /target
# Go to parent folder
cd ..
# Go to home folder
cd ~
リスト
ls ( list )コマンドはファイルやディレクトリを印字します.
# Print files located in the current directory.
ls
# Print files located in the target directory
ls targetparent/target
オプション
既存のコマンドのほとんどにオプションを追加することができます
例えば、
# Print files located in the current directory with more details.
ls -l
# Print every files located in the current directory (hidden files as well).
ls -a
ファイルまたはディレクトリの作成/削除
mkdir(make directory)コマンドは新しいディレクトリを作成します.
# Make a new directory in current directory.
mkdir directoryName
タッチコマンドは新しいファイルを作成します.
# Make a new file in current directory.
touch fileName
rm/rmdir ( remove )コマンドはファイル/ディレクトリを削除します.
# Delete an empty directory.
rmdir myDirectory
# Delete a file.
rm myFile
# Delete a directory recursively.
rm -r myDirectory
どこですか。
pwd(print working directory)コマンドは現在の場所を表示します.
# Display current location in terminal.
pwd
ファイル管理
cpコマンドはファイルをコピーして貼り付けます.
# Create a copy of a file to target location.
cp myFile target/
mv(move)コマンドは別の場所にファイルを移動したり、現在のディレクトリにある場合に名前を変更します.
# move file to target location.
mv myFile target/
# rename file.
mv myFile newName
端末からファイルを読み込み/編集する
head/tailコマンドはファイルの一部を印字します.
# Print 10 first lines of a file.
head myFile
# Print 10 last lines of a file.
tail myFile
# Print 30 first lines of a file.
head -n 30 myfile
cat ( concatenate )コマンドはファイルの内容を印刷したり、複数のファイルを連結したり、ファイルを作成したり編集したりできます.
# Print content of a file in terminal.
cat myFile
# Print content of a file with numbers.
cat myFile -n
# Combine multiple files ogether.
cat fileOne fileTwo > target
サーチ
grep(正規表現を取得)指定した式を検索します.
# Look for a word in a file.
grep word fileName
# Look for a word in a file without case sensitivity.
grep -i word fileName
ここでは、bashコマンドのための私の個人的なカンニングペーパーです!
読書ありがとう😇
Reference
この問題について(bashコマンド入門🧑🏿💻), 我々は、より多くの情報をここで見つけました
https://dev.to/killianfrappartdev/bash-commands-introduction-13e7
テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol
# Go to target folder
cd /target
# Go to parent folder
cd ..
# Go to home folder
cd ~
# Print files located in the current directory.
ls
# Print files located in the target directory
ls targetparent/target
# Print files located in the current directory with more details.
ls -l
# Print every files located in the current directory (hidden files as well).
ls -a
# Make a new directory in current directory.
mkdir directoryName
# Make a new file in current directory.
touch fileName
# Delete an empty directory.
rmdir myDirectory
# Delete a file.
rm myFile
# Delete a directory recursively.
rm -r myDirectory
# Display current location in terminal.
pwd
# Create a copy of a file to target location.
cp myFile target/
# move file to target location.
mv myFile target/
# rename file.
mv myFile newName
# Print 10 first lines of a file.
head myFile
# Print 10 last lines of a file.
tail myFile
# Print 30 first lines of a file.
head -n 30 myfile
# Print content of a file in terminal.
cat myFile
# Print content of a file with numbers.
cat myFile -n
# Combine multiple files ogether.
cat fileOne fileTwo > target
# Look for a word in a file.
grep word fileName
# Look for a word in a file without case sensitivity.
grep -i word fileName
Reference
この問題について(bashコマンド入門🧑🏿💻), 我々は、より多くの情報をここで見つけました https://dev.to/killianfrappartdev/bash-commands-introduction-13e7テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol