Skip to content

Lesson 3: Help session

Lesson recap

In this lesson, we continued to learn about the Biowulf environment and should now be able to

  • Copy content from one directory to another
  • Use options of the ls command to view various directory content information
  • Determine file and directory permissions and modified these
  • Remove files

Practice questions

Question 1:

Can you copy the following folder to your data directory?

/data/classes/BTEP/unix_on_biowulf_2023_practice_sessions/lesson3_practice

Solution

cp -r /data/classes/BTEP/unix_on_biowulf_2023_practice_sessions/lesson3_practice/ /data/username

If you are in your data directory then you can do the following, where "." denotes here in the present working directory

cp -r /data/classes/BTEP/unix_on_biowulf_2023_practice_sessions/lesson3_practice/ .

Question 2:

Can you change into lesson3_practice and then list its contents so that you see permissions?

Solution

cd lesson3_practice
ls -l
total 2
drwxr-s---. 2 student2 student2 4096 Jan 16 15:17 sample_sequence_data
-rwxr-x---. 1 student2 student2   46 Jan 16 15:17 text1.txt

There are three sets of rwx permissions - a set for the file/directory owner, a set for those in the group, and a set for everyone else.

Question 3:

How many files and directories are in the folder lesson3_practice?

Solution

There is 1 file (text1.txt) and a folder (sample_sequence_data)

Question 4:

What permission is set for the file in lesson3_practice?

Solution

Owner has read, write, and execute Group has read and execute

Question 5:

Can you add write permission to the group for the file in lesson3_practice

Solution

chmod g+w text1.txt

Question 6:

Can you make a copy of text1.txt and call it text1_copy.txt?

Solution

cp text1.txt text1_copy.txt

Question 7:

Can you remove text1_copy.txt?

Solution

rm text1_copy.txt