ファイルとディレクトリの管理:`mkdir`、`rm`、`cp`、`mv`
ファイルやディレクトリの作成、削除、コピー、移動を効率的に行う方法を身につけます。
「ファイルとディレクトリの管理:`mkdir`、`rm`、`cp`、`mv`」はCoddyKit上の無料Linux Command Line Masteryレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはLinux Command Line Mastery学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Linux Command Line Masteryコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Mastering File Management
Managing files is a core shell skill. This lesson covers the four essentials: mkdir, cp, mv, and rm — create, copy, move, delete.
Creating Folders with `mkdir`
mkdir (make directory) creates a new folder — just give it a name. Try making one called my_documents.
mkdir my_documentsAdvanced `mkdir` Usage
Create several folders at once by listing names. Add -p to build nested directories, creating any missing parents along the way.
mkdir reports project/src/main -pCopying Files with `cp`
cp (copy) duplicates a file: give it a source and a destination. Here we use touch to make a file first, then copy it.
touch notes.txt
cp notes.txt backup_notes.txtCopying Folders with `cp -r`
To copy a whole folder, add -r (recursive) so cp grabs the directory and everything inside. Without it, folders are skipped.
mkdir data_folder
touch data_folder/file_a.txt
cp -r data_folder archived_dataMoving Files with `mv`
mv (move) relocates files or folders — like cut and paste. Point it at a source and a destination directory.
touch document.pdf
mkdir important_files
mv document.pdf important_files/Renaming Files & Folders
Bonus: mv also renames. Move a file to the same place with a new name, and you’ve renamed it.
touch old_report.txt
mv old_report.txt new_report.txtDeleting Files with `rm`
rm (remove) deletes files — permanently, with no trash to recover from. Always double-check what you’re removing.
touch unwanted.txt
rm unwanted.txtDeleting Folders with `rm -r`
To delete a non-empty folder, add -r so rm clears the directory and its contents. Extreme caution — this is irreversible.
mkdir empty_folder
rm -r empty_folderQuick Check: File Management
Imagine you have a file named draft.txt in your current directory. You want to create a new folder called final_docs and then move draft.txt into it, renaming it to final_report.txt in the process. Which sequence of commands would achieve this?
Lesson Summary
Great work! You’ve got file management down: mkdir to create, cp to copy, mv to move or rename, and rm to delete (with -r for folders).
AI チューターと学ぶ Linux Command Line Mastery — 無料
ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。
- コース
- 12
- レッスン
- 48
よくある質問
「ファイルとディレクトリの管理:`mkdir`、`rm`、`cp`、`mv`」レッスンは無料ですか?
はい。「ファイルとディレクトリの管理:`mkdir`、`rm`、`cp`、`mv`」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Linux Command Line Masteryコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Linux Command Line Masteryコースには全4レッスンが含まれています。
「ファイルとディレクトリの管理:`mkdir`、`rm`、`cp`、`mv`」で何を学びますか?
ファイルやディレクトリの作成、削除、コピー、移動を効率的に行う方法を身につけます。 ブラウザで直接実行するハンズオンコードでLinux Command Line Masteryを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Linux Command Line Masteryを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのLinux Command Line Masteryは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。
「ファイルとディレクトリの管理:`mkdir`、`rm`、`cp`、`mv`」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このLinux Command Line Masteryレッスンでコードを書いて実行できますか?
はい。すべてのLinux Command Line Masteryレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- Linuxシェル入門
- 基本操作:`cd`、`ls`、`pwd`
- ファイルとディレクトリの管理:`mkdir`、`rm`、`cp`、`mv`
- ヘルプを探す:man、--help、tldr