Introduction To UNIX File System
Introduction To UNIX File System
Introduction To UNIX File System
Lab 4
Introduction to UNIX File System
Part I. The mkdir (make directory) command creates a new subdirectory under your
working directory or any other directory you specify as a part of the command.
1. Use pwd command to check your working directory. Output of pwd should be similar to:
/home/username
2. Create a directory named memos. i.e. type mkdir memos.
3. Type ls and check if directory named memos is created.
1. Type cd command. This command will take you to your home directory.m
2. Type pwd to check if you are in your home directory. i.e. /home/username
3. Type cd memos to change your working directory to memos, and then check your
working directory by pwd command. Output of pwd should be /home/username/memos
4. Create another directory called box, and change your directory to box. Again check your
working directory with pwd. Output of pwd should be /home/username/memos/box
5. Type cd .. this command will take you one directory up. Check if your working
directory is memos.
6. Repeat 1 to return your home directory. i.e. type cd.
Part III. In this part you will learn how to copy, move and erase files. cp (copy) command is
used for copying files, mv (move) command is used to move files and rm (remove)
command is used to erase files. In this section it is assumed that in your home directory
these files are present ayse.txt, ali.txt, lena.log, sky.to and loop.co, if not create these files
using pico or gedit editor.
1. Use man command to get help on these commands: cp, mv and rm.
2. Copy lena.log into memos directory. i.e. cp lena.log memos.
3. Change your directory to memos and check if lena.log is there. i.e. use ls.
4. Remove lena.log by using rm command. i.e. rm lena.log. Then check if it is erased.
5. mv command can also be used to rename filenames. i.e. mv ayse.txt veli.dat will
rename ayse.txt as veli.dat.
6. Type cp veli.dat elena.rtr. What is the difference of this command from the
command investigated in step 5.
Part IV. In this part following directory structure will be created and tree command will
be investigated.
1. Type tree command to see directory structure under your home directory. This
command also displays the number of directories and files. i.e. tree ~.
2. Use mkdir command to create the directory structure shown below.
3. Return to your home directory and type tree to see if the shown directories are
created
correctly: type cd and then tree. Show your work to the instructor.
4. Return to home directory and try to change your working directory to pop directory by
writing a single command. i.e. cd star/music/pop. And confirm by pwd command.
5. Copy all the files starting with character a to fire directory. i.e. cp ~/a*.*
~/star/fire. Please note that the tilde (~) used before slash (/) means home
directory.
6. Change your working directory to fire and remove all the files inside this directory.
7. Remove fire directory as well. i.e. you should use rmdir command.
8. The -p (i.e., parents) option creates the specified intermediate directories for a new
directory if they do not already exist. For example, it can be used to create the following
directory structure: mkdir -p food/fruit/citrus/oranges.
9. Type tree to check what directory structure has been created in step 8.
1. Use rmdir command to remove all the directories under the star directory. Hint: start
form the inner directories (i.e. pop), the directory that you wish to remove should be
empty. Show that you remove all the directories correctly to the instructor.
Note: The commands learned in this lab section will be used in the subsequent laboratory
work.
Carefully read the description of the corresponding lab. The lab outline contains background for
the lab and directions for doing the lab procedure. There may also be handouts or other materials
you have access to. By the help of a LiveCD of Ubuntu you can study to the corresponding lab
without making any changes to your machine. Answers of the preliminary Lab Questions must
be handled at the beginning of the laboratory. A full printable version of this sheet is available
online.
: To learn about Ubuntu operating system and learn commands of Ubuntu operating system and
how to move, rename a files and how to make a directories.
SYNOPSIS
mv [OPTION]... [-T] SOURCE DEST
mv [OPTION]... SOURCE... DIRECTORY
mv [OPTION]... -t DIRECTORY SOURCE...
DESCRIPTION
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
--backup[=CONTROL]
make a backup of each existing destination file
-f, --force
do not prompt before overwriting
-i, --interactive
prompt before overwrite
-n, --no-clobber
do not overwrite an existing file
If you specify more than one of -i, -f, -n, only the final one takes
effect.
--strip-trailing-slashes
remove any trailing slashes from each SOURCE argument
-S, --suffix=SUFFIX
override the usual backup suffix
-t, --target-directory=DIRECTORY
NAME
rmdir - remove empty directories
SYNOPSIS
rmdir [OPTION]... DIRECTORY...
DESCRIPTION
Remove the DIRECTORY(ies), if they are empty.
--ignore-fail-on-non-empty
is non-empty
-p, --parents
remove DIRECTORY and its ancestors; e.g., `rmdir -p a/b/c' is
similar to `rmdir a/b/c a/b a'
-v, --verbose
output a diagnostic for every directory processed
--version
output version information and exit
NAME
mkdir - make directories
SYNOPSIS
mkdir [OPTION]... DIRECTORY...
DESCRIPTION
Create the DIRECTORY(ies), if they do not already exist.
Mandatory arguments to long options are mandatory for short options too.
-m, --mode=MODE
set file mode (as in chmod), not a=rwx - umask
-p, --parents
no error if existing, make parent directories as needed
-v, --verbose
print a message for each created directory
-Z, --context=CTX
set the SELinux security context of each created directory to CTX
--version
output version information and exit
Signature >:_________________