Page Up, Page Down in Mac

As someone to new to Mac, I did miss the PageUp, PageDown keys. I just found that you could use the arrows keys in combination with fn key.

fn + Up Arrow for Page Up
fn + Down Arrow for Page down
fn + Left Arrow for top of the file
fn + Right Arrow for bottom of the file

I am not sure why I haven’t searched for the solution earlier. Perhaps I am content with the navigation keys in vi/less.

G – bottom of the file
g – start of the file

Advertisements

What are the differences between 7z, 7za and 7zr binaries?

We receive a 7z file and we want to extract it on the command line. We search on Google and we are confused because some examples use 7z and some others use 7za.

We can use both 7z or 7za or even 7zr as long as the format for the archive is 7z.

From Arch Linux Wiki:

7z uses plugins to handle archives.
7za is a stand-alone executable. 7za handles fewer archive formats than 7z, but does not need any others.
7zr is a stand-alone executable. 7zr handles fewer archive formats than 7z, but does not need any others. 7zr is a “light-version” of 7za that only handles 7z archives.

Continue reading

How to create and extract a 7-zip archive in Linux and Mac

Create an archive of the current directory:

7z a filename.7z

Create an archive of a specific directory:

7z  a  filename.7z  /path-to-dir

Extract a 7z archive in the current directory with full path:

7z  x   filename.7z

Extract a 7z archive in the current directory without directory names:

7z  e filename.7z

You should not have a “-” before a or x. It will not work, a will “Add files to archive” and x will extract an archive with full path.

If you have 7za binary, you can use it as well. In CentOS 7, 7z binary is available only after installing p7zip-plugins.

rpm -qf `which 7za`
p7zip-16.02-2.el7.x86_64
rpm -qf `which 7z`
p7zip-plugins-16.02-2.el7.x86_64

Whereas in Mac, brew install p7zip installs 7z, 7za and 7zr.

How to create and extract 7-zip file with password

This will create a 7-zip archive of the current directory protected by a password

7z a filename.7z -pPASSWORD

where a stands “Add files to archive” and PASSWORD is the password. To archive a different directory use:

7z a filename.7z -pPASSWORD /path/dir

To extract this file

7z x filename.7z -pPASSWORD

where x stands for extract. You can use 7za where 7z binary is not available.