15.01.2024 Views

CompTIA A+ Certification All-in-One Exam Guide

  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

To delete all of the files in a directory, you can use this dangerous but useful

*.* wildcard (often pronounced “star-dot-star”):

del *.*

This is one of the few command-line commands that elicits a response—

but only in Windows. Upon receiving the del *.* command, Windows

responds with “Are you sure? (Y/N),” to which you respond with a Y or N.

Pressing y erases every file in the directory, so again, use *.* with care!

With Windows, we only use del to delete files; it will not remove

directories. Use rd to delete directories. In macOS and Linux, you can use the

rm command to delete both files and folders. Here’s an example of the rm

command using the –r switch to delete the folder Jedi as well as all of its

contents:

rm –r Jedi

The Windows rd command comes with a switch, /s, which makes it act

identically to the rm –r command:

rd /s Jedi

Clearly it can be very dangerous to use the rm and rd commands with

these switches. Use them carefully.

NOTE If you spend any time reading about macOS or Linux Terminal

commands online, you might see jokes involving the sudo rm –rf / command.

It tells the system to delete every file and folder on the computer’s hard drive!

The sudo portion means run this as root, rm means to delete, –r means to go

into every folder, f means to use force (in other words, delete it no matter

what), and finally the / points it at the root of the drive!

Copying and Moving Files

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!