Linuxcommands
Linuxcommands
In this article, we’ll go through a list of commonly asked Linux interview questions with
emojis to make it fun and engaging, followed by detailed answers.
Table of Contents
Answer:
The Linux Kernel is the core component of the Linux operating system. It acts as a bridge
between the hardware and applications, managing hardware resources, and allowing
processes to communicate with the system’s hardware. It manages memory,
processes, and hardware like the CPU, disk drives, and networking devices.
Answer:
Answer:
Use the chmod command to change file permissions. Permissions are represented as
read (r), write (w), and execute (x).
For example:
This gives the owner full permissions (rwx), and the group and others read and execute
permissions (r-x).
4. What is the use of the ls command?
Answer:
The ls command is used to list files and directories in the current working directory. It
supports various options like -l for detailed listing and -a to show hidden files.
Answer:
For example:
df -h
Answer:
The top command provides a real-time view of running processes, system resource
usage (CPU, memory), and allows you to manage processes.
Answer:
For example:
mkdir new_directory
Answer:
A symbolic link is a type of file that points to another file or directory. It acts as a
shortcut. Use the ln -s command to create a symbolic link.
For example:
ln -s target_file link_name
Answer:
You can use commands like cat, more, less, tail, or head to view the contents of a file.
cat filename
Answer:
You can schedule tasks by editing the cron table using crontab -e. Each cron job follows
the format:
* * * * * command
The five asterisks represent minute, hour, day of month, month, and day of week.
11. Explain the usage of df and du commands.
Answer:
For example:
Answer:
For example:
Answer:
Use the kill command followed by the process ID (PID) to terminate a process.
For example:
kill 1234
Answer:
• A hard link points directly to the inode of a file, meaning it acts as another
copy of the original file.
Answer:
For example:
cp source_file destination_file
Answer:
For example:
Answer:
A shell script is a file containing a series of commands for the shell to execute. It is used
to automate tasks. Shell scripts typically have a .sh extension.
To run a script:
bash script.sh
Answer:
For example:
Answer:
In most modern Linux distributions, firewalld is used for managing firewall settings. You
can control it using the firewall-cmd command.
For example:
firewall-cmd --add-port=80/tcp # to open port 80
Answer:
You can use the ip a or ifconfig command to check the IP address of your machine.
For example:
This set of questions will help you prepare for Linux interviews with a strong
understanding of both basic and advanced topics!