2
0

More than 1 year has passed since last update.

自分用 コマンド一覧

Last updated at Posted at 2022-12-20

基本のコマンド

1.ファイルを作成するtouchコマンド

touch test.txt

2.ファイルの中身を表示させるcatコマンド

cat test.txt

結果 
test.txtの内容が表示される

少し打ってからTabキーを押すことで、補完機能が起動し、打ち間違いを防ぐ

3.フォルダ(ディレクトリ)を作成するmkdirコマンド

mkdir html

結果
htmlフォルダが作成される

重要オプション 説明
-p 階層ディレクトリを作成するときつける

4.ファイルを移動するcdコマンド

cd html

結果 
今見いるフォルダからhtmlフォルダに移動する

cdだけで実行するとホームディレクトリに移動する
(ホームディレクトリ…
   ユーザが起点にするディレクトリで「~」で表される)

5.今見ているカレントディレクトリを表示させるpwdコマンド

pwd

結果
今のフォルダまで階層構造で見せる

6.ディレクトリの中身を表示させるlsコマンド

ls

7.ディレクトリを移動させるmvコマンド

mv test.txt html

結果 
test.txtがhtmlフォルダに移動する

mvコマンドは移動させるだけでなく、ファイルの名前の変更もできる!!
mv 現在のファイル名  新しいファイル名

8.ファイルやディレクトリのコピーができるcpコマンド

cp test.txt project.txt

結果 
test.txtをコピーしたproject.txtができる

cpコマンドでは「-r」を付けることで、ファイルだけでなくディレクトリもコピーすることができます。

9.ファイルやディレクトリの削除ができるrmコマンド

rm -r html

結果 
htmlフォルダが削除される

rmコマンドでもディレクトリの編集には「-r」が必要

2
0
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
2
0