For many users, the Mac's OS X is one amazing user interface but for security researchers, programmers, and system administrators Mac's command-line interface is an important weapon and, in many instances, the only way to achieve specific tasks. Here is the list of some common operations via the command line for Mac Os X.
Here's the list of commands with examples that might be a great cheat sheet for any user:
No need to look for an unzip command (even though there is one); just run the following command to unzip zip archives from the Terminal:% open filename.zip Since zip files unzip with a double-click, the open command does the same thing. I've found the 'open' command in Mac OS X very handy in the command line. From 'man open': The open command opens a file (or a directory or URL), just as if you had double-clicked the file's icon. If no application name is specified, the default application as determined via LaunchServices is used to open the specified files. ExifTool Command-Line Examples. System: Windows Mac OS X Linux: Task. Mac OS X: Unzip Items From the Command Line Unzip items from the command line. For example, if you wanted to unzip a file called myfile.zip you can use the following command: unzip myfile.zip Or if you wanted to unzip all the zipped files in a directory you could cd to said directory and run this command: unzip.zip.
locate
The locate utility hunts a particular private database of all open pathnames that OS X keeps individually from the searchable index. It's very quick to explore, but the database is restored only systematically — almost daily. The locate command is extremely beneficial if users are looking to find every occurrence of a file buried deep-toned in system folders or anything else that Spotlight can't control. It's extraordinarily helpful for troubleshooting and even more ordinary jobs like uninstalling Mac apps.
locate *.png
The above command will locate all the png files.
lsof
The lsof is the list open files command. When hunting down difficulties, especially security-related problems, it's usually necessary to identify which applications are actually interacting on the network. The lsof command is responsible for finding that. With the -i option, it gives all the public network connections in the process and the signatures of the applications utilizing them. This is one of the most useful commands.
$ lsof -i
The above command will list all the files.
networksetup
Network troubleshooting usually demands analyzing a machine's network environments and perhaps making adjustments to them to examine different assumptions about what may be faulty. The networksetup tool allows users to inspect all methods of network parameters such as IP addresses, possible network interfaces, and more than 50 other parameters. One configuration users apparently have to check regularly is the record of DNS servers, particularly in circumstances of the contemporary malware that modified this list to show to malicious DNS servers.
$ networksetup -getdnsservers ethernet
open
One of OS X's most handy operations, open helps soft communication between a command-line and the user interface. From the command line, users can open a folder or directory into a Finder, and then they can also open a text file or a document to make some quick changes.
$ open FaceTime
The above command can also be used to open various other applications for editing purposes.
mkdir
mkdir means 'Make Directory' or just, create a new folder. Anywhere this command is shot from, it will build the new folder in that drive. In this, users can define the title of the directory (folder) they desire to build or create. For example, the following command will create a folder called my-folder. This command is one of the most important and most used commands.
mkdir my-folder
As mentioned earlier, the above command example will create a new directory called my-folder. The important thing about this command is that users can create a series of directories and subdirectories forever if they want, In this, simply type out the path and press enter.
history
Viewing the command history could be a helpful trait if users want to examine a long-drawn command they've applied recently. The history command makes it straightforward to just copy and paste the command and recycle it. Understanding the command history can also be beneficial if there are many other users on the Mac and if a user needs to understand what sorts of operations they're executing with the Terminal app. To execute this command simply enter history and press the return key.
cat
The cat command is also known as concatenating is one of the most commonly applied commands Mac OS X and various other operating systems. cat command enables users to build single or various files, view checks of a file, concatenate files, and redirect results in files. For example, if you want to concatenate two files, creating the result to be a single file then this can be done by using the following command:
$ cat Myfile100.txt MyfFile200.txt > union.txt
The above command will concatenate the two files.
shutdown
System programmers or administrators occasionally have to reboot machines when the administrator isn't nearby. Giving the screen isn't invariably helpful — or even allowed. If users can get exclusive command-line access to the destination machine such as by the ssh or Secure Shell command, restarting remotely is a setup utilizing the shutdown command. The -r alternative means the user needs to restart; without it, the Mac will shut down. The now argument suggests exactly what it states: shutdown it now. Users can also define a date and time, in a pattern like yymmddhhmm, to preconfigure or reset a prolonged reboot.
$ shutdown -r now
The above command will reboot the system now.
top
The top command is close to Linux users too. It gives the most active programs running on a machine, supporting users to find why a machine might be working moderately. Apple's graphical Activity Monitor does the related task, but the top command provides the user with a smart aspect without neglecting the command-line setting.
By default, the top showcases the initial 20 programs in its inventory. The difficulty is that, for some purpose, OS X's top classifies its program not in order of decreasing CPU usage but an order of decreasing process ID. To obtain the list in decent CPU usage position users can add the -o cpu) option. The top inventory also reveals which programs are working and which are 'flagging' — expecting input/output actions to close. When a system is idle, the top normally exposes the offender.
$ top -o cpu
The above command will display the top 20 programs.
About the Author
ByteScout Team of WritersByteScout has a team of professional writers proficient in different technical topics. We select the best writers to cover interesting and trending topics for our readers. We love developers and we hope our articles help you learn about programming and programmers.Dec 21, 2020 • Filed to: Solve Mac Problems • Proven solutions
When Phil Katz invented the Zip file format over 30 years ago, it's highly arguable if he ever imagined his invention would see such profound and widespread use. Zipping files for Mac entails you take several files and compress them into a single file, all the while reducing the overall size of the resultant single file. How convenient is that?
Knowing how to Zip or Unzip files for Mac should thus be a prerequisite for you. If you don't know how to go about doing it, have a look below for an extensive lesson.
Part 1: What Is a Zip File on Mac
Zip is simply a data archive and compression format. Rar is very similar to the Zip but they are quite different too. For one, Zip files were invented long before Rar, meaning there are more software out there capable of opening and decompressing Zip files because it is a standard file format.
Along the same vein, compatibility is also a difference. Because the Zip format is older, both Windows and Mac come pre-installed with software that is capable of opening it. The same can't be said for the Rar format because it often requires third-party software to be opened. The Zip file format is a free and open-source, making it more popular. Thus, the majority of users have software that can open Zip files primarily. And when it comes to the archive creation process, its speed is relatively faster than that of the Rar format.
Zip files are well and truly capable of saving over 80% or more of the space in your Mac's hard drive. Do you now see the marked difference between the two formats?
Part 2: How to Zip a File on Mac for Free
You might ask yourself if knowing how to create and open Zip files are really worth taking the time out to know. Well, ask yourself these questions too: Don't you want to reduce email-transmission time? And wouldn't it be great to save many emails despite your mailbox's space limit? What about the time it takes to upload or download files via the web?
Zipping a file on Mac gives you great solutions to these questions. It uses a native tool called 'Archive Utility' that does the job for you. There are several ways to the Zip file on Mac. Some are free but there are paid options too (third-party software). Only the free solutions will be given out to you today, though. You're welcome.
How to Zip a File on Mac
1. Open a Finder window, then locate the file or folder you want to zip.
2. Right-click on the said file or folder.
3. Select 'Compress' in the drop-down menu you see. The file is then Zipped while the original is left just the way it was.
How to Create Zip Files and Folder on Mac
1. Open a Finder window.
2. How to bypass find my mac. Make a folder for the file or files you want to Zip.
3. Highlight the newly-created folder.
4. Click on 'File' in the top menu bar.
5. In the drop-down menu that appears, click on 'Compress.' A zip file will be created in the same directory as the original folder.
How to Zip Files Using Mac Terminal
You can Zip your files in Mac's Terminal in different ways, but the simplest method will be outlined here for you.
1. Open up a Finder window.
2. Open up Terminal by typing in 'Terminal' at the search bar located on the top right part of your screen.
You can also launch Terminal from your Mac's 'Applications/Utilities' folder.
3. Either way, you will see the program. Click on it to launch it.
4. If the Zipped file is not located on your desktop, move it to the desktop (it's more convenient in this way).
5. Type this command in the Terminal and leave a space: zip
Mac Unzip Gz
6. Drag and drop the file (s) to be Zipped into the Terminal's window.
7. Press 'Enter/Return'. The files will be compressed and Zipped into a single file.
How to Zip Files with Password on Mac
1. Choose the file you want to Zip and right-click on it (to make it easier, make sure the file is on your desktop).
2. Select 'Compress.'
Windows 10 Unzip Command Line
3. Open up a Finder window.
4. Navigate to your Mac's 'Utilities.'
5. Find and click on 'Terminal' to launch it.
6. Type in these commands in the Terminal: zip -er archive_name target_folder
7. A popup window will appear, prompting you to enter a password (you will have to enter the password twice; the second time will be for verification). Type in the secure password and click on 'OK' or press 'Enter/Return.' Your Zipped files are now password-protected.
Part 3: How to Unzip and Open Files on Mac for Free
Knowing how to zip files on Mac is good and fine but sometimes, the files you want are already Zipped. This is especially true if you downloaded the files from the web.
The internet of yesterday is not the same as the internet of today. More and more of the files uploaded to websites come in Zipped formats to make downloads faster and easier. So, what happens when youdownload these files but don't know your way around opening them? Bummer. That is just one reason why knowing how to open zip files on your Mac is now a necessity. But just like Zipping files, Unzipping them is quite easy too. There are, of course, different ways you can do that. Here are a few:
How to Unzip files on Mac
Method 1 (Archive Utility):
1. Navigate to wherever the Zipped file is (your desktop, downloads, etc.)
2. Double-click on the file. Because 'Archive Utility' is integrated into your macOS, the Zipped file will automatically open up and dump the contents into a folder bearing its name; the folder will be in the same directory as the Zipped file too.
Method 2 (Archive Utility):
1. Move your cursor over to the Zipped file or files and select them.
2. Right-click on them.
3. Select 'Open.' The Zipped archive will be extracted into a folder that's in the same directory as the archive.
Method 3 (Terminal):
1. Open up a Finder window.
2. Launch Terminal by typing in 'Terminal' at the search bar on the top-right section of your Mac's screen. Click on it to launch it.
3. Type this command in the Terminal: unzip {the name of the Zipped file}.zip
4. If the Zipped file is not located on your desktop, move it to the desktop because it makes things easier and faster for you. This is not necessary but it is advised, or else you have to type in the directory of the Zipped file before typing in its name. Like so:
unzip ~/Downloads/example.zip
5. Press on 'Enter/Return'. The contents of the Zipped file or files will be Unzipped to the same directory as the Zipped file.
Method 4 (Terminal)
You can Unzip multiple files all at once into a single directory using Terminal.
1. Open up 'Spotlight.'
2. Type in 'Terminal' and then launch it.
3. Type the following commands in Terminal:
cd /Users/phil/Downloads/folder_with_zips
(The above command is to navigate to where your multiple Zipped files are. Input the right directory as proper. In the above example, the Zipped files are in 'Downloads').
unzip *.zip
(This is the command that will Unzip the multiple files)
4. Press 'Enter/Return.' All the files will be Unzipped simultaneously.
Part 4: How to Recover Deleted Zip Files on Mac
Try as you may, it's almost impossible for you to use your Mac without Zipping your files for one reason or another. Even if you don't download much from the internet, it can be quite tempting to want to Zip your files simply because you're well aware it will save your hard drive much-needed space.
Mac Os X Unzip Command Line Command
Likewise, it will be nearly impossible for you to not delete your Zipped files; again, for several reasons. Maybe you didn't do it intentionally, or maybe you did, but then you realize you want the Zipped files back for one or various reasons.
Look no further than Recoverit Mac Data Recovery to be your one and only savior. It comes loaded with features that thoroughly scan your drive for deleted Zipped files and recovers them back to their exact state. And this is all achieved with a few simple steps:
Step 1: Choose a Location
- Open up Recoverit and choose the hard disk to be scanned. The disk should be where the deleted Zipped files had once been in. Click the 'Start' button.
Step 2: Scan the Location
- The scan will begin. After it's done, a window will display a preview of the deleted Zipped files. You can select and deselect filters during the scan to make your search quicker.
For instance, you can use 'File Type' or 'File Path' to alter your search and make judicious use of time. You can pause or stop the scan before it completes too; that's a feature that easily makes the operation even more convenient, wouldn't you agree?
Step 3: Preview & Recover Data
- A window will open up where you will see a preview of the deleted Zipped files to be recovered. Choose the files.
- Click on the 'Recover' button located below and to the right. Your Zipped files will be recovered.
- As a final note, you are advised to save the recovered ZIPPED files in a secondary location and not the one they were initially deleted from.
Isn't Recoverit Mac Data Recovery the most user-friendly software you've seen? The three steps are so simple even a child could do it: Choose a drive, scan it, preview your files, and recover them.
Part 5: How to Fix Zip File on Mac
There are those rare but alarming situations when your Zipped files get corrupted. This is an unavoidable flaw on computers. Fortunately, it's fixable.
As to why the Zipped file got corrupted in the first place, it's possible the files within the Zip were already damaged; or an error occurred while downloading the file from the web. Below are common errors plaquing Zip files.
Unable To Expand Zip File on Mac - This error is mostly caused by an unstable internet connection. If your network keeps going on and off while you're downloading a Zipped file, the end result could be a corrupted archive.
The problem could also stem from you, the user. You might have been too hasty in closing the web browser while the Zipped file was still downloading, consequently corrupting it.
Sometimes, even if you manage to completely download the Zipped file, don't be surprised to learn it's few megabytes short of the size it's supposed to be. Because of those missing megabytes, your entire Zipped file could be corrupted.
The Archive is Corrupted – Believe it or not, even exposing your Mac to magnetic fields or excessive temperatures and mechanical problems could also corrupt a Zipped file. Likewise, unzipping very large files can also corrupt them.
End-of-Central-Directory Signature Not Found – Here's another pervasive error. The probable reason you will see this error is because of the incomplete download of a Zipped file. Another possible reason is the file was one part of a multi-part archive, and the other components are missing.
All the same, the most important thing for you here is to know how to repair corrupted Zipped files, isn't it? These errors can be fixed via Terminal or any decompression utility software, which of course will be a third-party software:
Method 1 (Terminal):
1. Launch Terminal on your Mac.
2. Type this command in the Terminal: unzip ~/Downloads/example.zip
(Replace the 'Downloads' you see in the above example with the directory of your Zipped file. If it's in your Downloads folder too, then leave the command as it is.
Method 2 (Unarchiver):
1. Go to your Mac App Store, download Unarchiver, and install it.
2. Open it.
3. Drag your files into the square, blank space on the left side of the software.
4. Click on 'Decompress.' Your files will be extracted. This software can even succeed where Terminal fails.
Closing Words
By now, you should fully agree with the infinite Mac users out there and on how significant Zip files are. No more are they deemed less important than other software. Indeed, the majority of websites hosting files do so with the files being Zipped.
What's more, you don't have to worry about the state of your Zipped files and the multitude of important files you have within them because of what Recoverit Mac Data Recovery can do for you. This software can be something of an 'insurance' for your Zipped files. If anything befalls them, Recoverit will be there to help recover ZIP and RAR files.
What's Wrong with Mac
- Recover Your Mac
- Fix Your Mac
- Delete Your Mac
- Learn Mac Hacks