Text
stringlengths
16
168
Code
stringlengths
5
107
Display every character in the control set for spreadsheet.xlsx
cat -A spreadsheet.xlsx
Show the inode numbers for files.
ls -i
Display the output in colour.
ls -G
List file sizes in a way understandable to humans
ls -h
Print presentation.pptx contents with line numbering
cat -n presentation.pptx
Prior to files, list folders.
ls --group-directories-first
Show suppressed buffered output for configuration.ini
cat -u configuration.ini
Replicate video.mp4 to backup preserving attributes
cp -a video.mp4 backup
Make a backup of proposal.docx, relocate it only if it's more recent, and don't replace it.
mv -bnu proposal.docx archives
Show file information in long listing format
ls -l
List the contents of video.mp4 while suppressing buffered output.
cat -u video.mp4
Forcefully move script.py to templates, but prompt before overwriting
mv -fi script.py templates
Unzip files from presentation.pptx.zip quietly
unzip -q presentation.pptx.zip
Find directories with names containing 'backup' and not writable by others
find . -type d -name "*backup*" ! -perm -o=w
Never use policy.pdf in place of downloads.
mv -n policy.pdf downloads
Display the output in colour.
ls -G
Look for empty files
find . -type f -empty
Take configuration.ini out of the memo.txt.zip.
zip -d memo.txt.zip configuration.ini
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"
Display files in reverse alphabetical order
ls -r
Transfer audio.mp3 to reports_archive and forcefully replace existing files
cp -f audio.mp3 reports_archive
Files from proposal.docx.zip should be extracted into backup.
unzip -d backup proposal.docx.zip
Move files named 'spreadsheet.xlsx' and 'proposal.docx' from 'reports' to 'photos'.
mv /reports/spreadsheet.xlsx /photos/ | mv /reports/proposal.docx /photos/
Display database.sql, showing line numbers, non-printing characters, and tabs as spaces, with a '$' at the end of each line
cat -n -vT -e database.sql
Display policy.pdf with all control characters
cat -A policy.pdf
Replicate proposal.docx to backup and backup existing files
cp -b -p proposal.docx backup
Search for character devices
find . -type c
Sort the files by modification time and list all names that finish in ".mp4".
ls -t *.mp4
Concatenate contract.pdf and audio.mp3
cat contract.pdf audio.mp3
Create a new archive using photo.png and database.sql.zip.
zip -c database.sql.zip photo.png
Present comprehensive data: report.pdf should be moved to archives.
mv -v report.pdf archives
Move policy.pdf to presentations with force, but prompt for confirmation
mv -if policy.pdf presentations
Move spreadsheet.xlsx into archives in the same way that you would any other file.
mv -T spreadsheet.xlsx archives
Make a copy of executable.exe, don't replace it, and output verbosely
mv -bnv executable.exe music
video.mp4 should be moved to photos. handling it like any other file
mv -T video.mp4 photos
Extract files from presentation.pptx.zip into temp_folder
unzip -d temp_folder presentation.pptx.zip
Recursively list subdirectories with detailed information, then search for a specific file
ls -Rl | grep "filename"
Place all of the files in archives into an archive.
zip -r archives archives
Copy report.pdf to logs_archive and prompt before overwriting if necessary
cp -i report.pdf logs_archive
Show suppressed buffered output for audio.mp3
cat -u audio.mp3
Print presentation.pptx with suppression of repeated empty lines
cat -s presentation.pptx
Unzip files from presentation.pptx.zip quietly
unzip -q presentation.pptx.zip
Make the directories documents, reports, and projects with output that is verbose.
mkdir -v documents && mkdir -v reports && mkdir -v projects
Move the files from projects to downloads_archive after filtering them using *.txt.
grep -lR "*.txt" projects | xargs -I {} mv {} downloads_archive
Move audio.mp3 to archive and verify overwriting interactively.
cp -i audio.mp3 archive
Display every character in the control set for script.py
cat -A script.py
Recursive copying is used to move music to documents_archive, maintaining attributes, and making a backup.
cp -r -p -b music documents_archive
Create report.pdf.zip containing video.mp4
zip -c report.pdf.zip video.mp4
Display directory structure recursively
ls -R
Transfer logs to logs_archive with recursive copying, preserving attributes, and creating a backup
cp -r -p -b logs logs_archive
Without asking, make a backup, and force copy report.pdf to logs_archive while maintaining attributes
cp -f -p -b report.pdf logs_archive
Move configuration.ini to photos_backup, and if the files are already there, create a backup.
cp -b configuration.ini photos_backup
Update proposal.docx if newer in contract.pdf.zip
zip -u contract.pdf.zip proposal.docx
Move policy.pdf to databases, prompt before overwriting
mv -i policy.pdf databases
Show directories before files.
ls --group-directories-first
Backup spreadsheet.xlsx to documents_archive and maintain its attributes
cp -p spreadsheet.xlsx documents_archive
Only move spreadsheet.xlsx to projects if it is not yet in existence or is newer.
mv -u spreadsheet.xlsx projects
Clone policy.pdf to logs_archive with attribute preservation
cp -p policy.pdf logs_archive
Make new archive photo.png.zip with audio.mp3
zip -c photo.png.zip audio.mp3
Recursive copying is used to transfer music to documents_backup while maintaining attributes.
cp -r -p music documents_backup
Copy logs to projects_backup recursively
cp -r logs projects_backup
Unzip files from executable.exe.zip quietly
unzip -q executable.exe.zip
Make a hard link, backup, and copy configuration.ini to projects_backup while maintaining its properties.
cp -p -l -b configuration.ini projects_backup
Push photo.png firmly into templates, but ask to be asked before overwriting
mv -fi photo.png templates
Compress files spreadsheet.xlsx, database.sql, script.py into presentation.pptx.zip
zip presentation.pptx.zip spreadsheet.xlsx database.sql script.py
Make a copy of database.sql in downloads_archive, but before overwriting, get permission.
cp -i database.sql downloads_archive
List directories ahead of files
ls --group-directories-first
Zip report.pdf without directory structure
zip -j report.pdf.zip report.pdf
Save a backup of script.py, do not overwrite, and show verbose feedback
mv -nbv script.py photos
Print audio.mp3 without any warning errors
cat -q audio.mp3
Search for directories
find . -type d
Recursively list subdirectories with detailed information, colors, and human-readable sizes
ls -RdlhG
Print each file on a new line
ls -1
Output the first 50 lines of spreadsheet.xlsx
cat spreadsheet.xlsx | head -n 50
Create directory databases with verbose output and parent directories if they do not exist
mkdir -v -p databases
Force copy audio.mp3 to output without prompting, preserving attributes, and creating a backup
cp -f -p -b audio.mp3 output
Move configuration.ini to logs_archive and verify overwriting interactively.
cp -i configuration.ini logs_archive
Verify the document.docx.zip's integrity.
unzip -t document.docx.zip
Search for files with names starting with 'file' and modified in the last 7 days
find . -type f -name "file*" -mtime -7
Locate empty directories
find . -type d -empty
To photos, copy the files.
find . -name database.sql -exec cp {} photos \
Change to documents_archive and extract files from report.pdf.zip
unzip -C documents_archive report.pdf.zip
Prompt before overwriting archives with spreadsheet.xlsx
mv -i spreadsheet.xlsx archives
Treat the destination as a file, prompt before overwriting database.sql in temp, and print verbose information.
mv -iTv database.sql temp
Move memo.txt to reports_archive, then prompt for a file replacement.
cp -i memo.txt reports_archive
Without asking, make a backup, and force copy executable.exe to videos_backup while maintaining attributes
cp -f -p -b executable.exe videos_backup
Archive files script.py, executable.exe, video.mp4 into script.py.zip, compressing only '*.txt' files, excluding '*.tmp' files
zip -n '*.txt' -x '*.tmp' script.py.zip script.py executable.exe video.mp4
Move files from scripts to backup and append timestamp to filename
find scripts -type f -exec sh -c 'mv "$1" "$2/$(basename "$1")_$(date +%Y%m%d_%H%M%S)"' sh {} backup \;
Remove photo.png from proposal.docx.zip
zip -d proposal.docx.zip photo.png
Move script.py with properties preserved to documents_archive
cp -a script.py documents_archive
List files in order of last modification time
ls -t
Search for files with names starting with 'data' and not owned by the user 'admin'
find . -type f -name "data*" ! -user admin
Show suppressed buffered output for image.jpg
cat -u image.jpg
Add and move executable.exe to report.pdf.zip
zip -m report.pdf.zip executable.exe
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
List the contents of document.docx while suppressing buffered output.
cat -u document.docx
Show line numbers for database.sql that are not blank.
cat -b database.sql
Show database.sql with line breaks included
cat -E database.sql
List files in memo.txt.zip
unzip -l memo.txt.zip
Without asking, move executable.exe firmly to presentations.
mv -f executable.exe presentations