Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions 160804117 倪永炜
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
exercise1
@@ -0,0 +1,12 @@
+# 1.Create a file called message.txt in your home directory and move it into another directory.
+
+touch /home/message.txt
+mv /home/message.txt distination
+
+# 2.Copy the message.txt you just moved into your home directory.
+
+cp message.txt /home/message.txt
+
+# 3.Delete both copies of message.txt. Try to do this without using rm.
+
+unlink message.txt && unlink /home/message.txt

exercise2
@@ -0,0 +1,20 @@
+# Create a new directory called workbench in your home directory.
+mkdir /home/workbench
+
+# Without changing directories create a file called readme.txt inside of workbench.
+vim /home/workbench/readme.txt
+esc + :wq
+
+# Append the numbers 1, 2, and 3 to readme.txt so that each number appears on it’s own line.
+echo -e "1\n2\n3" > /home/workbench/readme.txt
+
+# Print readme.txt to the command line.
+cat -n readme.txt
+
+# Use output redirection to create a new file in the workbench directory called list.txt which lists the files and folders in your home directory.
+touch workbench/list.txt
+ls /home > /home/workbench/list.txt
+
+# Find out how many characters are in list.txt without opening the file or printing it to the command line.
+wc -m /home/workbench/list.txt
+

exercise3
@@ -0,0 +1,11 @@
+# Before I organized the photos by year, what command would have listed all of the photos of type .png?
+find . -name "*.png"
+
+# Before I organized the photos by year, what command would have deleted all of my hiking photos?
+find . -name "*hiking*"
+
+# What series of commands would you use in order to put my figures for a data science course and the pictures I took in the lab into their own folders
+
+# Supposed that we have a file including all pngs and txts, we are going to move them seperately.
+mv *.txt data
+mv *.jpg photo

exercise4
@@ -0,0 +1,11 @@
+# Before I organized the photos by year, what command would have listed all of the photos of type .png?
+find . -name "*.png"
+
+# Before I organized the photos by year, what command would have deleted all of my hiking photos?
+find . -name "*hiking*"
+
+# What series of commands would you use in order to put my figures for a data science course and the pictures I took in the lab into their own folders
+
+# Supposed that we have a file including all pngs and txts, we are going to move them seperately.
+mv *.txt data
+mv *.jpg photo