1 What is the UID of the root account on your CentOS instance? 2 In your system,
ID: 3599418 • Letter: 1
Question
1 What is the UID of the root account on your CentOS instance?
2 In your system, a file exists '/home/student/myfile.txt'. In a linux terminal, you wish to copy this file to the '/home/student/Desktop/' directory, keeping the file name. What is the exact linux command you will use?
3 In a linux terminal, what is the exact linux command that you can use to find out if a package is installed on your system? Assume we are checking for 'mypackage'
4 In a linux terminal, from a root account at the command line, what linux command can you type to shutdown the system (several possible answers)?
5
In a linux terminal, From a user account, enter the exact commands that you would use to do the following:
A. Create an empty file in your current directory named exam.txt
B. Set the file permissions on exam.txt to rwxrw_rw_
Explanation / Answer
1 What is the UID of the root account on your CentOS instance?
Ans)
To find UID of particular user we have to type command like below.
command:- id -u username
For your root account if the root username is root, type the command like below.
> id -u root
2 In your system, a file exists '/home/student/myfile.txt'. In a linux terminal, you wish to copy this file to the '/home/student/Desktop/' directory, keeping the file name. What is the exact linux command you will use?
Ans)
command:- cp /home/student/myfile.txt /home/student/Desktop/
The cp command in Linux will copy the file myfile.txt to a given directory or another file. If we want to copy another file we have to type the below command where anotherfile.txt becomes duplicate of file myfile.txt.
cp /home/student/myfile.txt /home/student/anotherfile.txt
3 In a linux terminal, what is the exact linux command that you can use to find out if a package is installed on your system? Assume we are checking for 'mypackage'
Ans)
command:- rpm -qa | grep mypackage
The command would be rpm where it will display the list of packages installed. On that we can grep for mypackage package to identify the package installed or not. If it is installed it will show the file otherwise no ouptut.
4 In a linux terminal, from a root account at the command line, what linux command can you type to shutdown the system (several possible answers)?
Ans) There are various commands available to shutdown the unix terminal and following are some of them.
command:-
> shutdown -h now
The above command shutdown the system immediately where -h option stands for shutting down the terminal.
> shutdown -h 0
The above command shutdown the system immediately. It actually brings down the system to run-level 0.
> poweroff
poweroff sends an ACPI signal to the system which instructs the terminal to power down the computer.
> halt
halt instructs the H/W to stop all the CPU functions and leaves powered on. We can use this option to get system to a level where users can perform low level maintenance.
> telinit 0
The command above instructs init to the specified run level which is 0. That means to shutdown the system.
5
In a linux terminal, From a user account, enter the exact commands that you would use to do the following:
A. Create an empty file in your current directory named exam.txt
Ans)
command:- touch exam.txt
The above command will create an empty file exam.txt with 0 bytes. The same command can be used to change modification time of the file if the file already exists.
B. Set the file permissions on exam.txt to rwxrw_rw_
Ans)
command:- chmod 766 exam.txt
The above command will set all permissions to owner and read, write permissions to group and others. The r stands for 4 in octal, w stands for 2 in octal and x stands for 1 in octal. So based on that we can identify the numerical octal equivalents of r or w or x and substitute the values accordingly.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.