Presentation is loading. Please wait.

Presentation is loading. Please wait.

3.4 User Interfaces This tutorial will give you a first-hand experience of: Navigating the directory structure in a CLI and an unfamiliar GUI Running the.

Similar presentations


Presentation on theme: "3.4 User Interfaces This tutorial will give you a first-hand experience of: Navigating the directory structure in a CLI and an unfamiliar GUI Running the."— Presentation transcript:

1

2 3.4 User Interfaces This tutorial will give you a first-hand experience of: Navigating the directory structure in a CLI and an unfamiliar GUI Running the same program from both a CLI and a GUI Writing and running your own programs via the CLI and a GUI Exiting a CLI and a GUI …all on a Raspberry Pi instead of a PC

3 3.4 User Interfaces By the end of of the tutorial, you need to present a summary of how to achieve these things in a CLI and a GUI: Finding a file by navigating the directories/folders Creating a folder Running a program Creating a text file Creating and running your own program Finally, you will write an evaluation that compares CLIs to GUIs in general terms based on your personal experience

4 The Raspberry Pi It is a computer, it just happens to be small
It uses a Linux operating system, not Windows The operating system and all programs and data are stored on flash memory, not a hard disk drive

5 The Raspberry Pi You will notice that its performance is somewhat inferior to the PC that you are used to You will also notice that it does not have obvious buttons like an on/off button If your Raspberry Pi freezes or stops working correctly, do not guess what to do. Seek help to prevent it from getting damaged.

6 Part 1 Command Line Fundamentals

7 Turn it on and log in Switch the Pi on at the plug
Wait for the password prompt The login details are: USERNAME: pi PASSWORD: raspberry When keying in the password, no characters will appear on the screen. Why do you think this is?

8 Command line fundamentals
You will be brought to this command prompt: ~ $ To operate a command line interface, you key in COMMANDS followed by any PARAMETERS that are needed

9 Command line fundamentals
At the prompt, type pwd This will show you the full path to the current working directory pwd stands for “print working directory”, as we use the word “print” to refer to output to the screen and not the printer in this context Since this is where it took you first, you have just learned where your HOME directory is

10 Command line fundamentals
In Linux, the HOME directory will be your user area In Linux, the ROOT directory is at the top of the tree structure that holds all user areas and computer settings together To get back to your HOME directory, type in cd ~ To get to the ROOT directory, type cd /

11 Command line fundamentals
Go to your HOME directory using what you saw on the previous slide You are inside a folder, and now we want to see what is found inside this folder, so type in ls Read the screen carefully, then type ls –l What is the difference between ls and the very similar ls –l?

12 Command line fundamentals
Using ls -l, you can now see that some of the items in your folder/directory are themselves folders/directories If you want to switch into one of the folders in the list, use cd folderName The name of the folder is an example of a PARAMETER. The COMMAND is cd, which changes directory, and its parameter is the name of the “destination” folder

13 Command line fundamentals
Use cd Pictures to switch into the folder of pictures Using what you know, show the list of all pictures stored in this directory Hopefully by now you are comfortable that a folder is a directory. We’ll call them directories from now on.

14 Command line fundamentals
By now, you should be in the Pictures directory. How do you know that? To return to the directory that holds this directory, use cd .. Think of cd .. as “go one step up the directory tree” To move 2 steps up the tree, use cd ../..

15 Command line fundamentals
Go to your TASK RECORDING SHEET now and ensure that you have answered all questions before moving on

16 PART 2 MAKING DIRECTORIES AND FILES

17 Making directories Go to your HOME directory
Make a subdirectory called briefNotes as follows: mkdir briefNotes The name of the directory is briefNotes so it is supplied as a PARAMETER when the command mkdir is used

18 Making directories Step into your briefNotes directory
Make 2 subdirectories inside briefNotes that are called “Technical” and “General” Go back to your HOME directory by typing in just 1 command Use a mixture of cd and ls to ensure that you have completed this correctly

19 Making a file To make a new text file, go to the directory in which you wish to make the new file and type in touch fileName.txt Practise this by navigating to your HOME directory and creating a file called ShoppingList.txt Create 2 more text files of any name of your choice to practise creating empty files

20 Deleting a file To delete a file, go to the directory where the file lives and type in rm fileName.txt Practise this by deleting the 2 files of any name that you made previously, but keep the text file called ShoppingList.txt Create a directory called trasher and immediately use rm to delete it Use ls to verify the success of your deletions

21 Deleting a directory To delete a directory, go to the directory above it and type in rm –r direcName The -r is called a FLAG. What other command have you encountered already that uses the –l flag? -r is required because it goes through the directory and removes all of its contents before removing the directory itself

22 PART 3 Running A Program

23 How to run a program There is a program built in to Linux called nano
It is a plain text editor, just like Notepad You should be conscious of which directory you are in before you run the program To run nano, simply type nano You will see a blank screen and you can start typing into it

24 How to run a program When you want to save your work for the first time, nano will ask you to give it a name and a file type (you control this) The directory that it will be saved into is the same directory from which you launched nano You use Ctrl+O on the keyboard to save the file in the directory that you are working in

25 How to run a program Try using nano to create a plain text file called Playlist.txt in your HOME directory in which you store a list of songs that you intend to play at a party, simply listing each one on a new line of the text file After saving it, to exit nano use Ctrl+X To check that your file exists use ls, and to read it use nano Playlist.txt

26 How to run a program You can run many programs in Linux simply by typing in their names Scratch is a GUI-based program and could not run in a command line environment, so when it is run from the command line, the operating system invokes its GUI capability and supports the running of the program Try typing scratch at the prompt

27 PART 4 PROGRAMMING

28 Programming To program means to write code that will cause the computer to do what you tell it to Python is one of many programming languages that humans can learn and computers can understand We have already learned how to use nano to edit text files, so now we will edit a Python program using nano and run it using python

29 Programming Choose your HOME directory to work in
Use touch hello.py to make a new Python file (observe that it is not a text file, but nevertheless it is built from purely plain text) Open the file you have just made in nano using nano hello.py

30 print(‘Hello world’);
Programming Type the following Python code into your newly created Python file: print(‘Hello world’); Use your nano skills to save and exit the file Run the program thus: python hello.py

31 PART 5 Exiting the command line

32 Safely exiting the CLI If you want to switch out of the command line and go into the GUI version of Linux, type startx When you are ready to shut down the Raspberry Pi completely, type sudo halt Wait until all processes are finished before disconnecting the power supply


Download ppt "3.4 User Interfaces This tutorial will give you a first-hand experience of: Navigating the directory structure in a CLI and an unfamiliar GUI Running the."

Similar presentations


Ads by Google