Linux interview questions and answers for an L1 level.
In this article, we have pointed out some of the Linux interview questions and answers which will not only help you prepare for your interviews but will also help you to understand a lot more about Linux OS.
Linux is considered as the most used operating system in the world and is best known for its efficiency and fast performance in the server segment. It is a Unix like operating System and was first introduced by Linux Torvalds.
If you are preparing for Linux System Administrator interview, then let me guide you with some of the basic questions which will be asked by the interviewer. So these are basically L1 level questions but you would like to have a look even if you are not a fresher anymore.
So let me point out some of those important questions below.
So here are some of the Linux interview questions and answers that will be helpful for an interview.
Q: How to increase the size of LVM partition?
Ans: #resize2fs /dev/<Name of the LVM Partition>
# df -Th
Q: How to reduce or shrink the size of LVM partition?
Ans: Umount the filesystem using umount command, then apply…
# resiz2fs /dev/mapper/myvg–mylv 10G
# df -Th
Q: How do you send a mail attachment via bash console?
Ans: for Ubuntu: # apt-get install mutt
for RedHat / Fedora: # yum install mutt
usage:
# mutt -s “Mail Subject” -a “file attachment path” “recipient email” < “message body”
Q: What are the run levels in Linux and how to change them?
Ans:
0: Halt System (To shut down the system)
1: Single user mode
2: Basic multi-user mode without NFS
3: Full multi-user mode (text-based)
4: unused
5: Multi-user mode with GUI
6: Reboot System
If you want to modify the default runlevel, then you need to edit the file “/etc/inittab” and change the default entry ( id:5:initdefault:)
By using ‘init’ command you can change the runlevel,
# init 3
the above command will move the system to runlevel 3 from its current runlevel.
# who -r
check the current runlevel.
Q: How can you find out how much memory Linux is using?
Ans: All the below commands will show the memory usage of a Linux machine.
# free – m
# vmstat
# top
# htop
Q: How to check all open ports on the Linux machine and block unused ports?
Ans: # netstat -tulpn or # netstat -anp
These commands will check the open or blocked ports on a Linux machine.
Q: What command would you use to create an archive (backup) file of your home directory “/home/user”?
Ans:
syntax: # mkdir /backup – ( create a directory for storing the backup)
# tar -cvfz /backup/user.bak.tar.gz /home/”username”
- – cvfz it stands for create/verbose/filename/compression format
- /backup/user.bak.tar.gz – The file name of the compressed file that has been backed up earlier.
- /home/”username” this refers to the targeted file that needs to be backed up.
Q. Why you should not Telnet to administer a Linux system remotely?
Ans: Telnet is a protocol which uses the most insecure method of communication. It sends data across the network in plain text format that anybody can easily find out the password by using the network tool.
It means if anyone runs a sniffer on your network, he can find the information very easily. So it is highly recommended to use ssh login for any Linux system.
Q. What is YUM?
Ans: YUM stands for Yellow dog Updater, Modified because it is based on YUP, the Yellow dog Updater.
Yellow Dog is a version of Linux for the Power Architecture hardware and it is RPM-based, just like Red Hat Enterprise Linux and Fedora. both the terms YUP and YUM were written by the Linux community to maintain an RPM-based system.
Q: What are the environmental variables?
Ans: An environmental variable is a kind of object that is totally ” dynamic ” on a computer that stores a “value” against it, it also can be referenced by one or more software programs in Windows. Environment variables can change its value that’s why it is called are dynamic. The values they store can be changed to match the current computer system’s setup and design (environment).
example:
Linux/Unix – $LANG environment variable stores the value of the language that the user understands.
Windows – %appdata% environment variable contains the directory path to the Application Data folder for your user profile. Settings and logs are stored inside this folder, among other things, for various software programs.
Conclusion:
So, guys, I have tried my best to simplify things so that you can have a better understanding and user experience. Now it’s your turn to pay me back.
Now I am expecting your responses. If you like this content or even dislike, just leave a comment. Your responses will motivate me to do better and deliver better. I will try my best to enrich my skill.
So thank you guys, Have a good day.