Text
stringlengths
16
168
Code
stringlengths
5
107
Before replacing files, mirror contract.pdf to documents_archive and ask questions interactively.
cp -i contract.pdf documents_archive
Make a backup of the current files and force copy photo.png to downloads_archive.
cp -b -f photo.png downloads_archive
Display video.mp4 with line endings
cat -E video.mp4
Duplicate executable.exe to music_library and backup existing files
cp -b -p executable.exe music_library
Use recursive copying to move reports to images_backup
cp -r reports images_backup
Look for regular files
find . -type f
Find files with names containing 'data' and not readable by others
find . -type f -name "*data*" ! -perm -o=r
Show line numbers for video.mp4
cat -n video.mp4
Recursively list subdirectories with detailed information and colors
ls -RdlG
Print each file's inode number.
ls -i
Search for files modified exactly 30 days ago
find . -mtime 30
List directories themselves with colored output and detailed information
ls -dGl
Make "temp" the directory and zip the files "memo.txt, "memo.txt, and "report.pdf" into it.
mkdir temp && zip temp.zip memo.txt memo.txt report.pdf
Files should be shown sorted by modification time.
ls -t
List all files containing "important" with human-readable sizes
ls -h *important*
Count the number of lines after hidden files and directories are displayed in long format.
ls -al | wc -l
Extract files from policy.pdf.zip into templates_backup
unzip -d templates_backup policy.pdf.zip
Before overwriting, move proposal.docx to logs and prompt.
mv -i proposal.docx logs
Remove script.py from presentation.pptx.zip
zip -d presentation.pptx.zip script.py
Compress files proposal.docx, report.pdf, contract.pdf into database.sql.zip, quietly, using password 'secure123', preserving paths
zip -q -r -P secure123 database.sql.zip proposal.docx report.pdf contract.pdf
Search for files larger than 1MB
find . -size +1M
Move audio.mp3 to photos_backup, verify overwrite interactively, maintain attributes, and make a backup.
cp -i -p -b audio.mp3 photos_backup
Show hidden files with regular files.
ls -a
Backup backups to images_backup and maintain its attributes with recursive copying, creating a backup
cp -r -p -b backups images_backup
Check contents of document.docx.zip
unzip -l document.docx.zip
Show proposal.docx with error messages suppressed
cat -q proposal.docx
Provide a human-readable list of file sizes.
ls -h
Clone document.docx to music_library and ask for permission before replacing
cp -i document.docx music_library
Move executable.exe to music without asking to overwrite
mv -n executable.exe music
Sort files according to size and provide extensive information in lengthy format.
ls -Sl
Show files in a format with colour.
ls -G
Forcefully move script.py to templates, but prompt before overwriting
mv -fi script.py templates
Mirror documents to templates_backup recursively
cp -r documents templates_backup
Provide password '*.txt' to extract proposal.docx.zip
unzip -P *.txt proposal.docx.zip
Show line endings for contract.pdf
cat -E contract.pdf
Zip files proposal.docx, database.sql, memo.txt into report.pdf.zip, storing file attributes, displaying verbose output
zip -X -v report.pdf.zip proposal.docx database.sql memo.txt
If the parent directories and directory logs don't already exist, create them.
mkdir -p logs
Put every file on a separate line.
ls -1
Make a fresh archive with video.mp4.zip from photo.png
zip -c video.mp4.zip photo.png
Prompt before overwriting document.docx in backups, treating destination as file
mv -iT document.docx backups
Search for files with names starting with 'file' and not modified in the last 7 days
find . -type f -name "file*" -mtime +7
Show the inode numbers for files.
ls -i
Replicate executable.exe to templates_backup while retaining its attributes, creating a hard link, and making a backup
cp -p -l -b executable.exe templates_backup
Move audio.mp3 to templates and treat it as a regular file
mv -T audio.mp3 templates
Examine contract.pdf.zip for mistakes.
unzip -t contract.pdf.zip
Ask before replacing script.py in backups, treat destination as file, and show verbose feedback
mv -TiV script.py backups
Show each file separately, one on a line.
ls -1
Look for files exactly 50 bytes in size
find . -size 50c
Zip files contract.pdf, video.mp4, policy.pdf into image.jpg.zip, using password 'pass123', verbose output
zip -P pass123 -v image.jpg.zip contract.pdf video.mp4 policy.pdf
Show buffered output suppressed for policy.pdf
cat -u policy.pdf
Make directory "temp" and list files in "temp".
mkdir temp && ls temp
Extract encrypted photo.png.zip with password '*.pdf'
unzip -P *.pdf photo.png.zip
Unzip files from proposal.docx.zip ignoring directory structure
unzip -j proposal.docx.zip
Establish directory "scripts" and concatenate files "proposal.docx", "photo.png", "spreadsheet.xlsx" into it.
mkdir scripts && cat proposal.docx photo.png spreadsheet.xlsx > scripts/concatenated_file.txt
Show line endings for executable.exe
cat -E executable.exe
Show presentation.pptx with line numbers that aren't blank.
cat -b presentation.pptx
Move spreadsheet.xlsx to downloads_archive in duplicate, then replace it.
cp -f spreadsheet.xlsx downloads_archive
Find directories with names starting with 'dir'
find . -type d -name "dir*"
Transfer executable.exe to projects_backup while maintaining attributes
cp -a executable.exe projects_backup
Display report.pdf with the error messages hidden
cat -q report.pdf
Show hidden files and directories in long format with colored output
ls -alG
Print script.py with non-printing characters visible
cat -v script.py
Compress files presentation.pptx, audio.mp3, presentation.pptx into contract.pdf.zip, compressing with best compression, verbose output
zip -9 -v contract.pdf.zip presentation.pptx audio.mp3 presentation.pptx
Display hidden files and directories with detailed information and colors
ls -alG
List files with complete information organised by size and modification time in reverse order, then show the first 15 lines.
ls -Sltr | head -n 15
Prior to replacing image.jpg in projects, get permission. Treat the destination file.
mv -Ti image.jpg projects
Transfer logs to logs_archive with recursive copying, preserving attributes, and creating a backup
cp -r -p -b logs logs_archive
Freshen video.mp4 in audio.mp3.zip
zip -f audio.mp3.zip video.mp4
Transfer configuration.ini to documents in an unaltered manner
mv -n configuration.ini documents
List the contents of the directories after displaying them with coloured output.
ls -dG */ | xargs ls -lG
Before replacing, copy audio.mp3 to images_backup and ask for approval.
cp -i audio.mp3 images_backup
Make 'music', copy a file 'spreadsheet.xlsx' into it, and then delete the original file.
mkdir /music/ | cp /spreadsheet.xlsx /music/ | rm /spreadsheet.xlsx
List all files, arranged by size, with the word "notes" in their names.
ls -S *notes*
Display directory names instead of their contents
ls -d
Show hidden files and directories in a lengthy format with sizes that are readable by humans and full information.
ls -alh
Search for empty files
find . -type f -empty
Test spreadsheet.xlsx.zip for corruption
unzip -t spreadsheet.xlsx.zip
Duplicate image.jpg to archive with user confirmation for overwrite and preserving attributes
cp -i -p image.jpg archive
Search for files owned by user *.png
find . -type f -user "*.png"
Compress files memo.txt, executable.exe, executable.exe into spreadsheet.xlsx.zip, excluding '*.tmp' files, preserving paths, verbose output
zip -x '*.tmp' -r -v spreadsheet.xlsx.zip memo.txt executable.exe executable.exe
Change directory to output and extract files from document.docx.zip
unzip -C output document.docx.zip
Move the files listed in images to videos_backup. maintaining the directory structure
find images -type f -exec mv -t videos_backup -- {} +
Print database.sql contents with line endings
cat -E database.sql
Create zip of presentations and its contents
zip -r presentations presentations
Using attribute preservation, clone video.mp4 to temp_folder, establish a hard link, and create a backup
cp -p -l -b video.mp4 temp_folder
Duplicate executable.exe to music_library and backup existing files
cp -b -p executable.exe music_library
Create a backup of audio.mp3, do not overwrite, and display verbose output
mv -bnv audio.mp3 presentations
Transfer files to output from temp and add a timestamp to the filename
find temp -type f -exec sh -c 'mv "$1" "$2/$(basename "$1")_$(date +%Y%m%d_%H%M%S)"' sh {} output \;
List all files having "notes" in their names, sorted by size
ls -S *notes*
Display document.docx with all control characters
cat -A document.docx
Display the line counts for executable.exe
cat -n executable.exe
Replace videos with memo.txt only if it's newer or doesn't exist
mv -u memo.txt videos
Make a hard link by copying script.py to projects_backup and maintaining all of its properties.
cp -p -l script.py projects_backup
Refresh memo.txt in the zip file script.py.
zip -f script.py.zip memo.txt
Make directory images and output verbosely
mkdir -v images
Recursively list directory contents
ls -R
Display files in order of modification timestamp
ls -t
Copy document.docx to photos_backup and backup existing files
cp -b -p document.docx photos_backup
Prompt for confirmation before replacing document.docx in music
mv -i document.docx music
Extract files from image.jpg.zip into downloads_archive
unzip -d downloads_archive image.jpg.zip