LAB 3


 

 


 

DKT 221/3

OPERATING SYSTEM PRINCIPLE

 

 

LAB MODULE 3


 

 











PART 1

1.     Use this command to open .bashrc file

- sudo nano .bashrc


2.     Next we need to add the export PS1 command in the .bashrc. Go to the last line of coding and add

- export PS1= "\h \u \w \$"


3.     In order to load the saved .bashrc file . We need to use this command then press ENTER

- bash

- . .bashrc



4.     To undo the change we need to go back to the .bashrc file again

- sudo nano .bashrc


5.     Next . remove this command and save the changes

- export PS1= "\h \u \w \$"



6.     After that , type the command again and press ENTER . Now we see that the PS1 is changed back to normal 

- . .bashrc






PART 2

1.     Create 3 dummy files , run and see the errors

- ls -la File with no name.txt


2. Run the command again but enclose the filename in quotation . It wil work properly now

- ls -la "File with no name.txt"


3.     Enter this command and press TAB . This will help fill in the blanks for you

- ls -la File\ with\ no\ name\.txt


4.     Run and observe the error 

- ls -la special.txt


5. Enclose the command in quotatios as we did before

- ls -la "special.txt"


6.     Type this and then try putting quotation on it . You will see that it doesn't work 

- ls -la -startswithdash.txt


7.     To fix this you need to put the ./ operator at the command

- ls -la ./-startswithdash.txt






PART 3

1.     Run the command

- ping -c 1 packt.com


2.     Next , run the command . And you should get a 0 if it works properly

- echo?


3.     Then run the command

- ping -c 1 phooney


4.     Run this command and it should return a non-zero value to show that it was a failure

- echo $?






PART 4

1.     Enter this command . There wont ba any result because the output went into the file 

- ifconfig>file1.txt


2.     Run this in order to see the output

- cat file1.txt


3.     Theres another way to read the file and that is using the command

- sort<file1.txt


4.     We can eve do both in just one command

- sort<file1.txt>output-file.txt


5.     We can also send the output to another command using the pipe operator . This would display only the lines from route that contain the phrase wlan0

- route | grep wlan0






PART 5

1.     In one terminal , we run

- tty


2. In the other terminal , run this command

- route


3.     Then run this . The output should show in the other terminal

- route>/dev/pts/0






PART 6

1. Install

- sudo apt-get install screen


2.     Run this command

- screen -list






PART 7

1.     In the terimal , run the command

- screen -L


2.     Now press CTRL+A and C .I It will create another window


3.     Type CTRL+A+0


4.     Type CTRL+A+3 . It will go to copy mode where you can copy any command that you wrote








Comments

Popular posts from this blog

LAB 2 : Exploring the ESP32 GPIOs

LAB 1