Featured Post

SQL Interview Success: Unlocking the Top 5 Frequently Asked Queries

Image
 Here are the five top commonly asked SQL queries in the interviews. These you can expect in Data Analyst, or, Data Engineer interviews. Top SQL Queries for Interviews 01. Joins The commonly asked question pertains to providing two tables, determining the number of rows that will return on various join types, and the resultant. Table1 -------- id ---- 1 1 2 3 Table2 -------- id ---- 1 3 1 NULL Output ------- Inner join --------------- 5 rows will return The result will be: =============== 1  1 1   1 1   1 1    1 3    3 02. Substring and Concat Here, we need to write an SQL query to make the upper case of the first letter and the small case of the remaining letter. Table1 ------ ename ===== raJu venKat kRIshna Solution: ========== SELECT CONCAT(UPPER(SUBSTRING(name, 1, 1)), LOWER(SUBSTRING(name, 2))) AS capitalized_name FROM Table1; 03. Case statement SQL Query ========= SELECT Code1, Code2,      CASE         WHEN Code1 = 'A' AND Code2 = 'AA' THEN "A" | "A

Tail Command in Linux: A Comprehensive Overview

The tail in Linux is handy command. You can check the last lines of a file in Linux/Unix operating systems.

You can use it to display last lines from single file, display last lines from multiple files, display the last entries of log files.


Tail Command in Linux


During production support the usage of Tail command is helpful since you can check latest logs quickly. Here are the top Tail command examples.

#1 Display last lines in a file (Tail file Linux)


Here's the tail command that shows last three lines of a file.

cat sample.txt | tail -3

It displays last 3 lines of a file. The same command you can use as

tail -3 sample.txt

#2 Display last lines of multiple files


There are three files. sample2.txt, sample3.txt, sample4.txt. The command displays the last 3 lines from all the three files.

tail -3 sample[2-4].txt


Tail command


#3 Tail -f option (Tail f Linux)


The –f option is to check status of long-running process that is redirecting output to a file. For example, if you invoke the below command, the status it writes to the output.

find . -print |xargs grep -i abc </tmp/abc &

Using the -f option you can see contents of the file /tmp/abc whenever it is updated: 

tail -f /tmp/abc


Related

References

Comments

Popular posts from this blog

How to Fix datetime Import Error in Python Quickly

Explained Ideal Structure of Python Class

How to Check Kafka Available Brokers