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}

How to annotate / add markup to a screenshot on a Mac

This post introduces how to annotate/ add markup to a screenshot on Mac.

Adding markup to a screenshot simply means adding things like text, underlines, circles, boxes, and arrows to the screenshot to further highlight or draw attention to certain details within the image. Markup is useful if you want to make quick notes for designers, make corrections to homework, or mark areas of interest within html code to website developers.

These steps show you how to add markup to screenshots without first saving the screenshot and then having to use image editing software:

  1. Hold the CTRL key while holding the command and SHIFT buttons. Press 3 for capturing the full screen, press 4 for a part of the screen, and press 4 followed by the spacebar for a window. This will hold the screenshot in the clipboard.
  2. Open the Preview application on your Mac and then using the following shortcut to view the image from the clipboard in Preview.
command +   N

3. Use the tools within Preview to make changes such as cropping the image, inserting caption text, and adding coloured shapes.

4. To copy the new edited image to clipboard before pasting into your email or document, press command +  A keys to select the full image and then press the command + C keys.

 

Reference:

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/

[LaTeX] Add appendices in an article

This post introduces how to add appendices to an article.

The command \appendix  is included in all basic class files, so you do not need to include any extra package to add appendix, unless the journal that you aim at has specific appendix style requirements.

\begin{document}

\section{Your section name here}
\section{Your section name here}

% Activate the appendix in the doc
% from here on sections are numerated with capital letters 
\appendix

\section{Appendix A title here}
\subsection{Appendix subsection title here}
\subsection{Appendix subsection  title here}

\section{Appendix B title here}

\end{document}

VPN setup on Ubuntu 16.04 (using Cisco AnyConnect client)

This post introduces how to setup VPN on Ubuntu  16.04 LTS using Cisco AnyConnect Client.

Step 1:  Download Cisco AnyConnect client.

Penn Stater can download at here.

Step 2: Extract the file(s) and install as root.

(1) extract the downloaded file;

(2) then cd to the extracted directory where it has an installation .sh file;

(3) then issue the following command to install Cisco AnyConnect Client:

$sudo ./AnyConnectInstall.sh 

# note your .sh file may have slight different name

Step 3:  Run the following command.

$ sudo apt-get install openconnect network-manager-openconnect-gnome

We need to issue this command to  show Cisco Compatible VPN in the list when we open network manager and add a new VPN.

Step 4:  Open Network Manager.

 

Step 5: Add a VPN in the Network Manager

Step6:  Choose Cisco AnyConnect Compatible VPN (openconnect) and click Create.

Step 7: Enter the following info

  • Connection name: Tech Services VPN [Note you can name this as you wish]
  • Gateway: vpn.its.psu.edu  [type in your vpn accordinly]

Click Save.

Step 8: Open Cisco Anyconnect client

Type your VPN address in the connect to textbox, and then enter your username and psw.

Then you are ready to go:)

 

References:

VPN, CISCO AnyConnect, Linux

Cisco VPN client on Ubuntu 16.04 LTS

 

 

 

Two ways to merge PDF files on Mac (GUI and command line)

This post introduces how to merge PDF files on Mac from GUI and from Terminal on Mac OS.

(For Ubuntu and Windows users, check out my post here for solutions.)

Method 1: GUI — using Preview  that comes with your Mac OS.

Check here for how to combine PDFs and reorder, rotate, and delete pages. If the page is not accessible, check the pdf I linked to in the references.

Method 2: From Terminal

We will introduce using gs command.

many people may already have gs package  installed and are already using gs.

TO check whether your Mac has gs installed,  in your terminal, issue the following command:

$ which gs

If you see something like this “/usr/local/bin/gs”, you OS has gs installed

If you see something like “… command not found”, you will need to install gs first.

You can use brew to install it.

$ brew install gs

If you do not have brew installed, check: Install Homebrew.

After you have gs installed,

in your terminal, cd to the directory where the pdf files you want to merge are located, and then issue the following command:

$ gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf source1.pdf source2.pdf source3.pdf

Then you will see a merged.pdf appear in the same folder where you source pdfs are.

Note: You may encounter these two errors in your terminal after your issue the pdf merge command I mentioned above, but be assured, the merge.pdf is correct. you can double check if you are worried about that:)

 

References:

Use Preview to combine PDFs on your Mac (pdf)

How can I combine multiple PDFs using the command line?

 

Read the first line of a file from terminal (on Ubuntu and Mac)

This post introduces how to read the first line of a file from terminal. It works on both Linux (Ubuntu) and Mac OS.

For getting top or bottom 10 files under a director from terminal (on Ubuntu and Mac), check here.

Note: you do not need to install anything, it is built-in on your Ubuntu/Mac OS.

Step 1: open a terminal 

Step 2: cd to the directory where your file (e.g., .txt file) is located 

Step 3: issue the following command

$ head -n 1 example.txt  
# this will read and print the first line of the file in the terminal

$ head -n 2 example.txt 
# this will read and print the first two lines of the file ... you got the idea...

***********************************************

Analogously, see the following command for displaying the last line of a file from terminal:

$ tail -n 1 example.txt # this will read and print the last line of the file in the terminal 

$ tail -n 2 example.txt # this will read and print the last two lines of the file ... you got the idea...

Get top or bottom 10 files under a director from terminal (on Ubuntu and Mac)

This post get top/bottom 10 from the sorted file names in current directory.

For reading the first line of a file from terminal (on Ubuntu and Mac), check here.

Note: you do not need to install anything, it is built-in on your Ubuntu/Mac OS.

Step 1: open a terminal 

Step 2: cd to the directory where your file (e.g., .txt file) is located 

Step 3: issue the following command accordingly

$ ls | head -10

# the pipe symbol (i.e., |) puts the output of the ls command as the input of the head command.

if you would like to get more information of the files, use the following instead:

$ ls -l | head -10

similarly,

if you would like to get the bottom 10 files in the current directory, issue the following command:

$ ls | tail -10

or for detailed information of the files, use

$ ls -l | tail -10

You guessed it, if you would like to get the top/bottom 20, just change the -10 to -20:)

simply, enough, right?

 

For more commonly used Linux commands, check my other posts at here  and here .