Text
stringlengths
16
168
Code
stringlengths
5
107
If the parent directories and the directories scripts, presentations, and reports don't already exist, create them with verbose output.
mkdir -p -v scripts && mkdir -p -v presentations && mkdir -p -v reports
Extraction of image.jpg.zip in full
unzip -v image.jpg.zip
Generate directory "documents" and list contents of "documents".
mkdir documents && ls documents
Display proposal.docx, showing line numbers and non-printing characters, with a '$' at the end of each line
cat -n -v -e proposal.docx
Display directories at the top of the list
ls --group-directories-first
Search for files with names containing 'log' and created in the last 24 hours
find . -type f -name "*log*" -ctime -1
Ask before replacing presentation.pptx in videos and treat destination as a file
mv -Ti presentation.pptx videos
Display executable.exe with buffered output suppressed
cat -u executable.exe
Find directories with names ending in 'backup' and with read permissions for the group
find . -type d -name "*backup" -perm /g=r
Unwrap configuration.ini.zip, extracting to standard output, to directory backup
unzip -p -d backup configuration.ini.zip
Using hard links, mirror presentation.pptx to backup
cp -l presentation.pptx backup
Sort files by modification time
ls -t
Replicate audio.mp3 to temp_folder while retaining its attributes
cp -p audio.mp3 temp_folder
If policy.pdf is more recent or does not already exist in photos, move it there.
mv -u policy.pdf photos
Sort files by size and modification time in reverse order with colored output
ls -SltrG
Find files with a size of precisely 50 bytes.
find . -size 50c
Keep a copy of policy.pdf, avoid overwriting, and provide detailed feedback.
mv -nbv policy.pdf logs
Before replacing executable.exe in temp, prompt, treating destination as file
mv -iT executable.exe temp
Enumerate files with expanded properties.
ls -l
Display inode numbers of files
ls -i
Print report.pdf contents with non-blank line numbering
cat -b report.pdf
Search for files with names containing 'image' and with execute permissions for others
find . -type f -name "*image*" -perm /o=x
Enable colored listing
ls -G
List files in long format
ls -l
List the contents of a directory, including any hidden files or directories.
ls -a
Output the first 15 lines of report.pdf
cat report.pdf | head -n 15
Zip files photo.png, proposal.docx, executable.exe into audio.mp3.zip, compressing only '*.txt' files, verbose output
zip -n '*.txt' -v audio.mp3.zip photo.png proposal.docx executable.exe
Without asking, forcefully copy report.pdf to scripts_backup while maintaining attributes
cp -f -p report.pdf scripts_backup
Show the inode numbers for files.
ls -i
Archive files image.jpg, document.docx, photo.png into document.docx.zip, preserving paths
zip -r document.docx.zip image.jpg document.docx photo.png
Transfer proposal.docx to images_backup and prompt before replacing files
cp -i proposal.docx images_backup
Overwrite files without prompting when extracting memo.txt.zip
unzip -o memo.txt.zip
Place executable.exe in the policy.pdf archive.zip
zip -m policy.pdf.zip executable.exe
Verbose extraction of contract.pdf.zip
unzip -v contract.pdf.zip
To images, copy the files.
find . -name script.py -exec cp {} images \
Look for files with name presentation.pptx
find . -name presentation.pptx
Display report.pdf with non-blank line numbers
cat -b report.pdf
List directories without their contents
ls -d
Place configuration.ini.zip inside executable.exe.
zip -m configuration.ini.zip executable.exe
Show directories prioritized over files
ls --group-directories-first
Mirror proposal.docx with properties preserved to videos_backup
cp -p proposal.docx videos_backup
Extract files from image.jpg.zip into downloads_archive
unzip -d downloads_archive image.jpg.zip
Clone spreadsheet.xlsx to reports_archive with attribute preservation
cp -a spreadsheet.xlsx reports_archive
Extract the files from presentation.pptx.zip by navigating to downloads_archive.
unzip -C downloads_archive presentation.pptx.zip
Search for files with names containing 'document' and created in the last 24 hours
find . -type f -name "*document*" -ctime -1
Verify configuration.ini.zip's integrity.
zip -T configuration.ini.zip
Check for updates and add contract.pdf to report.pdf.zip
zip -f report.pdf.zip contract.pdf
Make a hard link, backup, and duplicate executable.exe to projects_backup while maintaining all attributes.
cp -p -l -b executable.exe projects_backup
List files sorted by size and modification time in reverse order
ls -Sltr
Force copy spreadsheet.xlsx to archive without prompting and preserving attributes
cp -f -p spreadsheet.xlsx archive
Display memo.txt in quiet mode
cat -q memo.txt
Archive files video.mp4, video.mp4, audio.mp3 into policy.pdf.zip, excluding '*.log' files, storing symbolic links
zip -x '*.log' -y policy.pdf.zip video.mp4 video.mp4 audio.mp3
Print each file on a new line
ls -1
List the contents of report.pdf while suppressing the repetitive blank lines.
cat -s report.pdf
Unzip the contents of "database.sql" into the directory "music" that has been created.
mkdir music && unzip database.sql.zip -d music
Transfer videos to documents_archive with recursive copying, preserving attributes, and creating a backup
cp -r -p -b videos documents_archive
Freshen video.mp4 in script.py.zip
zip -f script.py.zip video.mp4
Compress files using gzip
find . -type f -execdir gzip {} \
List all files with names ending in ".mp4" sorted by modification time
ls -t *.mp4
Make a backup of video.mp4, don't replace it, and only move it if it's more recent.
mv -nbu video.mp4 presentations
Duplicate executable.exe to music_library and backup existing files
cp -b -p executable.exe music_library
Create a backup of report.pdf, do not overwrite, and move only if newer
mv -bnu report.pdf scripts
Change directory to videos_backup and extract files from photo.png.zip
unzip -C videos_backup photo.png.zip
Clone script.py to images_backup and forcefully substitute existing files
cp -f script.py images_backup
Take the updated files out of photo.png.zip.
unzip -U photo.png.zip
List the contents of presentation.pptx using the ^tabsI
cat -T presentation.pptx
Unprompted overwrite current files when extracting video.mp4.zip
unzip -o video.mp4.zip
Check for updates and add presentation.pptx to proposal.docx.zip
zip -u proposal.docx.zip presentation.pptx
Request permission before changing audio.mp3 to templates, treat the destination as a file, and provide detailed comments.
mv -TiV audio.mp3 templates
Make backups of the current files and mirror proposal.docx to archive.
cp -b proposal.docx archive
Create a directory called "templates" and copy all of the contents from "videos" to "templates" after moving all of the files from "presentations" to "videos".
mv /presentations/* /videos/ | mkdir /templates/ | cp /videos/* /templates/
Transfer audio.mp3 forcefully to reports, asking for confirmation, and treating destination as a file
mv -ifT audio.mp3 reports
Delete files with name memo.txt
find . -name memo.txt -exec rm {} \
Shrink templates and everything in it.
zip -r templates templates
Mirror policy.pdf to output with attributes intact, creating a hard link, and making a backup
cp -p -l -b policy.pdf output
Create a backup of policy.pdf, do not overwrite, and display verbose output
mv -bnv policy.pdf videos
Take image.jpg out of the proposal.docx.zip.
zip -d proposal.docx.zip image.jpg
Zip templates recursively
zip -r templates templates
Find files with names ending in '.txt' and modified in the last 7 days
find . -type f -name "*.txt" -mtime -7
Zip files contract.pdf, video.mp4, policy.pdf into image.jpg.zip, using password 'pass123', verbose output
zip -P pass123 -v image.jpg.zip contract.pdf video.mp4 policy.pdf
Assume destination is a file, move only if it's newer, and ask before replacing proposal.docx in images.
mv -iTu proposal.docx images
Remove configuration.ini.zip without showing the result
unzip -q configuration.ini.zip
List contents of video.mp4 with line numbers
cat -n video.mp4
Create directory scripts and parent directories if they do not exist
mkdir -p scripts
Mirror memo.txt to projects_backup with attributes intact
cp -a memo.txt projects_backup
Show configuration.ini with every control character present.
cat -A configuration.ini
Mirror proposal.docx to videos_backup with attributes intact, creating a hard link, and making a backup
cp -p -l -b proposal.docx videos_backup
Check for corruption with configuration.ini.zip.
zip -T configuration.ini.zip
Mirror proposal.docx to videos_backup with attributes intact, creating a hard link, and making a backup
cp -p -l -b proposal.docx videos_backup
Search for files larger than 1MB
find . -size +1M
Pack photo.png without any archive paths
zip -j photo.png.zip photo.png
If proposal.docx is more recent, update it in audio.mp3.zip.
zip -f audio.mp3.zip proposal.docx
Provide a complete list of every file in the current directory, then extract just the file names.
ls -al | awk '{print $9}'
Look for files exactly 50 bytes in size
find . -size 50c
Archive report.pdf into new proposal.docx.zip
zip -c proposal.docx.zip report.pdf
Print image.jpg with all control characters visible
cat -A image.jpg
Make a backup of the current files and copy memo.txt to downloads_archive.
cp -b memo.txt downloads_archive
Make a copy of document.docx in projects_backup and forcefully replace any existing files.
cp -f document.docx projects_backup
Shift script.py to projects treating it as a non-directory
mv -T script.py projects
Move the files to reports_archive after extracting them from temp that match *.mp4.
tar -cvf - -C temp.zip . | tar xvf - -C reports_archive --wildcards "*.mp4"