AI Courses

Making and moving things

Written by

in

Making and moving things | Master AI Automation in 4 hours Master AI Automation in 4 hours Course About Ayush Modules Sample chapter Toolbox The Microcap Minute Classroom / Module 03: The Command Line / Chapter 3 Making and moving things Watch first, then read. Same lesson, your pace. What you will learn – Creating folders and files from the keyboard – Copying, renaming and moving without Finder/Explorer – Deleting safely: the one command that deserves your fear Create mkdir projects # new folder mkdir projects/week1 # folder inside a folder (parent must exist) touch notes.txt # new empty file (instantly) touch feels anticlimactic, an empty file appears, but it’s how scripts, configs and placeholder files are born. Rename the habit: mkdir for rooms, touch for paper. Copy cp notes.txt backup.txt # copy file, give copy a name cp notes.txt projects/ # copy into a folder cp -r prompts prompts-backup # -r = recursive: whole folder + contents The -r flag (“recursive”) is the difference between copying a box label and copying the box with everything inside . Any command that travels into folders may need it. Rename & move (same command!) Here’s a secret that simplifies everything: renaming is moving. A file’s name is part of its address, so: mv draft.txt essay.txt # rename in place mv essay.txt projects/ # move to folder mv projects/essay.txt . # move back here (“.” means right here) mv old new . That’s all renaming ever was. Delete, with gloves on rm notes.txt # delete a file rm -r old-project # delete a folder and everything inside Now the warning this chapter exists for: the terminal has no recycle bin. rm does not ask “are you sure?” (unless you configure it to). It doesn’t move things anywhere. It erases them. Permanently. The three safety rules of rm : pwd before rm . Look where you’re standing. Most disasters are rm fired from the wrong room. Type full names, never wildcards casually. rm *.txt deletes every text file here. Powerful; respect it. ls first when unsure. See exactly what you’re about to delete, then press Up-arrow, edit the command into rm . With those three habits, rm is just a tool like any other. Without them it’s how people lose a semester of work in four keystrokes. Try it yourself Inside ai-workspace/projects , build a practice town: mkdir town , then inside it create touch house.txt school.txt park.txt . Copy house.txt to villa.txt , move school.txt into nothing (rename it library.txt ), make mkdir shops and put copies of every file inside with cp -r . Walk through it with ls and cd .. until it makes sense. Then demolish the whole town with exactly two commands ( cd .. , then rm -r town ). Verify with ls . Rebuilt-and-demolished beats never-built. Key takeaways – mkdir builds rooms, touch creates files, cp -r duplicates folders wholesale. – Renaming is just moving: mv old new . – rm is permanent, no bin, no undo. – Safety trinity: pwd first, no casual wildcards, ls before delete. Download the exercise sheet (PDF) Module workbook (PDF) โ† Prev: Finding your way Next: Looking inside โ†’ Classroom / Module 03: The Command Line / Chapter 3 Making and moving things What you will learn – Creating folders and files from the keyboard – Copying, renaming and moving without Finder/Explorer – Deleting safely: the one command that deserves your fear Create mkdir projects # new folder mkdir projects/week1 # folder inside a folder (parent must exist) touch notes.txt # new empty file (instantly) touch feels anticlimactic, an empty file appears, but it’s how scripts, configs and placeholder files are born. Rename the habit: mkdir for rooms, touch for paper. Copy cp notes.txt backup.txt # copy file, give copy a name cp notes.txt projects/ # copy into a folder cp -r prompts prompts-backup # -r = recursive: whole folder + contents The -r flag (“recursive”) is the difference between copying a box label and copying the box with everything inside . Any command that travels into folders may need it. Rename & move (same command!) Here

๐Ÿ“„ Download PDF

๐Ÿ“„ Download PDF