Study guide
2.4 Creating, Moving and Deleting Files
LPI Linux Essentials Certificate 010-160
Track your progress as you read
Finished sections get a check mark.
1 Introduction & Exam Overview
1.1 Current Exam Facts 1.2 Study Strategy & Blueprint Weights
2 Topic 1: The Linux Community and a Career in Open Source
1.1 Linux Evolution and Popular Operating Systems 1.2 Major Open Source Applications 1.3 Open Source Software and Licensing 1.4 ICT Skills and Working in Linux
3 Topic 2 Part A: Command Line Basics & Getting Help
2.1a Bash Shell, Command Syntax & Variables 2.1b Quoting, History & Safe Command Syntax 2.2 Using the Command Line to Get Help
4 Topic 2 Part B: Directories, Listing & File Operations
2.3 Using Directories and Listing Files 2.4 Creating, Moving and Deleting Files
5 Topic 3 Part A: Archiving & Searching Data
3.1 Archiving and Compression on the Command Line 3.2a Pipes, Redirection, and Basic Regular Expressions 3.2b grep and Text Extraction Tools
6 Topic 3 Part B: Turning Commands into Scripts
3.3a Script Basics: Shebang, Variables, and Arguments 3.3b Loops, Exit Status, and Simple Conditionals 3.3c Editors, chmod +x, and Running Scripts
7 Topic 4 Part A: Choosing an OS, Hardware & FHS Basics
4.1 Choosing an Operating System 4.2 Understanding Computer Hardware 4.3a Where Programs and Configuration Live (FHS Basics)
8 Topic 4 Part B: Processes, Logs & Networking
4.3b Processes, Memory & Logs 4.4 Your Computer on the Network
9 Topic 5: Security and File Permissions
5.1 Basic Security and Identifying User Types 5.2 Creating Users and Groups 5.3 Managing File Permissions and Ownership 5.4 Special Directories and Files
2.4 Creating, Moving and Deleting Files
Key Takeaways Explain This Topic AI
touch creates an empty file or updates timestamps; mkdir creates directories and mkdir -p builds missing parents
cp copies files and cp -r copies directory trees; mv renames or relocates; neither is a substitute for the other
rm deletes files; rm -r deletes directory trees; rmdir removes only empty directories
Linux filenames are case-sensitive: Report.txt and report.txt are different names
Simple globbing with *, ?, and [ ] expands to matching names before the command runs; * does not match a leading dot
Last updated: July 2026
2.4 Creating, Moving and Deleting Files
Quick Answer: Build with touch and mkdir ( mkdir -p for nested paths). Duplicate with cp / cp -r . Rename or relocate with mv . Remove files with rm , trees with rm -r , and empty folders with rmdir . Linux names are case-sensitive, and shell globs ( * , ? , [ ] ) expand before the command runs.
Objective 2.4 turns navigation into file operations : create, rearrange, delete, and select names with globs—remembering File and file are different.
- Case Sensitivity
- On a typical Linux filesystem, names are case-sensitive : touch Report.txt
- touch report.txt
- ls
You now have two files. Commands looking for REPORT.txt fail unless that exact spelling exists—a frequent Essentials trap.
- Creating Files With touch touch notes.txt
- touch a.txt b.txt c.txt
If the name does not exist , touch creates an empty file.
If it already exists , touch updates timestamps and leaves content unchanged.
touch does not open an editor; it only creates or refreshes metadata.
- Creating Directories With mkdir mkdir reports
- mkdir drafts archive # multiple directories at once
- mkdir -p labs/linux/010 # create missing parents
Plain mkdir labs/linux/010 fails if labs or linux is missing. mkdir -p creates each missing component and does not fail merely because the final directory already exists. Use -p whenever you build nested lab trees in one step.
- Copying With cp cp notes.txt notes.bak
- cp notes.txt ~/backup/
- cp file1.txt file2.txt dest_dir/
- cp -r project project-copy
- Goal Pattern
- Duplicate a file cp source dest
- Copy into a directory cp source dir/
- Copy several files into a directory cp a b c dir/
- Copy a directory tree cp -r source_dir dest
Without -r (or -R ), cp refuses to copy a directory. Recursive copy duplicates the tree; the original remains. Useful companion flags: -i (prompt before overwrite), -v (verbose). If the destination file name already exists, cp typically overwrites it when permissions allow unless you add -i or -n .
- Moving and Renaming With mv
- mv both renames and moves : mv draft.txt final.txt # rename in place
- mv report.pdf ~/Documents/ # move into a directory
- mv a.txt b.txt archive/ # move several items
If the destination is an existing directory, sources go into it. If it is an existing file name, mv overwrites by default ( -i prompts). A successful mv does not leave a duplicate at the old path—use cp when you need to keep the original.