Think of organizing papers on your study desk. Sometimes you grab a blank sheet, put papers into a folder, make a photocopy, move a folder to another shelf, or throw old drafts into the bin.
In the Linux terminal, you do those exact same actions using five short, friendly commands: touch, mkdir, cp, mv, and rm.
1. Creating Files and Folders (touch & mkdir)
Use touch to create an empty file, and mkdir (short for make directory) to create a new folder.
# Create an empty text file named notes.txt
touch notes.txt
# Create a new folder named projects
mkdir projects
2. Copying and Moving Files (cp & mv)
cp (copy) makes a duplicate—like a photocopier—while mv (move) relocates the original file or renames it.
# Copy notes.txt into the projects folder
cp notes.txt projects/notes.txt
# Rename notes.txt to todo.txt
mv notes.txt todo.txt
# Move todo.txt inside the projects folder
mv todo.txt projects/
3. Deleting Files Safely (rm)
Unlike your desktop Recycle Bin or Trash, the rm (remove) command deletes files permanently right away. For beginner server safety, always add -i (interactive) so Linux asks for your confirmation first.
# Ask before deleting todo.txt (type y and Enter to confirm)
rm -i projects/todo.txt
# Remove an empty folder safely with rmdir
rmdir projects
If you ever feel unsure before deleting something on a server, run ls first to double-check the exact file name.
3 Things to Remember
- Use
touchto create an empty file andmkdirto create a new folder. cpduplicates a file, whilemvmoves or renames it.- Linux
rmhas no Recycle Bin—userm -iso the terminal asks before deleting.