Note: All of this assignment should be done from the command line. Note: You can
ID: 3890821 • Letter: N
Question
Note: All of this assignment should be done from the command line. Note: You can check the problems without answer lines by running the command gradelabi.pl 1. What is the flag for the 1s command to show file details? (4 pts) (see: man) what is the flag for the 1s command to show hidden files? (4 pts) What is the flag for the wc command to count words? (4 pts) 2. In your home directory, create a directory named ELE209. Remember, case matters. (4 pts) (see: mkdir, 1s rmdir, mv) 3. In the ELE209 directory, create a directory named lab1. (4 pts) (see: ed) 4. In your ELE209/1ab1 directory, create two directories named pub1 ic and private.(4 pts) 5. Make the public directory world readable and writeable. (4 pts) (see: chmod, 1s) Make the private directory have no access by other users. (4 pts) 6. Copy the filetestfile 1 from the directory /net/common/ele209/1abl to your ELE209/1ab1/public directory. (4 pts) (see: cp) Edit it to insert your name. (4 pts) (see: emacs) 7. Copy the filetestfile2 from the directory /net/common/ele209/1ab1 to your ELE209/1ab1/private directory. (4 pts) 8. Copy the file testfile3.txt from the directory /net/common/ele209/1ab1 to your ELE209/1ab1/public directory and rename it to mytestfile3.txt, (4 pts) (see: mv) Make it readable only by yourself. (4pts) 9. Copy the hidden file (there is only one) from the directory /net/common/ele209/1ab1 to your ELE209/labl/public directory. (4 pts) (see: 1s) 10. Copy the file testhidden.txt from the directory /net/common/ele209/1ab1/subdir to your ELE209/lab1/private directory. (4 pts) 11. In your ELE209/1ab1/public directory, create a symbolic link to the file /etc/hostname and call it myhostname. (4 pts) (see; 1n) What is the contents of this file? (4 pts) (see: less, cat) Get the file http://www.ele.uri.edu/faculty/sendag/ele208/s14/1abs/sample1.txt and put it in your ELE209/1ab1/public directory. (4 pts) (see: wget) What is the size of this file in bytes? (4 pts) (see: 1s, wc) How many lines does this file contain? (4 pts) How many words does this file contain? (4 pts) 12. What is the environment variable HOST set to? (4 pts) (see: echo) How about HOME? (4 pts) 13. heck your answers by running the command gradelabl.pl.Explanation / Answer
“-a” flag is used to show hidden file(list all entries including those starting with a period (.))
“-w” is used to count the number of words using wc
2)
Eg. Here i want to remove ELE209 directory. Enter “rmdir ELE209” in terminal and press enter.
3) Use mkdir command as shown below to create lab1 directory
first go to ELE209 directory from your home directory by using "cd ELE209"
and then type "mkdir lab1" command in your terminal.
4) To create private and public directory use mkdir command as shown below
Type "mkdir private" and hit enter in ther terminal
Type "mkdir public" command and hit enter in the terminal
5) To make the public directory readable and writeable use “chmod 0777 /public “ command and
hit enter in lab1 directory. Which will allow all people to read and write permision. To check file
permission use “ls –l” command.
To make private directory have no access to other users use “chmod o-rwx /private”
command. To check permission has been change or not use “ls –l” command and hit enter.
Here r-> read permission, w -> write permission and x-> execute permission. Negative sign
indiacate we are removing these permission for other user.
6) To copy testfile1 from “/net/common/ele209/lab1” to your “ELE209/lab1/private” use following command “cp –R testfile1 /net/common/ele209/lab1” in “/net/common/ele209/lab” .
And to edit testfile use “cat > testfile1” and write in the console window, Whatever you want write and when done press Ctr+D
7) To copy testfile2 file from the directory “/net/common/ele209/lab1/” your “ELE209/lab1/public” directory use following command
First go to “/net/common/ele209/lab1/” directory by typing “cd /net/common/ele209/lab1/” command in the home directory and then run below command
“cp –R testfile ELE209/lab1/public/”
8) use following command for 8th question
First go to “ /net/common/ele209/lab1” by using “cd /net/common/ele209/lab1” int the home
directory
Then enter following command to copy testfile3.txt into “/ELE209/lab1/public/”
“cp -R testfile3.txt /ELE209/lab1/public/”
To rename it use
“mv testfile3.txt my testfile3.txt”
To change permission use
“chmod u+r , g-r, o-r mytestfile3.txt”
9) “ cp –r /net/common/ele209/lab1/.[^.]* /ELE209/lab1/public/ “
This command will copy hidden file from source directory to destination directory.
10)
First got to “/net/common/ele209/lab1/subdir” directory by running “cd “/net/common/ele209/lab1/” command in your home directory . Then use following command to copy it.
“cp –r testhidden.txt /ELE209/lab1/private/ “
11) first go to “”/ELE209/lab1/public/” from home directory using “ cd /ELE209/lab1/public/”
command.
And run below command
“ln –s /etc/hostname/ myhostname”
12) Open terminal and type
“ wget –o /ELE209/lab1/public/ http://www.ele.uri.edu/faculty/sendag/ele208/s14/labs/sample1.txt “
And to know size of file and how many words are there first goto /ELE209/lab1/public/” directory by using cd command and use
“wc sample1.txt” command”
13) If you want to know about HOME just type
“echo $HOME”
Which will shoow you what is your home directory
Here my home directory is /home/cg/root
To get the info abut HOST enviroment variable enter foloowing command
“echo $HOST”
Actually HOST enviroment variable is a simple utility for performing DNS lookups. If you want know more information regarding it type “man HOST” in your terminal.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.