Chapter 3: Linux Basic Commands
Interview Questions
- Q1. What do the permissions 755 and 644 mean?
- 755 = owner rwx, group r-x, others r-x (typical for directories/scripts). 644 = owner rw-, group r--, others r-- (typical for files).
- Q2. What is the difference between
aptandyum? - Both are package managers.
aptis used on Debian/Ubuntu with .deb packages;yumis used on RHEL-family systems like Amazon Linux and CentOS with .rpm packages (on newer releasesyumruns its successor,dnf). - Q3. What is the difference between
suandsudo? suswitches to another user (often root) and needs that user's password.sudoruns a single command with elevated privileges based on rules in/etc/sudoers, and logs it.- Q4. How do you find which process is using the most memory?
- Use
topand pressM, orps aux --sort=-%mem | head. - Q5. What is the difference between
killandkill -9? killsends SIGTERM (15), allowing the process to clean up.kill -9sends SIGKILL, which ends it immediately without cleanup — use it only as a last resort.- Q6. Where are user accounts and passwords stored?
- Accounts in
/etc/passwd, hashed passwords in/etc/shadow, groups in/etc/group.