introduction to linuxmendel.bii.a-star.edu.sg › ...ngstutorial_linuxintro.pdf · introduction to...

14
Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima BII, A*STAR Singapore

Upload: others

Post on 04-Jul-2020

19 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Introduction to LinuxUsing Windows Subsystem for Linux (WSL)

Slides prepared by Jhoann MiyajimaBII, A*STAR Singapore

Page 2: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Starting Ubuntu Terminal

click Windows Icon

Page 3: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Starting Ubuntu Terminal

click onUbuntu 18.04 LTS

Page 4: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Starting Ubuntu Terminal

Page 5: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Getting around Linux system

pwd- print working directory

- to know which directory you are in

- forward slash(/) denotes the base of Linux file system

- user directory is usually like "/home/username"

Page 6: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Getting around Linux system

cd- change directory

cd ..- to move one level up to parent

directory

cd <specific directory>- For example:

change directory to C:\

Page 7: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Getting around Linux system

lsprint the contents of current directory

(folders/files/programme/etc)

Page 8: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Creating a new folder

First go to “Documents” folder

- From current directory: /mnt/c

(the long way)

cd Users -> cd User -> cd Documents

(the short way)

cd Users/User/Documents

Page 9: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Creating a new folder

mkdir- make new directory

mkdir <folder name>- For example we want to make a

new folder and we name it “newFolder” mkdir newFolder

- Opening a windows browser, you should see a newly created folder with the name “newFolder”

Page 10: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Deleting a folder

rmdir- Remove directory

rmdir <folder name>- for example we want to remove

the “newFolder” rmdir newFolder

- checking with windows browser, “newFolder” should now be removed

Page 11: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Printing ‘Hello World’ – Starting nano

nano- text editor for Linux System to create your first

Perl script/code

nano <name of Perl script/code>.pl- For example: nano myfirstprogramme.pl

Page 12: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Printing ‘Hello World’ – Inside nano

You can see the name of your Perl script/code

Page 13: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Printing ‘Hello World’ – Inside nano

Type the command:

print “Hello World!\n”;

To save and exit:Ctrl + o EnterCtrl + x

Page 14: Introduction to Linuxmendel.bii.a-star.edu.sg › ...NGStutorial_LinuxIntro.pdf · Introduction to Linux Using Windows Subsystem for Linux (WSL) Slides prepared by Jhoann Miyajima

Printing ‘Hello World’ – Back to Ubuntu

To check if perl script/code is present:

ls you can see it here!

To run your Hello World script:

perl myfirstprogramme.pl

Hello World! is now printed