The subject is UNIX Please answer questions and include the Exercise number. Exe
ID: 3736305 • Letter: T
Question
The subject is UNIX
Please answer questions and include the Exercise number.
Exercises:
3.7, How does the command mv bar1 bar2 behave, where both bar1 and bar2 are directories, when (i) bar2 exists, (ii) bar2 doesn’t exist?
3.8, Explain the difference between the commands cd ~charlie and cd ~/charlie. Is it possible for both commands to work?
3.9, charlie uses /usr/charlie as his home directory, and many of his scripts refer to the pathname /usr/charlie/html. Later, the home directory is changed to /home/charlie, thus breaking all his scripts. How could charlie have avoided this problem?
3.14 Explain what the following commands do: (i) cd, (ii) cd $HOME, (iii) cd ~.
3.18, What is the significance of these commands? (i) mv $HOME/include ., (ii) cp -r bar1 bar2, (iii) mv * ../bin
3.22, How do DOS and UNIX text files differ? Name the utilities that convert files between these two formats.
3.26 Name three advantages zip has over gzip.
Thank You!
Explanation / Answer
3.7, How does the command mv bar1 bar2 behave, where both bar1 and bar2 are directories, when (i) bar2 exists, (ii) bar2 doesn’t exist?
Answer:
when (i) bar2 exists, The directory bar1 is moved to the directory bar2
contents of bar2 is given below:
bar2:
bar1
when (i) bar2 does not exists, The directory bar1 is renamed to the directory bar2. Here bar2 does contain bar1 directory
3.8, Explain the difference between the commands cd ~charlie and cd ~/charlie. Is it possible for both commands to work?
The command 'cd ~charlie' takes you to the home directory of charlie
The command cd ~/charlie takes you to the directory 'charlie' in your home directory
3.9, charlie uses /usr/charlie as his home directory, and many of his scripts refer to the pathname /usr/charlie/html.
Later, the home directory is changed to /home/charlie, thus breaking all his scripts. How could charlie have avoided this problem?
UNIX determines the executable search path with the $PATH environment variable
The problem can be avoided by adding the directory to the end of the path, use the following command:
PATH=$PATH:/usr/charlie/html
3.14 Explain what the following commands do: (i) cd, (ii) cd $HOME, (iii) cd ~.
All the commamd changes the directory to home directory
the 3 commands does the same thing
3.18, What is the significance of these commands? (i) mv $HOME/include ., (ii) cp -r bar1 bar2, (iii) mv * ../bin
mv $HOME/include .
moves the directory 'include' under $HOME/include to your current directory
cp -r bar1 bar2
cp copies the contents of directories of bar1 to bar2, and if a directory 'bar1' has subdirectories they are copied (recursively) too
mv * ../bin
moves all the contents in current directory to 'bin' which is under current directory's parent
3.22, How do DOS and UNIX text files differ? Name the utilities that convert files between these two formats.
In Windows, lines end with both the line feed and carriage return ASCII characters, but Unix uses only a line feed.
ie windows has where as UNIX has only
there are dos2unix and unix2dos utilites which connvert the file format
3.26 Name three advantages zip has over gzip.
1. zip ican archive and compress multiple files, while gzip does only compression.
2. individual files can be extracted from a zip file, gzip does not extract individual files.
3. zip files can package and compress files/directories on by it’s own, unlike gzip, who needs the help of another command like tar to archive/package the files.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.