Do real work on the filesystem — make folders and files, copy and move and rename them, delete safely, use wildcards to act on many files at once, and bundle a folder into a single compressed archive.
mkdir ("make directory") creates folders; -p creates a whole nested path in one go and never complains if it already exists. touch creates an empty file (or updates a file's timestamp if it already exists) — handy for quickly making a file to work with.
Create a folder
mkdir projectCreate a nested path in one step (-p makes every missing level)
mkdir -p project/src/componentsCreate empty files
touch project/README.md project/src/app.jscp ("copy") duplicates a file: cp source destination. Copying a whole folder needs -r ("recursive") so it descends into everything inside. The original is left untouched — you end up with two copies.
Copy one file to a new name
cp project/README.md project/README.bakCopy a file into another folder (keeps the same name)
cp project/README.md /tmp/Copy an entire folder and everything in it (-r = recursive)
cp -r project project-copyLinux has no separate "rename" command — moving and renaming are the same operation, mv. mv old new gives a file a new name; mv file folder/ moves it somewhere else. Unlike cp, the original does not stay behind.
Rename a file (move it to a new name in the same folder)
mv project/README.bak project/OLD-README.mdMove a file into another folder
mv project/OLD-README.md /tmp/Rename a folder
mv project-copy project-archiverm ("remove") deletes files permanently — there is no recycle bin, so a deleted file is gone. rm -r deletes a folder and everything in it. Be deliberate: double-check the path before you press Enter, especially with -r. rmdir is the safe alternative for a folder you believe is already empty — it refuses to delete one that is not.
Delete a single file (permanent — no trash)
rm /tmp/README.mdDelete a folder and everything inside it (-r = recursive)
rm -r project-archiveRemove an empty folder only — fails safely if it isn't empty
rmdir project/src/componentsThe shell expands wildcard patterns before the command runs, so you can target many files at once. * matches any run of characters, ? matches exactly one, and [...] matches any one character in the set. Tip: run ls with your pattern first to preview exactly what it will hit before you copy or delete.
Preview first: every .js file in the current folder
ls *.jsEvery file starting with "app"
ls app*All log files, then a single-character match: file1, file2 ...
ls *.logls file?.txttar packs a whole folder into a single file (a "tarball"), and can compress it at the same time — perfect for backups or sending a project somewhere. Read the flags as a sentence: -c create, -z gzip-compress, -v verbose (list files), -f name the file. Swap -c for -x to extract it back out, and -t to peek inside without unpacking.
Create a compressed archive of the project folder
tar -czvf project.tar.gz project/List what's inside an archive without extracting it
tar -tzvf project.tar.gzExtract it back out (-x = extract)
tar -xzvf project.tar.gz