Question

In: Computer Science

Move the file “nfile2” into the “unix” directory. Copy the file “nfile1” into the “java” directory....

  1. Move the file “nfile2” into the “unix” directory.

  1. Copy the file “nfile1” into the “java” directory.

  1. Show how you would create the files “test1”, “test2”, & “test3” in the “test” directory to ensure that they have the same file creation date/time.

  1. From the ~ folder, use the * and then the [ ] wildcard procedures to list all the files in the “test” directory.
  1. From the directory structure above, give an example of a relative path & an absolute path.

  1. Use the ‘zip’ utility to compress the ‘labs.tar’ file to get the archive file labs.zip. Show how you can uncompress the zip file that was created.

  1. Use the gzip utility to compress the archive file labs.tar to get the file labs.tar.gz. Show two(2) ways that you can retrieve the original contents from the labs.tar.gz file.

Solutions

Expert Solution


Q1. Move the file “nfile2” into the “unix” directory.
moving file into a directory we will use the mv command as below
mv file_name path_of_directory

mv nfile2  unix/


Q2. Copy the file “nfile1” into the “java” directory.
to copy file we will use th cp commond same as mv command the only difference is we will use cp instead of mv

cp nfile1 java/


Q3. Show how you would create the files “test1”, “test2”, & “test3” in the “test” directory to ensure that they have the same file creation date/time.

We can do this in multiple ways.

Option 1.

go to the test directory using the command below :
cd test

After this execute touch command to create multiple files at a time as given below.

touch test1 test2 test3


Option 2


Specify the file while creating a new file using touch.

syntax: touch dir_path/file_name 

command: touch test/test1 test/test2 test/test3

in the above command, we are creating test1, test2, test3 files in the test directory.


Q4. From the ~ folder, use the * and then the [ ] wildcard procedures to list all the files in the “test” directory.
we are firest going on directory using command change directory cd
after that listing all files in tat directory using command ls [a-z]* in bracket we are specify the range a-z

cd test
ls [a-z]*


Q5. From the directory structure above, give an example of a relative path & an absolute path.

absolute path is that which specify the location from root (/) path
for example suppose test directory is on Desktop then it's relative path will

/home/abhi/Desktop/test​​​​​​​

In the above path abhi is user. so in your case it might be anything.

relative path is a path from present working directory. suppose if we are on desktop the relative path will

Desktop/test


Q6. Use the ‘zip’ utility to compress the ‘labs.tar’ file to get the archive file labs.zip. Show how you can uncompress the zip file that was created.

zip command is used to copress and unzip command is used to uncompress.

zip labs.zip labs.tar
unzip labs.zip


Q7.  Use the gzip utility to compress the archive file labs.tar to get the file labs.tar.gz. Show two(2) ways that you can retrieve the original contents from the labs.tar.gz file.

gzip command creates the compress file and delete the original file.
command to compress:

gzip labs.tar


Uncompress using gzip:

Way1:

gzip -d labs.tar.gz


Way2:

tar xvzf file.tar.gz




Related Solutions

Demonstrate your grasp of the Unix file system by constructing a directory structure as follows: In...
Demonstrate your grasp of the Unix file system by constructing a directory structure as follows: In your home ( ~ ) directory, create a directory named “UnixCourse”. This directory will be used in the remaining assignments of this course, as well as this one. Several of the commands that you will issue in this course will examine files in this directory and, in some cases, send me a listing of those files or even copies of those files for grading...
In a UNIX-like file system, a directory typically contains: A. filenames and i-nodes B. permission information,...
In a UNIX-like file system, a directory typically contains: A. filenames and i-nodes B. permission information, pointers to direct blocks C. filenames and ownership information D. filenames, i-nodes, major device numbers and minor device numbers
UNIX/LINUX SCRIPT: Create a named directory and verify that the directory is there by listing all...
UNIX/LINUX SCRIPT: Create a named directory and verify that the directory is there by listing all its contents. Write a shell script to validate password strength. Here are a few assumptions for the password string.   Length – a minimum of 8 characters. • Contain alphabets , numbers , and @ # $ % & * symbols. • Include both the small and capital case letters. give a prompt of Y or N to try another password and displays an error...
1. Compare the Unix directory and the windows directory and answer the following: a. Match 3...
1. Compare the Unix directory and the windows directory and answer the following: a. Match 3 Unix directories to a Windows directory that is similar in function. Briefly describe their similarities and differences. b. Find a directory in Unix that appears to have no equivalent in Windows. What does it do? c. Find a directory in Windows that appears to have no equivalent in Unix. What does it do?
Unix command lines. A) Assume that your current working directory is NOT the same as your...
Unix command lines. A) Assume that your current working directory is NOT the same as your home directory. Print all file and subdirectory names of your home directory into a file named file2. B) Copy the text from line 11 to line 20 of a given file input.txt and append the copied text at the end of the file output.txt. (Assume that the file input.txt contains more than 20 lines of text contents) C) Count and display the total number...
Parse the dirent struct to see if an entry is a directory or a file. If...
Parse the dirent struct to see if an entry is a directory or a file. If it is a directory, prepend "./" to the filename before printing it out. Include a main that does this below. Please do the above code using C language.
Write a script that prompts the user for a pathname of a file or directory and...
Write a script that prompts the user for a pathname of a file or directory and then responds with a description of the item as a file along with what the user's permissions are with respect to it (read, write, execute).
Write a bash script file that tests each file entry in the current directory. It should...
Write a bash script file that tests each file entry in the current directory. It should determine if it is a file or directory. If it is a file, it will determine if it is readable or not. If it is readable, it will display only the first 4 lines to the terminal in sorted order (just sort the first 4 lines). If it is a directory, it should display the contents of that directory (the files and subdirectories). NOTE:...
What are the UNIX commands for each of these steps? 1. Copy all of the files...
What are the UNIX commands for each of these steps? 1. Copy all of the files in your Files directory to the Backup directory. 2. Create an ITE130 directory in the Classes Directory 3. Move all the ITE 130 files from the backup directory to the ITE130 directory. 4. Redirect echo step 19 to mark this step in the lab3.txt file 5. Display all of the directories and sub-directories including files so I can verify you completed all the above...
Task 1: Getting familiar with Unix commands Questions: How do you remove a directory and all...
Task 1: Getting familiar with Unix commands Questions: How do you remove a directory and all of its contents, including any subdirectories and files, without using rmdir repeatedly?         [5 Points] Go to your home directory (i.e. /home/) and enter the following command: ls -ali Explain the output. You need to clearly what each column specifies, what are the values in each column means. Also explain how it is different from: ls -li    [5 Points] How will you copy directory (not...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT