-->

How to show all hidden characters in Notepad++

Author : Piyush Gupta

The way to enable this depends on your version of Notepad++. 
On newer versions you can use:
Menu View → Show Symbol → *Show All Characters`
or
Menu View → Show Symbol → Show White Space and TAB

On older versions you can look for:
Menu View → Show all characters
or
Menu View → Show White Space and TAB

How to count the number of Lines, Words, and, Characters in a File using terminal

Author : Piyush Gupta

The most easiest way to count the number of lines, words, and characters in text file is to use the Linux command “wc” in terminal.
The command “wc” basically means “word count” and with different optional parameters one can use it to count the number of lines, words, and characters in a text file.
To count the number of lines, use “wc” with “l” as
$ wc -l yourTextFile
To count the number of words, use “wc” with “w” option as
$ wc -w yourTextFile
And to count the total number of characters, use “wc” with “c” as
$ wc -c yourTextFile
Using wc with no options will get you the counts of bytes, lines, and words (-c, -l and -w option).
$ wc sample.txt 
 1065    5343   40559 sample.txt

Example:

Following command will count number of lines in /etc/passwd files and print on terminal. We can also use –lines in place of -l as command line switch.
$ wc -l /etc/passwd

Count Total Character in File:


Use -m or –chars switch with wc command to count number of characters in a file and print on screen.
$ wc -m /etc/passwd

Count Total Words in File:


Use -w or –words switch with wc command to count number of words in a file and print on screen.
$ wc -w /etc/passwd

What is Soft Links and Hard Links in Linux File System

Author : Piyush Gupta

To make links between files you need to use ln command. A symbolic link (also known as a soft link or symlink) consists of a special type of file that serves as a reference to another file or directory. Unix/Linux like operating systems often uses symbolic links.

Two types of links

There are two types of links
  • symbolic links: Refer to a symbolic path indicating the abstract location of another file
  • hard links : Refer to the specific location of physical data.

How do I create soft link / symbolic link?

Soft links are created with the ln command. For example, the following would create a soft link named link1 to a file named file1, both in the current directory
$ ln -s file1 link1
To verify new soft link run:
$ ls -l file1 link1
Use following command to create a soft link of Apache configuration file under /etc directory. While creating softlink of file inode number will be different that original file.
ln -s /etc/httpd/conf/httpd.conf /etc/httpd.conf
Check soft link and original file inode number.
ls -li /etc/httpd/conf/httpd.conf /etc/httpd.conf

4035744 lrwxrwxrwx 1 root root 19 Sep 19 18:19 /etc/httpd.conf -> /etc/httpd/conf/httpd.conf
6130556 -rw-r--r-- 1 root root 19 Sep 19 18:59 /etc/httpd/conf/httpd.conf

How do I create Hard link?


Use following command to create a hard-link of Apache configuration file under /etc directory. While creating hard-link of file inode number will be same as original file.
ln /etc/httpd/conf/httpd.conf /etc/httpd.conf
Check soft link and original file inode number.
ls -li /etc/httpd/conf/httpd.conf /etc/httpd.conf

6130556 -rw-r--r-- 2 root root 19 Sep 19 18:19 /etc/httpd.conf
6130556 -rw-r--r-- 2 root root 19 Sep 19 18:59 /etc/httpd/conf/httpd.conf

How to convert tabs to spaces in Notepad++

Author : Piyush Gupta

To convert existing tabs to spaces, press Edit->Blank Operations->TAB to Space.
If in the future you want to enter spaces instead of tab when you press tab key:
  1. Go to Settings->Preferences...->Language (since version 7.1) or Settings->Preferences...->Tab Settings (previous versions)
  2. Check Replace by space
  3. (Optional) You can set the number of spaces to use in place of a Tab by changing the Tab size field.

Find the list of all installed packages in Linux

Author : Piyush Gupta

Some times we need to check how many packages are installed in our Linux machine. This article will help you to find all installed packages on Redhat and Debian based Linux systems.

Find the list of all installed packages

Use one of following commands to list all installed packages on CentOS, RedHat, Fedora, Ubuntu, Debian and LinuxMint systems
On CentOS, RHEL & Fedora:
# rpm -qa    # Using rpm command 

# yum list installed    # Using yum command
On Ubuntu & Debian:
# dpkg --get-selections

$ apt list --installed   # Ubuntu 14.04 or above