JB

VM Connections and Linux Commands

Connecting to VMs and X2Go

  • To connect to VMs, use the port number provided.
  • For USQ students, the username is your student ID after removing everything before the "@" symbol.
  • X2Go can be downloaded following the link in the announcement.
  • Wi-Fi connections may cause issues with connecting to the YesFi network.
  • The exercises will be based on VM1.
  • Ensure all items are correct based on the provided instructions.
  • VM can be accessed in the browser.

Exercise 1.6: Software Upgrading and Installation

  • Use sudo before install or update software, to gain root permission. If sudo doesn't work, switch to the root user directly using:
    • su root
    • The password is the initial password.
  • Two commands are used: sudo apt update and sudo apt upgrade.
    • sudo apt update: Checks for updates (index update).
    • sudo apt upgrade: Upgrades the software itself.
  • To stop a process, use Control + C.

Installing Software

  • Command which <software-name> checks if a software is installed.
  • If nothing is returned after using the "which" command, then the specified software is not installed.
  • Install software using:
    • sudo apt install <software-name>
  • Examples of software to install: tree, wget.

Exercise 1.7: Checking Processes

  • ps -u $USER: Shows processes running for the current user.
  • top: Lists users and their processes on the machine.

Exercise 1.8: Environment Variables

  • Environment variables can be understood as global variables for the terminal session.
  • Set an environment variable:
    • export <variable_name>=<value> (e.g., export cost_code=123)
  • View the value of a variable with:
    • echo $<variable_name>

Exercise 1.9: Downloading Files with wget

  • Use wget command to download a file.
  • The file (GPL 3.0 text file) can be found in the PDF documents.
  • Command Example:
    • wget <URL>

Exercise 1.10: Creating and Editing Text Files with vi or vim

  • Use vi or vim to create or edit a text file:
    • vi <filename.txt>
  • If the file exists, its content will be displayed; otherwise, a new file will be created.
  • Press i to enter insert mode.
  • To save and exit:
    • Press Esc to exit insert mode, type :wq and press Enter (write and quit).
  • To discard changes:
    • Press Esc to exit insert mode, type :q! and press Enter (quit without saving).
  • Using Nano text editor
    • nano <filename>
    • Use Ctrl + X to exit Nano. It will prompt to save the changes.

Installing a New System in Hyper-V and WSL

  • In Hyper-V, you can install VMs from ISO files.
  • In the Windows Store, search for "WSL" to find and install different Linux distributions like Debian.
  • After downloading, the system can be set up with a username and password.