Hello please answer the following linux question for me thank you! 1. Open up a
ID: 3886288 • Letter: H
Question
Hello please answer the following linux question for me thank you!
1. Open up a terminal. Type “pwd” to confirm your working directory is something like “/home/cct”. Then type “ls” to display the list of directories. Now we want to create a directory to put some files in. Type the following commands cct@cct-vm:~$ mkdir Lab2 cct@cct-vm:~$ ls If everything goes well, you should see a new directory called “Lab2”.
2. To get into this new directory, use the following command cct@cct-vm:~$ cd Lab2 You can type “pwd” to find out where you are. The “pwd” command tells you your present working directory. Now that you are inside Lab2, create 2 more directories inside Lab2 (ex: “Apple” and “Orange”). We can enter and exit from a directory using “cd” command. Assuming you are currently in /Lab2 (use “pwd” to check), you can enter into the Orange directory by doing a “cd Orange” and get out of the Orange back to Lab2 by typing “cd ../”.
Question 1. Try to create a new directory with the same name as an existing one. What is the error message you see?
3. Next, we want to put stuff into the directories you have created. Type this command: cct@cct-vm:~/Lab2$ echo “Hello world” > hello.file You can copy hello.file into a directory by using the “cp” command. Assuming you are currently in the Lab2 directory, copying the file into a directory called Orange, the command is: cct@cct-vm:~/Lab2$ cp hello.file Orange/ If you want to move the file (rather than copying it), the command to use is “mv”. 4. To delete a file, use the “rm” command. To delete a directory, you will need to the “-r” flag cct@cct-vm:~/Lab2$ rm –r Orange
Question 2. Try deleting a file that does not exist. What happens?
Question 3. Some of the commands we used today are: “pwd”, “mkdir”, “cd”, “ls”, “cp” and “mv”. Explain in your words what each command does.
Explanation / Answer
Question1) While creating a new directory with the same name , the error message i got is
mkdir: cannot create directory 'Orange': File exists
Questin 2) Whiel deleting a file that does not exist the error message that i got is
rm: cannot remove 'myfile': No such file or directory
Question3)
pwd : This command prints out the present working directory on the terminal . It show the directory in which we currently are
mkdir : This command is used to create a new directory , We can specify the name of the directory and the location where we want to create the file
usage: mkdir dirname
cd : This command is used to change the director in which we are working , with this command we can navigate in our file system.
ls : This command is used to list all the directories and files in a specified directory
cp: This command is used to copy a file from one directory to another directory ,
USAGE : cp filename directory_location
mv : This command is used to rename or move a file from one directory to another directory
usage: mv filename new_location
PLEASE RATE !!
Thanks !
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.