Linux / Unix: please help as much as you can. Thanks. (1) What do the following
ID: 3854365 • Letter: L
Question
Linux / Unix: please help as much as you can. Thanks.
(1) What do the following commands do? Explain in detail.
a. cat <Enter> # ie when you type carriage return after typing cat
b. chmod -R 700 $HOME
(2) Identify command options and arguments in the following
$ ls -a -r /tmp /usr .
$ fold -80 /etc/passwd > /tmp/passwd
$ uname -S amazon
$ cat -A /tmp
(3) List name(s) of commands available in Unix system for the following
a. to create a directory structure project.d/project.d/project.d from your home directory without using
multiple commands.
b. to list the first 20 lines in a file
(4) Explain what we do in the following set of commands.
$ pwd
/home/john
$ echo $HOME
/home/john
$ ln -s $HOME /tmp/$HOME.$$ <--- Explain this
$ cd /usr/src/cmd/usr/src/cmd
$ pwd
/usr/src/cmd/usr/src/cmd
$ cd ../../cmd/bin/usr/src <--- Explain this
(5) Using chmod write cmds for the following.
a. change the file perms to read and write by user and no other perms for others.
b. Add perms to a file to be readable by other and group.
Explanation / Answer
1)
a.
b. chmod -R 700 $HOME:
This command canges the permissioins to the home directory. While giving chmod -R 700 $HOME, user having all(read(4),write(2),execute(1)) = 7 permissions and groups and others contains 0 means no permissions.
2) $ ls -a -r /tmp /usr:
This command lists all files in the reverse order in that location /tmp /usr.
$ fold -80 /etc/passwd > /tmp/passwd:
/etc/passwd is a file location and that file consists of password details of entire system. While executing $ fold -80 /etc/passwd > /tmp/passwd, that permissions file is copies to /tmp location.
$ uname -S amazon:
This command prints the kernel name of amazon server.
$ cat -A /tmp:
If tmp is a file this command opens that file. Oterwise it can't.
(3) List name(s) of commands available in Unix system for the following
a. to create a directory structure project.d/project.d/project.d from your home directory without using
multiple commands.
By using mkdir -p option we can create directory in that path.
syntax: mkdir -p project.d/project.d/project.d
b. to list the first 20 lines in a file:
We can use the following commands:
head command:
head -20 file.txt
sed command:
sed -n 1,20p /file
awk command:
awk 'FNR <= 20' /file
4) Explain what we do in the following set of commands.
$ pwd /home/john
This command sows the present working directory irrespective of location mentions after pwd.
$ echo $HOME
It shows the vallue that has been set to $HOME
$ ln -s $HOME /tmp/$HOME.$$.
This command makes the value of $HOME in /tmp as value in $HOME
5) Using chmod write cmds for the following.
a. change the file perms to read and write by user and no other perms for others.
chmod -R 600 file.txt
b. Add perms to a file to be readable by other and group.
chmod -R 644 file.txt
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.