1. What command would I use if I want to be prompted before removing (deleting)
ID: 3537111 • Letter: 1
Question
1. What command would I use if I want to be prompted before removing (deleting) several files in my home working directory that have a '.pbx' extension? (hint: use the man pages for the command and search for the word 'prompt'). (5 points) 2. I have a file called bigfile.txt that I want to move from the ~/Desktop directory to the ~/Documents directory. I am currently in the ~/Desktop directory. What command would I use to do this? (5 points) 3. What command would I use to make a copy of the file copyme.doc (name the copy newcopyme.doc). (5 points) 4. What command would I use to display a long listing of *all* files (hidden and regular) in my home directory, and ALL directories below it? (hint: use the man pages and search for the term 'recursive'). (5 points) 5. What command would I use to display a big text file called "file.txt" to the screen so I could move through it a line or a page at a time? (5 points) 6. What command would I use to create the nested directories /one/two/three/four? (hint: Use a SINGLE command. See the man pages). (5 points) 7. I am in my home directory. I want to search for all files in the ~/Documents directory that have the keyword 'Daytona' in them. What command should I use? (hint: DO NOT change directories. Search in the man pages for the keyword 'recursive.') (5 points) 8. What command would I use to remove the directory "~/temp"? (2 points) 9. I want to update my system, and am logged in as DrPhil (a non root account). I know I can use the command "aptitude self-upgrade" to do this. What command can I add to this sequence so I can run it as root? (Give me the entire command sequence). (3 points) 10. I have a file called "DSC.txt" in the directory ~/Documents/Daytona/ATC. My current working directory is ~/Documents/Daytona/ATC. I want to move DSC.txt to the parent directory. What command would I use to do this? (5 points) 11. I am working in the ~/Documents/Daytona/ATC/June/Linux directory. I want to change back to my home directory. What single command would I use to do this (the shortest command!)? (5 points) 12. This question is related to Question 11 above. Now I want to change back to directory ~/Documents/Daytona/ATC/June/Linux. What single command would I use to do this (the shortest command!)? (5 points) 13. I am in my home directory, and I want to remove the nested directory ~/temp/mystuff/morestuff/moremorestuff. There are files in each directory. What command would I use to remove all of the directories and files, without being prompted? (There are two commands you can use for this. You will definitely need to use the man pages. This is a little difficult, but it's all there in the man pages). (5 points) 14. This isn't a command question. What is the parent directory of ~/Documents/student/ATC/June/2013? Give me the ENITRE path! (5 points) 15. What is the option for the 'rm' command that prompts me before deleting individual files? (see the man page) (5 points) 16. What command would I use to make a copy of the file "earth.doc" (name the copy mynewearth.txt). (5 points) (5 points) 17. What keys on the keyboard would I use to scroll back and forth through the commands I've previously issued from the terminal? (5 points) 18. If I typed "cd ~/De" at the command line in terminal running under a default installation, then hit the tab key, what would happen? (3 points) 19. Complete this sentence: Linux is only a ______________ (5 points) 20. Complete this sentence: In Linux everything is a _______________ (5 points)
Explanation / Answer
1. What command would I use if I want to be prompted before removing (deleting)
several files in my home working directory that have a '.pbx' extension? (hint: use the man pages for the command and search for the word 'prompt'). (5 points)
when you want to interact before deleting ,like if you want to prompt a message before deleting then use -i after the remove command.
I stands for interactive
syntax
$ rm -i file
for several files, use
$ rm -i *.pbx
2. I have a file called bigfile.txt that I want to move from the ~/Desktop directory to the ~/Documents directory. I am currently in the ~/Desktop directory. What command would I use to do this? (5 points)
BIT OF EXPLAINATION ABOUT PATH
Let me tell you how the path works. If you have are in
/home and you have to enter into /home/richie/anderson
then you can just use $ command(such as mv rm or cp) abc.txt richie/anderson
in case you are at /home/richie and you have to go to /home/def
then you ll use ../def
.. means you are going to the parent directory of richie which is home. That is going one hierarchy back. and then entering the directory def.
.. means parent directory
. means same directory
Your answer.
As you are already in the Desktop directory, you don't need to give the path of Desktop Directory
Give the path of the Documents Directory.
$ mv bigfile.txt Documents/file2
the path to Documents folder may always vary.
so, to get the path of the Document folder, go to Document folder and find the path by using the command
pwd
3. What command would I use to make a copy of the file copyme.doc (name the copy newcopyme.doc). (5 points)
$ cp copyme.doc newcopyme.doc
4. What command would I use to display a long listing of *all* files (hidden and regular) in my home directory, and ALL directories below it? (hint: use the man pages and search for the term 'recursive'). (5 points)
ls -laR
a for hidden files
R for recursive
5. What command would I use to display a big text file called "file.txt" to the screen so I could move through it a line or a page at a time? (5 points)
$ less file.txt
it ll paginate the file.
6. What command would I use to create the nested directories /one/two/three/four? (hint: Use a SINGLE command. See the man pages). (5 points)
to create nested directories, you can use
mkdir -p one/two/three/four
this ll create a strructure
one--> inside that--> two --> inside that --> three --> inside that --> four
7. I am in my home directory. I want to search for all files in the ~/Documents directory that have the keyword 'Daytona' in them. What command should I use? (hint: DO NOT change directories. Search in the man pages for the keyword 'recursive.') (5 points)
Again get the path of the Documents directory and paste the path there at /Documents
There can be multiple ways to do this
Method 1
grep -rn '<word or regex>' <location>
grep -rn 'Daytona' /Documents
check the path of Documents and replace in place of /Documents
r for recursive
and n for line numbers. SO it will return the line number as well
Method 2
$ find /Documents -name '*{Daytona}*' -print
or
$ find /Documents -name '*{Daytona}*'
8. What command would I use to remove the directory "~/temp"? (2 points)
Hopefully, it is not tmp. It has some different meaning.
Considering it as /temp
$ rmdir /temp
9. I want to update my system, and am logged in as DrPhil (a non root account). I know I can use the command "aptitude self-upgrade" to do this. What command can I add to this sequence so I can run it as root? (Give me the entire command sequence). (3 points)
Either become the superUser first
using the command
su -
it ll ask for the password and then $ prompt will be changed to # prompt
then
# aptitude update
# aptitude safe-upgrade
then
Look for packages installed from anything else than stable:
for this, use
# aptitude search '?narrow(?installed, !?archive(stable))'
then
looking for packages installed from testing (assuming you have sources lists with stable and testing repositories):
for this use
# aptitude search '?narrow(?installed, ?archive(testing) !?archive(stable))'
if you want to merge these commands and the command to become the superUser, in other words if you dont want to be the superUser first.
then use
sudo before every command
example
sudo aptitude update
10. I have a file called "DSC.txt" in the directory ~/Documents/Daytona/ATC. My current working directory is ~/Documents/Daytona/ATC. I want to move DSC.txt to the parent directory. What command would I use to do this? (5 points)
$ mv DSC.txt ../DSC.txt
or
$ mv DSC.txt /../DSC.txt
i have little confusion here. but either of them works for sure. I think first one is correct. In case the first one doesnt work for you. Try for the second one.
11. I am working in the ~/Documents/Daytona/ATC/June/Linux directory. I want to change back to my home directory. What single command would I use to do this (the shortest command!)? (5 points)
cd ~
12. This question is related to Question 11 above. Now I want to change back to directory ~/Documents/Daytona/ATC/June/Linux. What single command would I use to do this (the shortest command!)? (5 points)
cd -
13. I am in my home directory, and I want to remove the nested directory ~/temp/mystuff/morestuff/moremorestuff. There are files in each directory. What command would I use to remove all of the directories and files, without being prompted? (There are two commands you can use for this. You will definitely need to use the man pages. This is a little difficult, but it's all there in the man pages). (5 points)
rm -r /temp
r is for recursive
all the files and directories inside temp will be deleted automatically
14. This isn't a command question. What is the parent directory of ~/Documents/student/ATC/June/2013? Give me the ENITRE path! (5 points)
it is something like
/home/yourUSERLOGINNAME/Documents/student/ATC/June/2013
anything can be placed in place of yourUSERLOGINNAME
suppose my login name is Uday
then I ll use
/home/User/Documents/student/ATC/June/2013
So the parent Directory is Uday
15. What is the option for the 'rm' command that prompts me before deleting individual files? (see the man page) (5 points)
rm -i
16. What command would I use to make a copy of the file "earth.doc" (name
the copy mynewearth.txt). (5 points) (5 points)
$ cp earth.doc mynewearth.txt
17. What keys on the keyboard would I use to scroll back and forth through the commands I've previously issued from the terminal? (5 points)
up and down arrow keys
18. If I typed "cd ~/De" at the command line in terminal running under a default installation, then hit the tab key, what would happen? (3 points)
Tab is used for auto completion. So if there is a path or there is something like Denmark. So cd ~/De will change into cd ~/Denmark autmoatically
19. Complete this sentence: Linux is only a ______________ (5 points)
No idea. Doesnt make any sense to me. Find it yourself.
20. Complete this sentence: In Linux everything is a _______________ (5 points)
File
It was too much of work and time taking
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.