LAB_4_192020356

LAB 4 192020356

We will use the dmesg program, which shows information about the running kernel, for this example. If it is not available, or if your computer has been running for a long time, the following may not match up quite right on your system.




PART 1 Using grep to find pattern

1. Run the following command: cd /tmp




2. Use dmesg to create a file, so we can search for some information about your system:






















3. Let's see if we can determine what network device is being used. Ru n: grep network dmesgl.txt







4. Command: grep -i network dmesgl.txt









5. Command : grep -i cdrom dmesgl.txt












6. Command: echo$?
    













7.  Command: grep -i jimlewis dmesgl.txt and then run command: echo$?

























PART 2 Using ZIP to compressing file


1.  Run cd /tmp, then make a temporary directory name lbooktemp. After that run command 'cd lbooktemp' . Next create some files with command 'ls > f1.txt; route > f2.txt; dmesg > f3.txt'.






2. Create some more files name ifconfig.dat and dmesg.dat, then package and compress the first one into a single file. Next use command 'zip lbook1.zip *.txt' and 'zip lbook1.zip *.txt *.dat'.













3. Make another directory name 'test'.





4. The unzip process is show in figure below.


















PART 3 Using TAR to compressing file

1. Use the same file as before: cd /tmp/lbooktemp





2. Create a gzip compressed archive file.








3. Run 'file lbook1.tar.gz'






4. Run the following command 'cp lbook.tar.gz test', 'cd test', 'tar xvzf lbook1.tar.gz' .


5. Run 'ls -la' then type 'tar tvzf lbook1.tar.gz' for tell option











6. Then type 'tar tvzf lbook1.tar.gz' for tell option






7. run 'cd /tmp' and 'tar cvzf lbooktemp1.tar.gz lbooktemp'
























PART 4 Other helpful command such as stat, sum, touch and more

1. Run 'cd /tmp' and 'dmesg > file1.txt' to create a file name 'file1.txt' in tmp.








2. Run 'ls -la'





























3. Run 'stat file1.txt' command in terminal












4. Run 'sum file1.txt' command






5. Run 'touch file2.txt' command and 'file file2.txt'


6. Run 'ls -la file1.txt' and 'touch file1.txt'

7. Run 'ls -la' 



8. Run 'less file1.txt' and it will output a command list for less.

 


9. Run 'head file1.txt'



10. Run 'tail file1.txt'


--------------------------------------LAB END HERE----------------------------------------------








Comments

Post a Comment

Popular Posts