Krishna Logo
Divied
Call: Harsha @ 571-386-2972

 

Loading
Latest News
Home Navigation Divied
INTERVIEW Navigation Divied UNIX INTERVIEW QUESTIONS
Showing 61 - 70 of 323 Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Next
UNIX INTERVIEW QUESTIONS
 
61How Does The Inode Map To Data Block Of A File
Date Posted: 07/02/2012

Ans: Inode has 13 block addresses. The first 10 are direct block addresses of the first 10 data blocks in the file. The 11th address points to a one-level index block. The 12th address points to a two-level (double in-direction) index block. The 13th address points to a three-level(triple in-direction)index block. This provides a very large maximum file size with efficient access to large files, but also small files are accessed directly in one disk read.

 
 
62How To Get The CPU And Memory Details In Linux Server?
Date Posted: 07/02/2012

Ans: In Linux based systems, you can easily access the CPU and memory details from the /proc/cpuinfo and /proc/meminfo, like this:
$>cat /proc/meminfo
$>cat /proc/cpuinfo
Just try the above commands in your system to see how it works

 
 
63How To Tell If My Process Is Running In Unix?
Date Posted: 07/02/2012

Ans: You can list down all the running processes using [ps] command. Then you can “grep” your user name or process name to see if the process is running. See below:
$>ps -e -o stime,user,pid,args,%mem,%cpu | grep "opera"
14:53 opera 29904 sleep 60                     0.0  0.0
14:54 opera 31536 ps -e -o stime,user,pid,arg  0.0  0.0
14:54 opera 31538 grep opera                   0.0  0.0

 
 

Ans: The standard command to see this is [ps]. But [ps] only shows you the snapshot of the processes at that instance. If you need to monitor the processes for a certain period of time and need to refresh the results in each interval, consider usi...  

 
 
65How To Check If A File Is Present In A Particular Directory In UNIX?
Date Posted: 07/02/2012

Ans: Using command, we can do it in many ways. Based on what we have learnt so far, we can make use of [ls] and [$?] command to do this. See below:
$> ls –l file.txt; echo $?

If the file exists, the [ls] command will be successful. Hence [echo $?] will print 0. If the file does not exist, then [ls] command will fail and hence [echo $?] will print 1.

 
 
66How To Check If The Last Command Was Successful In UNIX?
Date Posted: 07/02/2012

Ans: To check the status of last executed command in UNIX, you can check the value of an inbuilt bash variable [$?]. See the below example:
$> echo $?

 
 
67How To List Down File/folder Lists Alphabetically?
Date Posted: 07/02/2012

Ans: Normally [ls –lt] command lists down file/folder list sorted by modified time. If you want to list then alphabetically, then you should simply specify: [ls –l]

 
 
68How To Fail A Shell Script Programmatically?
Date Posted: 07/02/2012

  Ans: Just put an [exit] command in the shell script with return value other than 0. this is because the exit codes of successful Unix programs is zero. So, suppose if you write
Exit -1
Inside your program, then your program will thrown an error and exit immediately.

 
 
69How To Check The Command Line Arguments In A UNIX Command In Shell Script?
Date Posted: 07/02/2012

  Ans: In a bash shell, you can access the command line arguments using $0, $1, $2, variables, where $0 prints the command name, $1 prints the first input parameter of the command, $2 the second input parameter of the command and so on.

 
 
70How To Execute A Database Stored Procedure From Shell Script?
Date Posted: 07/02/2012

    Ans:
$> SqlReturnMsg=`sqlplus -s username/password@database<<EOF
BEGIN
Proc_Your_Procedure (… your-input-parameters …);
END;
/
EXIT;
EOF`
$> echo $SqlReturnMsg

 
Showing 61 - 70 of 323 Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Next
Shadow Bottom
 
    Courses Offered
  • Courses not available.
 
© 2005 - 2018 Krishna Training.
Designed & Developed By BitraNet