Text
stringlengths
16
168
Code
stringlengths
5
107
Backup archives to temp_folder and maintain its attributes with recursive copying
cp -r -p archives temp_folder
Erase spreadsheet.xlsx from policy.pdf.zip
zip -d policy.pdf.zip spreadsheet.xlsx
Compress files using gzip
find . -type f -execdir gzip {} \
Display photo.png with the error messages hidden
cat -q photo.png
Extract files with verbose mode enabled from database.sql.zip
unzip -v database.sql.zip
Forcefully move audio.mp3 to photos without prompting
mv -f audio.mp3 photos
Test presentation.pptx.zip for errors
unzip -t presentation.pptx.zip
Display report.pdf with line numbers
cat -n report.pdf
Ignore paths when zipping photo.png
zip -j document.docx.zip photo.png
Extract files from presentation.pptx.zip into temp_folder
unzip -d temp_folder presentation.pptx.zip
Place configuration.ini.zip inside database.sql.
zip -m configuration.ini.zip database.sql
Pack memo.txt without paths into archive
zip -j script.py.zip memo.txt
Making a hard link and mirroring presentation.pptx to scripts_backup while preserving properties
cp -p -l presentation.pptx scripts_backup
Test integrity of contract.pdf.zip
zip -T contract.pdf.zip
Backup current files and move downloads to templates_backup.
cp -b -r downloads templates_backup
Search for files smaller than 100KB
find . -size -100k
Before replacing proposal.docx in reports, prompt, treating destination as file
mv -iT proposal.docx reports
Find files with permissions set to 777
find . -type f -perm 777
Transfer configuration.ini to output and, if required, prompt before overwriting
cp --interactive configuration.ini output
List files in order of file size
ls -S
compel Make a backup of the current files and copy document.docx to temp_folder.
cp -b -f document.docx temp_folder
List all files and directories, including hidden ones
ls -a
Recursive copying is used to transfer music to documents_backup while maintaining attributes.
cp -r -p music documents_backup
Show directories themselves with detailed information, then list the number of files in each directory
ls -ld */ | xargs -I {} sh -c 'echo {}; ls -l {} | wc -l'
Forcefully move image.jpg to downloads, prompt before overwriting, and move only if newer
mv -fiu image.jpg downloads
Move database.sql to projects_backup, then ask to overwrite interactively.
cp -i database.sql projects_backup
Pack spreadsheet.xlsx into video.mp4.zip
zip -c video.mp4.zip spreadsheet.xlsx
Decompress video.mp4.zip, extracting files matching pattern '*.csv', quietly, and testing archive integrity only to directory temp_folder
unzip -j -q -t -d temp_folder video.mp4.zip '*.csv'
Transfer image.jpg to archives, making any necessary destination overwrites.
mv -f image.jpg archives
List directories and their contents recursively
ls -R
Check that memo.txt.zip is intact.
zip -T memo.txt.zip
Prompt before overwriting script.py in videos_backup
cp -i script.py videos_backup
Extract presentation.pptx.zip with password 'secretpass', verbose output, excluding temp_file2.txt, and extracting to standard output to directory downloads_archive
unzip -P secretpass -v -x temp_file2.txt -p -d downloads_archive presentation.pptx.zip
Extract image.jpg.zip with password '*.pdf'
unzip -P *.pdf image.jpg.zip
Copy script.py to reports_archive while keeping all of its properties.
cp -a script.py reports_archive
Display the contents of document.docx with the repeated blank lines disabled
cat -s document.docx
Move policy.pdf to templates_backup, verify overwrite interactively, maintain attributes, and make a backup.
cp -i -p -b policy.pdf templates_backup
List directory names only
ls -d
List contents of document.docx with buffered output suppression
cat -u document.docx
Clone report.pdf with preserving attributes to scripts_backup
cp -a report.pdf scripts_backup
List contents of video.mp4 with buffered output suppression
cat -u video.mp4
Create a backup of proposal.docx, do not overwrite, display verbose output, and treat destination as file
mv -bnvT proposal.docx presentations
Make a backup of the current files and copy configuration.ini to reports_archive.
cp -b -p configuration.ini reports_archive
Display hidden folders and files with a coloured output.
ls -aG
Show files with colored output
ls -G
Delete files with name presentation.pptx
find . -name presentation.pptx -execdir rm {} \
Open database.sql.zip, extract the contents, and replace any existing files.
unzip -o database.sql.zip
Copy files to archives
find . -name configuration.ini -execdir cp {} archives \
Backup backups to images_backup and maintain its attributes with recursive copying, creating a backup
cp -r -p -b backups images_backup
Show the file's inode numbers.
ls -i
Print presentation.pptx contents with line numbering
cat -n presentation.pptx
Delete files with name memo.txt
find . -name memo.txt -exec rm {} \
Reverse the default sorting order
ls -r
Display proposal.docx with non-blank line numbers
cat -b proposal.docx
Copy report.pdf to downloads_archive and ask before replacing existing files
cp -i report.pdf downloads_archive
Delete files with name image.jpg
find . -name image.jpg -delete
Out of report.pdf.zip, remove proposal.docx.
zip -d report.pdf.zip proposal.docx
Output the last 30 lines of database.sql
cat database.sql | tail -n 30
Unzip files from script.py.zip quietly
unzip -q script.py.zip
Place the files from photos into an archive.
zip -r photos photos
Delete files with name video.mp4
find . -name video.mp4 -delete
Make a fresh archive with video.mp4.zip from photo.png
zip -c video.mp4.zip photo.png
Show document.docx with error messages suppressed
cat -q document.docx
Forcefully move image.jpg to presentations, prompt before overwriting, and move only if newer
mv -fiu image.jpg presentations
If the parent directories and directory presentations don't already exist, create them.
mkdir -p presentations
Search for files modified exactly 30 days ago
find . -mtime 30
Files should be sorted descendingly.
ls -r
Sort files by the date they were last modified.
ls -t
Search for empty directories
find . -type d -empty
Copy downloads in its entirety, including all subdirectories, to documents_archive.
cp -r downloads documents_archive
Files should be sorted in reverse order.
ls -r
List contents of photo.png with line numbers
cat -n photo.png
Turn on colour output.
ls -G
In reports_archive, prompt before overwriting memo.txt.
cp -i memo.txt reports_archive
Backup logs to images_backup and backup existing files
cp -b -r logs images_backup
Duplicate images to downloads_archive including all subdirectories
cp -r images downloads_archive
Look for gaming devices.
find . -type c
Show image.jpg with the blank lines suppressed.
cat -s image.jpg
Look for files under 100 KB in size.
find . -size -100k
List of files in extended format
ls -l
Look for files with the name database.sql.
find . -name database.sql
Display verbose output while extracting contract.pdf.zip
unzip -v contract.pdf.zip
Move audio.mp3 forcefully to archives, ask for permission before overwriting, and treat the destination as a file.
mv -fiT audio.mp3 archives
List contents of audio.mp3.zip without extracting
unzip -l audio.mp3.zip
Display proposal.docx, showing line numbers and non-printing characters, with a '$' at the end of each line
cat -n -v -e proposal.docx
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
Extract memo.txt that is encrypted.Zip file protected with '*.mp3'
unzip -P *.mp3 memo.txt.zip
Enumerate file sizes in a human-readable format.
ls -h
List files one per line
ls -1
Mirror proposal.docx to music_library and overwrite existing files without seeking permission
cp -f proposal.docx music_library
Only use configuration.ini in place of scripts if it is less than or equal to that directory.
mv -u configuration.ini scripts
Verbose result: proposal.docx should be moved to templates.
mv -v proposal.docx templates
Duplicate images to downloads_archive including all subdirectories
cp -r images downloads_archive
Transferring report.pdf to downloads will replace any preexisting files.
mv -f report.pdf downloads
Search for files larger than 1MB
find . -size +1M
Ask before replacing script.py in music
mv -i script.py music
Display proposal.docx in quiet mode
cat -q proposal.docx
Refresh video.mp4 in the zip file configuration.ini.
zip -f configuration.ini.zip video.mp4
Make spreadsheet.xlsx a hard link in documents_backup.
cp -l spreadsheet.xlsx documents_backup
Extract files with verbose mode enabled from database.sql.zip
unzip -v database.sql.zip