cd to the root directory. Execute the following command: ls -ld /tmp You will no
ID: 3693368 • Letter: C
Question
cd to the root directory. Execute the following command:
ls -ld /tmp
You will notice that the permissions on the /tmp directory contain the sticky bit. (The permissions end with a t)
A. What is the significance of the sticky bit being set on a directory?
(Hint: execute man -s2 chmod for more info on the sticky bit)
The sticky bit prevents a file from being deleted....forever.
A file can only be deleted or modifed by the user if owned by the user or can be deleted or modified by a privileged user.
The sticky bit prevents a file from being copied.
The sticky bit makes the file an executable file.
Explanation / Answer
Ans;
Create a find command string that will locate the file called resolv.conf and once found, grep for the number of lines that the string nameserver appears in within the file.
Begin your find search within the /etc directory.
Answer:
find /etc -name resolv.conf -exec grepnameserver {} > out.txt ; ; wc -l out.txt ; rm out.txt
Complete the find command string by replacing the ## with the required characters.
Answer:
find /etc -name 'resolv.conf' -exec grep resolv.conf 'nameserver' {} ;
While viewing the file called mypasswd you notice that all of the references to the user's shells, the C shell, were entered in upper-case letters. That is not correct.
Create a sed command string that will convert ONLY the references to the user's shell CSH to csh within the file called mypasswd and save the output to a new file called newpasswd in your home directory.
Be Careful. There are other refernces to CSH in the file.
Which comand string will do this?
sed 's/CSH/csh/g' mypasswd>newpasswd
sed 's/CSH$/csh/g' mypasswd>newpasswd
sed 's/CSH$/csh/g' mypasswd> ~/newpasswd
sed 's/csh$/csh/g' mypasswd> ~/newpasswd
Answer: sed 's/CSH$/csh/g' mypasswd>newpasswd
cd to the directory called final that is located within my home directory.
A copy of the group file called mygroup was created using the !as the field separator. The fields should be separated using a : not a !.
Create a single command string that will modify the file called mygroup and change all occurrences of the ! to a :. The command string must also sort the file numerically on the GID field and then save the output to a file callednewgroup.
Replace the ## in the command string below with the correct characters to make the above described work.
sed 's/!/:/g' mygroup | sort –n –t ‘:’–k +2> ~/newgroup
The +2 is presumptuous about GID is in that column. The other command for this is as given below:
sed -e 's/!/:/g' mygroup|sort|sort -n -k 3 -t : >newgroup
cd to the directory called final that is located within my home directory.
Create a command string that will output the name of the largest file in the directory. The largest file would be the file with the greatest file size in bytes. The ONLY output from the command string should be a single file name.
Will the following command provide the answer requested above?
ls -l | sort -k5rn | head -1 | awk '{ print $9 }'
Yes
No
Answer: NO
When you more the file called blink, you get the error message:
blink: Too many levels of symbolic links
A. What is it that is causing this error...specifically?
The link called blink does not exist.
The link called blink is linked to a very large file.
Too many symbolic links.
The link called blink is a link to alink. The link called alink is a link back to blink.
The file called blink should be called beelink.
Answer: Too many symbolic links. The link called blink is a link to alink. The link called alink is a link back to blink.
Execute the following command:ls -ld /tmp
You will notice that the permissions on the /tmp directory contain the sticky bit. (The permissions end with a t)
A. What is the significance of the sticky bit being set on a directory?
The sticky bit prevents a file from being deleted....forever.
A file can only be deleted or modifed by the user if owned by the user or can be deleted or modified by a privileged user.
The sticky bit prevents a file from being copied.
The sticky bit makes the file an executable file.
Answer: A file can only be deleted or modified by the user if owned by the user or can be deleted or modified by a privileged user.
When you cat the file entry called sga, you get the error message:
cat: sga: No such file or directory
What is it that is causing this error?
sga is a link.
sga is a link to file that does not exist.
sga does not exist in my directory called final.
The permissions on sga do not allow you to read the file.
Answer: sga is a link to file that does not exist.
Consider the following alias:
aliasdirc='ls -l | grep '^d' | wc -l'
What EXACTLY will this alias do when it is executed?
The alias will list the sub-directores in the current directory.
The alias will count the files in the current directory.
The alias will output the number of sub-directories in the current directory.
The alias will grep for the file called ^d.
Answer: The alias will grep for the file called ^d.
Create the following alias.
alias gohome='cd $home'
Upon executing the alias called gohome, you will....
Change directory to the directory called home.
Change directory to the directory of a user called home.
Change directory to my home directory.
Change directory to your own home directory.
Answer: Change directory to the directory called home.
sed 's/CSH/csh/g' mypasswd>newpasswd
sed 's/CSH$/csh/g' mypasswd>newpasswd
sed 's/CSH$/csh/g' mypasswd> ~/newpasswd
sed 's/csh$/csh/g' mypasswd> ~/newpasswd
Answer: sed 's/CSH$/csh/g' mypasswd>newpasswd
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.