Question

In: Computer Science

Create the directory tree above in your /home/username folder using at most three (3) mkdir commands...

  1. Create the directory tree above in your /home/username folder using at most three (3) mkdir commands

  1. Use the ‘cat’ utility to create two text files called “nfile1” & “nfile2” in the “notes” directory. “nfile1” should contain the names of persons (at least 2 persons).

  1. Use the vi editor to create a simple text file, then save & quit. Briefly explain the various modes of vi and show how to delete a character, a word and a line

  1. Use the ‘tar’ utility to create an archive file of the ‘labs’ directory. Name your archive file labs.tar. Show how you can retrieve the contents from the labs.tar file.

  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.

Solutions

Expert Solution

(a). If you want to create a directory, use: mkdir directory_name. To create multiple directories, use braces {}. Ex if you want to create 3 directories named directory1, directory2 and directory3 at the current directory, then write: mkdir {directory1, directory2, directory3}. Also to make directory with a hierarchy, you can use -p. Ex - mkdir -p dir1/dir2/dir3 will make dir1 at current directory, dir2 inside dir 1, and dir3 inside dir2.

(b). cat is a very popular command used to create files, concatinate, display and echo a file. To do the second task of the question, create the "notes" directory using mkdir, or change directory to it using cd command (if notes is already made). Then write:

cat > nfile1

and press enter. Then type two names and press CTRL+D to save file.Do similar for creating the nfile2.

(c). vi editor is one of the most popular text editors for Linux. To create a new text document, just write:

vi filename.txt

and press enter. Then a blank screen is presented. But vi editors has two modes, command and insert. In command mode you can do operations such as save (using w) or close. (using q). To start typing, you need to get into insert mode by pressing i. To delete a character, word and line, you can press x, dw, and dd respectively

(d). To create an archive of whole directory, write: tar -rczf path/where/you/want/to/store/labs.tar labs

To retrieve it, write: tar xf labs.tar


Related Solutions

Step # 3 - Create the following structure in the home directory: Refer to previous Steps...
Step # 3 - Create the following structure in the home directory: Refer to previous Steps 1 + 2 for reference.   Do a tree to check your work as you go. No GUI, use command line only. Start by creating a directory within the home directory in which to experiment. Do a pwd and make sure you are in /home/pi Make a directory called YourInitials_fun Example: acf_fun In that directory, create a series of files and directories outlined below Make...
Linux-Practise1: Run the following commands (Print working directory) pwd. What is the output of the above...
Linux-Practise1: Run the following commands (Print working directory) pwd. What is the output of the above command Create a file named Linux1 nano Linux1 Type the following in the file Hello world Save the file Create a copy of the file cp Linux1 Linux2 view the listing of the files in the directory            ls What is the output of the above command rename the file mv Linux2 Linux3 view the listing of the files in the directory            ls...
At the command prompt: Change to your Downloads folder inside your home folder. Inside your Downloads...
At the command prompt: Change to your Downloads folder inside your home folder. Inside your Downloads folder, create a new folder named "IT1130". Inside the IT1130 folder, enter the following command: date /T > now.txt This last command creates a text file named now.txt containing the current date. Use the more command to display the contents of the now.txt file. Copy and paste the entire output of your more command into the space provided below. There should be one line...
Please create (if not already in your linux home directory) files of any type. Once these...
Please create (if not already in your linux home directory) files of any type. Once these files are created, archive them, compress the archive and move these files to the thrash directory. This could be a script to be run from the shell or the script to be run from an executable file. Submit your code and clearly explain all steps of your script.
Create a web page using PHP that allows the users to create an account (a username...
Create a web page using PHP that allows the users to create an account (a username and a password). There should be a login page that allows users to create an account by entering their preferred username and password. The same page should also let users login if they already have an account. If a user is logged in successfully , they should be able to enter a comment and also read the comments entered by others previously.
Using NetBeans, create a Java project named FruitBasket. Set the project location to your own folder....
Using NetBeans, create a Java project named FruitBasket. Set the project location to your own folder. 3. Import Scanner and Stacks from the java.util package. 4. Create a Stack object named basket. 5. The output shall: 5.1.Ask the user to input the number of fruits s/he would like to catch. 5.2.Ask the user to choose a fruit to catch by pressing A for apple, O for orange, M for mango, or G for guava. 5.3.Display all the fruits that the...
Ask the user for their name Create a file called "daily.dat" within the home directory Ask...
Ask the user for their name Create a file called "daily.dat" within the home directory Ask the user for a line of text that the system should save to the file Add to the file the line of text entered by the user Ask the user for a second line of text that the system should save to the file Append at the end of the file the line of text entered by the user Create a copy of the...
Using Ubuntu, what are the commands for the following: Assume that your company just hired 3...
Using Ubuntu, what are the commands for the following: Assume that your company just hired 3 new software developers. You are responsible for setting up a LDAP server and adding those three new employees into the LDAP database. Please complete the follow tasks: Installing and configuring a OpenLDAP server on your Ubuntu server Set the domain component (dc) = nodomain Insert an organization unit node into the LDAP database: dn:ou=People,dc=nodomain objectClass:organizationalUnit ou:People Insert a group node into the LDAP database:...
Using one Unix command, how to go to my home directory using tilde, ~. Using one...
Using one Unix command, how to go to my home directory using tilde, ~. Using one Unix command, how to go to your home directory using tilde, ~. Make sure you are in your home directory. Using one Unix command, how to go to your hw4 directory inside your hw directory, inside your it244directory using a relative pathname. Using one Unix command, how to go to my home directory using an absolute pathname. Using one Unix command, how to go...
Using PyCharm, create a new Project lab8. Under lab8 create a new Directory exercise, then create...
Using PyCharm, create a new Project lab8. Under lab8 create a new Directory exercise, then create a Python file called nested.py, type the following: Test your code by putting the following at the bottom of the file: make_table_of_stars(2,3) (as shown in the code above). Run the file by right clicking in the code area of Pycharm, then choosing “Run nested”. Your output should be: *** *** (2 rows with 3 columns of stars). Reverse the 2 and 3. What happens?...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT