Skip to main content

LAB OS 2

__________________________________________________

** Before we start the lab, please Install and Launch Linux. **

__________________________________________________

Command retrieval and line editing

1. Type in all the commands below and press "Enter".

a) route
    - "route" is used for showing or update the IP/kernel routing table.

b) uptime
    - "uptime" is used to find out how long the system is active (running).

c) ls
    - "ls" is used to list files or directions in Linux and other Unix-based Operating Systems.

d) date
    - "date" is used to display the system date and time.

    Output of all the commands above :


2. By pressing up arrow, the previous command will be shown.

    Pressed up arrow 1 time :

    Pressed up arrow 2 times :
    
    Pressed up arrow 3 times :
    
    Output after pressed up arrow 3 times :

__________________________________________________

   **The summary of the keys used for retrieval and editing is as follows :

__________________________________________________

Using history

    - "history" is used to show all the commands that have been used recently in a list.

    Output : 

___________________________________________

Filename auto-completion

1. Use "cd Desktop" to change to home directory.

2. Use "mkdir (filename)" to create a directory. For example, I used "mkdir Linuxbook" in this lab.



3. Change to Linuxbook using the command "cd Linuxbook". Then, insert the following commands : 

        ls > file2.txt

        ls > file3.txt

        ls > file4.txt

        ls > unique1.txt

4. Create one more file using command "ls > file1.txt"


5. Type command "ls -la u" and then press Tab. The rest of the filename "unique1.txt" will

appear. Press Enter.

6. Now type ls -al file and press Tab. Nothing will happen, and your console may

beep. Press Tab again. Now all 4 file names will appear.

7. Add a 4, press Tab again, and then Enter. The command ls -la file4 will run.

    - "ls -al file4.txt" is shown after Tab is pressed.

    -This is the output after Enter is pressed.

__________________________________________________

The shell prompt


Refer to the line export PS1="\u \h \w \$ "

1. The \u command means to show the current user of this shell.

    -in this case, the user is linuxmint.

2. The \h command shows the hostname of this machine.

    -in this case, the user is linuxmint201

3. The \w command means to show the full path of the current directory. This change

    is highly recommended, as the user doesn't have to type pwd (Print Working

    Directory) all the time to know what directory is being used.

    -the output is symbol "~"

4. The \$ means to display a $ or # depending on the effective UID.

5. echo command is used to display the content of a variable.

**Below are others environmental terminals :

___________________________________________

1. Prepending a dot to the PATH means the program will be looked for in the current 

    directory first, before searching the rest of the path. This is very useful during the 

    code development for example. This can be done by putting $PATH: before the rest of the path. 

    :$PATH means the program will look for the path first before going to the current directory.


2. There is no content inside the EDITOR at first.

3. A path is assigned using command export.

4. An export can be removed by using "export EDITOR=", which is empty path.

__________________________________________________

Using aliases

By using aliases, we can easily create a simple command without having to type the full command next time.

    Here, I used some alias command. This is the list: 

    alias cls="tput clear"

    alias la="ls la"

    alias lt="ls -latr"

    **If you no longer want the alias, you can remove it by using the unalias command, for example, 

    "unalias cls", "unalias la", "unalias lt".

__________________________________________________

    This is another example of alias command.

1. First we make directory named "linuxbook1" inside Desktop.

2. By using command ' alias lbook="cd Desktop.linuxbook1" ', we will be taken directly to the     

    directory using command "lbook".

3. This is another example using export and alias.

4. Command export set a path named LBOOK. Then, command ' alias lbook="cd $LBOOK" ' is used 

    and we no need to type the whole path.

5. Lastly, we can type command "lbook" to directly go to "linuxbook1".

1. The command "touch" is used to create, change and modify timestamps of a file. 

2. The command "cp" stands for copy. This command is used to copy files or group of files or directory.

3. Here, we combined the commands export, alias, touch and cp to create a file named "f1.txt".

__________________________________________________

Thank you for reading. Feel free to ask me if you have any questions.
__________________________________________________

Comments

Popular posts from this blog

LAB 1 : D'ARSONVAL GALVANOMETER

--------------------------------------------------------------------------- Please ensure you have installed Multisim software before proceeding.  Click the link here if you want to install the software :   https://www.ni.com/en-my/support/downloads/software-products/download.multisim.html#312060 --------------------------------------------------------------------------- Objectives 1. To find the internal resistance and the currect sensitivity of the galvanometer.  Exercise 1. Set the potentiometer to 510 Ω. Connect the circuit as in the Figure 1.1 and keep the voltage source in minimum position such that voltage output from the voltage terminals  are 0V. 2. Increase the voltage supply and the galvanometer pointer will deflect towards right hand side or left hand side. You can replace the galvanometer with the DMM/Ammeter  in the Multisim. Assume R g is 1.2 Ω for the given galvanometer. Vary the voltage supply until the galvanom...

Lab 3 : Blynk Application

--------------------------------------------------------------------------- Please ensure you have installed ESP32 properly in Arduino IDE software before proceeding. Click this link if you want to install Arduino IDE :  https://www.arduino.cc/en/software --------------------------------------------------------------------------- Please ensure you have installed and setup Blynk application before proceeding. (Take note that I am using the OLD VERSION of Blynk app in this lab.) Click this link if you want to install Blynk application :  https://blynk.io/ Click this link if you want to setup Blynk application :  https://microcontrollerslab.com/control-esp32-outputs-blynk-app-arduino-ide/ --------------------------------------------------------------------------- Part A : Blynk Application   Below are the circuit connections :  --------------------------------------------------------------------------- This is the Google Drive link of the coding for Lab Pract...