LoginSignup
1
1

More than 5 years have passed since last update.

Macのターミナルで使用するコマンド

Posted at

cd コマンド

カレントディレクトリにあるファイルに移動する。(change directoryの略)
cd test.html  # testテストというファイルに移動する
cd ~/  #ホームディレクトリに移動する
cd ..  #一つ上の階層のファイルに移動する

pwd コマンド

カレントディレクトリのパスを表示する。(print working directoryの略)
pwd  #カレントディレクトリのパスを表示する

touch コマンド

中身が空のファイルを作る。
touch test.html  #test.htmlという中身が空のファイルを作る

mkdir コマンド

新しい空のディレクトリを作る。(make directoryの略)

mkdir test #test
というファイルを作る

mv コマンド

ファイルを移動したり、ファイル名を変更したりする。(moveの略)
mv test.html tmp/ 
 #test.htmlというファイルを相対パスでtmp/に移動する
mv test.html test2.html 
 #test.htmlというファイルをtest2.htmlに名前変更する

cp コマンド

ファイルをコピーする。(copyの略)

cp test.html tmp/  #test.htmlを相対パスでtmp/というディレクトリの中にコピーする
cp test.html test2.html  #test.htmlをtest2.htmlという名前でコピーする
cp −r dir /tmp/  #dirというディレクトリとその中身を絶対パスで/tmp/にそっくりコピーする

openコマンド

ターミナルからFinderでファイルを開く

open .  #現在のターミナルのディレクトリFinderで開く
open ~/  #ホームディレトリをFinderで開く

ファイルの設定を読み込み有効にする

source ~/.bash_profile 

#ホームディレクトリにある.bash_profileに書き込んだ設定を読み込み有効にする

source .bash_profile  
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1