LAB 4
LAB 4 : OPERATING SYSTEM
Run the following command : cd /tmp
After that use dmesg to create file : dmesg > dmesg1.txt
If fail use this command sudo dmesg > dmesg1.txt
we can see the file we create using that command
Run command : grep network dmesg1.txt to determine what network device is been used. The results will show nothing because the output may not be very informative.
But what if case is an issue? We can try the following command : grep -i network dmesg1.txt
Now try the following command : grep -i cdrom dmesg1.txt
grep returns a code based on results of the search. Run the above command again (remember the up arrow shortcut)
Run the following command again : echo $? The return code should not be 0.
Part 2
Run the following command : cd /tmp and make temporary directory : mkdir lbooktemp
To create some files : ls > f1.txt; route > f2.txt; sudo dmesg > f3.txt
Then,create some more files: ifconfig.dat; dmesg > dmesg.dat
The unzip program is used to extract files out of a zipped file (also called an archive). Make another directory using this command: mkdir test and run the following command. Now unzip the file using this command : unzip lbook1.zip
We can view the contents of a zip file without extracting anything by running the following command: unzip -1 lbook1.zip
Part3
Run the following command: cd/tmp
Create a file: sudo dmesg >file1.txt and run ls -la command , remember the info because we will use it later.
Now suppose we have sent that file to someone that is running a Linux system and want to ensure it did not get corrupted along the way. Run the fllowing command: sum file1.txt
- The first number is the checksum and the second is the nummber of blocks for the file. If other person runs sum on his copy of the file and sees the same info ,the files are the same.
We have created alot a files by using the redirection operator. We can also use the touch command: touch file2.txt. However,since file2.txt did not exist, touch will create as an empty file.
Let run the command : file file2.txt to prove it
Try run this command : ls -la file1.txt
Now run the following command : touch file1.txt and run ls -la file1.txt. We should notice it shows the current date and time on i
- When using the less command press the space bar to scroll down. Press Ctrl+Z to exit
Comments
Post a Comment