Linux
Questions and concise answers by subject
By profession
By subject
Permissions and servicesQuestions: 2
What does chmod 640 mean?
Owner reads/writes (6), group reads (4), others have no access (0). On a directory, x permits traversal.
How do systemctl start and enable differ?
start runs the service now; enable configures boot-time startup. enable --now does both.
Working in the terminalQuestions: 1
How do > and >> differ?
> replaces file contents; >> appends. Check the path first: replacement can destroy existing data.
Additional questionsQuestions: 10
How do chmod and chown differ?
chmod changes read, write and execute permissions. chown changes the owner and, if specified, the file group.
What the interviewer wants to hear: Distinguish permissions from ownership.
How do you find processes listening on ports?
Use sudo ss -tulpn for TCP/UDP, local addresses, ports and processes. netstat -tulpn is a legacy option if installed. Other users’ process details may require administrator privileges.
What the interviewer wants to hear: Map ports to processes; local listening does not prove remote reachability.
What does systemctl do, and how does it differ from init scripts?
systemctl manages systemd services: start, stop, status and boot-time activation. Systemd uses unit files, dependencies and process supervision; legacy SysV init usually ran shell scripts from /etc/init.d.
What the interviewer wants to hear: Distinguish the systemctl tool from systemd.
How do you find files modified in the last 24 hours?
In the relevant directory use find /var/log -type f -mmin -1440, or find /var/log -type f -mtime -1 for day-based matching. This is content modification time, not creation time; searching / can be slow and produce permission errors.
What the interviewer wants to hear: Choose the search scope and understand mtime.
What is the sticky bit and where is it used?
In a shared directory it restricts deletion and renaming to the file owner, directory owner or a privileged process. Example: /tmp, usually mode 1777. It does not prevent content changes when file write permissions allow them.
What the interviewer wants to hear: Directory and file permissions are different.
How do you check disk usage and find large files?
df -h shows filesystem space; du -h --max-depth=1 /var shows directory sizes. find /var -type f -size +100M finds large files. Do not delete unfamiliar files without checking their purpose and retention policy.
What the interviewer wants to hear: Distinguish filesystem free space from file sizes.
How does kill differ from kill -9?
kill PID normally sends SIGTERM (15), allowing the process to handle it and exit cleanly. kill -9 PID sends uncatchable SIGKILL without cleanup. Try normal shutdown or SIGTERM first; SIGKILL is a last resort.
What the interviewer wants to hear: Do not start with forced termination.
How do you schedule a script with cron?
Use crontab -e; for example 0 2 * * * /usr/bin/bash /opt/scripts/check.sh >> /var/log/check.log 2>&1 runs daily at 02:00. Check log write permissions and absolute paths: cron has a limited environment. Use @reboot for startup rather than a normal schedule.
What the interviewer wants to hear: Understand scheduling, environment and logging.
What is an inode?
A filesystem structure containing file metadata: ownership, permissions, timestamps and data information. The name belongs to a directory entry, not the inode. ls -i shows the number; df -i shows availability. Inodes can run out before disk space.
What the interviewer wants to hear: Explain why a disk with free space may still reject new files.
How do you check a port from another machine?
For TCP use nc -vz server.example 443; on Windows use Test-NetConnection server.example -Port 443. Test authorized hosts only. A successful connection proves TCP reachability, not application health; a timeout may mean filtering or routing trouble. UDP needs a separate test.
What the interviewer wants to hear: Distinguish the port, network and application.
