Linux
Linux
1, which command is used to list all files and directories in the current directory?
a) ls
b) cd
c) mkdir
d) cat
2, which command is used to display the contents of a file?
a) echo
b) touch
c) cat
d) grep
3, what command is used to create a new directory?
a) mkdir
b) rm
c) mv
d) cp
4, how do you move a file from one location to another?
a) cp
b) mv
c) ln
d) rm
5, which command is used to search for a specific file or directory?
a) find
b) grep
c) ls
d) cat
6, which command is used to create a new user account?
a) adduser
b) passwd
c) useradd
d) usermod
7, how do you change a user's password?
a) passwd
b) useradd
c) usermod
d) chpasswd
8, what command is used to display information about the currently logged-in user?
a) whoami
b) id
c) finger
d) w
9, how do you add a user to a specific group?
a) addgroup
b) groupadd
c) usermod
d) groupmod
10, what command is used to switch to a different user account?
a) login
b) su
c) sudo
d) chown
11, What do the permissions "rwx" represent for a file or directory?
a) Read, Write, and Execute
b) Read, Write, and Search
c) Read, Write, and List
d) Read, Write, and Modify
12, How do you change the permissions of a file or directory?
a) chmod
b) chown
c) chmod
d) chgrp
13, What command is used to display the permissions of a file or directory?
a) ls -l
b) chmod
c) chown
d) find
14, How do you grant read, write, and execute permissions to the owner, group, and others?
a) chmod 777
b) chmod 755
c) chmod 644
d) chmod 600
15, What do the permissions "drwxr-xr-x" mean for a directory?
a) The directory is owned by the root user, and everyone has read and execute permissions.
b) The directory is owned by the current user, and the group and others have read and execute
permissions.
c) The directory is owned by the current user, and the group and others have only read
permissions.
d) The directory is owned by the current user, and the group and others have read, write, and
execute permissions.
16, How do you change the ownership of a file or directory?
a) chmod
b) chown
c) chgrp
d) Both b and c
17, What command is used to grant everyone read and execute permissions on a file?
a) chmod 755
b) chmod 644
c) chmod 777
d) chmod 700
18, How do you set the same permissions for a new file or directory as the parent directory?
a) chmod -R
b) chmod +X
c) umask
d) Both a and c
19, What command is used to change the group ownership of a file or directory?
a) chown
b) chgrp
c) chmod
d) Both a and b
20, How do you grant read and write permissions to the owner and read permissions to the group and
others?
a) chmod 644
b) chmod 755
c) chmod 664
d) chmod 600
21, What command is used to display the current working directory?
a) pwd
b) cd
c) ls
d) echo
22, How do you display the process ID of a running process?
a) ps
b) kill
c) top
d) htop
23, What command is used to terminate a process?
a) stop
b) kill
c) exit
d) shutdown
24, How do you display the last few lines of a file?
a) head
b) tail
c) more
d) less
25, Which command is used to display a list of all user accounts on the system?
a) users
b) id
c) who
d) /etc/passwd
26, What command is used to remove a user account?
a) deluser
b) userdel
c) usermod -d
d) rmuser
27, How do you display information about the groups a user belongs to?
a) groups
b) id
c) /etc/group
d) Both a and b
28, What command is used to create a new group?
a) groupadd
b) groupmod
c) groupdel
d) usermod -G
29, How do you assign a user as the owner of a file or directory?
a) chmod
b) chown
c) chgrp
d) Both b and c
30, Which command is used to create a symbolic link (shortcut) to a file or directory?
a) ln
b) cp
c) mv
d) rm
31,which syntax is correct to display all element that found in array?
A,${var[0]}
B, ${var[@]}
C, ${!var[@]}
D, ${#var[@]}
32 which syntax is used to accept hidden text like “password”?
A, read –p
B, read –sp
C, read -a
D, none
33 what is the syntax sleep that waiting our script?
A, sleep<number>@
B, sleep<number>$
C, sleep<number>S
D , sleep <number>#
34, What is the correct example that fulfill the syntax of argument that help you to get input before script started?
A , echo “Enter your name: $1”
B, echo “Enter your Age: $09”
C, echo “Enter your father name: $2”
D, only choice “B” is incorrect
35, which one of f/f is correct the syntax of “shebang’s” that used to start every bash script?
A, #!bin/sh
B, !# bin/bash
C, #!bin/bash
D , A and C are correct answer
36, which one of the following is not metacharacters?
A, $ B,* C, % D,^
37 which one of the following is not true?
A, Plus(+) used to get line that have pattern that occurs 0 and more times
B, Question(?)used to get line that have pattern that occurs 0 and 1 times
C, Plus(+) used to get line that have pattern that occurs 1 and more times
D Asterisks(*) used to get line that have pattern that occurs 0 and more times
38, which one of the following is false?
A, /S used to get All text except whitespace
B /d used to get Digit/numbers
C, /W used to get All text except Alphanumeric
D, /D used to get Digit/numbers
39, which one the following that the syntax is false?
A, for num in {1..0..-1} do echo “$num” done
B for num in {1..0..-1}
C, for((i=0; i<5; i++))
D, while: do echo”linux is funny” done
40, How can we terminate infinite loop?
A, Ctrl+F
B, Ctrl+K
C, Ctrl+X
D, Ctrl+C