Text
stringlengths
16
168
Code
stringlengths
5
107
Duplicate policy.pdf to documents_backup and request confirmation before overwriting
cp -i policy.pdf documents_backup
Show line numbers for spreadsheet.xlsx
cat -n spreadsheet.xlsx
Extract files silently from proposal.docx.zip
unzip -q proposal.docx.zip
Check integrity of audio.mp3.zip
zip -T audio.mp3.zip
Create zip of presentations and its contents
zip -r presentations presentations
Search for empty files
find . -type f -empty
Files should be listed according to size.
ls -S
Files in contract.pdf.zip are displayed.
unzip -l contract.pdf.zip
Generate directory "music" and exclude file "exclude2.pdf" from it.
mkdir music && ls | grep -v exclude2.pdf
Move spreadsheet.xlsx to scripts if it's newer or doesn't already exist there
mv -u spreadsheet.xlsx scripts
Search for files with names containing 'document' and created in the last 24 hours
find . -type f -name "*document*" -ctime -1
Remove script.py from presentation.pptx.zip
zip -d presentation.pptx.zip script.py
Transfer video.mp4 to scripts as a regular file
mv -T video.mp4 scripts
Copy database.sql and perform a force overwrite in backup
cp -f database.sql backup
Put contract.pdf into a new report.pdf.zip archive.
zip -c report.pdf.zip contract.pdf
Forcefully move image.jpg to presentations, prompt before overwriting, and move only if newer
mv -fiu image.jpg presentations
List subdirectories recursively, each with a colour and full description.
ls -RdlG
Transfer spreadsheet.xlsx to documents_archive and interactively confirm overwrite
cp -i spreadsheet.xlsx documents_archive
Display executable.exe, showing line numbers, non-printing characters, and tabs as spaces
cat -n -vT executable.exe
Delete files with name presentation.pptx
find . -name presentation.pptx -execdir rm {} \
Display document.docx with suppressed empty lines
cat -s document.docx
Enable colorized output
ls -G
List contents of proposal.docx quietly
cat -q proposal.docx
When transferring to archives, avoid overwriting executable.exe.
mv -n executable.exe archives
Extract image.jpg.zip with password '*.pdf'
unzip -P *.pdf image.jpg.zip
Show the file's inode numbers.
ls -i
Verbose: Move database.sql to logs
mv -v database.sql logs
Show non-printing characters for report.pdf
cat -v report.pdf
Display directories listed before files
ls --group-directories-first
Print audio.mp3 without any warning errors
cat -q audio.mp3
Display report.pdf with line numbers
cat -n report.pdf
Display memo.txt with non-printing characters visible
cat -v memo.txt
Backup executable.exe before forcefully moving it to downloads
mv -bf executable.exe downloads
Zip files spreadsheet.xlsx, document.docx, report.pdf into script.py.zip, using compression level 6, verbose output, including empty directories
zip -6 -v -r0 script.py.zip spreadsheet.xlsx document.docx report.pdf
Display hidden files and directories in long format, then remove the owner information
ls -al | awk '{$2=$3=$4=""; print $0}'
Delete script.py from photo.png.zip
zip -d photo.png.zip script.py
If templates is outdated or nonexistent, only substitute video.mp4 for it.
mv -u video.mp4 templates
Mirror contract.pdf to images_backup and replace any files that already exist without authorization
cp -f contract.pdf images_backup
Copy archives recursively to templates_backup
cp -r archives templates_backup
Delete script.py from photo.png.zip
zip -d photo.png.zip script.py
Move presentation.pptx to scripts, preserving existing files
mv -n presentation.pptx scripts
Confirm before replacing contract.pdf with photos
mv -i contract.pdf photos
Do not replace scripts with image.jpg
mv -n image.jpg scripts
Recursive copying is used to preserve the properties of reports after a backup to logs_archive.
cp -r -p reports logs_archive
Display video.mp4 with line endings
cat -E video.mp4
Pack spreadsheet.xlsx into video.mp4.zip
zip -c video.mp4.zip spreadsheet.xlsx
Show hidden files and folders in a lengthy format with rich colours and details.
ls -alG
Create the directory "videos" and provide a list of its contents.
mkdir videos && ls videos
Transfer configuration.ini to output and, if required, prompt before overwriting
cp --interactive configuration.ini output
Move executable.exe to archives if it's newer or doesn't exist
mv -u executable.exe archives
Display files in reverse sorted order
ls -r
Files from spreadsheet.xlsx.zip should be extracted into temp_folder.
unzip -d temp_folder spreadsheet.xlsx.zip
Duplicate audio.mp3 to backup with user confirmation for overwrite
cp -i audio.mp3 backup
List directories themselves, along with full information and coloured output.
ls -dGl
Display every character in the control set for script.py
cat -A script.py
Show executable.exe as ^ with tabsI
cat -T executable.exe
Reverse the default sorting order
ls -r
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
Locate the contract.pdf files.
find . -name contract.pdf
Rename image.jpg to temp using force.
mv -f image.jpg temp
Show audio.mp3 contents with repeated empty lines suppressed
cat -s audio.mp3
Make a hard link, backup, and duplicate executable.exe to projects_backup while maintaining all attributes.
cp -p -l -b executable.exe projects_backup
Display proposal.docx in quiet mode
cat -q proposal.docx
Make a backup of document.docx, relocate it only if it's more recent, and don't replace it.
mv -bnu document.docx photos
Move script.py to logs and provide verbose feedback
mv -v script.py logs
Modify the file permissions.
find . -type f -exec chmod 644 {} \
Create a hard link of document.docx in images_backup
cp -l document.docx images_backup
Files are sorted by size, file sizes are shown in a format that is understandable by humans, and the final five lines are shown.
ls -lSh | tail -n 5
Display directories listed before files
ls --group-directories-first
Retrieve script.py.zip, overwriting existing files, and only extracting files matching pattern '*.jpg' to directory music_library
unzip -o -j -d music_library script.py.zip '*.jpg'
Find files with names containing 'test' and with read and write permissions for the user
find . -type f -name "*test*" -perm -u=rw
Recursively list subdirectories and display directory structure
ls -Rd
List files with extended attributes
ls -l
Duplicate executable.exe to images_backup and retain all attributes
cp -a executable.exe images_backup
In memo.txt.zip, add photo.png and check for updates.
zip -f memo.txt.zip photo.png
Extract the files from memo.txt.zip without a directory structure.
unzip -j memo.txt.zip
Update existing files in image.jpg.zip
zip -u image.jpg.zip proposal.docx
Create a backup of video.mp4, do not overwrite, and move only if newer
mv -bnu video.mp4 documents
If music is outdated or nonexistent, substitute photo.png for it.
mv -u photo.png music
Sort files in logs by size, then move them to logs_archive
ls -S logs | xargs -I {} mv logs/{} logs_archive
Verbose extraction of report.pdf.zip
unzip -v report.pdf.zip
Duplicate image.jpg to temp_folder and overwrite existing files forcibly
cp -f image.jpg temp_folder
Replicate policy.pdf to temp_folder while retaining its attributes and creating a hard link
cp -p -l policy.pdf temp_folder
Sort files according to size and provide extensive information in lengthy format.
ls -Sl
Transfer contract.pdf to reports while keeping all current files.
mv -n contract.pdf reports
Make executable.exe.zip that includes report.pdf
zip -c executable.exe.zip report.pdf
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
Create directory databases with verbose output
mkdir -v databases
Force copy spreadsheet.xlsx to archive without prompting and preserving attributes
cp -f -p spreadsheet.xlsx archive
Show line numbers for database.sql that are not blank.
cat -b database.sql
Forcefully move database.sql to temp, prompt before overwriting, and treat destination as file
mv -fiT database.sql temp
List all files in the current directory with detailed information, then exclude directories
ls -al | grep -v "^d"
Extract files from database.sql.zip into output
unzip -d output database.sql.zip
Push database.sql hard to presentations, ask for confirmation, and only transfer if there's a newer version available.
mv -ifu database.sql presentations
Concatenate report.pdf and report.pdf, numbering non-empty output lines and showing non-printing characters and tabs as '^I'
cat -b -vT report.pdf report.pdf
Files from policy.pdf.zip should be extracted into output.
unzip -d output policy.pdf.zip
Freshen configuration.ini in document.docx.zip
zip -f document.docx.zip configuration.ini
Search for empty files
find . -type f -empty
Take the updated files out of photo.png.zip.
unzip -U photo.png.zip
Show image.jpg with the blank lines suppressed.
cat -s image.jpg