Linux admin interview questions Part – II
1. What is Umask ? what is the default umask value for files and folders for localuser?
Abbreviation of Umask is user mask or user file creation mask. Umask is the default permission given to a file and folder when it is created in a linux machine.
The minimum and maximum UMASK value for a folder is 000 and 777
The minimum and maximum UMASK value for a file is 000 and 666
The default umask value for local user is 002. When a local user creates a file the default permission is 775 and for folder the default permission is 664.
The default umask value for root user is 022. When root user creates a file the default permission is 755 and for folder the default permission is 644.
2. What is the command to compare files in Linux / Unix ?
Using diff and comm command we can compare two or multiple files in Linux / Unix.
3. What are the multiple ways to share files and folders in linux ?
We can share files and folders between linux using NFS, FTP and Storage FILER.
4. How to share a file from linux to windows machine and windows to linux machine?
We can share files and folders between linux and windows machine using SAMBA services.
The steps to setup and configure SAMBA server is explained in the post Samba configuration.
5. How to find files which are accessed before 10 minutes ?
find . -amin -10
6. How to recovery deleted files in linux?
We can recovery deleted files using foremost command in linux. Steps to recover deleted files are explained in post Recover deleted files in Linux using foremost
7. What is the command to view the hidden files in Linux / Unix ?
Using ls command we can view the hidden files in Linux.
The output of above command will display the hidden files.
8. How to change permission and ownership of files and folders recursively?
chmod command is used to change permission and chown command is used to change ownership of both folders and files.
chmod -R 755 /tmp/test
chown -R tts:tts /tmp/test
The -R option will set the permission and owner ship recursively through out the folder.
9. How do you extract only a single file inside a tar ball ?
tar -tvf nagios-3.2.0.tar.gz
The above command will display all the files inside a tar ball without extracting it.
tar –extract –file=nagios-3.2.0.tar.gz nagios-3.2.0/xdata/xsddefault.h
The above command will extract the single file xsddefault.h from nagios-3.2.0.tar.gz tar ball.
10. How many runlevel in linux and can u explain it in detail ?
There are total of 6 runlevel and which determines the init services in linux / unix . Runlevel is well explained in post runlevel in linux.
11. How do you find the last installed rpm in linux server ?
rpm -qa –last | head
The above command will display last installed 10 rpm packages. To know more about RPM check post rpm command with examples in linux and unix
12. What is the main difference between scp and rsync ?
Scp and Rsync are used to copy files between same machine and different in linux. If you copy a file using scp and the destination folder already has the file then the whole data in the file will be copied. If you copy a file using rsync and the destination folder already has the file then only the updated data in the file will be copied.
13. How to lock and unlock a users password in linux ?
passwd -l <username>
passwd -u <username>
To lock users password use -l option and to unlock users password use -u option in passwd command.
14. How to run a shell script in linux ?
We can run a shell script in multiple ways and they are
15. How do you configure password less ssh login in linux ?
The password less ssh login is explained in post ssh password less login
16. What is the command used to remove password assigned to a group?
The above command will remove password assigned to a gropu in linux / unix.
17. What is Soft link and hard link and how to create it ?
To create soft link use following command
ls -s <source file name> <Destination file name>
To create hard link use below command
ln <source file name> <Destination file name>
The Soft link and Hard link are well explained in post soft link and hard link with examples in linux / unix.
18. What daemon is responsible for tracking events in linux machine ?
The syslogd daemon is responsible for tracking events in linux machine.
19. Explain Linux file system hierarchy ?
It is explained briefly in post linux file system hierarchy
20. Which command is used to review boot messages?
dmesg command is used to review all the system boot messages.
21. How do you restart Apache service in linux ?
Using the following command we can restart the apache httpd services in linux.
service httpd restart
22. How do you disable selinux in linux ?
To disable the SELinux permanently, modify the /etc/selinux/config and set the SELINUX=disabled as shown below
# cat /etc/selinux/config
23. How to set time for system hardware clock from linux command prompt ?
hwclock –set –date “27 Sep 2011 23:01″
The above command will set the hardware clock time.
24. How to mount a CDROM in linux ?
mount /dev/cdrom /mnt
25. Can u explain how the email works ?
We have already seen about how email works in post email working process.
Hope it is helpful. Linux admin interview question post will be continued.