Find Interview Questions for Top Companies
Ques:- Write a command to print all line except first line?
Asked In :-
Right Answer:
```bash
awk 'NR > 1' filename
```
Ques:- Write a command to rename the files in a directory with “_new” as postfix?
Asked In :-
Ques:- In the text file, some lines are delimited by colon and some are delimited by space. Write a command to print the third field of each line.?
Asked In :-
Right Answer:
```bash
awk -F '[: ]' '{print $3}' filename.txt
```
Ques:- Write a command to print the squares of numbers from 1 to 10 using awk command?
Asked In :-
Right Answer:
```bash
awk 'BEGIN { for (i=1; i<=10; i++) print i*i }'
```
Ques:- Write a command to print the second and third line of a file without using nr?
Asked In :-
Right Answer:
```bash
awk 'FNR==2, FNR==3 {print}' filename
```
Ques:- Write a command to find the total number of lines in a file without using nr?
Asked In :-
Right Answer:
```bash
awk 'END {print NR}' filename
```
Ques:- How to get only zero byte files which are present in the directory?
Asked In :-
Right Answer:
You can use the following `awk` command to get only zero-byte files in a directory:

```bash
ls -l | awk '$5 == 0 {print $9}'
```
Ques:- How to display even number of records into one file and odd number of records into another file?
Asked In :-
Right Answer:
You can use the following `awk` command to achieve this:

```bash
awk 'NR % 2 == 0 { print > "even.txt" } NR % 2 == 1 { print > "odd.txt" }' inputfile.txt
```
Ques:- How to print only blank line of file?
Asked In :-
Right Answer:
You can use the following `awk` command to print only the blank lines of a file:

```bash
awk '/^$/ { print }' filename
```
Ques:- How add a first record and last record to the current file in linux?
Asked In :-
Right Answer:
To add a first record and last record to a file in Linux using `awk`, you can use the following command:

```bash
awk 'BEGIN { print "First Record" } { print } END { print "Last Record" }' inputfile > outputfile
```

Replace `inputfile` with the name of your current file and `outputfile` with the desired name for the new file.
Ques:- Write a command to print zero byte size files?
Asked In :-
Right Answer:
```bash
awk 'BEGIN { for (f in ARGV) if (system("test -s " f) != 0) print f }' *
```
Ques:- how to run awk command specified in a file?
Asked In :-
Right Answer:
You can run an `awk` command specified in a file using the following syntax:

```bash
awk -f filename.awk inputfile
```

Replace `filename.awk` with the name of your file containing the `awk` script, and `inputfile` with the name of the file you want to process.
Ques:- Write a command remove all empty lines?
Asked In :-
Right Answer:
```bash
awk 'NF' filename
```
Ques:- Write a command to print the line number before each line?
Asked In :-
Right Answer:
```bash
awk '{print NR, $0}' filename
```
Ques:- Write a command delete all line except first line?
Asked In :- Quarks Technosoft,
Right Answer:
```bash
awk 'NR==1 {print; next} {next}' filename
```
Ques:- What is the use of ERRNO?
Asked In :-
Right Answer:
ERRNO is a variable in AWK that holds the error number of the last failed system call or library function, allowing users to check for errors and handle them appropriately in their scripts.
Ques:- What is the use of FIELDWIDTHS?
Asked In :-
Right Answer:
FIELDWIDTHS is an Awk built-in variable that specifies the widths of fields in a fixed-width input file, allowing Awk to correctly parse and process each field based on its defined width.
Ques:- What is the use of SUBSEP?
Asked In :-
Right Answer:
SUBSEP is a built-in variable in AWK that represents the subscript separator used in associative arrays. It is typically set to the ASCII character for the subscript separator, allowing for the use of multi-dimensional arrays.
Ques:- What is the use of CONVFMT?
Asked In :-
Right Answer:
CONVFMT is an AWK variable that defines the format for converting numbers to strings when they are printed. It specifies how numeric values should be formatted when using the print statement.
Ques:- What is the use of RSTART, RLENGTH and match ?
Asked In :-
Right Answer:
`RSTART` is the index of the start of the match found by the `match()` function, `RLENGTH` is the length of the matched string, and `match()` is a function that searches for a regular expression in a string and sets `RSTART` and `RLENGTH` accordingly.


The Unix category on takluu.com is designed for IT professionals and developers preparing for interviews that require a strong understanding of Unix operating systems. Unix has been the backbone of many enterprise systems due to its stability, security, and multitasking capabilities.

This section covers key topics such as Unix file system architecture, shell scripting, process management, file permissions, user management, and networking commands. You will also learn about vi editor, cron jobs, package management, and system monitoring tools.

Interview questions often assess your proficiency in writing shell scripts, automating tasks, troubleshooting system issues, and managing user permissions. Candidates may be tested on commands like grep, awk, sed, find, and piping techniques, as well as understanding system boot processes and kernel basics.

Roles such as Unix Administrator, DevOps Engineer, System Engineer, and Backend Developer often require expertise in Unix environments. This category also includes best practices for security hardening, backup strategies, and performance tuning in Unix systems.

At Takluu, we offer detailed tutorials, practical exercises, and interview question sets that will help you build confidence and excel in your Unix-related interviews.

Whether you’re a beginner or looking to deepen your Unix skills, this category equips you with comprehensive knowledge to manage Unix systems efficiently and advance your career.

AmbitionBox Logo

What makes Takluu valuable for interview preparation?

1 Lakh+
Companies
6 Lakh+
Interview Questions
50K+
Job Profiles
20K+
Users