Text
stringlengths
16
168
Code
stringlengths
5
107
Replace outdated files from video.mp4.zip with the most recent ones.
unzip -U video.mp4.zip
Create a new directory called "backups" and create symbolic link named "pointer" pointing to "backup".
mkdir backups && ln -s backup pointer
If scripts is outdated or nonexistent, only substitute contract.pdf for it.
mv -u contract.pdf scripts
Extract script.py.zip without displaying output
unzip -q script.py.zip
Zip proposal.docx without any folder organization
zip -j configuration.ini.zip proposal.docx
Put configuration.ini inside image.jpg.zip and delete
zip -m image.jpg.zip configuration.ini
Extract encrypted report.pdf.zip with password '*.py'
unzip -P *.py report.pdf.zip
Display directories themselves with comprehensive details.
ls -ld
Duplicate database.sql to downloads_archive by creating hard links
cp -l database.sql downloads_archive
Files should be displayed in coloured lists.
ls -G
List files in a lengthy format with output that is coloured.
ls -lG
Mirror configuration.ini to archive using hard links
cp -l configuration.ini archive
Find files with names ending in '.log' and larger than 1MB
find . -type f -name "*.log" -size +1M
List all files in the current directory with detailed information, then extract only the file names
ls -al | awk '{print $9}'
List all files in the current directory with detailed information, then sort them by modification time in reverse order
ls -al | sort -k6,6r
Display proposal.docx, showing line numbers and non-printing characters, with a '$' at the end of each line
cat -n -v -e proposal.docx
Show script.py with line breaks included
cat -E script.py
Print inode number of each file
ls -i
List subdirectories recursively, with human-readable sizes, colours, and extensive information.
ls -RdlhG
List each file on a single line.
ls -1
Make a copy of presentation.pptx in backup while preserving all properties.
cp -a presentation.pptx backup
Take the files out of script.py.Zip the file, then select reports_archive.
unzip -C reports_archive script.py.zip
Provide password '*.txt' to unzip policy.pdf.zip
unzip -P *.txt policy.pdf.zip
Show proposal.docx with error messages suppressed
cat -q proposal.docx
Print each file's inode number.
ls -i
List the files, one for each line.
ls -1
Transfer presentations to music_library and, if required, prompt before overwriting
cp -ir presentations music_library
Create a new archive using photo.png and database.sql.zip.
zip -c database.sql.zip photo.png
Backup logs to images_backup and backup existing files
cp -b -r logs images_backup
Make a hard link by copying photo.png to images_backup and maintaining all of its properties.
cp -p -l photo.png images_backup
Unzip files from video.mp4.zip ignoring directory structure
unzip -j video.mp4.zip
While extracting files, extract executable.exe.zip
unzip -q executable.exe.zip
Search for files with names containing 'log' and created in the last 24 hours
find . -type f -name "*log*" -ctime -1
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 contents of policy.pdf with non-printing characters displayed
cat -v policy.pdf
Display hidden files and directories in long format, then count the number of lines
ls -al | wc -l
Transfer executable.exe forcefully to archives, asking for confirmation, and treating destination as a file
mv -ifT executable.exe archives
Display every file on a different line.
ls -1
Zip files photo.png, proposal.docx, executable.exe into audio.mp3.zip, compressing only '*.txt' files, verbose output
zip -n '*.txt' -v audio.mp3.zip photo.png proposal.docx executable.exe
Create directory downloads and parent directories if they do not exist with verbose output
mkdir -p -v downloads
Print each file separately
ls -1
Confirm before replacing contract.pdf with photos
mv -i contract.pdf photos
Copy database.sql to videos_backup and backup existing files
cp -b database.sql videos_backup
Copy contract.pdf to videos_backup; interactive confirmation is necessary.
cp -i contract.pdf videos_backup
Display inode numbers of files
ls -i
Make a copy of presentation.pptx in images_backup, but before overwriting, get permission.
cp -i presentation.pptx images_backup
Archive files video.mp4, video.mp4, audio.mp3 into policy.pdf.zip, excluding '*.log' files, storing symbolic links
zip -x '*.log' -y policy.pdf.zip video.mp4 video.mp4 audio.mp3
Pack databases and all its files into archive
zip -r databases databases
Show line numbers for spreadsheet.xlsx
cat -n spreadsheet.xlsx
Files are sorted by modification time.
ls -t
Duplicate configuration.ini to scripts_backup with a backup if files exist
cp -b -i configuration.ini scripts_backup
Extract files from spreadsheet.xlsx.zip and change to projects_backup
unzip -C projects_backup spreadsheet.xlsx.zip
Recursively display the directory structure
ls -R
Transfer script.py to photos_backup and maintain its attributes
cp -p script.py photos_backup
Find the usual files.
find . -type f
Display the contents of report.pdf
cat report.pdf
Move audio.mp3 to reports with force, prompt for confirmation, and treat destination as file
mv -ifT audio.mp3 reports
Extract files from policy.pdf.zip into templates_backup
unzip -d templates_backup policy.pdf.zip
Replicate video.mp4 to backup preserving attributes
cp -a video.mp4 backup
Copy proposal.docx to music_library, making a backup copy of the original files.
cp -b -p proposal.docx music_library
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
Look for files bigger than one megabyte.
find . -size +1M
Show the contents of executable.exe with line numbers
cat -n executable.exe
Display directory names only, without their contents
ls -d
Transfer all of the files from "databases" to "reports," then zip them all together into a file called "file_name].zip."
cp /databases/* /reports/ | zip -r /reports/script.py.zip /reports/*
Turn on coloured listing.
ls -G
When extracting files from presentation.pptx.zip, ignore paths.
unzip -j presentation.pptx.zip
Transfer files to output from temp and add a timestamp to the filename
find temp -type f -exec sh -c 'mv "$1" "$2/$(basename "$1")_$(date +%Y%m%d_%H%M%S)"' sh {} output \;
Show the inode numbers for files.
ls -i
Retrieve script.py.zip, overwriting existing files, and only extracting files matching pattern '*.jpg' to directory music_library
unzip -o -j -d music_library script.py.zip '*.jpg'
Archive files database.sql, configuration.ini, audio.mp3 into video.mp4.zip, excluding '*.tmp' files, quietly
zip -x '*.tmp' -q video.mp4.zip database.sql configuration.ini audio.mp3
Print the file's inode numbers.
ls -i
Show spreadsheet.xlsx in tabbed mode as \I
cat -T spreadsheet.xlsx
Update database.sql in proposal.docx.zip if newer
zip -f proposal.docx.zip database.sql
Display presentation.pptx with the error messages hidden
cat -q presentation.pptx
Print executable.exe contents with line endings
cat -E executable.exe
Transfer spreadsheet.xlsx to projects, replacing any files that are already there.
mv -f spreadsheet.xlsx projects
Move contract.pdf to music only if it's newer or doesn't exist
mv -u contract.pdf music
Move document.docx to videos_backup, and if the files are already there, create a backup.
cp -b -i document.docx videos_backup
Uncompress proposal.docx.zip, extracting symbolic links, to directory downloads_archive
unzip -l -d downloads_archive proposal.docx.zip
Transfer memo.txt to output and make a backup if files already exist
cp -b -i memo.txt output
Show proposal.docx with error messages suppressed
cat -q proposal.docx
Clone database.sql with preserving attributes to temp_folder
cp -p database.sql temp_folder
Sort files by modification time and display file sizes in human-readable format, then count the number of lines
ls -lt | awk '{print $5}' | wc -l
Display files sorted by size
ls -S
Enable output with colors
ls -G
Update image.jpg in configuration.ini.zip if newer
zip -f configuration.ini.zip image.jpg
Prior to replacing image.jpg in projects, get permission. Treat the destination file.
mv -Ti image.jpg projects
Make a hard link and clone memo.txt to documents_backup while preserving attributes.
cp -p -l memo.txt documents_backup
Ask before replacing database.sql in backups, treat destination as file, and move only if newer
mv -iTu database.sql backups
Clone report.pdf with preserving attributes to scripts_backup
cp -a report.pdf scripts_backup
Move spreadsheet.xlsx into script.py.zip
zip -m script.py.zip spreadsheet.xlsx
Transfer files from temp to temp_folder that have been modified in the last 24 hours.
find temp -type f -mtime -1 -exec mv {} temp_folder \;
Unprompted overwrite current files when extracting video.mp4.zip
unzip -o video.mp4.zip
Clone report.pdf to reports_archive and prompt for permission to overwrite
cp -i report.pdf reports_archive
Extract executable.exe.zip, but only the most recent files.
unzip -U executable.exe.zip
Locate files modified more than 1 year ago
find . -mtime +365
Unprompted overwrite current files when extracting report.pdf.zip
unzip -o report.pdf.zip
Copy script.py to reports_archive while keeping all of its properties.
cp -a script.py reports_archive
Concatenate report.pdf and image.jpg, numbering all output lines and showing non-printing characters and tabs as spaces
cat -n -vT report.pdf image.jpg