Write the following terminal commands to perform the following tasks: Part I
- make a directory called first
mkdir first
- change directory to the first folder
cd first
- create a file called person.txt
touch person.txt
- change the name of person.txt to another.txt
mv person.txt another.txt
- make a copy of the another.txt file and call it copy.txt
cp another.txt copy.txt
- remove the copy.txt file
rm copy.txt
- make a copy of the first folder and call it second
cp -r first second
- delete the second folder
rm -rf second
Part II
- What does the man command do? Type in man rm. How do you scroll and get out?
- Displays the manual for a command; D - Scroll down, U - Scroll up, B - Go back, Q - Exit
- Look at the man page for ls. What does the -l flag do? What does the -a flag do?
- Lists files as a column; Gives all info
- How do you jump between words in the terminal?
- Ctrl + Arrows
- How do you get to the end of a line in terminal?
- Ctrl + e
- How do you move your cursor to the beginning in terminal?
- Ctrl + a
- How do you delete a word (without pressing backspace multiple times) in terminal?
- Alt + Backspace
- What is the difference between a terminal and shell?
- A terminal is the program that displays and accepts characters, and the shell is the program that displays path info and accepts commands.
- What is an absolute path?
- A path that starts from the root directory, begins with a
/
.
- A path that starts from the root directory, begins with a
- What is an relative path?
- A path that starts from the current directory.
- What is a flag? Give three examples of flags you have used.
- An option that tells a program to do something; -r for recursive, -l for list, -a for all.
- What do the r and f flags do with the rm command?
- r means recursive, it will delete all files and folders within the folder; f means that it will act on a folder.
See Our solution