command

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

Find user login history – last and lastb commands in Linux

Login

1.0 last and lastb

The last command gives a chronological list of user logins in a Linux system for a period of time. The lastb commands gives a similar list of failed logins to the system. By default, last uses the /var/log/wtmp file for the record of login data.… Read more

Cut command in Linux

1.0 cut

Cut command in Linux

The cut command cuts sections of each line of input files and writes it on its standard output. It is mostly used for taking out a few columns from the input files. The command syntax is,

cut option...
Read more

tr Command in Linux

1.0 tr

The tr command is a filter which reads the standard input, translates or deletes characters and writes on its standard output. The tr command syntax is,

tr [OPTION]... SET1 [SET2]

tr transliterates characters from SET1 into corresponding characters of SET2 in input and writes resulting text on the standard output.… Read more

Uniq command in Linux

1.0 uniq

The uniq command is a filter for finding unique lines in input. It reads input, suppresses duplicates and prints unique lines in its output. Used with the -D option, we can do the inverse and print the duplicate lines only.… Read more

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

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

Bash Scripting Tutorial

1.0 Bash Script

bash can be run interactively, as a login shell or as an interactive process from a terminal emulator like the gnome-terminal. bash can be run non-interactively by running a bash script. A bash script is a list of commands written to automate some system operations work in Linux.… Read more

bash

Bash Tutorial

1.0 SHELL

A shell provides a user interface to a computer system. There are two types of shells, the command line interface (CLI) and the graphical user interface (GUI). In this tutorial, we describe the command line interface shell only and refer to it simply as shell.… Read more

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