Text
stringlengths
16
168
Code
stringlengths
5
107
Backup downloads to backup and preserve directory structure
cp -r downloads backup
Replicate database.sql to documents_archive and ask before replacing existing files
cp -i database.sql documents_archive
List files in memo.txt.zip
unzip -l memo.txt.zip
Check for corruption with configuration.ini.zip.
unzip -t configuration.ini.zip
Preserve attributes of report.pdf while copying to downloads_archive
cp -p report.pdf downloads_archive
Create directories videos, templates, backups with verbose output
mkdir -v videos && mkdir -v templates && mkdir -v backups
If the parent directories and directory presentations don't already exist, create them.
mkdir -p presentations
Replicate document.docx to videos_backup and forcefully overwrite existing files
cp -f document.docx videos_backup
Transfer document.docx to music_library while keeping all of its properties.
cp -p document.docx music_library
Package files audio.mp3, photo.png, presentation.pptx into policy.pdf.zip, saving extended attributes
zip -X policy.pdf.zip audio.mp3 photo.png presentation.pptx
If music is outdated or nonexistent, substitute photo.png for it.
mv -u photo.png music
Show policy.pdf as ^ with tabsI
cat -T policy.pdf
Zip files presentation.pptx, policy.pdf, database.sql into configuration.ini.zip, excluding '*.log' files, verbose output
zip -x '*.log' -v configuration.ini.zip presentation.pptx policy.pdf database.sql
Forcefully move database.sql to temp, prompt before overwriting, and treat destination as file
mv -fiT database.sql temp
If music is outdated or nonexistent, substitute photo.png for it.
mv -u photo.png music
Make a hard link, backup, and replicate memo.txt to music_library while preserving its properties.
cp -p -l -b memo.txt music_library
Locate files modified more than 1 year ago
find . -mtime +365
Backup current files and move downloads to templates_backup.
cp -b -r downloads templates_backup
Place configuration.ini.zip inside executable.exe.
zip -m configuration.ini.zip executable.exe
Extraction of image.jpg.zip in full
unzip -v image.jpg.zip
Provide a human-readable list of file sizes.
ls -h
Move spreadsheet.xlsx into script.py.zip
zip -m script.py.zip spreadsheet.xlsx
Find files with names ending in '.log' and larger than 1MB
find . -type f -name "*.log" -size +1M
Clone report.pdf with preserving attributes to scripts_backup
cp -a report.pdf scripts_backup
Force copy presentation.pptx to archive and create a backup of existing files
cp -b -f presentation.pptx archive
Display verbose output while extracting executable.exe.zip
unzip -v executable.exe.zip
Create zip of presentations and its contents
zip -r presentations presentations
Show audio.mp3 contents with repeated empty lines suppressed
cat -s audio.mp3
Forcefully move presentation.pptx to photos, overwriting if necessary
mv -f presentation.pptx photos
Concatenate audio.mp3 and spreadsheet.xlsx, numbering non-blank output lines
cat -b audio.mp3 spreadsheet.xlsx
Delete files with name presentation.pptx
find . -name presentation.pptx -execdir rm {} \
Show directories listed first
ls --group-directories-first
Clone image.jpg to images_backup with attribute preservation, creating a hard link, and making a backup
cp -p -l -b image.jpg images_backup
Make a symbolic link named "pointer" pointing to "archive" and establish a new directory called "projects".
mkdir projects && ln -s archive pointer
Display hidden files and directories in long format with detailed information and colors
ls -alG
In document.docx.zip, add database.sql and check for updates.
zip -f document.docx.zip database.sql
Zip backups repeatedly
zip -r backups backups
Transfer spreadsheet.xlsx to projects, replacing any files that are already there.
mv -f spreadsheet.xlsx projects
Unpack proposal.docx.zip, preserving permissions, overwriting existing files, and only extracting files matching pattern '*.pdf' to directory documents_archive
unzip -K -o -j -d documents_archive proposal.docx.zip '*.pdf'
File compression with gzip
find . -type f -exec gzip {} \
Move contract.pdf with attribute preservation to scripts_backup
cp -p contract.pdf scripts_backup
List contents of photo.png with non-blank line numbers
cat -b photo.png
Fill database.sql with executable.exe.zip
zip -c database.sql.zip executable.exe
Unpack proposal.docx.zip, preserving permissions, overwriting existing files, and only extracting files matching pattern '*.pdf' to directory documents_archive
unzip -K -o -j -d documents_archive proposal.docx.zip '*.pdf'
Verbose output should be displayed while extracting photo.png.zip.
unzip -v photo.png.zip
Zip database.sql without directory structure
zip -j audio.mp3.zip database.sql
Compress files presentation.pptx, proposal.docx, proposal.docx into document.docx.zip, compressing with best compression, preserving paths
zip -9 -r document.docx.zip presentation.pptx proposal.docx proposal.docx
Examine audio.mp3.zip for mistakes.
unzip -t audio.mp3.zip
Move configuration.ini to templates as a regular file
mv -T configuration.ini templates
Find files with names ending in '.txt' and modified in the last 7 days
find . -type f -name "*.txt" -mtime -7
List files sorted by modification time and display file sizes in human-readable format
ls -lt -h
Making a hard link and mirroring presentation.pptx to reports_archive while preserving properties
cp -p -l presentation.pptx reports_archive
Remove all files with the name executable.exe.
find . -name executable.exe -exec rm {} \
List all files and directories, including hidden ones
ls -a
Replace scripts with configuration.ini without confirmation
mv -f configuration.ini scripts
Files should be sorted by size.
ls -S
Push database.sql hard to presentations, ask for confirmation, and only transfer if there's a newer version available.
mv -ifu database.sql presentations
Find any files with less than 100 KB.
find . -size -100k
Zip files executable.exe, contract.pdf, video.mp4 into report.pdf.zip, using compression level 6, verbose output
zip -6 -v report.pdf.zip executable.exe contract.pdf video.mp4
Create directory "templates" and move files matching pattern "*.py" to it.
mkdir templates && mv **.py* templates
Zip the contents of the newly created directory "backups" into the file "spreadsheet.xlsx.zip".
mkdir backups && zip spreadsheet.xlsx.zip backups/*
Output memo.txt with visible non-printing characters.
cat -v memo.txt
Verbose mode: Move image.jpg to documents
mv -v image.jpg documents
Make a backup of the current files and copy memo.txt to downloads_archive.
cp -b memo.txt downloads_archive
Display report.pdf, showing line numbers, non-printing characters, and tabs as spaces
cat -n -vT report.pdf
Show every file, even those that are hidden.
ls -a
Make a copy of document.docx in projects_backup and forcefully replace any existing files.
cp -f document.docx projects_backup
Extract files from spreadsheet.xlsx.zip into photos_backup
unzip -d photos_backup spreadsheet.xlsx.zip
Extract files with verbose output from database.sql.zip
unzip -v database.sql.zip
Make 'music', copy a file 'spreadsheet.xlsx' into it, and then delete the original file.
mkdir /music/ | cp /spreadsheet.xlsx /music/ | rm /spreadsheet.xlsx
Verbose extraction of contract.pdf.zip
unzip -v contract.pdf.zip
Make a hard link by copying script.py to projects_backup and maintaining all of its properties.
cp -p -l script.py projects_backup
Print the contents of database.sql with non-blank line numbering.
cat -b database.sql
Place all of scripts's files in an archive.s
zip -r scripts scripts
Display configuration.ini, showing tabs as spaces
cat -T configuration.ini
Mirror proposal.docx with properties preserved to videos_backup
cp -p proposal.docx videos_backup
List all files ending with ".py" with colored output
ls -G *.py
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
Erase spreadsheet.xlsx from presentation.pptx.zip
zip -d presentation.pptx.zip spreadsheet.xlsx
Files are sorted by modification time.
ls -t
Clone database.sql with preserving attributes to temp_folder
cp -p database.sql temp_folder
Show all files including hidden files
ls -a
Extraction of files from video.mp4.zip enabling verbose mode
unzip -v video.mp4.zip
Archive files script.py, memo.txt, database.sql into script.py.zip, displaying verbose output, including empty directories
zip -v -r0 script.py.zip script.py memo.txt database.sql
Check for updates and add document.docx to image.jpg.zip
zip -f image.jpg.zip document.docx
silently list the contents of configuration.ini
cat -q configuration.ini
Package files video.mp4, script.py, video.mp4 into policy.pdf.zip, compressing with best compression
zip -9 policy.pdf.zip video.mp4 script.py video.mp4
Ask before overwriting backups with image.jpg
mv -i image.jpg backups
Only use configuration.ini in place of scripts if it is less than or equal to that directory.
mv -u configuration.ini scripts
Replace databases with spreadsheet.xlsx if it's newer or doesn't exist
mv -u spreadsheet.xlsx databases
Create a backup of script.py, do not overwrite, display verbose output, and treat destination as file
mv -bnvT script.py archives
Extract image.jpg.zip, then update your files with the latest versions.
unzip -U image.jpg.zip
Make executable.exe.zip that includes report.pdf
zip -c executable.exe.zip report.pdf
In document.docx.zip, add database.sql and check for updates.
zip -f document.docx.zip database.sql
Print audio.mp3 using the symbol ^ for the tabs.I
cat -T audio.mp3
Synchronize contents of photos with archive using rsync and move files
rsync -av --remove-source-files photos/ archive
Transfer proposal.docx to images_backup and prompt before replacing files
cp -i proposal.docx images_backup
Transfer memo.txt as a normal file to music.
mv -T memo.txt music
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
Files from configuration.ini.zip should be extracted into documents_backup.
unzip -d documents_backup configuration.ini.zip