Text
stringlengths
16
168
Code
stringlengths
5
107
Make a hard link after copying policy.pdf to documents_backup.
cp -l policy.pdf documents_backup
Print report.pdf with suppression of buffered output
cat -u report.pdf
Show the names of the directories rather than their contents.
ls -d
Put configuration.ini inside image.jpg.zip and delete
zip -m image.jpg.zip configuration.ini
Move presentation.pptx to archives without replacing
mv -n presentation.pptx archives
Show buffered output suppressed for report.pdf
cat -u report.pdf
Zip files configuration.ini, presentation.pptx, spreadsheet.xlsx into executable.exe.zip, using password 'pass123', excluding '*.tmp' files
zip -P pass123 -x '*.tmp' executable.exe.zip configuration.ini presentation.pptx spreadsheet.xlsx
Display file sizes in human-readable form
ls -h
Move memo.txt to projects with force, but prompt for confirmation
mv -if memo.txt projects
Check for updates and add document.docx to image.jpg.zip
zip -f image.jpg.zip document.docx
Mirror configuration.ini to archive using hard links
cp -l configuration.ini archive
Search files in databases for *.jpg and move them to templates_backup
grep -rl "*.jpg" databases | xargs -I {} mv {} templates_backup
Unprompted overwrite current files when extracting report.pdf.zip
unzip -o report.pdf.zip
Update proposal.docx if newer in contract.pdf.zip
zip -u contract.pdf.zip proposal.docx
Transfer script.py to downloads without requesting a copy.
mv -n script.py downloads
Archive files policy.pdf, photo.png, image.jpg into image.jpg.zip, compressing only '*.txt' files, storing symbolic links
zip -n '*.txt' -y image.jpg.zip policy.pdf photo.png image.jpg
Concatenate report.pdf and image.jpg, numbering all output lines and showing non-printing characters and tabs as spaces
cat -n -vT report.pdf image.jpg
Show files with more information
ls -l
Show report.pdf with the blank lines suppressed.
cat -s report.pdf
Verify image.jpg.zip's integrity.
unzip -t image.jpg.zip
Output the first 100 lines of video.mp4
cat video.mp4 | head -n 100
List contents of document.docx with buffered output suppression
cat -u document.docx
Update report.pdf in presentation.pptx.zip if newer
zip -f presentation.pptx.zip report.pdf
Show hidden files and directories
ls -a
Recursively list subdirectories and display directory structure with colored output
ls -RdG
Unzip the contents of "database.sql" into the directory "music" that has been created.
mkdir music && unzip database.sql.zip -d music
Make a hard link, backup, and replicate proposal.docx to output while preserving its properties.
cp -p -l -b proposal.docx output
Move files to scripts
find . -name script.py -execdir mv {} scripts \
Erase spreadsheet.xlsx from policy.pdf.zip
zip -d policy.pdf.zip spreadsheet.xlsx
Extract only updated files from configuration.ini.zip
unzip -U configuration.ini.zip
Search for empty files
find . -type f -empty
Locate files larger than 1MB
find . -size +1M
Duplicate presentation.pptx to images_backup with user confirmation for overwrite, preserving attributes, and creating a backup
cp -i -p -b presentation.pptx images_backup
Recursively list subdirectories with detailed information, colors, and human-readable sizes
ls -RdlhG
Move audio.mp3 to photos_backup, verify overwrite interactively, maintain attributes, and make a backup.
cp -i -p -b audio.mp3 photos_backup
Look through directories.
find . -type d
Replace reports with video.mp4 only if it's newer or doesn't exist
mv -u video.mp4 reports
Move audio.mp3 to reports with force, prompt for confirmation, and treat destination as file
mv -ifT audio.mp3 reports
Make a backup copy of spreadsheet.xlsx and duplicate it to music_library with user approval to overwrite, preserve attributes, and overwrite
cp -i -p -b spreadsheet.xlsx music_library
Display directories only
ls -d
Freshen policy.pdf in spreadsheet.xlsx.zip
zip -f spreadsheet.xlsx.zip policy.pdf
Seek out outlets
find . -type s
Extract proposal.docx.zip's non-pathable files.
unzip -j proposal.docx.zip
Put a line between each file you list.
ls -1
Display directory names only, without their contents
ls -d
Transfer photo.png to scripts_backup by creating a hard link
cp -l photo.png scripts_backup
Create a backup by recursively copying downloads to archive while preserving its properties.
cp -r -p -b downloads archive
Compress files executable.exe, image.jpg, configuration.ini into contract.pdf.zip, storing file attributes
zip -X contract.pdf.zip executable.exe image.jpg configuration.ini
Print report.pdf with suppression of repeated empty lines
cat -s report.pdf
List every file, hidden files included.
ls -a
List contents of audio.mp3.zip
unzip -l audio.mp3.zip
Display executable.exe, showing line numbers, non-printing characters, and tabs as '^I', with a '$' at the end of each line
cat -n -v -T -e executable.exe
Output the last 20 lines of video.mp4
cat video.mp4 | tail -n 20
Find files modified within the last 7 days
find . -type f -mtime -7
Transfer executable.exe to photos_backup and interactively confirm overwrite while preserving attributes
cp -i -p executable.exe photos_backup
Locate empty files
find . -type f -empty
Make a copy of contract.pdf, don't replace it, and output verbosely
mv -bnv contract.pdf videos
Make a hard link, backup, and copy spreadsheet.xlsx to photos_backup while maintaining its properties.
cp -p -l -b spreadsheet.xlsx photos_backup
Check for updates and add video.mp4 to audio.mp3.zip
zip -u audio.mp3.zip video.mp4
Put video.mp4 on silent display.
cat -q video.mp4
Put backups and its contents in an archive.
zip -r backups backups
Replicate spreadsheet.xlsx to music_library while retaining its attributes, creating a hard link, and making a backup
cp -p -l -b spreadsheet.xlsx music_library
Display every character in the control set for policy.pdf
cat -A policy.pdf
Delete files with name presentation.pptx
find . -name presentation.pptx -execdir rm {} \
Using attribute preservation, clone image.jpg to projects_backup, establish a hard link, and create a backup
cp -p -l -b image.jpg projects_backup
Display contents of a directory recursively
ls -R
Create new archive policy.pdf.zip from contract.pdf
zip -c policy.pdf.zip contract.pdf
Move files with size greater than 1MB from templates to music_library
find templates -type f -size +1M -exec mv {} music_library \;
Delete files with name document.docx
find . -name document.docx -exec rm {} \
Look for regular files
find . -type f
Ignore directory structure when extracting files from document.docx.zip
unzip -j document.docx.zip
Sort files by modification time and display file sizes in human-readable format, then count the number of lines
ls -lt | awk '{print $5}' | wc -l
Check video.mp4.zip for integrity
zip -T video.mp4.zip
Overwrite existing files without prompting when extracting audio.mp3.zip
unzip -o audio.mp3.zip
Transfer spreadsheet.xlsx to logs, then output detailed comments.
mv -v spreadsheet.xlsx logs
List files in a lengthy format with output that is coloured.
ls -lG
Extract only updated files from video.mp4.zip
unzip -U video.mp4.zip
Look for empty files
find . -type f -empty
video.mp4 should be moved to photos. handling it like any other file
mv -T video.mp4 photos
Output the first 50 lines of spreadsheet.xlsx
cat spreadsheet.xlsx | head -n 50
Move script.py with properties preserved to documents_archive
cp -a script.py documents_archive
Move files with size greater than 1MB from templates to music_library
find templates -type f -size +1M -exec mv {} music_library \;
Present file sizes in an easily readable way.
ls -h
Extract only updated files from configuration.ini.zip
unzip -U configuration.ini.zip
Transfer logs to logs_archive with recursive copying, preserving attributes, and creating a backup
cp -r -p -b logs logs_archive
Look for files that are no larger than 1GB or 2GB.
find . -size +1G -size -2G
Find files with names containing *.doc*
find . -type f -name "**.doc**"
Verify policy.pdf.zip's integrity.
zip -T policy.pdf.zip
Make executable.exe a new archive.zip including image.jpg
zip -c executable.exe.zip image.jpg
Ignore directory structure when zipping configuration.ini
zip -j photo.png.zip configuration.ini
Unzip files from executable.exe.zip quietly
unzip -q executable.exe.zip
List directories without their contents
ls -d
Mirror memo.txt to reports_archive and create backups of existing files
cp -b memo.txt reports_archive
Without asking, make a backup, and force copy configuration.ini to downloads_archive while maintaining attributes
cp -f -p -b configuration.ini downloads_archive
Show colored output
ls -G
Ignoring the directory structure, extract the files from configuration.ini.zip
unzip -j configuration.ini.zip
List directories instead of their contents
ls -d
Copy files to music
find . -name video.mp4 -exec cp {} music \
Display files with additional details
ls -l
Create a "templates" directory and list the files within it.
mkdir templates && cp templates/* output