4 / 55 · 19 Linux & Command Line · Linux Directory Structure← prev⊞ allnext →☰ Read as one page
1.4File Operations
# Create directories (including parents)
mkdir -p tests/integration/api
# Copy files
cp source.json destination.json
cp -r tests/ tests-backup/ # Recursive copy
# Move/rename files
mv old-name.ts new-name.ts
mv test-results/ archive/test-results-sprint23/
# Remove files
rm unwanted-file.txt
rm -r old-directory/ # Recursive remove
rm -rf node_modules/ # Force recursive remove (use carefully!)
# Create an empty file
touch new-test.spec.ts
# View file content
cat small-file.txt # Entire file
head -20 large-file.log # First 20 lines
tail -50 large-file.log # Last 50 lines
tail -f /var/log/app.log # Follow file in real-time (live log monitoring)
less large-file.log # Paginated viewer (press q to quit)