Linux interview question’s for programmers
In many organization Linux / Unix server’s are used in the production environment. The programmer’s who are working on production environment need to know about some basic Linux / Unix commands to work. I am going to share some basic commands that shall be useful for programmers. It may also be useful for you in the interview point of view.
1.What is meant by shell?
The UNIX shell program interprets user commands, that are either directly entered by the user, or that may be read from a file called the shell script or shell program. Shell scripts are interpreted, not compiled. The shell reads commands from the script line per line and searches for those commands on the system
Commonly available shell are
1.sh or Bourne Shell,
2.bash or Bourne Again shell,
3.csh or C shell,
4.tcsh or TENEX C shell,
5.ksh or the Korn shell.
2.What is the shell you are presently using and how do you find it?
The most popularly used shell is BASH (Bourne again shell)
To find what is the shell you are currently using, type the below command
3.what is the use of .bash_profile ?
.bash_profile file will be present commonly in the user’s home directory
4.How to view only first 5 lines of a file ?
#cat /etc/bashrc | head -5
#head -5 /etc/bashrc
5.How to view only last 3 lines of a file ?
#cat /etc/bashrc | tail -3
#tail -3 /etc/bashrc
6.How do you find how many word in a file
60 200 1437 /etc/bashrc
The Output is in the order of number of lines, words and letters.
7.How do you find the RAM memory of Linux box ?
8.How do you find how many processors are there in the system ?
#cat /proc/cpuinfo | grep processor
9.Where do you find the Hardware Information’s of a linux machine ?
10.How do you find what are the ports opened in the Linux system ?
netstat —> Which will print the network statistics
-n —> show numeric address instead of name
-t —> tcp ports
-p —> Shows the process ID and name of the program
-l —> List only listening sockets
11.How do you find what are the process currently running on the system ?
ps command is used to print the current running process
-a —> Prints all process except demon process
-u —> It prints the user name associate with the process
-x —> Demon process or back round process
12. How do you find how many uses logged in the system
13.How do you find whether mysql is running or not ?
14.Tell me two commands to monitor your linux / Unix server
15.what is the command to shutdown and reboot the Linux server
The above command is used to shutdown the machine
The above command is used to reboot the machine