Text
stringlengths
16
168
Code
stringlengths
5
107
Display file sizes in comprehensible units for humans.
ls -h
Recursively list subdirectories with detailed information, then search for a specific file
ls -Rl | grep "filename"
When extracting memo.txt.zip, overwrite any existing files.
unzip -o memo.txt.zip
Display contract.pdf in quiet mode
cat -q contract.pdf
Search for files with names starting with 'file' and modified in the last 7 days
find . -type f -name "file*" -mtime -7
Create a new script.py by archiving report.pdf.zip
zip -c script.py.zip report.pdf
Move configuration.ini to templates as a regular file
mv -T configuration.ini templates
Filter files in databases based on *.exe, then move them to archive
grep -lR "*.exe" databases | xargs -I {} mv {} archive
Find files with names starting with 'report' and with read permissions for others
find . -type f -name "report*" -perm /o=r
Using attribute preservation, clone image.jpg to projects_backup, establish a hard link, and create a backup
cp -p -l -b image.jpg projects_backup
Use hard linking to clone script.py to music_library
cp -l script.py music_library
Transfer audio.mp3 to output and make a backup if files already exist
cp -b -i audio.mp3 output
See what's in database.sql.zip
unzip -l database.sql.zip
Move policy.pdf to presentations with force, but prompt for confirmation
mv -if policy.pdf presentations
Move script.py to documents and replace existing files
mv -f script.py documents
Replace outdated files from policy.pdf.zip with the most recent ones.
unzip -U policy.pdf.zip
Generate directory "documents" and list contents of "documents".
mkdir documents && ls documents
Display proposal.docx, showing line numbers and non-printing characters, with a '$' at the end of each line
cat -n -v -e proposal.docx
Avoid replacing report.pdf with temp.
mv -n report.pdf temp
Copy configuration.ini to documents_backup while preserving its attributes, creating a hard link, and making a backup
cp -p -l -b configuration.ini documents_backup
Display configuration.ini, showing line numbers and non-printing characters
cat -n -v configuration.ini
Compress files memo.txt, executable.exe, executable.exe into spreadsheet.xlsx.zip, excluding '*.tmp' files, preserving paths, verbose output
zip -x '*.tmp' -r -v spreadsheet.xlsx.zip memo.txt executable.exe executable.exe
Push proposal.docx firmly into projects, but ask to be asked before overwriting
mv -fi proposal.docx projects
List all files having "notes" in their names, sorted by size
ls -S *notes*
Display contract.pdf, squeezing multiple adjacent empty lines
cat -s contract.pdf
List every file's inode numbers.
ls -i
List all files containing "important" with human-readable sizes
ls -h *important*
Examine image.jpg.zip for consistency.
unzip -t image.jpg.zip
Compress files spreadsheet.xlsx, presentation.pptx, video.mp4 into audio.mp3.zip, silently
zip -q audio.mp3.zip spreadsheet.xlsx presentation.pptx video.mp4
List the contents of photo.png.zip.
unzip -l photo.png.zip
Change directory to output and extract files from database.sql.zip
unzip -C output database.sql.zip
Files from policy.pdf.zip should be extracted into output.
unzip -d output policy.pdf.zip
Seek out blocking gadgets
find . -type b
Copy database.sql and perform a force overwrite in backup
cp -f database.sql backup
Concatenate contract.pdf and audio.mp3
cat contract.pdf audio.mp3
Print audio.mp3 making visible all control characters.
cat -A audio.mp3
Move audio.mp3 to templates with force, prompt for confirmation, and move only if newer
mv -ifu audio.mp3 templates
Show each file on a separate line
ls -1
Extract executable.exe.zip, but only the most recent files.
unzip -U executable.exe.zip
List the lines that don't include a blank in executable.exe
cat -b executable.exe
Verify document.docx.zip for integrity
unzip -t document.docx.zip
Display the line counts for executable.exe
cat -n executable.exe
Show proposal.docx with error messages suppressed
cat -q proposal.docx
Find files with names starting with 'report' and with read permissions for others
find . -type f -name "report*" -perm /o=r
List the lines that make up report.pdf in the list.
cat -n report.pdf
Locate files smaller than 100KB
find . -size -100k
Mirror configuration.ini to images_backup with attributes intact and creating a hard link
cp -p -l configuration.ini images_backup
In executable.exe, update configuration.ini.zip If more recent
zip -f executable.exe.zip configuration.ini
Copy report.pdf to logs_archive and prompt before overwriting if necessary
cp -i report.pdf logs_archive
Don't use presentation.pptx to replace any existing files in backups.
mv -n presentation.pptx backups
Transfer memo.txt to archives, asking for approval
mv -i memo.txt archives
List directories and their contents recursively
ls -R
Extract contract.pdf.zip with password 'pass321' and verbose output to directory music_library
unzip -P pass321 -v -d music_library contract.pdf.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
Unzip files from presentation.pptx.zip quietly
unzip -q presentation.pptx.zip
Put a line between each file you list.
ls -1
Ignore paths when zipping photo.png
zip -j document.docx.zip photo.png
Display report.pdf with non-blank line numbers
cat -b report.pdf
List subdirectories recursively, with human-readable sizes, colours, and extensive information.
ls -RdlhG
List contents of photo.png with line numbers
cat -n photo.png
Move image.jpg as a normal file to databases.
mv -T image.jpg databases
List all files containing "log" in their names, including hidden ones
ls -a *log*
Show hidden files and folders in a lengthy format with rich colours and details.
ls -alG
Compress files using gzip
find . -type f -exec gzip {} \
Recursive copying is used to move music to documents_archive, maintaining attributes, and making a backup.
cp -r -p -b music documents_archive
Make a hard link, backup, and copy configuration.ini to projects_backup while maintaining its properties.
cp -p -l -b configuration.ini projects_backup
Extract files with verbose mode enabled from database.sql.zip
unzip -v database.sql.zip
Print proposal.docx with tabs represented as ^I
cat -T proposal.docx
Recursively list subdirectories and display directory structure with colored output
ls -RdG
Concatenate report.pdf and report.pdf, numbering non-empty output lines and showing non-printing characters and tabs as '^I'
cat -b -vT report.pdf report.pdf
Sort files in a list according to when they were last modified, and provide file sizes in a legible manner.
ls -lt -h
Show all files including hidden files
ls -a
Change permissions of files
find . -type f -execdir chmod 644 {} \
Transfer database.sql firmly to videos, ask permission before overwriting, and only move if a newer version is available.
mv -fiu database.sql videos
Mirror photo.png to templates_backup with attributes intact, creating a hard link, and making a backup
cp -p -l -b photo.png templates_backup
Find directories with names containing 'backup' and modified in the last 7 days
find . -type d -name "*backup*" -mtime -7
Mirror proposal.docx with properties preserved to videos_backup
cp -p proposal.docx videos_backup
List the contents of report.pdf while displaying each control character.
cat -A report.pdf
Make a backup of the current files and copy proposal.docx to logs_archive.
cp -b proposal.docx logs_archive
Display the contents of report.pdf
cat report.pdf
Display presentation.pptx with line endings
cat -E presentation.pptx
Compress projects and its contents
zip -r projects projects
Change the default order of sorting.
ls -r
Display files sorted by file size
ls -S
Search for files with names containing 'image' and with read permissions for the group
find . -type f -name "*image*" -perm /g=r
Prompt for confirmation before replacing document.docx in music
mv -i document.docx music
Package files presentation.pptx, document.docx, spreadsheet.xlsx into configuration.ini.zip, preserving paths, using password 'secure123'
zip -r -P secure123 configuration.ini.zip presentation.pptx document.docx spreadsheet.xlsx
Create a hard link of document.docx in images_backup
cp -l document.docx images_backup
Move configuration.ini to photos_backup, and if the files are already there, create a backup.
cp -b configuration.ini photos_backup
Update document.docx if newer in memo.txt.zip
zip -u memo.txt.zip document.docx
The files "photo.png, "video.mp4", and "executable.exe" should be concatenated into the directory "logs".
mkdir logs && cat photo.png video.mp4 executable.exe > logs/concatenated_file.txt
Shift video.mp4 to videos treating it like a normal file
mv -T video.mp4 videos
Release video.mp4.zip, testing archive integrity only, to directory temp_folder
unzip -t -d temp_folder video.mp4.zip
Extract memo.txt that is encrypted.Zip file protected with '*.mp3'
unzip -P *.mp3 memo.txt.zip
Locate named pipes
find . -type p
Take the files out of script.py.Zip the file, then select reports_archive.
unzip -C reports_archive script.py.zip
Search for files modified more than 30 days ago and smaller than 10KB
find . -type f -mtime +30 -size -10k
Move configuration.ini to logs_archive and verify overwriting interactively.
cp -i configuration.ini logs_archive
Show line numbers for script.py that are not blank.
cat -b script.py
Move files to videos
find . -name spreadsheet.xlsx -exec mv {} videos \