EDUCBA

EDUCBA

MENUMENU
  • Blog
  • Free Courses
  • All Courses
  • All in One Bundle
  • Login
Home Software Development Software Development Tutorials Unix Tutorial UNIX Interview Questions

UNIX Interview Questions

Priya Pedamkar
Article byPriya Pedamkar

Updated June 1, 2023

UNIX interview questions

Introduction to UNIX Interview Questions and Answers

UNIX is one secure operating system that is most popular in the banking sector, especially those organizations that prefer a secure system. It actually replaces the Windows operating system mainly for server location or environment.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

UNIX interviewer mainly asks or concentrates on UNIX commands, which are well-known and common commands for all. The person attaining the interview must be stronger in the UNIX command or shell script.

Common UNIX Command

Common UNIX command is explained below:

ls —> all the available files display by executing the same.

ls -l —> mainly used to list the files in long format, it contains more information like the file size, owners detail, and rights or permission for other users and provides the last modified data.

ls -a —> Mainly used to display those files starting with a dot.

more filename —> displaying some part of the file and how much it can adjust in one screen. Hitting on the space bar will display more data from that file, q can be used for quit. For searching the text inside the file, searching text can be put after /.

mv filename1 filename2 —> just move the file or cut the file. Normally used to move one file from one directory to another.

cp filename1 filename2 —> Copy the file with content in the same location.

rm filename —> using to remove the file from the directory. There has one option to use rm –I, which provides one confirmation text to the user before delete, possible to make this behavior default for any deleting activity by adding one alias in a .cshrc file.

diff filename1 filename2 —> Using for compare both the file and give the result with different.

wc filename —> Given details of a number of lines, words, or characters in a file.

chmod options filename —> Mainly used for providing permission on specific scripts or files. Default permission to the creator for reading and edit. But if anyone needs that specific file to be read, write, and executable, then the chmod command need to be used. We mainly user 3 number at the time of executing chmod.

Chmod 754

First Number 7 = Provide access to read, write and execute for the user.

Second Number 5 = Provide access to read and execute for the group.

Third Number 4 = Provide access to one read for other

N Description ls binary
0 No permissions at all — 000
1 Only execute –x 001
2 Only write -w- 010
3 Write and execute -wx 011
4 Only read r– 100
5 Read and execute r-x 101
6 Read and write rw- 110
7 Read, write, and execute rwx 111

gzip filename —> compressing multiple files, similar to the ZIP file concept of windows.

gunzip filename —> mainly to uncompress zip file which is compressed by gzip.

lpr filename —> mainly used for print, want to specify different printer name rather than default printer than –P option can be used.

mkdir dirname —> command to create the new directory in the executable command location. Duplicate directory names will not be allowed, and all the names are case sensitive.

cd dirname —> Mainly used for changing the directory, it will help to move to another directory and find all the file names in the new directory (ls –lrt command will help to display all the files under this directory). Move back to the previous directory normally uses cd .., and moving back to multiple parent directory normally execute cd .. / .. / .., which help to move directly in 3 top directories by executing one command. Cd directory name is also very much used in a Windows command script. Normally when one user logged in UNIX box, he moves to a home directory, then they have to use the cd command to move to the proper directory to execute any other require command.

pwd —> Always presenting the current location of the user.

Preparing for a job interview in UNIX. I am sure you want to know the most common 2023 UNIX Interview Questions that will help you easily crack the UNIX Interview. Below is the list of top UNIX Interview Questions and answers at your rescue.

Part 1 – UNIX Interview Questions and Answers (Basic)

This first part covers basic UNIX interview questions and answers

1. Command to find out those files which are hidden in the current directory

Answer:
$ ls -lrta

2. Command to find out the existing active running process currently in the UNIX system?

Answer:
$ ps -ef

Now if we know the name of the process, we can add grep after ps –ef like below:

$ ps –ef | grep java

Let us move to the next UNIX interview questions.

3. How one can determine memory utilization by an entire process in a UNIX box?

Answer:
This is the basic UNIX interview questions that are asked in an interview.
By using the $ top command.

Top command provides all the details, including memory usage, process ID, and others. Commands display should be like the below:Command display

4. Explain the command to find out Exception in the application log file, suppose the log file name is server.log?

Answer:
$ grep ‘Exception’ server.log —> will give the expected result.

$ grep ‘Exception’ server.log | wc –l —> will give the proper exceptions count in the total application server log file.

5. Command to find all the files in the same directory or subdirectory with a name like ‘Java’?

Answer:
$ find. -name ‘Java’

Part 2 – UNIX interview questions and answers (Advanced)

This first part covers Advanced UNIX interview questions and answers

6. How is the Shell script accepting command line arguments for internal processing in shell script logic?

Answer:
Arguments pass from the command line can be easily accepted in the shell script using $ (dollar sign). It always followed the argument numeric position on a command line.

7. Display or present the last 200 lines of an existing file in a UNIX box.

Answer:
$ tail -200f newfile.txt

Let us move to the next UNIX interview questions.

8. Command to find out the remaining disk space in UNIX/Linux server.

Answer:
$ df –kl

[db2inst1@eproc-db1-eps-temp ~]$ df -kl

Filesystem           1K-blocks    Used Available Use% Mounted on

/dev/mapper/vg0-root  41153856 6322928  32733776  17% /

tmpfs                  4029268     100   4029168   1% /dev/shm

/dev/sda1               487652   33803    428249   8% /boot

/dev/mapper/vg0-database1

20511356 6900920  12561988  36% /database1

/dev/mapper/vg0-database2

10190136 4346232   5319616  45% /database2

/dev/mapper/vg0-database3

10190136 7615792   2050056  79% /database3

/dev/mapper/vg0-backup

5029504 3549988   1217372  75% /backup

disk space

9. Provide access to any script file for the executable.

Answer:
$ chmod 755 *.sh

This is the advanced UNIX interview questions that are asked in an interview. If the requirement is to script should be readable, writable, and executable for any user, then the command can be chmod 777 *.sh

10. How can we kill one process in the UNIX box?

Answer:
$ kill -9 #pid —> pid can be found by executing the ps –ef command.

Recommended Articles

We hope that this EDUCBA information on “UNIX interview questions” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

  1. 4 Useful Of Shell Script Types For Linux Newbies (Helpful)
  2. Advanced SQL Interview Questions And Answers
  3. Useful Windows Server Interview Questions
  4. Ab initio Interview Questions And Answers
All in One Excel VBA Bundle
500+ Hours of HD Videos
15 Learning Paths
120+ Courses
Verifiable Certificate of Completion
Lifetime Access
Financial Analyst Masters Training Program
2000+ Hours of HD Videos
43 Learning Paths
550+ Courses
Verifiable Certificate of Completion
Lifetime Access
All in One Data Science Bundle
2000+ Hour of HD Videos
80 Learning Paths
400+ Courses
Verifiable Certificate of Completion
Lifetime Access
All in One Software Development Bundle
5000+ Hours of HD Videos
149 Learning Paths
1050+ Courses
Verifiable Certificate of Completion
Lifetime Access
Primary Sidebar
All in One Software Development Bundle5000+ Hours of HD Videos | 149 Learning Paths | 1050+ Courses | Verifiable Certificate of Completion | Lifetime Access
Financial Analyst Masters Training Program2000+ Hours of HD Videos | 43 Learning Paths | 550+ Courses | Verifiable Certificate of Completion | Lifetime Access
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more