Sunday, February 23, 2014

Getting Started - Interview Questions - Part 1



1) How do you login to a unix machine with your username and password?

Ans )  If your username is Michael. Then this is how you should login

login : Michael [Enter]
password :



2) What is a shell?

Ans) A Shell is a command line interpreter. Any command you type in will be translated by the shell to the kernel which inturn gives you the output


3) What is the command to display the "DATE" and "TIME"?
Ans )  $ date [ enter ]
           Sun Feb 23 15:41:12 IST 2014


4) What is the command to clear the screen?
Ans )     tput clear

5) What is the CALENDAR in UNIX?

Ans ) Calendar is used to display the days of the year and the dates. To view the output, you need to give
          $  cal

6)  How do you find the USERS in your system?

sdcapc-a31-p:/etc>who -Hu
NAME     LINE         TIME             IDLE          PID COMMENT
vpadmana pts/0        2014-02-09 00:43   .         24527 (192.168.11.252)

7)  What is the UNIX Command to find your USERNAME?

sdcapc-a31-p:/etc>who am i
vpadmana pts/0        2014-02-09 00:43 (192.168.11.252)


8) Write a UNIX command to find your MACHINE name, its operating system, its version?

sdcapc-a31-p:/etc>uname
Linux

sdcapc-a31-p:/etc>uname -r ----------------------------------> To know the Version of the Operating system
2.6.18-274.7.1.el5

sdcapc-a31-p:/etc>uname -n  ------------------------------> To know your hostname
sdcapc-a31-p

sdcapc-a31-p:/etc>hostname     ---------------------------> Alternate command to find the hostname
wysao-a31-p


9)  Write a UNIX command to find the name of your TERMINAL?

sdcapc-a31-p:/etc>tty
/dev/pts/0


10) What is the command to view the processes running in your machine?

$ ps
 
    PID    TTY                                    TIME                CMD
    345    console                               0:00                    ksh


11) How do you list the files?

sdcapc-a31-p:/home/vpadmana>ls

backupAutosysJILStatus.WYSAO.20140120.txt
backupAutosysJIL.WYSAO.20140120.jil
bounceVls.sh.20140117.log
checkForHungVLS.FIN.20140121.log
checkForHungVLS.FIN.20140205.log
checkForHungVLS.HRM.20140205.log
copyFiles.20140117.log
cycleDriverFINPRD_WOLFS_RUN.20140121.txt
cycleJobReport.FINPRD.DAILY.20140120072856.html
cyclelogs
cycleWait.201401181800.log
cyclogs.tar
jobreports
lockAllFINUsers.RELOCK.20140121190608.txt



12) How do logout from your session in UNIX?

Ans)    $ exit
            login :


13) What is the value associated with any character in UNIX system?

ASCII Value


14)  What is the difference between echo * and ls.   What do you think echo did?

Ans ) Echo * will list all the files only if there is a single file in that directory and if that file happens to be a directory.
     
        ls will list the files in the directory.


15) When you enter a UNIX command on shell prompt, what internal action goes through?

When you enter a command, the shell scans the command for any metacharacters. It simplifies the command to a simplified one and then passes the command to the kernel. The kernel looks for the executable in its PATH variable and if found, it executes the command and the output is displayed on to the SHELL.


16) What are the shells available?

C shell, Bash Shell, KSH - Korn Shell, Sh ( bourne shell ), tcsh