Working with Files
touch creates, cp copies, mv renames, rm deletes, ln links, find searches, stat shows details and mktemp makes safe temporary files. Be careful with rm -rf.
Example
d=$(mktemp -d); cd "$d"
echo hello > a.txt
cp a.txt b.txt
ln -s a.txt link.txt
wc -c < a.txt
find . -name "*.txt" | sort
ls -l link.txt | cut -c1
cd / && rm -rf "$d"Result
6 ./a.txt ./b.txt ./link.txt l
Exercise
Create a temp folder.
mktemp Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.