FIT2093 Week 2 Laboratory Sheet Basic Linux File Management & Commands
IMPORTANT NOTES:
1. Follow the instructions to install on your device the relevant software to allow you to log in and connect to your Virtual Machine on Monash Cloud server.
2. Study lecture materials at least 1 hour and prepare Question 1-4 under Lab Tasks section prior to the lab session. Prepared questions will be discussed in the lab session.
Copyright By PowCoder代写 加微信 powcoder
1 Overview
The objective of this lab is to introduce the students to the basic Unix commands. UNIX-like systems are increasingly being used on personal computers, mobile phones, web servers, and many other systems. This laboratory exercise reviews some of the essential commands and capabilities that match likely needs of FIT2093 students.
2 Lab Tasks: File and Directory manipulation
Root Directory and its Subdirectories. In this lab, we will use the Ubuntu 64-bit VM on Cloud. We will learn some basic Linux file and directory manipulation commands in the command terminal, so that we can use the com- mand terminal in future labs in this unit. A list of important unix commands is given in Table 1. For more details and examples for using these commands, refer to the Linux commands quick reference link on the week 2 Moodle lab material page.
Every file and directory in the file system has a path. Unix paths are delimited by forward slashes ( / ). e.g. A login name, Mark, has a directory as /srv/home/mark in the VM. After logging your VM, your directory follows the same pattern as /srv/home/[username], where [username] is your Monash authcate user name.
Figure 1: Unix file system hierarchy.
Special directories.
• Root Directory ( / ): The Top-Most directory.
• Bin Directory ( /bin ): Executable programs that comprise the GNU/Linux utilities. • Home Directory ( ~ ): Current User’s directory.
• Current Directory ( . ): The directory you’re in.
• Parent Directory ( .. ): The directory above.
Absolute paths: start with “/” i.e. the root directory. Relative paths: start from your current directory.
Week 2 Laboratory Sheet
whatis
cat [filename]
an interface to the on-line reference manuals display manual page descriptions
print a help message and exit
prints the last 50 commands
print lines matching a pattern
send the output of the command to that file concatenate files and print on the standard output make directories
remove empty directories
remove files or directories
copy files and directories
move or rename files and directories
search for files in a directory hierarchy
find files by name
print name of current/working directory
list directory contents
change working directory
The GNU version of the tar archiving utility
Table 1: File and Directory Manipulation Commands.
1. To poke around the Linux file system, open a Linux command terminal and take a look at the files in the root directory using the cd / command to change to the root directory, followed by the ls command to list the contents in the root directory. Experiment with variants of the ls command to see additional information, for example, what information does ls -l display, and what does ls -a display? (note: we will learn about the access control permissions of files in UNIX in a later lab). You should see directories with names like /bin, /home, /lib, and /usr.
2. There is an archive file with the filename poems.tar.gz on the /srv/fit2093files/fit2093lab , which contains a collection of poems by different writers. Use the change directory command cd to change your current directory to that directory and copy the file poems.tar.gz from /srv/fit2093files/fit2093lab to /srv/home/[username]. Then, list its contents to verify that it contains the file poems.tar.gz. Then run the command tar -xzvf poems.tar.gz to extract the contents of this archive file to your home directory.
3. Thearchivefileextractedintheprevioustaskshouldhavecreatedadirectorycalled/home/[username]/poems. Change your current directory to the latter. What command can you use to display the path of your current directory to verify that? Perform the operations in the following tasks from this poems directory.
4. Poems by both Angelou and Neruda are in the same directory. Create a separate directory for Neruda and move all his poems to the new directory. Rename the original directory as Angelou. (Hints: Auto-complete function: Try clicking “Tab” after keying first few characters of the folder name).
5. There is only one poem by Blake. Move that poem to Others directory and delete the directory Blake.
6. Create a text file called blank.txt using the gedit text editor and add some text to the file.
7. Use cat command to display the contents of the file.
Further Exploration
1. The Linux command ln can create a symbolic (soft) link to a target file or folder, similar to the “shortcut” in Windows operating system. Learn how to use ln to create a symbolic link by using the proper options and try it by yourself in the VM.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com