Basic Linux1
Basic Linux1
vn
BASIC LINUX
Question 1: cp,mv, and cat
This question covers basic file manipulation. To begin this question use the first button to set up a
small file and directory tree in /home/caine. The resulting tree looks like:
/
+--- home
|
+--- caine
|
+--- test1
| +--- file1
| +--- file2
| +--- file3
| +--- file4
|
+--- mydir1
| +--- info1
| +--- info2
|
+--- data
| +--- data1
| +--- data2
|
+--- lines
+--- words
+--- info
Create directory:
cd /home
mkdir caine
cd caine
mkdir test1 mydir1 data
touch lines words info
cd test1
touch file1 file2 file3 file4
cd ../mydir1
touch info1 info2
cd ../data
touch data1 data2
1. COPY file1 from test1 to data. Keep the name as file1.
Cat info2 lines > joined
6. Still in mydir1, concatinate info2 and lines and file1 from test1, saving the output as
"joined2".?
Cat info2 lines ../file1/test1 > joined2
7. Make a new direction in /home/caine called "etccopy". Now copy from /etc to your new
directory all the files which begin with a "u" and end with ".conf". Only copy from /etc and not
from any sub-directories?
Cd home/caine
mkdir etccopy
Cp /etc/[u]*[.conf] etccopy
8. List all the file and directory names in /etc which have 1 or more numbers in their name.
Remember to use "-d" in the ls command, and do not decend into subdirectories (i.e. no
recursion). Save this list in caine's home directory as a file called "digit". Do the "ls" command
when CDed to /etc, thus your names avoid having "/etc/" stuck in front of them.
Cd /etc/
ls d *[09]* >> /home/caine/digit