Text
stringlengths
16
168
Code
stringlengths
5
107
Create directory images and parent directories if they do not exist
mkdir -p images
Examine video.mp4.zip for consistency.
unzip -t video.mp4.zip
List directory contents recursively
ls -R
Make the directories documents, reports, and projects with output that is verbose.
mkdir -v documents && mkdir -v reports && mkdir -v projects
Show policy.pdf contents with repeated empty lines suppressed
cat -s policy.pdf
Print the contents of executable.exe with line numbers.
cat -n executable.exe
List directories themselves
ls -d
Show photo.png with suppressed buffered output
cat -u photo.png
Take files out of policy.pdf.zip and replace any files that already exist.
unzip -o policy.pdf.zip
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
Extract the files from presentation.pptx.zip by navigating to downloads_archive.
unzip -C downloads_archive presentation.pptx.zip
Show line endings for executable.exe
cat -E executable.exe
Extract image.jpg.zip, then update your files with the latest versions.
unzip -U image.jpg.zip
Create the directory "logs" and extract the contents of "presentation.pptx.zip" into it using Zipping.
mkdir logs && unzip presentation.pptx.zip -d logs
Locate regular files
find . -type f
Display every character in the control set for spreadsheet.xlsx
cat -A spreadsheet.xlsx
Find empty directories
find . -type d -empty
Copy files to reports
find . -name presentation.pptx -exec cp {} reports \
Print report.pdf contents with non-blank line numbering
cat -b report.pdf
Display document.docx with suppressed empty lines
cat -s document.docx
Display all files and directories recursively
ls -R
Unarchive spreadsheet.xlsx.zip, quietly and extracting to standard output to directory temp_folder
unzip -q -p -d temp_folder spreadsheet.xlsx.zip
Filter files in templates based on *.mp3 and move them to downloads_archive
grep "*.mp3" templates/* | xargs -I {} mv {} downloads_archive
Backup backups to images_backup and maintain its attributes with recursive copying, creating a backup
cp -r -p -b backups images_backup
Recursively list subdirectories with detailed information, then calculate the total disk usage
ls -Rl | du -h
Transfer downloads to archive with recursive copying and preserving attributes
cp -r -p downloads archive
Transfer executable.exe to projects_backup while maintaining attributes
cp -a executable.exe projects_backup
Reverse the order of file listing
ls -r
Display file sizes in a format that is easy to read
ls -h
Overwrite existing files in projects with policy.pdf
mv -f policy.pdf projects
Show the names of the directories rather than their contents.
ls -d
Unprompted overwrite current files when extracting report.pdf.zip
unzip -o report.pdf.zip
List directories without their contents
ls -d
Move policy.pdf to databases, prompt before overwriting
mv -i policy.pdf databases
Find files with names starting with 'report' and with read permissions for others
find . -type f -name "report*" -perm /o=r
Package files video.mp4, report.pdf, database.sql into image.jpg.zip, excluding '*.tmp' files
zip -x '*.tmp' -r image.jpg.zip video.mp4 report.pdf database.sql
Archive files presentation.pptx, presentation.pptx, report.pdf into memo.txt.zip, using compression level 6, excluding '*.tmp' files
zip -6 -x '*.tmp' memo.txt.zip presentation.pptx presentation.pptx report.pdf
Remove script.py from presentation.pptx.zip
zip -d presentation.pptx.zip script.py
Locate files named photo.png
find . -name photo.png
Before replacing executable.exe in temp, prompt, treating destination as file
mv -iT executable.exe temp
List contents of video.mp4 with buffered output suppression
cat -u video.mp4
Transfer executable.exe to images_backup and establish a hard link
cp -l executable.exe images_backup
Display directories at the top of the list
ls --group-directories-first
Maintain database.sql's characteristics and backup it to backup
cp -p database.sql backup
Preserve attributes of report.pdf while copying to downloads_archive
cp -p report.pdf downloads_archive
Create directory images with verbose output
mkdir -v images
If the parent directories do not already exist, create the directory scripts with verbose output.
mkdir -v -p scripts
video.mp4 should be moved to photos. handling it like any other file
mv -T video.mp4 photos
Find empty directories
find . -type d -empty
Copy policy.pdf to output while maintaining properties
cp -a policy.pdf output
Search for directories named *.pdf in the current directory
find . -type d -name "*.pdf"
Show non-printing characters for memo.txt
cat -v memo.txt
Show file sizes in a readable format
ls -h
Make a backup of proposal.docx, relocate it only if it's more recent, and don't replace it.
mv -bnu proposal.docx archives
List every file with the word "backup" in its name, together with all relevant details.
ls -l *backup*
File inode numbers are displayed
ls -i
Copy files to archives
find . -name configuration.ini -execdir cp {} archives \
Clone report.pdf to reports_archive and prompt for permission to overwrite
cp -i report.pdf reports_archive
List the files in descending order of size, show the file sizes in a comprehensible way, and then show the first ten lines.
ls -lSh | head -n 10
List file sizes in a way understandable to humans
ls -h
Give file sizes in an easy-to-read format.
ls -h
Duplicate video.mp4 to scripts_backup and keep attributes unchanged while creating a hard link
cp -p -l video.mp4 scripts_backup
Compress files using gzip
find . -type f -exec gzip {} \
Present file sizes in an understandable format for humans.
ls -h
Move database.sql to documents and provide verbose output
mv -v database.sql documents
Compress files document.docx, presentation.pptx, executable.exe into spreadsheet.xlsx.zip, compressing only '*.txt' files
zip -n '*.txt' spreadsheet.xlsx.zip document.docx presentation.pptx executable.exe
List contents of audio.mp3.zip without extracting
unzip -l audio.mp3.zip
Find files with names containing 'test' and with read and write permissions for the user
find . -type f -name "*test*" -perm -u=rw
Show photo.png with suppressed buffered output
cat -u photo.png
Transfer proposal.docx to images_backup and prompt before replacing files
cp -i proposal.docx images_backup
Compile and transfer configuration.ini to configuration.ini.zip.
zip -u configuration.ini.zip configuration.ini
Show tabs as ^I for database.sql
cat -T database.sql
List directory contents recursively
ls -R
Create a backup and force move photo.png to downloads
mv -fb photo.png downloads
Create directory reports with verbose output
mkdir -v reports
Generate a directory called 'images', transfer all the files from 'scripts' to 'archives', and lastly locate files that correspond to the pattern '*.ini'.
mkdir /images/ | cp /scripts/* /images/ | mv /images/* /archives/ | find /archives/ -name "*.*.ini"
Create a "templates" directory and list the files within it.
mkdir templates && cp templates/* output
Push database.sql hard to presentations, ask for confirmation, and only transfer if there's a newer version available.
mv -ifu database.sql presentations
Show line numbers for contract.pdf
cat -n contract.pdf
Place video.mp4 inside of database.sql.zip
zip -u database.sql.zip video.mp4
Search for symbolic links
find . -type l
Forcefully move photo.png to photos, but ask for approval
mv -if photo.png photos
Extract script.py.zip without displaying output
unzip -q script.py.zip
Change directory to music_library and extract files from image.jpg.zip
unzip -C music_library image.jpg.zip
Refresh video.mp4 in the zip file configuration.ini.
zip -f configuration.ini.zip video.mp4
Sort files alphabetically backwards
ls -r
Package files script.py, image.jpg, database.sql into presentation.pptx.zip, using compression level 3, silently
zip -3 -q presentation.pptx.zip script.py image.jpg database.sql
Before replacing presentation.pptx in projects, ask for confirmation.
mv -i presentation.pptx projects
Make a backup copy of spreadsheet.xlsx and duplicate it to templates_backup with user approval to overwrite, preserve attributes, and overwrite
cp -i -p -b spreadsheet.xlsx templates_backup
Move policy.pdf to archives and overwrite existing files
mv -f policy.pdf archives
Update existing files in document.docx.zip
zip -u document.docx.zip report.pdf
Display presentation.pptx, showing the dollar at the end of each line
cat -e presentation.pptx
List files in a lengthy format with output that is coloured.
ls -lG
Release photo.png.zip, excluding archive.zip, verbose output, and extracting symbolic links to directory output
unzip -x archive.zip -v -l -d output photo.png.zip
Locate files named photo.png
find . -name photo.png
Prompt for confirmation before moving document.docx to presentations
mv -i document.docx presentations
Show files listed in order of size
ls -S
Show directories in the beginning of the list
ls --group-directories-first
Display verbose output while extracting contract.pdf.zip
unzip -v contract.pdf.zip
Output video.mp4 with visible non-printing characters.
cat -v video.mp4