Error while executing the dig command

1.0 Error

While executing the dig command, the sendmsg() failed: Operation not permitted error was printed.

$ dig example.com
../../../../lib/isc/unix/net.c:581: sendmsg() failed: Operation not permitted
../../../../lib/isc/unix/net.c:581: sendmsg() failed: Operation not permitted
...

2.0 Solution

The error was resolved after adding the following iptables rules.… Read more “Error while executing the dig command”

Sort command in Linux

1.0 Sort

The sort command is for sorting lines in text files. For example, if we have a file names, we can sort it with the sort command,

$ cat names
John Doe
Jane Doe
John Roe
Richard Roe
Tommy Atkins
Max Mustermann
Erika Mustermann
Joe Bloggs
$
$ sort names
Erika Mustermann
Jane Doe
Joe Bloggs
John Doe
John Roe
Max Mustermann
Richard Roe
Tommy Atkins

The words in the input lines are fields, which are numbered 1 onwards.… Read more “Sort command in Linux”

grep Command in Linux

1.0 grep

grep is a program for searching a given string pattern in files. It searches the files for the pattern and prints the lines that contain strings matching the pattern. For example,

$ # grep pattern filenames ... 
$ grep 'hbox' find.c
    GtkWidget *window, *scrolled_win, *hbox, *vbox, *find;
    hbox = gtk_hbox_new (FALSE, 5);
    gtk_box_pack_start (GTK_BOX (hbox), w -entry, TRUE, TRUE, 0);
    gtk_box_pack_start (GTK_BOX (hbox), find, FALSE, TRUE, 0);
    gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);

2.0 grep Command Syntax

grep [OPTIONS] pattern [file ...]
grep [OPTIONS] [-e pattern | -f file ] [file ...]

3.0 Regular Expressions

The pattern, mentioned above, is a regular expression.… Read more “grep Command in Linux”

ss command in Linux

1. ss command

The ss command gives the socket statistics. It gives information about the network connections. ss is a replacement for the netstat command.

By default, the ss command gives information about non-listening sockets.

$ ss
Netid  State      Recv-Q Send-Q   Local Address:Port       Peer Address:Port
u_str  ESTAB      0      0                    * 4482                  * 4481
u_str  ESTAB      0      0                    * 4285                  * 3631
...
Read more “ss command in Linux”