|Hypertext Markup LanguageCascading Style SheetsExtensible Markup LanguageJava ScriptjQueryAngularJSOracle SQLOracle PL/SQLOracle D2K FormsOracle D2K ReportsOracle DatabaseJavaJava Database ConnectivityJava ServletJava Server PagesHibernateApache TomcatCC++PHPMy-SqlUnix/LinuxMS-DOSHR Interviews|
What is Shell Script in unix
A shell script is a list of commands in a computer program that is run by the Unix shell which is a command line interpreter.
$cat testHello.sh #!/bin/sh echo "-------------" echo Hello World
$./testHello.sh ------------- Hello World
Thanks for your comment.!
Write a comment(Click here) ...
What is Unix operating system?
UNIX is a powerful multitasking, multiuser computer Operating System initially developed by Ken Thompson, Dennis Ritchie at AT&T Bell laboratories in 1970.
What is a shell in Unix?
The shell is the Unix command line interpreter. It provides an interface between the user and the kernel and executes programs called commands.
What are the different types of shells available in unix?
There are following different Shells in unix operating system:
Bsh- Bourne shell, It is developed by Stephen Bourne.
What are different ways to create a file in Unix?
There are multiple ways to create a file in Unix-
echo and printf command
Using Vi,emacs text editors
How to delete a file in Unix?
rm command is used to delete file
To delete a file
To delete a file with confirmation
To deletes a file forcefully
Which command is used to delete all files in the current directory and all its sub-directories?
rm command to delete the specified files and directories.
To delete all files and subdirectories in the current directory
To delete the files with name
What is a pipe and give an example?
Unix commands alone are powerful, but when you combine them together. The symbol | is the Unix pipe symbol that is used in command line to combine them together.
The output of the command to the left of the pipe gets sent as input of the command to the right of the pipe.
$cat apple.txt | wc
ls - | grep "page" | wc -l
What is the difference between cat and more command?
"Cat" displays file contents. If the file is large the contents scroll off the screen before we view it. "More" command is like a pager which displays the contents page by page.
How to create and remove directory in Unix?
You make a new directory via mkdir newdirectoryname ,and can remove a directory using rmdir directoryname. To remove a directory, you must first remove all the files it contains.
What is nohup command in unix?
Nohup stands for no hang up. It is a Unix command that is used to run another command. It tells Unix not to stop passed command once it has started, that will keep running until done.
When you execute a Unix job in the background( &, bg command), and logout from the session, then that process will get killed. It can avoid this by executing the job with nohup. Nohup prevents the command from being aborted automatically when you log out or exit the shell.
# nohup sample.sh &
By default, standard output will be redirected to nohup.out file in the current directory. You can also redirect the output to an other file using the normal shell redirection.
# nohup sh sample.sh > sample-out.log &
Once a job is started or executed using the nohup command, stdin will not be available to the user.
What is inode?
An inode is a unique entry which by default gets created on a disk section for a file system. It contains the following information:
Location on the disk
ls and stat command used to display the inode numbers of the files-
What is relative path and absolute path?
Absolute path : Exact path from root directory.
What are some basic UNIX commands?
Some basic Unix commands -
What is du command do?
du command is short for disk usage, with the help of this command you can find the disk capacity and free space of the disk.
$du -h /home/demo/dict
What is the use of the command 'ls -x chapter[1-5]'?
ls stands for list; so it displays the list of the files that starts with 'chapter' with suffix '1' to '5', chapter1, chapter2, and so on.
What will the following command do?
It is similar to 'ls' command and displays all the files in the current directory.
What is the use of "grep" command?
grep (Global Regular Expression Print) is a pattern search command.
$grep -i "Search" Filename --to use the option -i for case insensitive search
How do display the 10th, 11th and 12th line of a file in Unix?
Combining the two commands head and tail can give you the result -
$ head -12 <filename> | tail -3
$ head -12 test.txt | tail -3
How will you find the 99th line of a file?
Combining the two commands head and tail can give you the result -
$ tail +99 test.txt|head -1
How to count number char, line in a file?
by using wc-stands for word count.
Which command is used to apply permission to a file?
“chmod” command which stands for “change mode” is used to add, remove, or modify file or directory permissions.
$ls -l *
- rw- r-- r--
How to find the latest file?
To get the latest file or directory in the current working directory
$ls -lrt |tail -1
-t switch sorts the listing by 'time' so the output is displayed from newest to oldest, -r switch reverses so the newest file is at the end of the listing, And -l gives you the long listing.
First we increased the denominator of a positive fraction by 3 and then decrease it by 5.The sum of the resulting fractions proves to be equal to 2/3. Find the denominator of the fraction if its numerator is 2?
If we divide a two digit number by the sum of its digits we get 4 as a quotient and 3 as a remainder. Now if we divide that two digit number by the product of its digits we get 3 as a quotient and 5 as a remainder . Find the two digit number?
The denominators of an irreducible fraction is greater than the numerator by 2.If we reduce the numerator of the reciprocal fraction by 3 and subtract the given fraction from the resulting one,we get 1/15.Find the given fraction?
If we add the square of the digit in the tens place of the positive two digit number to the product of the digits of that number we get 52,and if we add the square of the digit in the unit's place to the same product of the digits we get 117.Find the two digit number?
The sum of squares of the digits constituting a positive two digit number is 13, If we subtract 9 from that number we shall get a number written by the same digits in the reverse order. Find the number?
The arithmetic mean of two numbers is smaller by 24 than the larger of the two numbers and the GM of the same numbers exceeds by 12 the smaller of the numbers. Find the numbers?
A number being successively divided by 3,5,8 leaves remainder 1,4,7 respectively. Find the respective remainders if the order of divisors are reversed?
The sum of all possible two digit numbers formed from three different one digit natural numbers when divided by the sum of the original three numbers is equal to?
|HCF and LCM|
Find the HCF and LCM of the polynomial x2-5x+6 and x2-7x+10?
When we multiply a certain two digit number by the sum of its digits , 405 is achieved. If we multiply the number written in reverse order of the same digits by the sum of the digits, we get 486. Find the number?
The sum of two numbers is 15 and their geometric mean is 20% lower than their arithmetic mean. Find the numbers?
The difference of 1025-7 and 1024+x is divisible by 3. find x=?
A number when divided by the sum of 555 and 445 gives two times their difference as quotient and 30 as remainder . The number is?
The sum of three prime numbers is 100.If one of them exceeds another by 36 then one of the numbers is?
Find the number of zeros in the factorial of the number 18?
If a number is multiplied by 22 and the same number is added to it then we get a number that is half the square of that number. Find the number?
In doing a division of a question with zero remainder,a candidate took 12 as divisor instead of 21.The quotient obtained by him was 35. The correct quotient is?
A number when divided by 342 gives a remainder 47.When the same number is divided by 19 what would be the remainder?
|Jobs in West Bengal|
इंडियन पोस्ट सर्विस Indian Post Service - 2357 पद - 19/08/2021 अंतिम तिथि - पश्चिम बंगाल पोस्टल सर्कल
भारतीय स्टेट बैंक State Bank of India(SBI) - 6100 पद - 26/07/2021 अंतिम तिथि - CRPD/APPR/2021-22/10
कर्मचारी चयन आयोग Staff Selection Commission(SSC) - 25271 पद - 31/08/2021 अंतिम तिथि
|Jobs in Madhya Pradesh|
राष्ट्रीय स्वास्थ्य मिशन मध्य प्रदेश National Health Mission MP(NRHM) - 5215 पद - 22/06/2021 अंतिम तिथि
|Jobs in Punjab|
पंजाब स्टेट पावर कॉर्पोरेशन लिमिटेड Punjab State Power Corporation Limited (PSPCL) - 2632 पद - 20/06/2021 अंतिम तिथि
|Jobs in Chhattisgarh|
स्वास्थ्य सेवा निदेशालय, छत्तीसगढ़ Department of Health & Family Welfare, Chhattisgarh - 267 पद - 26/06/2021 अंतिम तिथि
दिल्ली सबऑर्डिनेट सर्विस सिलेक्शन बोर्ड Delhi Subordinate Services Selection Board(DSSSB) - 5807 पद - 03/07/2021 अंतिम तिथि
|Jobs in Madhya Pradesh|
राष्ट्रीय स्वास्थ्य मिशन मध्य प्रदेश National Health Mission MP(NRHM) - 2850 पद - 31/05/2021 अंतिम तिथि
इंडियन पोस्ट सर्विस Indian Post Service - 4368 पद - 29/05/2021 अंतिम तिथि
दिल्ली सबऑर्डिनेट सर्विस सिलेक्शन बोर्ड Delhi Subordinate Services Selection Board(DSSSB) - 7236 पद - 24/06/2021 अंतिम तिथि