What’s the difference between .tar.gz and .gz?

In Unix and Unix-like systems (like Ubuntu), archiving and compression are separate.

tar puts multiple files into a single (tar) file.

gzip compresses one file (only).

So to get a compressed archive, you combine the two, first use tar or pax to get all files into a single file (archive.tar), then gzip it (archive.tar.gz). If you only have one file you need to compress (notes.txt), there’s no need for tar, so you just do gzip notes.txt which will result in notes.txt.gz. There are other types of compression, such as compress, bzip2 and xz which work in the same manner as gzip (apart from using different types of compression of course)

Source: http://askubuntu.com/questions/122141/whats-the-difference-between-tar-gz-and-gz-or-tar-7z-and-7z

L2TP / IPSEC VPN on Ubuntu 16.04

LT2P IPSEC vpn works simple and easily with iOS/Android and Windows 10. Unfortunately as many people likely know (after a few google searches it seems) the client for this is pretty crap in Ubuntu 16.04.

Our setup uses a shared PSK, and a username and password.

I’ve tried a bunch of the quick setup guides, but many were for older versions of Ubuntu and thus didn’t work very well. Finally I stumbled across this guide: https://gist.github.com/psanford/42c550a1a6ad3cb70b13e4aaa94ddb1c

which was used to connect with a meraki router over vpn. There were some minor tweaks in my case, but I managed to get it work.

Continue reading

vim – perform a global search and replace

To perform a global search and replace in vim, use the search and replace command in command mode:


The % is a shortcut that tells vi to search all lines of the file for search_string and change it to replacement_string. The global (g) flag at the end of the command tells vi to continue searching for other occurrences of search_string. To confirm each replacement, add the confirm (c) flag after the global flag.

Setting the NLS_LANG Environment Variable for Oracle Databases

Setting the NLS_LANG Environment Variable for Oracle Databases:

  • On Window
  • On Unix (Solaris and Linux, CentOS, Ubuntu etc.)

It would also be advisable to set env variable in your .bash_profile [on start up script]

This is the place where other ORACLE env variables (ORACLE_SID, ORACLE_HOME) are usually set.

How to Compress and Extract Files Using the tar Command on Linux

Compress an Entire Directory or a Single File

Use the following command to compress an entire directory or a single file on Linux. It’ll also compress every other directory inside a directory you specify–in other words, it works recursively.

tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

Here’s what those switches actually mean:

  • -c: Create an archive.
  • -z: Compress the archive with gzip.
  • -v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful.
  • -f: Allows you to specify the filename of the archive.

Continue reading

Set up and Configure ModPagespeed on Apache/Ubuntu

Site performance is crucial in achieving online success, but site performance optimization can be a tedious and seemingly perpetual task that is often difficult to calculate a return on. Luckily, we can automate a large amount of general site performance optimizations, including on-the-fly image optimization, and asset minification, by installing an Apache server module called PageSpeed.

This post will outline how to set up PageSpeed on an Apache 2.4.7/Ubuntu 14.04 LTS 64-bit server set-up (but should work across most versions of either) and how to configure PageSpeed for a fairly vanilla website. I will finish up with how to perform various maintanence functions and some other small tricks. Because of the diversity of websites and the versitality of this Apache module, the are far many more use cases for the PageSpeed filters than what will be touched on here, so I would encourage you to check out the PageSpeed filters to see the full breadth of what the PageSpeed module is capable of.

Continue reading