Text
stringlengths
16
168
Code
stringlengths
5
107
Show image.jpg with the blank lines suppressed.
cat -s image.jpg
Search for empty files
find . -type f -empty
List all files having a coloured output that finish in ".png".
ls -G *.png
List file sizes in human-readable format
ls -h
Maintain database.sql's characteristics and backup it to backup
cp -p database.sql backup
Transfer the files to projects
find . -name report.pdf -exec mv {} projects \
Create directory "documents" and zip its contents into file "memo.txt.zip".
mkdir documents && zip memo.txt.zip documents/*
Pack spreadsheet.xlsx into video.mp4.zip
zip -c video.mp4.zip spreadsheet.xlsx
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 document.docx videos_backup
Make "photos" the directory and remove "ignore2.png" from it.
mkdir photos && ls | grep -v ignore2.png
Silently extract the files from contract.pdf.zip.
unzip -q contract.pdf.zip
Show inode numbers of files
ls -i
Move video.mp4 to images_backup and force overwrite it.
cp -f video.mp4 images_backup
Create backups of the current files and clone photo.png to temp_folder.
cp -b photo.png temp_folder
Show executable.exe with line numbers that aren't blank.
cat -b executable.exe
Move spreadsheet.xlsx to scripts if it's newer or doesn't already exist there
mv -u spreadsheet.xlsx scripts
Extract files from spreadsheet.xlsx.zip and change to projects_backup
unzip -C projects_backup spreadsheet.xlsx.zip
Print executable.exe while suppressing the output from the buffer.
cat -u executable.exe
Show executable.exe as ^ with tabsI
cat -T executable.exe
Recursively list the contents and subdirectories of a directory
ls -R
Create directory music and parent directories if they do not exist
mkdir -p music
Move image.jpg into archive executable.exe.zip
zip -m executable.exe.zip image.jpg
Duplicate executable.exe to output and keep attributes unchanged while creating a hard link
cp -p -l executable.exe output
Locate empty files
find . -type f -empty
Take image.jpg out of the proposal.docx.zip.
zip -d proposal.docx.zip image.jpg
Show line endings for contract.pdf
cat -E contract.pdf
Extract files without directory structure from image.jpg.zip
unzip -j image.jpg.zip
Treat the destination as a file, prompt before overwriting executable.exe in photos, and print verbose information.
mv -iTv executable.exe photos
Move image.jpg to documents with force, prompt for confirmation, and move only if newer
mv -ifu image.jpg documents
Search for files owned by the user 'user1' or 'user2'
find . -type f \( -user user1 -o -user user2 \)
Examine contract.pdf.zip for mistakes.
unzip -t contract.pdf.zip
Check for updates and add document.docx to image.jpg.zip
zip -f image.jpg.zip document.docx
Find directories with names starting with 'project' and not modified in the last 90 days
find . -type d -name "project*" -mtime +90
Extract encrypted report.pdf.zip with password '*.py'
unzip -P *.py report.pdf.zip
Print inode numbers of files
ls -i
Transfer script.py to photos and include detailed comments.
mv -v script.py photos
Transfer document.docx to archive and interactively confirm overwrite while preserving attributes and creating a backup
cp -i -p -b document.docx archive
Take the files out of configuration.ini.Zip the file, then select documents_archive.
unzip -C documents_archive configuration.ini.zip
Clone memo.txt to logs_archive with attribute preservation, creating a hard link, and making a backup
cp -p -l -b memo.txt logs_archive
List directory contents and subdirectories recursively
ls -R
Extract files and overwrite existing files from configuration.ini.zip
unzip -o configuration.ini.zip
Clone spreadsheet.xlsx to reports_archive with attribute preservation
cp -a spreadsheet.xlsx reports_archive
Create a backup and force move photo.png to downloads
mv -fb photo.png downloads
Backup current files and clone contract.pdf to photos_backup.
cp -b -p contract.pdf photos_backup
Create audio.mp3.zip containing image.jpg
zip -c audio.mp3.zip image.jpg
Enable colorized output
ls -G
Mirror report.pdf to music_library and interactively prompt before replacing files
cp -i report.pdf music_library
List files sorted by their sizes
ls -S
Forcefully move document.docx to reports, prompt before overwriting, and treat destination as file
mv -fiT document.docx reports
Find the specified pipes.
find . -type p
Search for files smaller than 100KB
find . -size -100k
Display the contents of report.pdf
cat report.pdf
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
Without asking, make a backup, and force copy report.pdf to logs_archive while maintaining attributes
cp -f -p -b report.pdf logs_archive
Take image.jpg out of the configuration.ini.zip.
zip -d configuration.ini.zip image.jpg
Overwrite existing files without prompting when extracting image.jpg.zip
unzip -o image.jpg.zip
Display the line counts for script.py
cat -n script.py
Verbose extraction of contract.pdf.zip
unzip -v contract.pdf.zip
Print policy.pdf with all control characters visible
cat -A policy.pdf
Show contents of image.jpg.zip
unzip -l image.jpg.zip
Zip templates recursively
zip -r templates templates
Verbose mode: proposal.docx should be moved to presentations.
mv -v proposal.docx presentations
Unzip files from executable.exe.zip ignoring directory structure
unzip -j executable.exe.zip
Making a hard link and mirroring presentation.pptx to reports_archive while preserving properties
cp -p -l presentation.pptx reports_archive
List all files beginning with "data" in reverse order
ls -r data*
List all the contents in a directory, including any hidden files.
ls -a
Show line numbers for script.py that are not blank.
cat -b script.py
Update document.docx if newer in memo.txt.zip
zip -u memo.txt.zip document.docx
Backup temp to backup and maintain its attributes with recursive copying
cp -r -p temp backup
Zip music along with its subfolders
zip -r music music
Archive files audio.mp3, presentation.pptx, audio.mp3 into proposal.docx.zip, using password 'pass123', verbose output
zip -P pass123 -v proposal.docx.zip audio.mp3 presentation.pptx audio.mp3
Provide a complete list of every file in the current directory, then extract just the file names.
ls -al | awk '{print $9}'
List the contents of a directory, including any hidden files or directories.
ls -a
Examine database.sql.zip for consistency.
zip -T database.sql.zip
Display executable.exe, showing line numbers, non-printing characters, and tabs as '^I', with a '$' at the end of each line
cat -n -v -T -e executable.exe
Disentangle policy.pdf.zip, excluding exclude.mp4, to directory images_backup
unzip -x exclude.mp4 -d images_backup policy.pdf.zip
Make a copy of policy.pdf and obliterate the current files in documents_backup.
cp -f policy.pdf documents_backup
List files sorted by size and modification time in reverse order with detailed information, then display the first 15 lines
ls -Sltr | head -n 15
Sort files in logs by size, then move them to logs_archive
ls -S logs | xargs -I {} mv logs/{} logs_archive
Zip music along with its subfolders
zip -r music music
Show inode numbers for files
ls -i
Make a hard link, backup, and duplicate contract.pdf to videos_backup while maintaining all attributes.
cp -p -l -b contract.pdf videos_backup
List directories before files.
ls --group-directories-first
Provide password '*.txt' to unzip policy.pdf.zip
unzip -P *.txt policy.pdf.zip
Forcefully move audio.mp3 to photos without prompting
mv -f audio.mp3 photos
Clone policy.pdf to music_library with attribute preservation, creating a hard link, and making a backup
cp -p -l -b policy.pdf music_library
Display directory names only, without their contents
ls -d
Place all of the files in archives into an archive.
zip -r archives archives
Extract report.pdf.zip, only extracting files matching pattern '*.txt', to directory scripts_backup
unzip -j -d scripts_backup report.pdf.zip '*.txt'
Before replacing files, mirror contract.pdf to documents_archive and ask questions interactively.
cp -i contract.pdf documents_archive
List all files beginning with "data" in reverse order
ls -r data*
Show line numbers for policy.pdf
cat -n policy.pdf
Extract report.pdf.zip, only extracting files matching pattern '*.txt', to directory scripts_backup
unzip -j -d scripts_backup report.pdf.zip '*.txt'
Extract newer files from contract.pdf.zip
unzip -U contract.pdf.zip
Do not overwrite contract.pdf when moving to archives
mv -n contract.pdf archives
Change directory to output and extract files from document.docx.zip
unzip -C output document.docx.zip
Force copy script.py to reports_archive without prompting
cp -f script.py reports_archive
Make directory images and output verbosely
mkdir -v images
Make a hard link and clone memo.txt to documents_backup while preserving attributes.
cp -p -l memo.txt documents_backup
Output memo.txt with visible non-printing characters.
cat -v memo.txt