How (and why) to clear the caches on your Mac

Your Mac takes care of routine maintenance behind the scenes eventually, but that doesn’t mean you can’t keep things tidy yourself in the meantime. One easy way to keep your Mac running its best is to occasionally clean the cache.

This post provides brief instructions on how to clean user caches and brower cashes manually, without using an application. For more in-depth caches cleaning, check out the references section below.

  • Clean up user caches manually

To find and clear your user cache manually, do the following:

    • In your Mac’s user folder, there’s a hidden Library folder, which itself contains a folder of caches left by the applications you’ve installed on your Mac.
    • Strongly recommend that you remove the insides of ~/Library/Caches  and   /Library/Caches folders, but not the folders themselves.
    • Want to make sure your junk user cache data is gone forever? – Empty out your Trash.

How to check a cache folder size

If you are unsure and want a safer option, go ahead and learn on how to use CleanMyMac to handle caches properly. It will find up to 5x more junk cache data to remove from all over your system.

 

  • Clean up browser caches manually

We love our browsers but we don’t love it when they start to use up hard disk space with cache files. Whether you’re wanting to free up space, get your browser performing better or trying to remove your history for the sake of privacy, removing your Mac browser cache will help.

Your browser cache is essentially saved bits of the websites you’ve visited recently. That way, if you go back, your computer can re-use locally cached elements that haven’t changed, which speeds up load times versus reloading everything fresh from the remote server. Your cache will overwrite itself eventually, but you can clear your cache, history, and cookies anytime you want to gain a little bit of extra security and speed up your Mac.

      • Clear Safari caches

To delete Safari’s websites’ caches and cookies via browser preferences:

      1. Click Safari in the top menu click Preferences.
      2. In the window that appears, click the Advanced tab, and enable Show Develop menu.
      3. In menu bar go to Develop and choose Empty Caches.

Check and delete Safari browser cache with Terminal:

      1. Press Command + Shift + G to open up the Terminal
      2. With these simple commands you can delete Safari’s cache file. But first, check its size using the disk usage (du) command:
        du -h /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db
        Note: replace “$HOME” with the name of your home folder

        1. To delete Safari’s cache file type:
          rm /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db
          Note: when you use the remove (rm)command files are essentially unrecoverable.
        2. A more prudent approach is to use the move (mv) command:
          mv /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db ~/.Trash/
          This will move the file to your user’s ($HOME) trash. From there it is still recoverable until you empty the trash.
          Safari will create a new Cache.db file automatically when you open a new webpage.
        3. Open a new webpage or restart Safari and recheck disk usage:
          du -h /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db

Clean cache in Safari

      • Clear Chrome caches

The simplest way to clear Chrome browser cache manually is:

      1. In the top right corner of Google Chrome browser click the 3-dot icon to choose Settings. 
      2. At the bottom of the menu, choose Advanced (or use Cmd+Shift+Delete keyboard shortcut)
      3. Click Clear browsing data and deselect all, but Cached images and files. Choose time range and hit Clear data button.

Delete caches in ChromeOne more way to delete Chrome browser cache is to clear some folders where these data located.

      1. To find Chrome cache files, open Finder and click to Go to the folder.
      2. To go to the folder where Chrome’ primary cache locates type: ~/Library/Caches/Google/Chrome/
      3. To go to the folder with the additional bulk of cached data type:~/Library/Application Support/Google/Chrome/Default/Application Cache/
      4. Select files within these folders and delete them.

          • Clear caches in Firefox manually

      1. Click the hamburger icon in the top right corner and choose Preferences.
      2. Choose Privacy & Security on the left sidebar.
      3. Scroll to the section Cookies and Site Data and click to Clear Data… tab
      4. Now, check Cached Web Content  and click Clear button to delete Firefox cache.
      5. Exit/quit all browser windows and re-open the browser.

Clear cache in Firefox

 

 

 

References

The guide to clean all caches on a Mac

There are three types of caches you can clean on your Mac:

    • User (or App) cache. These cache files created by all the apps that you use on Mac. It includes apps that came with your macOS (like Mail) as well as 3rd-party apps (like Sketch). Every applications creates a lots of cache – it wouldn’t be surprising to clear up gigabytes of space when cleaning app caches.
    • System cache. These cache data created by the built-in macOS system services that run your Mac.
    • Browser cache. All browsers store your browsing history and cache data from websites you visit. You know how you shop for something online and then for weeks you’re seeing it everywhere? That’s because your browser caches hundreds of files that make up the websites you visit. Caches also include cookies and trackers that save information about your browsing history and report the data back to the site. This works out in your favor when you return to a site without having to log in again, but it can also leave you feeling like your computer is spying on you.

Old cache files do nothing but cluttering your system and slowing down your Mac through all the wasted space it is taking up.  Here’s a guide to cleaning all these caches, at the end of which your Mac will be lighter and leaner.

Besides browser and website information, your Mac keeps several caches of its own for different reasons. The good news is you can clean them up manually, or you can clean them with a special app which can clear the browser cache in Safari, Chrome, and Firefox, as well as your system cache, email cache, user cache files, and even your DNS cache files.

How to delete user caches on a Mac

User cache makes up the majority of junk data on macOS. Your applications accumulate user’s cache data on a hard disk the longer they are in use. Some apps and utilities can build up cache sizes that reach into gigabytes. This is often just a waste of space, particularly with apps you don’t use every day. By clearing your user apps cache files, you’ll be amazed at how much hard disk space you can reclaim.

Note: Manually clearing cache files on a Mac is something that anyone can do. It takes some time and patience, but if you follow our instructions, you can get the job done all by yourself. Please follow the instructions closely.

Clean up user caches manually

To find and clear your user cache manually, do the following:

    • In your Mac’s user folder, there’s a hidden Library folder, which itself contains a folder of caches left by the applications you’ve installed on your Mac.
    • Strongly recommend that you remove the insides of ~/Library/Caches  and   /Library/Caches folders, but not the folders themselves.
    • Want to make sure your junk user cache data is gone forever? – Empty out your Trash.

How to check a cache folder size

If you are unsure and want a safer option, go ahead and learn on how to use CleanMyMac to handle caches properly. It will find up to 5x more junk cache data to remove from all over your system.

Get rid of cache files with CleanMyMac

    1. Launch CleanMyMac app.
    2. Select System Junk in the left sidebar.
    3. Hit Scan at the bottom of app’s window.
    4. Then click Clean.

Remove system junk

And you’re done! If you’d like to remove only cache files and nothing else, click on Review Details before clicking Clean. Deselect everything but System Cache Files and User Cache Files, then click Clean.

FlushDNS cache

Your Mac’s DNS cache is a list of all the DNS queries that were resolved for every site. When you type in “setapp.com,” the DNS server resolves that to a numerical IP address. But if you notice a site not loading, or your browser acting up or working too slowly, resetting the DNS cache might be the cure.

To flush DNS cache manually

    1. Open Terminal (⇧ Shift++U, and double-click on Terminal)
    2. Type this into Terminal: sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;say cache flushed
    3. Press Enter to run and fill your admin password to execute the command.

To clean your Mac’s DNS cache with CleanMyMac

    1. Open CleanMyMac and select Maintenance in the left sidebar
    2. Check the box for Flush DNS Cache
    3. Click the Run button at the bottom of the window

Flush DNS caches

Delete system caches on Mac

System cache files are generated by OS X and, unlike application cache, have nothing to do with the user. The hidden system caches are mainly created by the apps that run on your Mac. The clearing of system cache is not recommended in manual mode, unless you are very careful or trying to fix a problem. System cache files do not generally take up much space, which is another reason why a clean out isn’t as necessary as with user cache.

Clean up system cache data manually

You can find and delete system cache in the same way as user cache, by

    1. Going to ~/Library/Caches and hit Enter to removing the insides of the folders with the app name.
    2. System cache folders are named com.apple and should be backed up for safety.
    3. Go into the com.apple folders and delete the files inside of them. Only the files, not the folders!
    4. Right click on the Trash icon and “Empty Trash”.

That’s it, now, just like with your user cache, your system cache is also clear.

Be careful: not all app cache files can be safely deleted. Some app developers keep important information on cache folders. The great idea to backing up a folder before you erase all files inside. If everything works fine, you can delete this backup.

One-button solution to cleanup macOS caches

CleanMyMac is such a great tool because it lets you perform the exact maintenance you want, or run a Smart Cleanup scan with a single click and have the software make recommendations.

Smart cleanup

Clean up browser caches

We love our browsers but we don’t love it when they start to use up hard disk space with cache files. Whether you’re wanting to free up space, get your browser performing better or trying to remove your history for the sake of privacy, removing your Mac browser cache will help.

Your browser cache is essentially saved bits of the websites you’ve visited recently. That way, if you go back, your computer can re-use locally cached elements that haven’t changed, which speeds up load times versus reloading everything fresh from the remote server. Your cache will overwrite itself eventually, but you can clear your cache, history, and cookies anytime you want to gain a little bit of extra security and speed up your Mac.

Clear Safari caches step-by-step

To delete Safari’s websites’ caches and cookies via browser preferences:

    1. Click Safari in the top menu click Preferences.
    2. In the window that appears, click the Advanced tab, and enable Show Develop menu.
    3. In menu bar go to Develop and choose Empty Caches.

Check and delete Safari browser cache with Terminal:

    1. Press Command + Shift + G to open up the Terminal
    2. With these simple commands you can delete Safari’s cache file. But first, check its size using the disk usage (du) command:
      du -h /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db
      Note: replace “$HOME” with the name of your home folder
  1. To delete Safari’s cache file type:
    rm /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db
    Note: when you use the remove (rm)command files are essentially unrecoverable.
  2. A more prudent approach is to use the move (mv) command:
    mv /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db ~/.Trash/
    This will move the file to your user’s ($HOME) trash. From there it is still recoverable until you empty the trash.
    Safari will create a new Cache.db file automatically when you open a new webpage.
  3. Open a new webpage or restart Safari and recheck disk usage:
    du -h /Users/$HOME/Library/Caches/com.apple.Safari/Cache.db

Clean cache in Safari

That’s all.

Chrome clearing cache tutorial

The simplest way to clear Chrome browser cache manually is:

    1. In the top right corner of Google Chrome browser click the 3-dot icon to choose Settings. 
    2. At the bottom of the menu, choose Advanced (or use Cmd+Shift+Delete keyboard shortcut)
    3. Click Clear browsing data and deselect all, but Cached images and files. Choose time range and hit Clear data button.

Delete caches in ChromeOne more way to delete Chrome browser cache is to clear some folders where these data located.

    1. To find Chrome cache files, open Finder and click to Go to the folder.
    2. To go to the folder where Chrome’ primary cache locates type: ~/Library/Caches/Google/Chrome/
    3. To go to the folder with the additional bulk of cached data type:~/Library/Application Support/Google/Chrome/Default/Application Cache/
    4. Select files within these folders and delete them.

How to delete cache in Firefox manually

    1. Click the hamburger icon in the top right corner and choose Preferences.
    2. Choose Privacy & Security on the left sidebar.
    3. Scroll to the section Cookies and Site Data and click to Clear Data… tab
    4. Now, check Cached Web Content  and click Clear button to delete Firefox cache.
    5. Exit/quit all browser windows and re-open the browser.

Clear cache in Firefox

How to clean all browsers cache data at once

    1. Open CleanMyMac and select Privacy in the left sidebar
    2. Click Scan at the bottom of app’s window
    3. Then Select Items to advance to the next page. The list is broken down by app: you can check each browser to remove all data, such as cookies, browsing history, downloads history, HTML5 local storage, saved passwords, and even close the tabs from your last session. Or you can uncheck any of that you want to keep
    4. Click the Remove button at the bottom of the window when you’re ready to delete everything that’s checked

Cleaning in progress

Screenshot shortcuts on Linux (Ubuntu, CentOS, RedHat)

This post  provides shortcuts for taking screenshots on Linux (including Ubuntu, CentOS, and RegHat).

The command is the same for Ubuntu, CentOS, RedHat. (Check HERE for screenshot shortcuts on Mac.)

  •  Using Gnome Screenshot

    • Press PrtScn to take a fullscreen screenshot to a PNG file (normally the screenshot file is saved in the Pictures folder.)
    • Press Alt+PrtScn to take a screenshot of an active window. This shortcut will create a screenshot of your active window as a PNG file. The file will be saved in your Pictures folder.
    • Press Shift+PrtScn to capture a customized screen area. You’ll be able to click and drag a selection box to determine what is captured in the screenshot. A PNG file with the image you captured will be saved in your Pictures folder.
    • Press Shift+CTRL +PrtScn to copy what you customized area capture  to clipboard.
    • More advanced functions:

The Gnome Screenshot utility allows you to perform some additional screenshot functions, such as adding a delay, and add tooltip.

Open the Screenshot utility. You can find the Screenshot utility in the Accessories folder of your Applications menu.

      • Select your screenshot type. You can choose from any of the options outlined above.
        • (Ubuntu)

        • (RedHat)

      • Add a delay. If your screenshot is time-dependent, you can use the Screenshot utility to add a delay before the screenshot is captured. This will allow you to make sure the right content is on the screen.
        • (Ubuntu)

        • (RedHat)

      • Select your effects. You can choose to include your mouse pointer in the screenshot, as well as whether or not you want to add a border to the screenshot.

(Ubuntu)

(RedHat)

 

 

 

  •  Using GIMP

GIMP (GNU Image Manipulation Program) is a freely distributed software for manipulating images. We can easily optimize the image, convert their type using GIMP. It provides the power and flexibility to designers to transform images into truly unique creations. GIMP is the cross platforms application and available for Linux, Windows, MAC OS, and FreeBSD etc.

Install GIMP

You can get it for free using your Software Center. Open the Software Center, search for “gimp”, and then install the “GIMP Image Editor”.

For installing GIMP from command line on Ubuntu, check my post HERE.

Click the “File” menu and select “Create” → “Screenshot”.

The screenshot creation tool will open. This tool is very similar to the Gnome Screenshot utility.

 

Select the type of screenshot you want to take.

You can choose to take three different types of screenshots: single window, full-screen, or custom selection. If you choose the single window option, you’ll be able to click the window that you want to take a screenshot of.

(Ubuntu)

(RedHat)

Add a delay.

You can add a delay before the screenshot is taken so that you can arrange everything exactly how you want it. If you have single window or custom screenshots selected, you’ll choose your screenshot target after the delay timer runs out.

Click “Snap” to take the screenshot.

Depending on your settings, the screenshot may be taken immediately. When you’re finished, the screenshot will open in the GIMP editing window.

 

Save the screenshot. If you don’t want to make any edits to the screenshot, you can save it to your hard drive. Click the “File” menu and select “Export”. Give the screenshot a name and choose where you would like to save it. Click the “Export” button once you are satisfied.

 

 

References

4 Ways to Take a Screenshot in Linux (with Pictures) – wikiHow (PDF)

 

 

 

 

 

How to Add Categories and Tags for WordPress Pages

This post provides instructions on how to add Categories and Tags for WordPress Pages.

By default, for a wordpress site, there are only Categories and Tags for posts, not for page. And it is not possible to edit the categories name once entered. However, once you read through this tutorials, you will be able to add Categories and Tags for both you Posts and for Pages, as well as edit them.

Download and install Post Tags and Categories for Pages plugin.

First, you need to download the plugin to your PC by clicking the “Download”.

click “install Now”

Activate the Post Tags and Categories for Pages plugin.

Once activated, go to Pages » Add New and you will find post categories and tags now available for your pages too.

That’s it. No complex setup. This plugin just works out of the box.

Before and after enabling categories and tags for WordPress pages

What this plugin does is that it modifies the default categories and tag taxonomies and associate them with Page post type along with the default posts. Lets say you have a category called “books” that you use to sort your posts. Using this plugin, you can easily add a page and file it in the same Books category, so your page will appear in the category archive along with your regular posts.

 

References

How to Add Categories and Tags for WordPress Pages (September 10th, 2017 ) — PDF

Categories vs Tags – SEO Best Practices for Sorting your Content (April 5th, 2018 )

What’s the difference between Categories and Tags?

Sorting Your Content

Categories are meant for broad grouping of your posts. Think of these as general topics or the table of contents for your site. Categories are there to help identify what your blog is really about. It is to assist readers finding the right type of content on your site. Categories are hierarchical, so you can sub-categories.

Tags are meant to describe specific details of your posts. Think of these as your site’s index words. They are the micro-data that you can use to micro-categorize your content. Tags are not hierarchical.

For example if you have a personal blog where you write about your life. Your categories can be something like: Music, Food, Travel, Rambling, and Books. Now when you write a post about something that you ate, you will add it in the Food category. You can add tags like pizza, pasta, steak etc.

One of the biggest difference between tags and categories is that you MUST categorize your post. You are not required to add any tags. If you do not categorize your post, then it will be categorized under the “uncategorized” category.

 

 

[LaTeX] subfigures with captions

This post provides Latex code examples for how to generate sub-figures with and without captions.

  • Sub-figures with captions
\documentclass{article}
\usepackage{graphicx, caption, subcaption}
\begin{document}
  This article is about ....

\begin{figure}
 \begin{subfigure}{0.96\textwidth} 
     \includegraphics[width=\textwidth]{subfig1} 
     \caption{subfig 1 caption text here}
 \end{subfigure} 
 \centering  %note: this centering command applies to subfig1
 \hfill
 \begin{subfigure}{0.47\textwidth}
     \includegraphics[width=\textwidth]{subfig2}
     \caption{subfig 2 caption text here}
 \end{subfigure}
 \hfill
 \begin{subfigure}{0.47\textwidth}
     \includegraphics[width=\textwidth]{subfig3}
     \caption{subfig 3 caption text here}
 \end{subfigure}
 \caption{the overall fig caption text here}
 \label{fig:subfig_example} % Give a unique label
\end{figure}

\end{document}
  • Sub-figures without caption
\documentclass{article}
\usepackage{graphicx}
\begin{document}
  This article is about ....

%*For figures without sub-captions
\begin{figure}
    \includegraphics[width=0.96\textwidth]{subfig1}
    \centering 
    \hfill
    \includegraphics[width=.48\textwidth]{subfig2} 
    \hfill
    \includegraphics[width=.48\textwidth]{subfig3}
    % figure caption is below the figure
    \caption{figure caption text here}
 \label{fig:subfig_example2} % Give a unique label
 \end{figure}
 
\end{document}

Install DB Browser for SQLite on Ubuntu 16.04

This post introduces how to install DB Browser for SQLite on Ubuntu 16.04.

For Ubuntu and derivaties, @deepsidhu1313 provides a PPA with the latest release at here:

https://launchpad.net/~linuxgndu/+archive/ubuntu/sqlitebrowser

Step 1: Add the PPA shown above by issuing the following command in your terminal:

$ sudo add-apt-repository -y ppa:linuxgndu/sqlitebrowser

Step 2: Update the cache using:

$ sudo apt-get update

Step 3: Install the DB Browser for SQLite package by issuing the following command:

$ sudo apt-get install sqlitebrowser

 

Reference:

http://sqlitebrowser.org/