Question
Using your username and password login into ACC Linux server (cois-linux.austincc.edu) Create a directory under your home directory named lab5 Make your lab5 directory your
Using your username and password login into ACC Linux server (cois-linux.austincc.edu)
Create a directory under your home directory named lab5
Make your lab5 directory your working directory
EXERCISE 1:
Check that lab5 is your present working directory. If that is not the case, change directory to lab5 before you continue to the next task.
|
Create a few small to large size text files for use in this lab by executing the following commands:
man cat > mediumFile
man bash > largeFile
cp /home/khernandez/public/smallFile .
Use the cat command to display the smallFile with line numbers. What command did you use to accomplish this task?
Display the smallFile and mediumFile using the more and less command. Did you notice any difference in the output provided by these commands?
You need to display the first 12 lines of largeFile. What command could you use? Show your session.
You need to display the last 5 lines of the smallFile. What command could you use? Show your session.
Using the wc command display the size in bytes of smallFile, mediumFile, largeFile. Show your session.
EXERCISE 2:
Using cat, create a file named days in your lab5 directory that holds the names of the days of the week (Monday, Tuesday, etc one day per line). Show your session.
EXERCISE 3:
The purpose of this part of the lab is to have you appreciate the working of tail command with f option. Make a copy of the smallFile in a file called dataFile. What command did you use to accomplish this task?
Then copy a C program file (lab5.c) from instructors public directory by executing the following command:
cp /home/khernandez/public/lab5.c .
Now run the following commands, in this order:
gcc lab5.c o generate
This first command produces the executable code for the C program in the generate file.
./generate >> dataFile &
This second command appends the output of the date command to the contents of dataFile, initially every five seconds and then every 10 seconds (you can see lab2.c for implementation details).
Write down the number in second column (right after number in brackets) that the system displays in your terminal after that second command is executed. That number is the PID (Process ID) number.
Now run the following tail command that displays the current contents of dataFile and then displays the data newly appended to dataFile.
tail f dataFile
After you have seen working the tail f command for a minute or so, terminate it with
kill PID
where PID (Process ID) is the number you wrote down in previous step after submitting the generate command to the system.
Signout and return your system to Windows
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started