Text
stringlengths
16
168
Code
stringlengths
5
107
Extract files from audio.mp3.zip into projects_backup
unzip -d projects_backup audio.mp3.zip
Output the first 20 lines of video.mp4
cat video.mp4 | head -n 20
Put every file on a separate line.
ls -1
Display image.jpg with buffered output suppressed
cat -u image.jpg
Locate the contract.pdf files.
find . -name contract.pdf
Locate files exactly 50 bytes in size
find . -size 50c
Replace videos with memo.txt only if it's newer or doesn't exist
mv -u memo.txt videos
Display files with extended information
ls -l
Copy report.pdf to downloads_archive and ask before replacing existing files
cp -i report.pdf downloads_archive
Recursive copying is used to preserve the properties of reports after a backup to logs_archive.
cp -r -p reports logs_archive
List contents of policy.pdf with tabs shown as ^I
cat -T policy.pdf
Forcefully move document.docx to reports, prompt before overwriting, and treat destination as file
mv -fiT document.docx reports
Zip memo.txt ignoring directory structure
zip -j configuration.ini.zip memo.txt
Extract configuration.ini.zip without displaying output
unzip -q configuration.ini.zip
Replace any files that are currently in reports with configuration.ini
mv -f configuration.ini reports
Search for directories named *.pdf in the current directory
find . -type d -name "*.pdf"
Find files larger than 1MB
find . -type f -size +1M
Transfer spreadsheet.xlsx to documents_archive and interactively confirm overwrite
cp -i spreadsheet.xlsx documents_archive
Find the specified pipes.
find . -type p
Move video.mp4 to documents with force, prompt for confirmation, and treat destination as file
mv -ifT video.mp4 documents
List directories themselves
ls -d
Replicate database.sql to documents_archive and ask before replacing existing files
cp -i database.sql documents_archive
Display tabs as ~For memo.txt, I
cat -T memo.txt
Present file sizes in a legible format.
ls -h
Display the line ends for memo.txt
cat -E memo.txt
Recursive copying is used to transfer music to documents_backup while maintaining attributes.
cp -r -p music documents_backup
Create a backup of video.mp4, do not overwrite, and move only if newer
mv -bnu video.mp4 documents
Find files larger than 1MB
find . -size +1M
Copy spreadsheet.xlsx to reports_archive and create a backup of existing files
cp -b spreadsheet.xlsx reports_archive
Package files executable.exe, document.docx, report.pdf into configuration.ini.zip, excluding '*.tmp' files, preserving paths
zip -x '*.tmp' -r configuration.ini.zip executable.exe document.docx report.pdf
Make a "music" directory and add files to it.
mkdir music | ls music
Filter files in templates based on *.mp3 and move them to downloads_archive
grep "*.mp3" templates/* | xargs -I {} mv {} downloads_archive
Show non-blank line numbers for spreadsheet.xlsx
cat -b spreadsheet.xlsx
Replicate video.mp4 to backup preserving attributes
cp -a video.mp4 backup
List files in reverse order of modification time
ls -r
Move the files in archives to downloads_archive after filtering them using *.pdf.
grep "*.pdf" archives/* | xargs -I {} mv {} downloads_archive
Before replacing current files, copy report.pdf to music_library and be sure to ask.
cp -i report.pdf music_library
Forcefully move audio.mp3 to photos without prompting
mv -f audio.mp3 photos
Display file inode numbers
ls -i
Refresh report.pdf in the zip file proposal.docx.
zip -f proposal.docx.zip report.pdf
Extract files with verbose mode enabled from image.jpg.zip
unzip -v image.jpg.zip
Extract spreadsheet.xlsx.zip, verbose output, to directory downloads_archive
unzip -v -d downloads_archive spreadsheet.xlsx.zip
Create archive of photos and its contents
zip -r photos photos
Check for updates and add proposal.docx to executable.exe.zip
zip -f executable.exe.zip proposal.docx
Show line numbers for contract.pdf
cat -n contract.pdf
Remove spreadsheet.xlsx from database.sql.zip
zip -d database.sql.zip spreadsheet.xlsx
Transfer files larger than 1 MB from projects_backup to music
find music -type f -size +1M -exec mv {} projects_backup \;
Delete empty directories
find . -type d -empty -delete
Verbose output: Move photo.png to databases
mv -v photo.png databases
Assume destination is a file, move only if it's newer, and ask before replacing audio.mp3 in templates.
mv -iTu audio.mp3 templates
Print configuration.ini with non-printing characters visible
cat -v configuration.ini
Show file sizes in human-readable units
ls -h
Look for files modified within the last 7 days
find . -mtime -7
Mirror proposal.docx to music_library and overwrite existing files without seeking permission
cp -f proposal.docx music_library
Print presentation.pptx without error messages
cat -q presentation.pptx
Put a line between each file you list.
ls -1
Display files in descending order of size.
ls -S
Print executable.exe contents with line endings
cat -E executable.exe
Duplicate presentation.pptx to backup with preserved attributes
cp -p presentation.pptx backup
Save a backup of database.sql, do not overwrite, and move only if newer
mv -nbu database.sql archives
Clone document.docx to music_library and ask for permission before replacing
cp -i document.docx music_library
Pack logs and its files into archive
zip -r logs logs
Make a backup of the current files and force copy photo.png to downloads_archive.
cp -b -f photo.png downloads_archive
To documents_archive, copy logs. recursively
cp -r logs documents_archive
Transfer image.jpg to backup with attribute preservation
cp -p image.jpg backup
Ignoring the directory structure, extract the files from report.pdf.zip
unzip -j report.pdf.zip
In memo.txt.zip, add photo.png and check for updates.
zip -f memo.txt.zip photo.png
Make a list of the files in the "presentations" directory after creating it.
mkdir presentations && cp presentations/* projects_backup
To documents_archive, copy logs. recursively
cp -r logs documents_archive
List the files in order of modification date.
ls -t
List contents of photo.png with non-blank line numbers
cat -b photo.png
Show hidden files and directories with colored output
ls -aG
Transfer document.docx to temp, replacing current files without permission
mv -f document.docx temp
Move proposal.docx to photos_backup and request confirmation from the user to see if the files are there.
cp -i proposal.docx photos_backup
List directory contents including hidden files
ls -a
Move audio.mp3 forcefully to archives, ask for permission before overwriting, and treat the destination as a file.
mv -fiT audio.mp3 archives
Without asking, move executable.exe firmly to presentations.
mv -f executable.exe presentations
List the contents of a directory, including any hidden files or directories.
ls -a
Enumerate folders empty of contents.
ls -d
Show all files including hidden files
ls -a
Show hidden files and directories in long format with detailed information
ls -al
List files in memo.txt.zip
unzip -l memo.txt.zip
Create a backup by recursively copying photos to music_library while preserving its properties.
cp -r -p -b photos music_library
Without asking, make a backup, and force copy configuration.ini to downloads_archive while maintaining attributes
cp -f -p -b configuration.ini downloads_archive
Update image.jpg in configuration.ini.zip if newer
zip -f configuration.ini.zip image.jpg
Using attribute preservation, clone proposal.docx to templates_backup, establish a hard link, and create a backup
cp -p -l -b proposal.docx templates_backup
Forcefully move image.jpg to downloads, prompt before overwriting, and move only if newer
mv -fiu image.jpg downloads
Display file inode numbers
ls -i
Unzip files from executable.exe.zip ignoring directory structure
unzip -j executable.exe.zip
Search for empty files
find . -type f -empty
Move files to videos
find . -name spreadsheet.xlsx -exec mv {} videos \
Ask before replacing script.py in backups, treat destination as file, and show verbose feedback
mv -TiV script.py backups
Package files configuration.ini, photo.png, database.sql into document.docx.zip, displaying verbose output, storing file attributes
zip -v -X document.docx.zip configuration.ini photo.png database.sql
If templates is outdated or nonexistent, only substitute video.mp4 for it.
mv -u video.mp4 templates
Show subdirectories recursively
ls -R
Display files in reverse sorted order
ls -r
Display the contents of script.py with the repeated blank lines disabled
cat -s script.py
Recursive copying is used to preserve the properties of reports after a backup to logs_archive.
cp -r -p reports logs_archive
Compile and transfer configuration.ini to configuration.ini.zip.
zip -u configuration.ini.zip configuration.ini
Transfer reports to scripts_backup with recursive copying, preserving attributes, and creating a backup
cp -r -p -b reports scripts_backup