Unix Commands Interview Questions – Subscribe to FREE & Exclusive career resources at www.jobsassist.


UNIX Commands Interview Questions
Check for your FREE Bonuses at the end of this eBook

© JobsAssist.com (http://www.jobsassist.com/) and VyomWorld.com (http://www.vyomworld.com/) – Free Student Resources

Contents of file1 and file2 should be displayed on the screen and this output should be appended in a file . Which of the following commands is not a filter man .jobsassist. From output of ls the lines containing ‘poem’ should be displayed on the screen along with the count. This combined list should be sorted and the sorted list should be stored in a file ‘newcity’.com (http://www. (c) pg . The trick is to use the special symbol “-“ (a hyphen) for those commands that recognize the hyphen as std input. 2. who > logfile $ (date . 4.vyomworld. 6. Output of who should be displayed on the screen with value of total number of users who have logged in displayed at the bottom of the list. the contents of this file is sorted together with the output of who (rep by the hyphen) and the sorted output is redirected to the file newfile. What does the command “$ls | wc –l > file1” do? ls becomes the input to wc which counts the number of lines it receives as input and instead of displaying this count . Name of cities should be accepted from the keyboard .Unix Commands Interview Questions – Subscribe to FREE & Exclusive career resources at www. © JobsAssist. Explain the following commands. $ ls > file1 $ banner hi-fi > message $ cat par. All files present in a directory dir1 should be deleted any error while deleting should be stored in a file ‘errorlog’.com/) – Free Student Resources .com/) and VyomWorld. This list should be combined with the list present in a file.3 par. What is the significance of the “tee” command? It reads the standard input and sends it to the standard output while redirecting a copy of what it has read to the file specified by the user.5 >> report $ cat file1>file1 $ date . What does the command “ $who | sort –logfile > newfile” do? The input from a pipe can be combined with the input from a file . (d) head Ans: man A filter is a program which can receive a flow of data from std input. 5. 3.jobsassist. 1. meanwhile sort opens the file logfile. 4. who) > logfile 3. who $ date .com/CareerMag/ 1.com (http://www. (b) cat . the value is stored in file1. 2. Output of ls should be displayed on the screen and from this output the lines containing the word ‘poem’ should be counted and the count should be stored in a file.4 par. process (or filter) it and send the result to the std output. Construct pipes to execute the following jobs. 5. In the above command the output from who becomes the std input to sort .

Explain the steps that a shell follows while processing a command. the shel goes ahead with processing the command line in one or more passes. Which command is used to delete all files in the current directory and all its sub-directories? rm -r * © JobsAssist.com/) and VyomWorld. Syntax : grep Example : grep 99mx mcafile 12. PATH evaluation: It finally looks for the PATH variable to determine the sequence of directories it has to search in order to hunt for the command. Any word containing a wild-card is replaced by a sorted list of filenames that match the pattern.com/) – Free Student Resources . It searches for the pattern. If the file is large the contents scroll off the screen before we view it. So command 'more' is like a pager which displays the contents page by page. Wild-card interpretation: The shell finally scans the command line for wild-cards (the characters *. What is the difference between cat and more command? Cat displays file contents. using spaces and the delimiters. ]).jobsassist.Compares two files byte by byte and displays the first mismatch diff . ?. All consecutive occurrences of a space or tab are replaced here with a single space.com (http://www.com/CareerMag/ 7. [. Command substitution: Any command surrounded by backquotes is executed by the shell which then replaces the standard output of the command into the command line. What difference between cmp and diff commands? cmp .jobsassist. Parsing: The shell first breaks up the command line into words. 10. The list of these filenames then forms the arguments to the command. Write a command to kill the last background job? Kill $! 14. unless quoted or escaped.Unix Commands Interview Questions – Subscribe to FREE & Exclusive career resources at www.com (http://www.vyomworld. After the command line is terminated by the key. What is the use of ‘grep’ command? ‘grep’ is a pattern search command. The sequence is well defined and assumes the following order. unless quoted.tells the changes to be made to make the files identical 11. in a file(s). 9. Variable evaluation: All words preceded by a $ are avaluated as variables. specified in the command line with appropriate option. How is the command “$cat file2 “ different from “$cat >file2 and >> redirection operators ? is the output redirection operator when used it overwrites while >> operator appends into the file. 13.

wc-stands for word count. Is it possible to create new a file system in UNIX? Yes.com/CareerMag/ 15. Is it possible to restrict incoming message? Yes.com (http://www. 17. ‘mkfs’ is used to create a new file system. How many prompts are available in a UNIX system? Two prompts.character. 22. 16. wc -c for counting number of characters in a file. so it displays the list of the files that starts with 'chapter' with suffix '1' to '5'.jobsassist. 18. each file has a separate inode and a unique inode number. 20. using the ‘mesg’ command. 21. b . 24.com/) and VyomWorld. chapter2. PS2 (Secondary Prompt). Is ‘du’ a command? If so. Write a command to display a file’s contents in various formats? $od -cbd file_name c . What is the use of the command "ls -x chapter[1-5]" ls stands for list.vyomworld. if so. Is it possible to count number char. chapter1. od=Octal Dump.jobsassist. and so on.Unix Commands Interview Questions – Subscribe to FREE & Exclusive career resources at www. d-decimal.com/) – Free Student Resources . wc -l for counting lines in a file. With the help of this command you can find the disk capacity and free space of the disk.com (http://www. what is its use? Yes. Name the data structure used to maintain file identification? ‘inode’.binary (octal). What will the following command do? $ echo * It is similar to 'ls' command and displays all the files in the current directory. How? Yes. 23. How does the kernel differentiate device files and ordinary files? © JobsAssist. it stands for ‘disk usage’. line in a file. PS1 (Primary Prompt). 19.

with some other value of ‘errno’ you are in trouble! The most-used technique is to assume that success or failure with ‘EPERM’ implies that the process exists. your process is not allowed to send signals to *anybody*). then it is called pipeline. That tells the shell to arrange for the output of the preceding command to be passed as input to the following command.) ‘kill()’ returns -1. ‘kill()’ returns -1. or security enhancements are causing the system to deny its existence.com/) – Free Student Resources . How to terminate a process which is running and the specialty on command kill 0? With the help of kill command we can terminate the process. This implies that a process exists with the given PID. ‘errno == EPERM’ the system would not allow you to kill the specified process. the process could be a zombie. MAIL and TERM 27.com/) and VyomWorld. it could be a zombie) or draconian security enhancements are present (e.g. (On some systems. and the system would allow you to send signals to it. Explain kill() and its possible return values. What are shell variables? Shell variables are special variables. Syntax: kill pid Kill 0 . What is a pipe and give an example? A pipe is two or more commands separated by pipe char '|'. 26. What is redirection? Directing the flow of data to the file or from the file for input or output. This means that either the process exists (again. When a sequence of commands are combined using pipe. Example : ls -l | pr The output for a command ls is the standard input of pr.jobsassist.com/CareerMag/ Kernel checks 'type' field in the file's inode structure.Unix Commands Interview Questions – Subscribe to FREE & Exclusive career resources at www. 30.kills all processes in your system except the login shell. How to switch to a super user status to gain privileges? Use ‘su’ command. if you are writing specifically for a system (or all those systems) that provide a ‘/proc’ filesystem: checking for the existence of ‘/proc/PID’ may work. ‘errno == ESRCH’ either no process exists with the given PID. Example: PATH.jobsassist.com (http://www. Example : ls > wc 28. a name-value pair created and maintained by the shell. and any other error implies that it doesn't. ‘kill()’ returns -1. It is system-dependent whether the process could be a zombie. HOME. © JobsAssist.vyomworld. 29. 25. An alternative exists. The system asks for password and when valid entry is made the user gains super user (admin) privileges.com (http://www. There are four possible results from this call: ‘kill()’ returns 0.

What is relative path and absolute path.jobsassist.com/) – Free Student Resources . © JobsAssist. Absolute path : Exact path from root directory.com (http://www.jobsassist.com/CareerMag/ 31.com/) and VyomWorld.Unix Commands Interview Questions – Subscribe to FREE & Exclusive career resources at www.vyomworld.com (http://www. Relative path : Relative to the current path.

Download URL : http://www.Unix Commands Interview Questions – Subscribe to FREE & Exclusive career resources at www.vyomworld.jobsassist.com/) and VyomWorld. so make sure you download the eBook before the password gets expired.com/digital/ Username : interview Password : vyom FREE Bonus #3 – Computer Networks Interview Questions with Answers Download URL : http://www.com/digital/ Username : techebook Password : t@ch@b00k This is a limited time access to download the eBook.com (http://www.com/digital/ Username : network Password : questions © JobsAssist.com/) – Free Student Resources . Hope you enjoy reading this eBook and it helps you in getting a much better job! FREE Bonus #2 – 50 HR Interview Questions with Answers Download URL : http://www.bestebooksworld.com/CareerMag/ FREE Bonus #1 – 500+ Technical Interview Questions with Answers There are 175 Pages in this eBook which contains the questions on the following streams with answers Data Structures C C++/OOPS Quantitative Aptitude UNIX RDBMS SQL Computer Networks Operating Systems.com (http://www.bestebooksworld.jobsassist.bestebooksworld.

Sign up to vote on this title
UsefulNot useful