Text
stringlengths
16
168
Code
stringlengths
5
107
Create directory "videos" and zip files "database.sql", "image.jpg", "image.jpg" in it.
mkdir videos && zip videos.zip database.sql image.jpg image.jpg
Make 'archives', copy 'photo.png' into it, and then make 'shortcut', a symbolic link, to the file.
mkdir /archives/ | cp /photo.png /archives/ | ln -s /archives/ /shortcut/
Locate files named photo.png
find . -name photo.png
Transfer executable.exe to images_backup and establish a hard link
cp -l executable.exe images_backup
Pack photo.png without any archive paths
zip -j photo.png.zip photo.png
Print each file on a new line
ls -1
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
Search for files between 1GB and 2GB in size.
find . -size +1G -size -2G
While extracting files, extract image.jpg.zip
unzip -q image.jpg.zip
Files can be sorted by size.
ls -S
Push proposal.docx firmly into projects, but ask to be asked before overwriting
mv -fi proposal.docx projects
Turn on coloured listing.
ls -G
Duplicate executable.exe to images_backup and retain all attributes
cp -a executable.exe images_backup
Extract newer files from contract.pdf.zip
unzip -U contract.pdf.zip
Extract files with verbose output from memo.txt.zip
unzip -v memo.txt.zip
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 directories themselves with colored output, then list their contents
ls -dG */ | xargs ls -lG
Display contract.pdf, squeezing multiple adjacent empty lines
cat -s contract.pdf
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 directories first, followed by files
ls --group-directories-first
Concatenate executable.exe and policy.pdf, numbering all output lines
cat -n executable.exe policy.pdf
Look for directories.
find . -type d
List the contents of image.jpg.zip.
unzip -l image.jpg.zip
Zip reports and subdirectories
zip -r reports reports
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 hidden files and directories in long format with detailed information and colors
ls -alG
Mirror policy.pdf to output with attributes intact, creating a hard link, and making a backup
cp -p -l -b policy.pdf output
Move configuration.ini to documents without replacing existing files
mv -n configuration.ini documents
Look for figurative connections.
find . -type l
Make the directory "downloads" and search its contents for files that match the pattern "*.sql".
mkdir downloads && find downloads -name "**.sql*"
Duplicate spreadsheet.xlsx to logs_archive and keep attributes unchanged, creating a hard link, and making a backup
cp -p -l -b spreadsheet.xlsx logs_archive
Search for files owned by the user 'user1' or 'user2'
find . -type f \( -user user1 -o -user user2 \)
Release video.mp4.zip, testing archive integrity only, to directory temp_folder
unzip -t -d temp_folder video.mp4.zip
Provide password '*.sql' to extract presentation.pptx.zip
unzip -P *.sql presentation.pptx.zip
Delete all files with the executable.exe name.
find . -name executable.exe -execdir rm {} \
Display every file, even those that are hidden.
ls -a
List directories before files in the display
ls --group-directories-first
Delete image.jpg from executable.exe.zip
zip -d executable.exe.zip image.jpg
Make a copy of database.sql in downloads_archive, but before overwriting, get permission.
cp -i database.sql downloads_archive
Recursively list subdirectories
ls -R
Ask before replacing script.py in music
mv -i script.py music
Copy database.sql to downloads_archive and ask for confirmation from the user
cp -i database.sql downloads_archive
Move audio.mp3 forcefully to archives, ask for permission before overwriting, and treat the destination as a file.
mv -fiT audio.mp3 archives
Take files out of executable.exe.zip and replace any files that already exist.
unzip -o executable.exe.zip
Copy document.docx to reports_archive, ensuring that the user approves the overwrite.
cp -i document.docx reports_archive
Sort files based on size
ls -S
List all files having "notes" in their names, sorted by size
ls -S *notes*
Create a backup of report.pdf, do not overwrite, and move only if newer
mv -bnu report.pdf scripts
Backup temp to backup and maintain its attributes with recursive copying
cp -r -p temp backup
Show file sizes in human-readable units
ls -h
Replace outdated files from video.mp4.zip with the most recent ones.
unzip -U video.mp4.zip
Show files containing more details
ls -l
Show spreadsheet.xlsx in tabbed mode as \I
cat -T spreadsheet.xlsx
Backup current files and move downloads to templates_backup.
cp -b -r downloads templates_backup
Search for files larger than 1MB
find . -size +1M
Using attribute preservation, clone video.mp4 to temp_folder, establish a hard link, and create a backup
cp -p -l -b video.mp4 temp_folder
Verify presentation.pptx.zip for integrity
zip -T presentation.pptx.zip
Replicate downloads to templates_backup recursively
cp -r downloads templates_backup
Delete script.py from photo.png.zip
zip -d photo.png.zip script.py
Show directories prioritized over files
ls --group-directories-first
Test image.jpg.zip for corruption
zip -T image.jpg.zip
Files should be shown sorted by modification time.
ls -t
Concatenate executable.exe and policy.pdf, numbering all output lines
cat -n executable.exe policy.pdf
Use hard links to replicate spreadsheet.xlsx to documents_archive.
cp -l spreadsheet.xlsx documents_archive
Display hidden files and directories with detailed information and colors
ls -alG
Display file sizes in a legible manner
ls -h
Show hidden files with regular files.
ls -a
Copy files to reports
find . -name presentation.pptx -exec cp {} reports \
Avoid replacing report.pdf with temp.
mv -n report.pdf temp
Display hidden files and directories in long format
ls -al
Find files with names containing *.doc*
find . -type f -name "**.doc**"
Unpack policy.pdf.zip with password 'pass123' and preserving permissions to directory scripts_backup
unzip -P pass123 -K -d scripts_backup policy.pdf.zip
List all files in the current directory
ls -a
Recursive copying is used to preserve the properties of reports after a backup to logs_archive.
cp -r -p reports logs_archive
List directories before files
ls --group-directories-first
Make a hard link, backup, and copy configuration.ini to projects_backup while maintaining its properties.
cp -p -l -b configuration.ini projects_backup
Display directories at the top of the list
ls --group-directories-first
Make a copy of executable.exe, don't replace it, and output verbosely
mv -bnv executable.exe music
Test integrity of presentation.pptx.zip
unzip -t presentation.pptx.zip
Search for directories with names starting with 'backup' and not owned by the user 'admin'
find . -type d -name "backup*" ! -user admin
silently list the contents of configuration.ini
cat -q configuration.ini
Move database.sql to report.pdf.zip and add it.
zip -m report.pdf.zip database.sql
Just the directory names should be listed.
ls -d
Silently extract the files from document.docx.zip.
unzip -q document.docx.zip
Put contract.pdf into a new report.pdf.zip archive.
zip -c report.pdf.zip contract.pdf
Sort files by size
ls -S
Extract presentation.pptx.zip with password '*.py'
unzip -P *.py presentation.pptx.zip
Show tabs as ^I for database.sql
cat -T database.sql
To photos, copy the files.
find . -name database.sql -exec cp {} photos \
Archive files policy.pdf, photo.png, image.jpg into image.jpg.zip, compressing only '*.txt' files, storing symbolic links
zip -n '*.txt' -y image.jpg.zip policy.pdf photo.png image.jpg
If the parent directories do not already exist, create the directory scripts with verbose output.
mkdir -v -p scripts
Print presentation.pptx without error messages
cat -q presentation.pptx
Take files out of audio.mp3.zip and replace any files that already exist.
unzip -o audio.mp3.zip
Print document.docx while preventing the display of several blank lines.
cat -s document.docx
Modify the file permissions.
find . -type f -exec chmod 644 {} \
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'
Mirror spreadsheet.xlsx to videos_backup and inquire as to whether the files are already there.
cp -i spreadsheet.xlsx videos_backup
Search for files smaller than 100KB
find . -size -100k
Recursive copying is used to move archives to music_library, maintaining attributes, and making a backup.
cp -r -p -b archives music_library
Place contract.pdf inside of the archive spreadsheet.xlsx.Zip
zip -u spreadsheet.xlsx.zip contract.pdf