|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 are some basic UNIX commands?
Some basic Unix commands -
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 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
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 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.
|Pipes and Cistern|
Two pipes A and B can fill a tank in 6 hours and 4 hours respectively. If they are opened on alternate hours and if pipe A s opened first, in how many hours, the tank shall be full?
A large tanker can be filled by two pipes A and B in 60 min and 40 min respectively. How many minutes will it take to fill the tanker from empty state if B is used for first half of the time, and A and B fill it together for the other half?
A tank is filled by 3 pipes with uniform flow. The first two pipes operating simultaneously fill the tank in the same time during which the tank is filled by the third pipe alone. The 2nd pipe fills the tank 5 hours faster than first pipe and 4 hours slower than third pipe. The time required by first pipe is?
Two pipes A and B together can fill a cistern in 4 hours. Had they been opened separately, then B would have taken 6 hours more than A to fill the cistern. How much time will be taken by A to fill the cistern separately?
Two pipes A and B can fill a tank in 24 min and 32 min respectively. If both the pipes are opened simultaneously, after how much time B should be closed so that the tank is full in 18 min?
Two pipes A and B can fill a tank in 36 min and 45 min respectively. A water pipe C can empty the tank in 30 min. First A and B are opened. after 7 min, C is also opened. In how much time, the tank is full?
Two pipes can fill a cistern in 14 hours and 16 hours respectively. The pipes are opened simultaneously and it is found that due to leakage in the bottom it took 32 min more to fill the cistern. When the cistern is full, in what time will the leak empty it?
Bucket P has thrice the capacity as Bucket Q. It takes 60 turns for Bucket P to fill the empty drum. How many turns it will take for both the buckets P and Q, having each turn together to fill the empty drum?
In a class , 30 % of the students offered English, 20 % offered Hindi and 10 % offered Both.If a student is offered at random, what is the probability that he has offered English or Hindi?
In a lottery ,there are 10 prizes and 25 blanks.A lottery is drawn at random. what is the probability of getting a prize ?
Two dice are thrown simultaneously .what is the probability of getting two numbers whose product is even?
Two diced are tossed the probability that the total score is a prime number?
Two cards are drawn at random from a pack of 52 cards What is the probability that either both are black or both are queens?
Two dice are thrown together .What is the probability that the sum of the number on the two faces is divisible by 4 or 6?
A bag contains 6 white and 4 black balls .Two balls are drawn at random .Find the probability that they are of the same colour?
In a simultaneous throw of a pair of dice,find the probability of getting a total more than 7?
An unbiased die is tossed.Find the probability of getting a multiple of 3?
|Problems on Ages|
My brother is 3 years elder to me. My father was 28 years of age when my sister was born while my mother was 26 years of age when i was born. If my sister was 4 years of age when my brother was born,then what was the age my father and mother respectively when my brother was born?
बैंकिंग कार्मिक चयन संस्थान Institute of Banking Personnel Selection(IBPS) - 7855 पद - 29/07/2022 अंतिम तिथि
कर्मचारी चयन आयोग (एसएससी) Staff Selection Commission (SSC) - 1411 पद - 29/07/2022 अंतिम तिथि
|Jobs in Rajasthan|
राजस्थान अधीनस्थ और मंत्रिस्तरीय सेवा चयन बोर्ड Rajasthan Subordinate and Ministerial Services Selection Board (RSMSSB) - 5546 पद - 22-Jul-2022 अंतिम तिथि
उत्तर मध्य रेलवे भर्ती प्रकोष्ठ Railway Recruitment Cell(NCR) - 1659 पद - 01/08/2022 अंतिम तिथि
|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 अंतिम तिथि