Welcome back to our Linux Interview Questions series on Tecmint! After laying a strong foundation in the first article, we’re here with 15 more carefully chosen questions and answers to help you improve your Linux skills and feel more confident during interviews.
Keep in mind: these questions aren’t taken directly from real interviews, but they cover important concepts that every Linux learner should understand. Think of them as useful tools to help you learn step-by-step and build a solid knowledge base.
Let’s get started!
Q1: Which command is used to record a user login session into a file?
The script
command records a user’s terminal session, capturing everything typed and displayed between the start and exit of the script.
Example usage:
script my-session-record.txt Script started, file is my-session-record.txt exit Script done, file is my-session-record.txt
You can then view the session log by opening my-session-record.txt
with any text editor.

Q2: How can you view kernel log messages in Linux?
The dmesg command prints the kernel ring buffer, which contains boot messages and hardware-related logs.
dmesg | less

Q3: Which command shows the Linux kernel release version?
Use uname -r
to display the kernel release string.
uname -r 6.8.0-59-generic
Other useful uname options:
-v
: Kernel version-m
: Machine hardware name-n
: Network node hostname-o
: Operating system
Q4: How do you identify the type of a file in Linux?
The file
command inspects a file and tells you its type, which is useful to confirm whether a file is binary, script, text, or something else.
file /bin/bash
Sample Output:
/bin/bash: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=2f77b36371c214e11670c7d9d92727e9a49f626b, for GNU/Linux 3.2.0, stripped
Q5: Which command locates the binary, source, and man page files for a command?
The whereis
command locates the binary, source, and manual files related to a command.
whereis ls ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz
Q6: Which files are executed by default when a user logs into a shell?
When a user logs into a shell, files like .bash_profile
, .profile
, and .bashrc
in the user’s home directory are executed to set up the shell environment.
Specifically, .bash_profile
(or .profile
on some systems) is typically run for login shells, and .bashrc
is executed for non-login interactive shells.
Q7: What is the purpose of the /etc/resolv.conf file?
The /etc/resolv.conf
file is used to configure DNS (Domain Name System) settings for the system. It specifies the nameservers the system should use to resolve domain names into IP addresses.
Each line typically begins with the keyword nameserver, followed by the IP address of a DNS server.
nameserver 8.8.8.8 nameserver 8.8.4.4
This file is read by the system’s resolver libraries during hostname resolution, which may be dynamically updated by network management tools like NetworkManager or dhclient.
Q8: How do you create a symbolic (soft) link in Linux?
To create a symbolic (soft) link in Linux, use the ln -s
command. A symbolic link acts as a shortcut that points to another file or directory and can even span across different filesystems.
ln -s [target_file_or_directory] [link_name]
For example.
ln -s /etc/httpd/conf/httpd.conf httpd.original.conf
In this example, httpd.original.conf
becomes a symbolic link pointing to the original Apache configuration file. If the target file is moved or deleted, the symbolic link becomes broken.
Q9: Is the pwd command an alias for passwd?
No, the pwd command is not an alias for passwd
command.
pwd
stands for Print Working Directory, and it displays the absolute path of the current directory you’re working in.passwd
is a completely different command used to change the password of a user account.
Example usage:
pwd /home/user passwd Changing password for user
Q10: How do you check PCI device information in Linux?
The lspci
command is used to list all PCI (Peripheral Component Interconnect) devices in the system, along with details such as the device type, vendor, and model.
This is especially useful for identifying hardware components like network cards, graphics cards, and storage controllers.
lspci
To get more detailed information, you can use:
lspci -v

Q11: What does the chmod command do, and how is it used?
The chmod
(change mode) command is used to modify the access permissions of files and directories in Linux using symbolic notation (e.g., u+x
) or octal notation (e.g., 755
).
In octal notation, each digit represents a set of permissions:
- 7 = read (4) + write (2) + execute (1)
- 5 = read (4) + execute (1)
- 0 = no permissions
Example:
chmod 755 script.sh
Q12: What is the difference between su and sudo commands?
su
(substitute user) allows you to switch to another user account, usually the root user.sudo
(superuser do) lets you execute a single command with elevated privileges without switching users.
The sudo
command uses your own password for authentication and relies on the permissions configured in the /etc/sudoers
file to determine allowed commands.
Q13: How do you view running processes in Linux?
You can use the ps command to get a snapshot of current running processes, or top and htop for a real-time, interactive view.
ps aux top htop
htop is an enhanced, user-friendly alternative to top (may need to be installed separately).
Q14: What is the purpose of the cron daemon?
The cron daemon is used to schedule and execute repetitive tasks (called cron jobs) automatically at specified times and dates. These jobs are defined in crontab files.
Example crontab entry: This runs a backup script every day at 2 AM:
0 2 * * * /usr/local/bin/backup.sh
Q15: How do you find the disk usage of files and directories in Linux?
The du (disk usage) command is used to estimate the space used by files and directories.
du -sh /var/log
-s
(summary) shows only the total size for the specified directory.-h
(human-readable) displays the size in a readable format (e.g., KB, MB, GB).
Conclusion
Mastering these questions will solidify your Linux fundamentals and help you approach interviews with confidence. Stay tuned as we continue this series, exploring more advanced Linux topics, system administration, and scripting.
Keep practicing, stay curious, and happy Linux learning!
Great Work Avishek / Ravi,
But few questions are not sufficient to cover the interview on Linux.
I hope you can create important questions soon for each topic of Linux.
Nice to have tutorials for Linux beginners- I hope that people are able to see how easy Linux really is- especially for everyday web surfing and email.
Really good. Without tecmint it is very difficult to learn linux for beginners.
@Kiran,
Thanks a ton for such kind words about TecMint..
Very nice and very useful. Dil mange more ;)
Nice write up… wish to see more on awk and sed questions
Dear Neel,
awk and sed are something i really appreciate very much. It needs a lot of dedication to produce an article on awk and sed. I will do as soon as possible.
Keep Connected. thanks for your feedback.
Well written keep it up
Welcome @ Ravi
thanks for giving me information
Welcome birendra
Grate dude! very helpful………
THanks @ Ashok Dobal, for your Great Response.
Very much helpful for beginners in Linux
Nice to hear that it was helpful.
Thanks @ Phani
very useful..thanks a lot for sharing.
Welcome @ Ankit Sahil
super@@@@@@@2better to privide more..
Thanks @ bittu, we are considering your request.
I think answer for Q6 isn’t fully correct.
1. ~/.bashrc will run only if user shell is bash, and ~/.bashrc will run after ~/.bash_profile script if it present.
2. Threre are a lot of scripts may run before ~/.profile script. At first /etc/profile, and then every script in /etc/profile.d/ directory.
At fact ~/.bashrc and ~/.profile are the lastest files which called for user profile.
Thanks for that waiting for more question
sure @ koshal, we are coming up with next article on Interview Question on Next Saturday, and every Saturday.
Nice list for learning basic Linux commands.
Thanks.
Thanks @ SAB for your Feedback.
Great article. Thanks Avishek. I have never missed your articles and always archiving it for future reference.
Thanks @ Shahrun Ishak, Your comment is one of the best honour, i received.
Thanks! waiting for new items
Thanks @ saber, for your feedback. we are coming up with next interview article on next saturday. Till then stay tuned and connected.
Coollllllllll…………
Thanks @ durga prasad. :)
There is a mistake (twice) in the question and answer about resolv.conf. The file is wrongly named resolve.conf instead of resolv.conf.
Thanks @ Yannic for pointing that out. libreoffice dictionary ammended it automatically from resolv.conf to resolve.conf.
Anyway, It has been fixed in the article.
gr8..
Thanks @ nilesh khetre, for your highly appreciated feedback.
Thanks for the articles, it’s so great!!
Thanks @ Fernando Souza, for your valueable feedback.
Thanks …Very helpful…
welcome@ Suhail cheroor.
very helpfull
thanks
ashu