Software Engineering Deprtment
EAST CHINA UNIVERSITY OF TECHNOLOGY
Linux File Management and Text Processing
Student Name : _______________________
Student ID : _______________________
Date : _______________________
1. Objective
To demonstrate comprehensive proficiency in Linux command-line operations,
including directory navigation, file creation/editing, file manipulation (copy,
move, link, delete), and text processing utilities (head, tail, cut, paste, wc).
2. Submission Guidelines
Create a single document (Word or PDF) named
Unix_Chapter5_Lab_YourStudentNumber.pdf.
For every step below, you must paste a clear screenshot of your terminal
showing both the command you typed and its output.
Ensure your terminal prompt (showing your username/machine) is
visible in the screenshots to verify authenticity.
Phase 1: Directory and File Creation
1) Create a new directory named memos.
Screenshot 1: Show the command and successful creation with ls.
2) Use the vi editor to create a file called myfile. Type at least 3 lines of text, save, and exit.
Screenshot 2: Show the vi command and the file contents (e.g., using cat myfile).
3) Create another file named large and add several lines of text to it.
Screenshot 3: Show the creation and contents of the large file.
UNIX/Linux OS LAB
Software Engineering Deprtment
EAST CHINA UNIVERSITY OF TECHNOLOGY
Phase 2: File Manipulation and Linking
4) Use the cp command to copy all files in your current directory into the memos directory.
Screenshot 4: Show the command and verify with ls memos.
5) Use the ln command to create a link (hard or soft) for the file large, naming it large_link.
Screenshot 5: Show the command and verify with ls -l.
6) Use the mv command to rename large to [Link].
Screenshot 6: Show the command and verify with ls.
7) Use the mv command to move [Link] into the memos directory.
Screenshot 7: Show the move command and verify with ls memos.
Phase 3: Navigation and Further Manipulation
8) Change your current working directory to memos.
Screenshot 8: Show the command and verify with pwd.
9) Create another name (link) for myfile and call it MF.
Screenshot 9: Show the command and verify with ls -l.
UNIX/Linux OS LAB
Software Engineering Deprtment
EAST CHINA UNIVERSITY OF TECHNOLOGY
10) Copy myfile to a new file named [Link].
Screenshot 10: Show the command and verify with ls.
Phase 4: Listing and Verification
11) List all files in the current directory whose filenames start with my.
Screenshot 11: Show the command and its output.
12) List all files in the current directory that have the extension .old.
Screenshot 12: Show the command and its output.
Phase 5: Data Generation and Basic Text Processing
(Note: Perform these steps in your home directory or a new clean directory. You may cd .. to
go back).
13) Create two files called numbers and characters. Type in lines of repeating numbers and
characters similar to the following (at least 10 lines):
numbers characters
111111111 AAAAAAAAAA
222222222 BBBBBBBBBB
333333333 CCCCCCCCCC
... ...
1010101010 KKKKKKKKKK
11 11 11 11 11 LLLLLLLLLLLLLL
Screenshot 13: Show the creation and cat output of both files.
UNIX/Linux OS LAB
Software Engineering Deprtment
EAST CHINA UNIVERSITY OF TECHNOLOGY
14) Show the first two lines of the numbers file.
Screenshot 14: Show the command and output.
15) Show the first two lines of both the numbers and characters files simultaneously.
Screenshot 15: Show the command for both files and output.
16) Show the last 10 lines of the numbers file.
Screenshot 16: Show the tail command and output.
17) Show the last two lines of both the numbers and characters files simultaneously.
Screenshot 17: Show the command for both files and output.
UNIX/Linux OS LAB
Software Engineering Deprtment
EAST CHINA UNIVERSITY OF TECHNOLOGY
Phase 6: Advanced Text Processing (cut, paste, wc)
18) Use the paste command to put the numbers and characters files together side-by-side.
Screenshot 18: Show the paste command and output.
19) Use the paste command again to show numbers and characters together, but use the @
character as the field separator.
Screenshot 19: Show the paste command and output.
20) Use the cut command to show only the first five characters of each line in the numbers
file.
Screenshot 20: Show the cut command and output.
21) Show how many lines are in the numbers and characters files.
Screenshot 21: Show the command and output.
UNIX/Linux OS LAB
Software Engineering Deprtment
EAST CHINA UNIVERSITY OF TECHNOLOGY
22) Show how many lines, words, and characters are in the numbers, characters, and the
merged file (from step 18).
Screenshot 22: Show the wc command for all three files and output.
Phase 7: Cleanup
23) List all files in your current directory to see what needs to be cleaned up.
Screenshot 23: Show command and output.
24) Change to the parent directory. Delete the memos directory and all of the files
remaining in it using a single command.
Screenshot 24: Show the command and verify the directory is gone with ls.
25) List your remaining files, then remove all the test files (myfile, large_link, numbers,
characters, etc.) in the current directory.
Screenshot 25: Show the ls, the rm command, and a final ls showing an empty or clean
directory.
UNIX/Linux OS LAB
Software Engineering Deprtment
EAST CHINA UNIVERSITY OF TECHNOLOGY
Deliverable:
Submit the Unix_Chapter5_Lab_YourStudentNumber.pdf. file containing all commands
executed and their corresponding terminal outputs.
Submission
Execute each task in the Linux terminal.
Take a screenshot showing the command and its output.
Paste the screenshot below the corresponding task in your report document.
Submit the document before leaving the lab.
UNIX/Linux OS LAB