Text
stringlengths
16
168
Code
stringlengths
5
107
Copy script.py to projects_backup and prompt for confirmation before replacing
cp -i script.py projects_backup
Move report.pdf to temp, handling it like it wasn't a directory.
mv -T report.pdf temp
For each file name, create a backup, a hard link, and mirror it to the destination directory while preserving its properties.
cp -p -l -b photo.png documents_backup
Create a backup of photo.png, regard the destination as a file, display detailed feedback, and refrain from overwriting.
mv -nbvT photo.png videos
Display configuration.ini, showing line numbers and non-printing characters
cat -n -v configuration.ini
Make script.py a hard link in documents_archive.
cp -l script.py documents_archive
Create archive of photos and its contents
zip -r photos photos
Display script.py with tabs as ^I
cat -T script.py
Check script.py.zip to maintain integrity
unzip -t script.py.zip
Prior to replacing spreadsheet.xlsx with templates, get confirmation.
mv -i spreadsheet.xlsx templates
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
Update proposal.docx if newer in contract.pdf.zip
zip -u contract.pdf.zip proposal.docx
Show audio.mp3 contents with repeated empty lines suppressed
cat -s audio.mp3
Transfer configuration.ini to logs_archive and interactively confirm overwrite while preserving attributes and creating a backup
cp -i -p -b configuration.ini logs_archive
List file sizes in human-readable format
ls -h
List directories ahead of files
ls --group-directories-first
Make a clone of proposal.docx in templates_backup and replace any existing files with force.
cp -f proposal.docx templates_backup
Enumerate folders empty of contents.
ls -d
Erase policy.pdf from proposal.docx.zip
zip -d proposal.docx.zip policy.pdf
Subdirectories are listed recursively, and the directory structure is displayed with coloured output.
ls -RdG
Clone image.jpg to images_backup with attribute preservation and creating a hard link
cp -p -l image.jpg images_backup
Create a backup of audio.mp3, do not overwrite, and display verbose output
mv -bnv audio.mp3 presentations
Transfer document.docx to archive and interactively confirm overwrite while preserving attributes and creating a backup
cp -i -p -b document.docx archive
Arrange files according to when they were last modified, show the file sizes in a legible manner, and then tally the amount of lines.
ls -lt | awk '{print $5}' | wc -l
Delete files with name image.jpg
find . -name image.jpg -delete
Move database.sql to projects_backup, then ask to overwrite interactively.
cp -i database.sql projects_backup
Display database.sql, showing line numbers, non-printing characters, and tabs as '^I'
cat -n -v -T database.sql
Show directories themselves with detailed information, then calculate the total size
ls -ld */ | du -h --max-depth=0
Make a hard link, backup, and duplicate executable.exe to projects_backup while maintaining all attributes.
cp -p -l -b executable.exe projects_backup
Free document.docx.zip, listing files only, to directory downloads_archive
unzip -l -d downloads_archive document.docx.zip
Show report.pdf with the blank lines suppressed.
cat -s report.pdf
Show only the names of the directories; show nothing inside.
ls -d
Display contents of a directory recursively
ls -R
Backup archives to temp_folder and maintain its attributes with recursive copying
cp -r -p archives temp_folder
Unzip files from executable.exe.zip ignoring directory structure
unzip -j executable.exe.zip
List all files in the current directory with detailed information, then sort by file extension
ls -al | awk -F. '{print $NF}' | sort
Backup video.mp4 before forcefully moving it to templates
mv -bf video.mp4 templates
Sort the files in the list according to size, and show the file sizes in a legible manner.
ls -Sh
Extract the files from memo.txt.zip without a directory structure.
unzip -j memo.txt.zip
Without verifying, switch videos for spreadsheet.xlsx.
mv -f spreadsheet.xlsx videos
Show directory names without contents
ls -d
Find files with names containing 'data' and modified more than 30 days ago
find . -type f -name "*data*" -mtime +30
Show line numbers for memo.txt
cat -n memo.txt
Verify the image.jpg.zip's integrity.
zip -T image.jpg.zip
Print database.sql while suppressing the output from the buffer.
cat -u database.sql
If the parent directories and directory logs don't already exist, create them.
mkdir -p logs
Display memo.txt with non-printing characters
cat -v memo.txt
Extract files silently from spreadsheet.xlsx.zip
unzip -q spreadsheet.xlsx.zip
Move configuration.ini to documents without replacing existing files
mv -n configuration.ini documents
Find the image.jpg files.
find . -name image.jpg
Make a backup of video.mp4, don't replace it, and only move it if it's more recent.
mv -nbu video.mp4 presentations
Zip backups repeatedly
zip -r backups backups
List the amount of files in each directory after displaying the directories themselves with comprehensive information.
ls -ld */ | xargs -I {} sh -c 'echo {}; ls -l {} | wc -l'
Copy spreadsheet.xlsx to reports_archive and create a backup of existing files
cp -b spreadsheet.xlsx reports_archive
Show audio.mp3 with the blank lines suppressed.
cat -s audio.mp3
Create a new archive using photo.png and database.sql.zip.
zip -c database.sql.zip photo.png
Update report.pdf in presentation.pptx.zip if newer
zip -f presentation.pptx.zip report.pdf
Show memo.txt with every control character present.
cat -A memo.txt
Remove spreadsheet.xlsx from database.sql.zip
zip -d database.sql.zip spreadsheet.xlsx
List the contents of a directory, including any hidden files or directories.
ls -a
Backup archives to temp_folder and maintain its attributes with recursive copying
cp -r -p archives temp_folder
List contents of spreadsheet.xlsx quietly
cat -q spreadsheet.xlsx
Sync the contents of music_library with archives. moving files and utilising rsync
rsync -av --remove-source-files archives/ music_library
Change permissions of files
find . -type f -execdir chmod 644 {} \
Transfer the files that have been edited within the last seven days from projects to temp_folder.
find projects -type f -mtime -7 -exec mv {} temp_folder \;
Check for updates and add presentation.pptx to proposal.docx.zip
zip -u proposal.docx.zip presentation.pptx
Transfer downloads to archive with recursive copying and preserving attributes
cp -r -p downloads archive
Display files in colorized format
ls -G
Output the last 50 lines of proposal.docx
cat proposal.docx | tail -n 50
Move contract.pdf to scripts and print verbose feedback
mv -v contract.pdf scripts
Find the usual files.
find . -type f
Transfer audio.mp3 to reports and display the output verbosely
mv -v audio.mp3 reports
Show memo.txt with every control character present.
cat -A memo.txt
Display tabs as ~For video.mp4, I
cat -T video.mp4
Display the contents of document.docx with the repeated blank lines disabled
cat -s document.docx
Update existing files in database.sql.zip
zip -u database.sql.zip contract.pdf
Show presentation.pptx with characters that don't print
cat -v presentation.pptx
Locate files named photo.png
find . -name photo.png
Show suppressed buffered output for audio.mp3
cat -u audio.mp3
Print configuration.ini without error messages
cat -q configuration.ini
Pack databases and all its files into archive
zip -r databases databases
Show tabs as ^I for policy.pdf
cat -T policy.pdf
Mirror proposal.docx with properties preserved to videos_backup
cp -p proposal.docx videos_backup
List the files in order of modification date.
ls -t
Examine video.mp4.zip for consistency.
unzip -t video.mp4.zip
Compress projects and its contents
zip -r projects projects
Print photo.png without any warning errors
cat -q photo.png
Display file sizes in comprehensible units for humans.
ls -h
Display configuration.ini, showing line numbers and non-printing characters
cat -n -v configuration.ini
Overwrite existing files when extracting spreadsheet.xlsx.zip
unzip -o spreadsheet.xlsx.zip
Copy files to music
find . -name video.mp4 -exec cp {} music \
Extract files and overwrite existing files from configuration.ini.zip
unzip -o configuration.ini.zip
Ignoring the directory structure, extract the files from configuration.ini.zip
unzip -j configuration.ini.zip
Display policy.pdf with all control characters
cat -A policy.pdf
Include hidden files in the list of files.
ls -a
List files with each on a new line
ls -1
Look for files that have the name report.pdf.
find . -name report.pdf
Create a hard link and replicate image.jpg to output while preserving its properties.
cp -p -l image.jpg output
Gently unzip the contents of memo.txt.zip.
unzip -q memo.txt.zip
Assume destination is a file, move only if it's newer, and ask before replacing audio.mp3 in templates.
mv -iTu audio.mp3 templates