Text
stringlengths
16
168
Code
stringlengths
5
107
Look for files that have the name report.pdf.
find . -name report.pdf
Display photo.png with the error messages hidden
cat -q photo.png
Display hidden files and directories with extensive information in a lengthy manner.
ls -al
Provide password '*.pdf' to extract configuration.ini.zip
unzip -P *.pdf configuration.ini.zip
Erase spreadsheet.xlsx from policy.pdf.zip
zip -d policy.pdf.zip spreadsheet.xlsx
Zip files report.pdf, presentation.pptx, photo.png into video.mp4.zip, using compression level 3
zip -3 video.mp4.zip report.pdf presentation.pptx photo.png
Output video.mp4 with visible non-printing characters.
cat -v video.mp4
Copy contract.pdf to documents_backup and create a hard link
cp -l contract.pdf documents_backup
Make a hard link, backup, and replicate proposal.docx to output while preserving its properties.
cp -p -l -b proposal.docx output
Concatenate video.mp4 and presentation.pptx, numbering non-empty output lines
cat -b video.mp4 presentation.pptx
List all files in long format whose names begin with "file" recursively.
ls -lR file*
Move video.mp4 to documents with force, prompt for confirmation, and treat destination as file
mv -ifT video.mp4 documents
List directory tree recursively
ls -R
Show file sizes in a readable manner
ls -h
Show the names of the directories rather than their contents.
ls -d
Move image.jpg to presentations and replace existing files without asking
mv -f image.jpg presentations
Update existing files with newer versions from audio.mp3.zip
unzip -U audio.mp3.zip
Copy all files from 'temp' to 'images', then compress them into a zip file named 'script.py.zip'.
cp /temp/* /images/ | zip -r /images/script.py.zip /images/*
Check contents of document.docx.zip
unzip -l document.docx.zip
Transfer files from temp to temp_folder that have been modified in the last 24 hours.
find temp -type f -mtime -1 -exec mv {} temp_folder \;
Find any files with less than 100 KB.
find . -size -100k
Zip backups repeatedly
zip -r backups backups
Display the line ends for spreadsheet.xlsx
cat -E spreadsheet.xlsx
Files are sorted in reverse order based on size and modification time, producing coloured output.
ls -SltrG
List the directories on their own.
ls -d
Show non-printing characters for memo.txt
cat -v memo.txt
Extract files from memo.txt.zip and overwrite existing files
unzip -o memo.txt.zip
Gently unzip the contents of memo.txt.zip.
unzip -q memo.txt.zip
Files in backups should be sorted by size before being moved to photos_backup.
ls -S backups | xargs -I {} mv backups/{} photos_backup
Search for empty directories
find . -type d -empty
Force copy executable.exe to scripts_backup without prompting, preserving attributes, and creating a backup
cp -f -p -b executable.exe scripts_backup
Copy files to downloads
find . -name database.sql -execdir cp {} downloads \
Unwrap configuration.ini.zip, extracting to standard output, to directory backup
unzip -p -d backup configuration.ini.zip
Prompt before overwriting document.docx in backups, treating destination as file
mv -iT document.docx backups
Display files with colorized output
ls -G
After providing a thorough description of every file in the current directory, remove directories.
ls -al | grep -v "^d"
When zipping, disregard paths proposal.docx.
zip -j video.mp4.zip proposal.docx
Extract files from presentation.pptx.zip into temp_folder
unzip -d temp_folder presentation.pptx.zip
Compile and transfer configuration.ini to configuration.ini.zip.
zip -u configuration.ini.zip configuration.ini
List files sorted by size and modification time in reverse order
ls -Sltr
Erase spreadsheet.xlsx from policy.pdf.zip
zip -d policy.pdf.zip spreadsheet.xlsx
Look for empty files
find . -type f -empty
List directory contents including hidden files
ls -a
Display hidden files and directories with detailed information and colors
ls -alG
Forcefully move photo.png to photos, but ask for approval
mv -if photo.png photos
Change directory to videos_backup and extract files from photo.png.zip
unzip -C videos_backup photo.png.zip
Display hidden files and directories in long format with detailed information and human-readable sizes
ls -alh
Zip files document.docx, presentation.pptx, executable.exe into executable.exe.zip, including empty directories
zip -r0 executable.exe.zip document.docx presentation.pptx executable.exe
Prompt before overwriting memo.txt in scripts, treat destination as file, and display verbose output
mv -iTv memo.txt scripts
Extract spreadsheet.xlsx.zip, verbose output, to directory downloads_archive
unzip -v -d downloads_archive spreadsheet.xlsx.zip
Display contract.pdf with non-printing characters
cat -v contract.pdf
Transfer executable.exe to images_backup and establish a hard link
cp -l executable.exe images_backup
Locate files named image.jpg
find . -name image.jpg
Display the names of directories but not their contents.
ls -d
Show suppressed buffered output for configuration.ini
cat -u configuration.ini
Search for files modified in the last 24 hours and larger than 100KB
find . -type f -mtime -1 -size +100k
Extract encrypted report.pdf.zip with password '*.py'
unzip -P *.py report.pdf.zip
Show database.sql with line breaks included
cat -E database.sql
Extract files from spreadsheet.xlsx.zip and change to projects_backup
unzip -C projects_backup spreadsheet.xlsx.zip
Push image.jpg hard to presentations, ask for confirmation, and only transfer if there's a newer version available.
mv -ifu image.jpg presentations
Seek for files bearing the image.jpg name.
find . -name image.jpg
Display policy.pdf with suppressed empty lines
cat -s policy.pdf
Transfer photo.png to reports solely in cases where it is not in use or is more recent.
mv -u photo.png reports
Unarchive configuration.ini.zip, only extracting files matching pattern '*.pdf', quietly, and verbose output to directory scripts_backup
unzip -j -q -v -d scripts_backup configuration.ini.zip '*.pdf'
Freshen configuration.ini in document.docx.zip
zip -f document.docx.zip configuration.ini
Display contents of photo.png.zip
unzip -l photo.png.zip
Modify the file permissions
find . -type f -execdir chmod 644 {} \
Modify the file permissions
find . -type f -execdir chmod 644 {} \
Print the contents of executable.exe with line numbers.
cat -n executable.exe
When extracting files from report.pdf.zip, ignore paths.
unzip -j report.pdf.zip
Move image.jpg to temp and handle it as a regular file
mv -T image.jpg temp
Search for files larger than 1MB
find . -size +1M
Delete empty directories
find . -type d -empty -delete
Zip proposal.docx without any folder organization
zip -j configuration.ini.zip proposal.docx
Duplicate executable.exe to output and keep attributes unchanged while creating a hard link
cp -p -l executable.exe output
List each subdirectory in detail recursively, then tally the total number of directories.
ls -Rd | grep "/$" | wc -l
Compile and transfer policy.pdf to presentation.pptx.zip.
zip -u presentation.pptx.zip policy.pdf
Backup archives to temp_folder and maintain its attributes with recursive copying
cp -r -p archives temp_folder
When transferring to archives, avoid overwriting executable.exe.
mv -n executable.exe archives
Zip configuration.ini ignoring directory structure
zip -j presentation.pptx.zip configuration.ini
Turn on colour output.
ls -G
Find files with permissions set to 777
find . -type f -perm 777
Sort files by size
ls -S
Replace any files that are currently in reports with configuration.ini
mv -f configuration.ini reports
Transfer database.sql to documents_archive and make a backup if files already exist
cp -b database.sql documents_archive
Move image.jpg into archive executable.exe.zip
zip -m executable.exe.zip image.jpg
Provide a complete list of every file in the current directory, and then reverse-order the files based on their modification times.
ls -al | sort -k6,6r
Unarchive image.jpg.zip with password 'secure123' and overwriting existing files to directory videos_backup
unzip -P secure123 -o -d videos_backup image.jpg.zip
Without extracting, list the contents of presentation.pptx.zip.
unzip -l presentation.pptx.zip
Show buffered output suppressed for report.pdf
cat -u report.pdf
Copy image.jpg and forcefully replace existing files in music_library
cp -f image.jpg music_library
List all files having "backup" in their names with detailed information
ls -l *backup*
Display photo.png with the error messages hidden
cat -q photo.png
Display the line ends for memo.txt
cat -E memo.txt
Overwrite existing files when extracting spreadsheet.xlsx.zip
unzip -o spreadsheet.xlsx.zip
Move policy.pdf to databases, prompt before overwriting
mv -i policy.pdf databases
Move image.jpg as a normal file to databases.
mv -T image.jpg databases
Locate files modified more than 1 year ago
find . -mtime +365
Move the files in archives to downloads_archive after filtering them using *.pdf.
grep "*.pdf" archives/* | xargs -I {} mv {} downloads_archive
Unpack proposal.docx.zip, preserving permissions, overwriting existing files, and only extracting files matching pattern '*.pdf' to directory documents_archive
unzip -K -o -j -d documents_archive proposal.docx.zip '*.pdf'