Navigation

Exercise 1.4#

Exercise 1.4

  • Use cd to go up one level

# Use cd to change directory and .. to go up one level
cd ..
  • Use ls to see all the home directories of other users on the server

# Use ls to see what is in the directory
ls
  • Try to go up two levels using cd

# Use cd to change directory and .. to go up two levels
cd ../..
  • Use cd to go back to your home directory

# To get to the home directory just typing cd
cd
  • Use absolute path to enter the directory at /nfs/teaching/551-0132-00L/1_Unix/genomes. What is in it?

# Use cd to change directory and give the absolute path to go to genomes
cd /nfs/teaching/551-0132-00L/1_Unix/genomes

# Use ls to see what is in there
ls
  • Use absolute path to go home

# Use cd to change directory and remember that an absolute path starts at the root
cd  /nfs/nas22/fs2202/biol_micro_teaching/course_home/<your eth username>

# Since the pathname is quite long, we created an alias. So, you can shorten the part "nas22/fs2202/biol_micro_teaching/" to "teaching/" and still refer to the correct location. Therefore, the command below leads you also home.
cd  /nfs/teaching/course_home/<your eth username>

Note that the alias can be used in any command and we use the shortened version in the OLM

  • Go to the root of the file system. Can you find the first directory leading to the teaching directory?

# Use cd to change directory and to go to the root use /
cd /
# Check what is in the root directory, you see a directory called nfs which is always the first directory from the root /nfs in each absolute path
ls
  • Experiment with cd and ls to explore the directory structure within /nfs/teaching/551-0132-00L/1_Unix/genomes before returning to your home directory

# Let's start at the genomes directory:
cd /nfs/teaching/551-0132-00L/1_Unix/genomes
ls

# What's in the bacteria directory?
cd bacteria
ls

# Finally let's go to your personal home directory
cd
cd ~
# Notice that either one of the options above work

# Check that you are in your home directory
pwd