Posts

Showing posts with the label Shell Scripting MCQ's

100+ LINUX Shell Scripting MCQ's

1. What is the output of the following command for bash shell: echo linux $0 a) linux echo b) linux linux c) linux bash d) linux View Answer Answer:c 2. What would be the current working directory at the end of the following command sequence? $ pwd / home / user1 / proj $ cd src $ cd generic $ cd . $ pwd a) /home/user1/proj b) /home/user1/proj/src c) /home/user1 d) /home/user1/proj/src/generic View Answer Answer:d 3. How do you print the lines between 5 and 10, both inclusive a) cat filename | head | tail -6 b) cat filename | head | tail -5 c) cat filename | tail +5 | head d) cat filename | tail -5 | head -10 View Answer Answer:a 4. Create a new file “new.txt” that is a concatenation of “file1.txt” and “file2.txt” a) cp file.txt file2.txt new.txt b) cat file1.txt file2.txt > new.txt c) mv file[12].txt new.txt d) ls file1.txt file2.txt | new.txt View Answer Answer:b 5. which of these is NOT a valid variable in bash a) __ (double underscore) b) _1var (underscore 1 ...