Linux / UNIX Interview questions and answersTo display a list of all manual pages containing the keyword "date", what command would you type?
man -k date man -f date
* What command will display the first several lines of a file called "junk"?
head junk man head
* Rig it so everything in the folder gets deleted tonight at 10pm. Every night at 10pm.
Set cronjob, see How do I add jobs to cron under Linux or UNIX oses?
== Local security ==
* How do you feel about `sudo`?
sudo allows a permitted user to execute a command as the superuser or another user. sudo is much better than su and you don't have to share root password with other users/admin.
Linux sudo Configuration
* What's the difference between `telnet` and `ssh`? What's a good use for each?
TELNET, by default, does not encrypt any data sent over the connection (including password, and so it is often practical to eavesdrop on the communications and use the password later for malicious purposes;
SSH by default encrypt password and traffic. SSH is recommended for all use.
* How do you ensure your users have hard-to-guess passwords?
Set password policy, see
Howto: Protect account against a password cracking attack
Linux check passwords against a dictionary attack
Linux Password Cracking: Explain unshadow and john commands ( john the ripper tool )
== Filesystem ==
* What is the difference between a symbolic and hard link? When would you use each?
How to: Linux / UNIX create soft link with ln command
Understanding UNIX / Linux symbolic (soft) and hard links
* I have a file named `-fr`. How do I get rid of it?
rm -- -fr rm \-rf
* Why did I just ask that question?
For testing UNIX concepts and command line args.
* To partition or not? How?
Sure. See The importance of Linux partitions
* What are RAID 0, 1, 5, 0+1? What level would you use for a web server and why? A database server?
See level @ What are the different RAID levels for Linux / UNIX and Windows Server?
More about RAID - Can RAID Act As The Reliable BACKUP Solution For Linux / UNIX / Windows Server?
Linux Check The Health of Adaptec RAID array
== `/etc` ==
* `ls -l /etc`. What is all this stuff?
See, Linux / UNIX - Display the permissions of a file
* You added a line to `/etc/aliases`, but it doesn't seem to be working. Why?
Restart sendmail so that file get updated. The program "newaliases" must be run after this file is updated for any changes to show through to sendmail / postfix.
Deny login access to zope and set shell to /sbin/nologin. There are other ways too...
* Bring up `/etc/passwd`. What is all this junk?
See, Understanding /etc/passwd file format
* What are shadow passwords?
/etc/shadow file stores actual password in encrypted format for user's account with additional properties related to user password
Understanding /etc/ shadow file
== Processes ==
* How many processes are running on your machine right now?
top atop ps -e ps aux ps aux | wc -l man ps
* Name as many shells as you can.
Bourne shell (sh)
Almquist shell (ash)
Debian Almquist shell (dash)
Bourne-Again shell (bash)
Friendly interactive shell (fish)
Korn shell (ksh)
C shell (csh)
TENEX C shell (tcsh)
Es shell (e
esh (Unix) Easy Shell
rc shell (rc) - shell for Plan 9 and Unix
runscript The initial shell interpreter used to process startup scripts in Gentoo
scsh (Scheme Shell)
Stand-alone Shell (sash)
Z shell (zsh)
* What's your favorite shell? Why?
bash - it rocks and feature rich.
* Write a shell script to append "snork" to the file "test" but only if "test" already exists.
[ -f test ] && echo "snork" >> test ||:
User will not able to login. A root user can this problem by resting permission
cmod perm /home/user
. is current directory
.. parent directory
== Startup ==
* Describe the boot process of your favorite Linux in as much detail as you can.
See redhat or any other distro doc
* What are runlevels?
The term runlevel refers to a mode of operation in one of the computer operating systems that implement Unix System V-style initialization. Conventionally, seven runlevels exist, numbered from zero to six, though up to ten, from zero to nine, may be used.
man init man runlevel
* Describe an experience you had with a difficult user.
* How do you keep up with current tools and practices?
* How did you document your work at your last job so someone else could pick up where you left off?
Use our social skillz
== Totally miscellaneous ==
* When debugging a core in gdb, what does the command `bt` give: core memory, heap usage, or calling stack?
man gdb Read gdb page
Ask user to upgrade internet connection. If using windows ask to reboot windows .. LOL just kidding, google for slow apache problem. There could be zillions of causes
== Apache ==
* How do you rig Apache to start up on boot?
chkconfig httpd on
chkconfig httpd on httpd -t service httpd on netstat -tulpn | grep 80 tail -f /var/log/httpd/access_log tail -f /var/log/httpd/error_log