Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

5 Nov 2024

Most Asked Tcs Unix Mcq Questions

UNIX

 

1. which symbol be used with grep command to match pattern pat at the beginning of the line?->^pat

2. which command is used to sort the lines of a data in a file in reverse order->sort -r

3. which of the command to change the protection mode of files starting emp and ending with 1,2 or 3?->chmod u+x emp[1-3]

4. which command is used to remove the directory->rmdir(rd command is used to remove an empty directory rmdir removes the directory, specified by the directory parameter from the system)

5. find the occurence of the word and print its occurence count->grep -o -i "unix" myfile wc -l

 

grep is used for search -i remove case sensitive , wc for word count -l is for print the word count

6. what will be the output of the below command?->find -type f -perm 0777 -print

->display all files who has the three permission for all levels of user

7. which awk script will give you the average of second column of the file named file1, which has "l" as the delimiter?->awk BEGIN(FS='l',s=0){s=s+$2}END{print s}file 1

8. which command used to search "hello unix" in file ignoring case?->

grep -i "hello unix" file name

9. which of the following command in unix used to remove the duplicate lines->uniq

10. which unix command is used to display the content of the file?->cat

11. which unix command is used to count the number of lines, word and characters in a file?->wc

12. what is the purpose of chmod command?->modify file permissions

13. the pwd command in unix is used for->printing current directory

14. which command will display all hidden files in a directory->ls-a

15. what does the >> operator do in unix?->appends output to a file

16. which unix command displays the manual or help pages of a command?->man

17. which unix command is used to display the process status?->ps

18. what does the kill command do in unix->stops a running process

19. which unix command can be used to display disk usage?->du

20. the alias command in unix is used for->creating a shortcut for a command

21. which of the following commands will display the last 100 lines of a file named "data.txt"?->tail -n 100 data.txt

22. which is primary purpose of the crontab command->schedule tasks to run at specific intervals

23. which command allows you to substitute a string in file?->sed

24. which command is used to find the location of a program in unix->which

25. which command is used to send the output of one command as the input to another command?-> ( | )

26. what does the chown command do?->change the owner of a file or directory

27. the IN command in unix is used to->link files

28. which command is used to repeat the last executed command in unix->!!

28. what does the $? variable signify in unix->exit status of the last command

29. the touch command in unix is primarily used to modify file timestamps 

FOR MORE QUESTION REFER INDIA BIX