1. Alternative to Netstat command
A.ps
B.ls
C.ss
D.netstat
E. df
Answer: (C) SS
Explanation: ss – socket statistics. Netstat command to get statistics on network/socket connections. However the netstat command has long been deprecated and replaced by the ss command from the iproute suite of tools.
2. View last 5 line of the file /etc/sudoers
A. tail –n 5 /etc/sudoers
B. tail /etc/sudoers
C. tail –t 5 /etc/sudoers
D. tail –5 /etc/sudoers
Answer : (A) tail –n 5 /etc/sudoers
Explanation : Tail produce the output of last 10 a file .If you use –n customize the output lines count .
3. In below which command we are using find the hidden files on directory and showing long listing format.
A. ls –l
B. ls –a
C. DIR
D. show hidden
E. ls –al
answer: (E) ls –al
Explanation: ls command is one of the most frequently used command in Linux. Which provides the information about the files, folder, and script on a directory. This is alternate to DIR in windows.
4. Which command we are using to view the Disk usage in RHEL 7
A. df
B. list disk
C. partbrobe
D. autofs
Answer: (A) df
Explanation: df- Disk file system .It used to summary the full usage of Disk in Red-hat Enterprise Linux 7.
5. Which is default file System Red-hat Linux
A. XFS
B. ZFS
C. EXT4
D. EXT2
E. NTFS
Answer: (A) XFS.
Explanation: XFS is a very high performance, scalable file system and is routinely deployed in the most demanding applications. In Red Hat Enterprise Linux 7, XFS is the default file system and is supported on all architectures.
6. Create a new group name instructors with GID 300000
Create three users gorewell,rbradbury,dadams with password Linux
Add new users to supplementary group instructors and primary group should remain same .
Answer :
[Root@serverX ~ ] # groupadd –g 300000 instructors
[Root@serverX ~ ] # useradd –G instructors gorewell
[Root@serverX ~ ] # useradd –G instructors rbradbury
[Root@serverX ~ ] # useradd –G instructors dadams
[Root@serverX ~ ] # passwd gorewell
New Password :
conform password :
passwd: all authentication tokens updated successfully .
Or
[Root@serverX ~ ]# system-config -users
Explanation: In Linux, a ‘useradd‘ command is a low-level utility that is used for adding/creating user accounts in Linux and other Unix-like operating systems. The ‘adduser‘is much similar to useradd command, because it is just a symbolic link to it.
The groupadd command creates a new group account using the values specified on the command line and the default values from the system. The new group will be entered into the system files as needed.
system-config –users : graphical utility to manage users
7. Create a user gorewell with UID 7000
force the newly created user to change the passwd on first login
Answer:
[Root@serverX ~ ] # useradd –u 7000 gorewell
[Root@serverX ~ ] #chage –d 0 gorewell
Explanation:
In Linux, a ‘useradd‘ command is a low-level utility that is used for adding/creating user accounts in Linux and other Unix-like operating systems. The ‘adduser‘is much similar to useradd command, because it is just a symbolic link to it.
The command name ‘chage’ is an acronym for ‘change age’. This command is used to change the user’s password’s aging / expiry information.
8. Create a shared directory /home/developers on ServerX according to following requirements
The Directory is owned by user root and group instructors
Set permissions with SETGID on /home/developers directory ,So that owner and group have full read/write/execute permission and other user have read permissions
Answer:
[Root@serverX ~ ] #mkdir /home/developers
[Root@serverX ~ ] #chown :instructors /home/developers
[Root@serverX ~ ] #chmod 2774 /home/developers
Explanation:
The mkdir command is is used to create new directories.The chown command changes the owner and owning group of files. Thechmod command changes the access mode of one file or multiple files.
9. Determine the process which using most resource on ServerX and terminate it
Answer:
[Root@serverX ~ ] #top
[Root@serverX ~ ] #pkill #####
Expanation :
Top sorts all process by CPU utilization. Find the process number or name from top .And then kill the process by pkill number of process #####.
10. Use bash Commands to complete the following task on the ServerX machine
Display the first 12 lines of the /usr/bin/clean-binary-files file and send the output to the /home/student/headtail.ext
Answer:
[Root@serverX ~ ] #head –n 12 /usr/bin/clean-binary-files > /home/student/headtail.txt
Explanation : The head command reads the first few lines of any text given to it as an input and writes them to standard output (which, by default, is the display screen).