December 18, 2022

Top 30 Essential Linux/UNIX Interview Questions for Oracle DBAs [ 2023 ]

Unix/Linux/Solaris Interview Questions/answers for Oracle DBAs

1. What is the difference between soft link and hard link?
Answer:
A symbolic (soft) linked file and the targeted file can be located on the same or different file system while for a hard link they must be located on the same file system, because they share the same inode number and an inode table is unique to a file system, both must be on the same file system.

2. How you will read a file from a shell script?

Answer:
while read line
do
echo $line
done < file_name

3. What is the use of umask?

Answer:
Will decide the default permissions for files.

4. What is the default value of umask?

Answer:
022

5. What is crontab and what are the arguments?

Answer:
The entries have the following elements:
field             allowed values
-----             --------------
minute            0-59
hour                0-23
day of month   1-31
month             1-12
day of week     0-7 (both 0 and 7 are Sunday)
user                 Valid OS user
command         Valid command or script

? ? ? ? ? command

|  | |  | |_________day of the week (0-6, 0=Sunday)
|  | |  |___________month (1-12)
|  | |_____________day of the month (1-31)
|  |_______________hour (0-23)
|_________________minute (0-59)


6. How to find an operating system (OS) version?
Answer:
uname -a

7. How to find out the run level of the user?
Answer:
uname -r

8. What is load average ?

Answer:
Load Average is the value that represents the load on the system for a specific period of time. Also it can be considered the ratio of the number of active tasks to the number of available CPUs.
run queue length - the sum of the number of processes that are currently running plus the number that are waiting (queued) to run.

9. What is the top command?
Answer:
top is an operating system command, it will display top processes which are taking high CPU and memory.

10. How to delete 7 days old trace files?

Answer:
find ./trace –name *.trc –mtime +7 –exec rm {} \;

11. How to get the 10th line of a file (by using grep)?

Answer:

12. (In Solaris) how to find out whether it is 32bit or 64bit?

Answer:

13. What is paging?

Answer:

14. What are huge pages?
Answer:

15. How to find out the status of the last command executed?
Answer:
$?

16. How to find out the number of arguments passed to a shell script?

Answer:
$#

17. How to add users in Solaris/Linux?
Answer:
useradd command

18. What does sudo stand for in Linux systems?
Answer:
Abbreviation of sudo is "substitute user do" (some people will abbreviate it as "super user do"), which allows users to run programs with the security privileges of another user, by default the superuser.

19. How to find out the memory size of the Linux host?
Answer:
grep MemTotal /proc/meminfo | awk '{FS=":"}{print $2 }' | awk '{print $1/1024/1024}'

20. How to find out the number of CPUs in Linux host?
Answer:
grep "physical id" /proc/cpuinfo | wc -l

21. What is inode ? how to get inode information ?
Answer:
inode (index node) is a data structure that describes a file system object, such as a file or a directory.
Each file/directory is associated with an inode, which is identified by an integer, often referred to as an i-number or inode number.
Each inode stores the attributes and disk block locations of the object's data.
File system object attributes include metadata (times of last change, access, modification), ownership and permissions.
A file's inode number stays the same when it is moved to another directory.

ls -i  -- inode number
df -i -- to show inode information

22. How to get the creation time of a file ?
Answer:

23. What are RAID levels? What is RAID 0, RAID 1 and RAID 10? 
Answer:

24. Which RAID level best suits databases ?
Answer:

25. How to split a bigger file into smaller files ?
Answer:

26. How will you execute the last command executed?
Answer:

27. How to find out all files larger than 100MB ?
Answer:

28. Which command will tell you for how many days the host has been running?
Answer:

29. Which commands will show the load average of the host ?
Answer:

30. How can you eliminate the ongoing process in Linux? (or) How to kill an OS process ?

8 comments:

  1. Hi There,
    . I'm trying to find a SQL-statement for what's in column "Occurences" below. I need to calculate the amount of times a "User" has a "Filename" with similar name (regardless the Drive and Folder it is stored).
    The output of below query is not correct. I want to get those MEMID which has more than one DOB records rows.
    create table #Mem (MEMID varchar(20), DOB datetime, MEMRef varchar(20), MEMLogdate datetime)
    insert into #Mem values ('4651','1956-12-19','A','1989-05-29')
    insert into #Mem values ('1233','1956-12-19','A','2011-07-07')
    insert into #Mem values ('1233','1956-12-19','A','1997-09-08')

    insert into #Mem values ('1235','1957-12-19','A','2012-07-07')
    insert into #Mem values ('1235','1957-12-19','A','1998-09-08')

    insert into #Mem values ('1236','1959-12-19','A','1998-09-08')
    ;with duplicateDOB as (
    select dob from #Mem group by dob having count(*) > 1
    )
    select * from #Mem
    where dob in (select * from duplicateDOB)

    --Current Output
    MEMID DOB MEMRef MEMLogdate
    4651 1956-12-19
    A 1989-05-29 --This row should not be in output because this has only one row
    1233 1956-12-19
    A 2011-07-07
    1233 1956-12-19
    A 1997-09-08
    1235 1957-12-19
    A 2012-07-07
    1235 1957-12-19
    A 1998-09-08

    --Desired Output
    MEMID DOB
    MEMRef MEMLogdate
    1233 1956-12-19
    A 2011-07-07
    1233 1956-12-19
    A 1997-09-08
    1235 1957-12-19
    A 2012-07-07
    1235 1957-12-19
    A 1998-09-08

    Regards,

    Irene Hynes

    ReplyDelete
  2. Please try:

    select MEMID, DOB from #Mem group by MEMID,DOB having count(*) >1;

    ReplyDelete
  3. Nice blog. Thanks for sharing this information. Keep updating.....
    Linux Online Training

    ReplyDelete
  4. Uname -r will print only the kernel release version?
    runlevel command will only print the current run level.

    ReplyDelete

  5. A big thank you for sharing such a valuable blog, I found this blog really useful. As a contribution to your blog post, I would like to share with you another Linux Interview Questions and Answer which I found as good as yours.

    ReplyDelete
  6. Thanks for the blog. Useful information is being provided.

    ReplyDelete