목. 7월 24th, 2025

Linux Terminal Commands Illustration
Basic Linux commands in action

Introduction to Linux File Operations

Linux provides simple but powerful commands to manage your files and folders. Unlike graphical interfaces, command-line tools give you precise control. Let’s learn three essential operations: deleting, copying, and moving files.


🔥 1. Deleting Files and Folders

Key commands: rm (remove) and rmdir (remove directory)

Delete a file:

rm filename.txt

File Deletion Example

Delete multiple files:

rm file1.jpg file2.txt file3.log

Delete a folder (and its contents):

rm -r my_folder

⚠️ Warning: rm -r is permanent! Linux has no recycle bin.

Delete empty folder:

rmdir empty_folder

📋 2. Copying Files and Folders

Key command: cp (copy)

Copy a file:

cp original.txt duplicate.txt

Copy to another directory:

cp document.pdf ~/Documents/

Copy a folder recursively:

cp -r Photos/ Vacation_Photos/

Copy Command Visualization

Preserve file attributes:

cp -p source_file backup_file

🚚 3. Moving/Renaming Files and Folders

Key command: mv (move)

Move a file:

mv report.docx /archive/

Rename a file:

mv oldname.txt newname.txt

Move multiple files:

mv *.png ~/Pictures/

Move a folder:

mv Project/ /backup/project_archive/

Move/Rename Operation


⚠️ Critical Safety Tips

  1. Double-check paths before deleting
  2. Use ls to verify files before running rm
  3. Add -i for interactive confirmation:
    rm -i important_file.txt
    cp -i source.txt existing_file.txt
  4. Use tab completion (type partial name + press Tab)

💡 Practice Exercise

  1. Create test files: touch file1 file2 file3
  2. Make a folder: mkdir test_backup
  3. Copy files: cp file* test_backup/
  4. Rename one: mv test_backup/file1 test_backup/renamed
  5. Delete originals: rm file*
  6. Verify with ls test_backup

Practice Terminal Screenshot


Conclusion

Mastering rm, cp, and mv gives you fundamental control over your Linux system. Start with simple operations and gradually incorporate options like -r (recursive) and -i (interactive). Remember: With great power comes great responsibility! 🔐

> 💻 Pro Tip: Use man cp, man rm, or man mv to explore more options in the manual pages!

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다