Interview Questions and Answers in Linux: Part-3

vivek bangare

Vivek Bangare

Author

Interview Questions and Answers in Linux: Part-3

Hello everyone, This is the third part of the interview questions and answers in Linux. Along with that will go through some examples also. I will create a series of questions and answers for beginners to advanced levels.

more vs less command

Both are used for viewing large files page-wise.

'less' is faster, it doesn't load the entire file at once, and allows navigations using up/down keys.

What does 'shred' do?

It is used to permanently delete data that you don't want to be recovered. 

Difference between find vs locate
find:
  • works in real-time
  • searches all directories.
  • Examine each file one by one.
  • requires a lot of I/O calls, and takes longer to get results.
locate:
  • Works in offline mode.
  • Searches files in updated db.
  • Comparatively quicker but the results are not as fresh as 'find'. 
command to print only 60 lines from file

pr -l 60 {file_name} [default 66]

How to collect reports or saved system information and log servers like CPU, memory disks, interrupts, network interfaces?
  • sar [commands]
  • logs are stored in /var/log/sadd file
How to verify memory status and cpu status as linux admin?

vmstat or free

Difference between cron and anacron
Cron:
  • Granularity is in minutes.
  • Normal users can schedule.
  • Expects the system up and running.
Anacron:
  • Granularity is in days.
  • Only superusers can schedule.
  • Doesn't expect to execute as soon as the system is up and running. 
Shadow password file

A shadow password system file is known as /etc/shadow. It stores encrypted user passwords and it can only access by a root user.

Earlier Linux file system stores in /etc/passwd but it is vulnerable, to avoid this vulnerability newer version of Linux stores password in /etc/shadow (it's in hashed)