Overblog Tous les blogs Top blogs Économie, Finance & Droit Tous les blogs Économie, Finance & Droit
Editer l'article Suivre ce blog Administration + Créer mon blog
MENU
http://rayr.over-blog.com/

rayr.over-blog.com/

Publicité

Mac Unzip Command Line



  1. Mac Unzip Command Line Windows
  2. Mac Unzip Command Line
  3. Mac Unzip Rar Command Line

If you have a zip compressed file, you can unzip it in the Linux command line. The unzip command in Linux is quite versatile and you can use it do a lot more than just extracting zip file.

I have discussed how to gzip a folder in Linux in the past. It's time to see various usage of the unzip command. Before you do that, make sure that unzip has been installed on your system. You can use your distribution's package manager to install the command.

Unzip archivename.zip. If you want to make a zip without those invisible Mac resource files such as 'MACOSX' or '.Filename' and.ds store files, use the '-X' option in the command so: zip -r -X archivename.zip foldertocompress TAR.GZ – Cross Platform. Use the 'cd' command to change the directory to the location where you want to unzip the zip file. For example you can use: cd./Desktop. The next step is to invoke the unzip command. Type the following into Terminal. This assumes you have a zip file ready to unzip. This will unzip you file into you desktop location. 1- Unzip in Terminal One solution is to use Terminal, a built-in program on the Mac. 1) Open Terminal. You can use the Mac search at the top right and start typing Terminal. It will appear, click on it to open the program. 2) Type 'unzip' and a space, then drag/drop the zip file into the Terminal window.

On Ubuntu and Debian, you can use this command:

Once you have verified that, let's see how to use unzip in Linux terminal.

Unzip command in Linux

The unzip command has a really simple syntax:

If you use it to extract a zip file without any option, it will extract all the files in the current directory:

And that's not what you would want most of the time. It'll just flood your current directory with all the extracted files.

1. Unzip to a directory

The expected behavior is that you should have the files extracted to a certain directory, normally with the same name as the zip file.

You can specify the target directory where you want to extract the files.

If the target directory doesn't exist, it will be created. You cannot create nested directories in this manner though.

Do note that you can also put the target directory at the end but not all options can be added at the end.

Mac unzip command line windows
2. See the content of the zip file without extracting

If you want to see what the zip file contains, you son't always have to extract it first. You can use the -l option and it will show the content of the zip file.

As you can see, it also shows the timestamp of the files and the actual size of the individual files in bytes.

If you want, you can get more information like the compressed size, compression ratio by using the verbose mode with -v option. The CRC-32 in the output is the cyclic redundancy check.

3. Overwrite all the files without prompting

If there are already files with the same name in the directory where you are extracting the files, you'll be promoted for each such files. You can force overwrite all the files with option -o.

4. Do not overwrite any files -n

Top apps for mac air. If you don't want any existing file to be overwritten by newly extracted files, use the -n option (stands for never overwrite).

5. Update files and create if necessary

This is slightly different the overwriting all the files. In this case, only those files will will be overwritten that have newer timestamp than the existing files. If a file doesn't exist, it will be created.

You can achieve that with option -u:

6. Freshen existing files but create none

Slight change from the previous example here. In this one, it will update the existing files if they have older timestamp but it won't create any new files even if they don' exist.

The option -f allows you to do that:

7. Extract in quiet mode

When you unzip a file, it shows all the files that have been extracted on the display. Now imagine a zip file that has hundreds of files in it. If you extract it, your screen will be cluttered with the output.

You can use the quiet mode with option -q and you won't see anything on the display: Sims 4 mac product code.

Mac Unzip Command Line Windows

8. Exclude files from extraction

You can also exclude certain files or certain type of files from being extracted.

In my example, let's say I don't want to extract any .eps files.

Those were some of the most common examples of the unzip command in Linux. You can always check its man page to learn about more options.

Do you use some other option with unzip frequently? Why not share it with us in the comments?

Mac Unzip Command Line

Unzip in terminal

Mac Unzip Rar Command Line

Become a Member for FREE
Become a member to get the regular Linux newsletter (2-4 times a month) and access member-only content

Join the conversation.





Publicité
Partager cet article
Repost0
Pour être informé des derniers articles, inscrivez vous :
Commenter cet article