Chapter 5
The easiest way to use your Pi is to open the built-in desktop. The Pi’s desktop looks and works like other computer desktops. It’s not exactly the same as a Windows or Mac desktop, but it’s close enough. You don’t have to learn a whole new way of using a computer.
To make the desktop appear, type startx and press Enter when the dollar sign appears after you power up the Pi and log in with Pi as the username and “raspberry” as the password.
The Pi loads its desktop app — this takes a while — and eventually you see the screen shown in Figure 5-1. You can now click around with your mouse, open, drag, resize and close windows, launch apps, and do all the things you usually do on a desktop.
If you have an older version of the Pi software, you may see the screen shown in Figure 5-2. This is the old version of the desktop. It has all the same stuff, but some of it is in different places.
The old version is easier to understand. Icons for important apps like Scratch and Python are right in front of you. To launch the apps, double-click them.
In the new version, you can see the same things by clicking the menu at the top left. Scratch and Python are inside the Programming menu. To launch them, single-click them.
Don’t sweat the differences. Both desktops have the same options. This book uses a mix of desktops so that you can get used to both. The desktop may change again in the future, so it’s good to understand that sometimes things move around!
What does everything do? The desktop is split into two main areas.
The taskbar is the area with the clock, the icons, the menu, and the graph thing with a percentage, which I explain in the upcoming section “Use the Activity Monitor.”
On the old desktop, the taskbar is at the bottom of the screen. On the new desktop, it’s at the top.
The old desktop has a few icons floating on it. On the new desktop, the background area has the Trashcan icon, and nothing else.
When you open a window, it floats over the desktop area. You can drag the window around, resize it, and do all the usual things to it.
To drag a window, click the colored area at the top with the name and/or description. It’s called the title bar because it looks like a bar and it has a title.
You can click any window edge and drag it. You also can click a window bigger or smaller by clicking the bottom right corner.
The top right of the window has three small buttons. In order, they hide the window, make the window fill the screen, and close the window.
When you open a window, the desktop creates a tab in the taskbar. When you hide a window, the tab stays in the taskbar so that you can click it to show the window again.
Figure 5-3 shows a desktop with a handful of windows and tabs. All the windows are hidden, except one.
Click on the Taskbar menu, and you can see submenus with all kinds of apps and features. If you’ve used the desktop on a Windows PC or a Mac, you can probably guess what some of them do.
The taskbar also has quick launch icons. They get special treatment. Icons in the desktop area are often hidden behind open windows, which makes them hard to use, but you can always see the quick launch icons.
Here’s the list of quick launch icons for the new desktop:
This book doesn’t have much to say about the last two items. They’re for older Pi users who need help with high school and college math.
But you need to know how to use the first three items in the list to get the most value from the Pi’s desktop.
To use a Quick Launch app, click its icon. Your Pi launches the app, and its window appears on the desktop.
Desktop windows all work the same way.
Epiphany, shown in Figure 5-4, is the Pi’s web browser. It works just like any other web browser. You can type a URL into the URL box and open multiple tabs. Figure 5-4 shows Epiphany with the main Google page loaded.
But it’s not quite like other browsers, and there are a couple of things you need to know about it.
The first thing isn’t a big deal. The weird name means sudden realization. It’s really just an excuse to give the Pi a web browser with a name that has pi in it.
The second thing is more important. The Pi is not a fast computer, and Epiphany is not a fast web browser. It can take a minute or two for some pages to load. Epiphany also has problems loading some pages. If you see an error message when you try to load a page, it’s not usually your fault.
In Epiphany, you can search the web for a word or phrase by typing it into the URL box and pressing Enter. Epiphany uses a search engine called Duck Go. It gives similar results to Google, but includes bigger ads. If you want to use Google instead, you can open the main Google page (www.google.com
) and search from there.
Files are the information you store on your computers. To keep files organized, they’re often kept in folders. Folders can contain more folders. Or more files. Or both. (But they can’t contain squirrels. Which is a good thing.)
To help you find your way around, the Pi includes a file manager app called File Manager.
You can find the icon to the right of the web browser icon in the taskbar. It looks like a battered filing cabinet. To launch File Manager, click the icon. Figure 5-5 shows the file list that appears.
File Manager shows a list of folders at the left of the window. To see the files inside a folder, click it. The files appear in the right of the window.
To see the folders inside a folder, click the tiny triangle next to the folder name. When a folder is open — showing the folders inside it — the triangle points down. When a folder is closed, the triangle points to the right, at the folder name.
The complete list of folders is called the directory tree because it’s a bit like an upside-down tree. The tree builds down from a root, which is the super-important everything-starts-here folder.
This folder is so important it has a super-important name. It’s called / — a single backslash.
If you refer to Figure 5-5, you can see that the superimportantrootfolder includes a lot of other folders. They hold the files and folders that make your Pi work.
You can also see a folder called pi at the top of the list. This is your home folder. Every user on a Pi has a home folder. Because you spend a lot of time at home, File Manager includes it in the directory tree so that you can get to it quickly without having to find it in the main tree.
The directory tree gives every single file in your Pi its own address — which is just the list of folders you need to click through to get to the file.
Addresses look like this:
/home/pi/mystuff/and_so_on…
To get to a file at that address:
As you open more and more folders, File Manager always shows you where you are. It’s hard to get lost.
Here’s a real example, which takes you to the pre-installed apps in your Pi, including the web browsers mentioned in the sidebar “Using other web browsers”:
/usr/share/raspi-ui-overrides/applications
See whether you can click your way through the address to find the files. You’ll need to scroll down through the tree to see all the folders in /usr/share because there’s a lot of stuff in there.
Figure 5-6 shows all the apps in File Manager. The folder includes the apps in the desktop menus and some others. You can double-click any of them to launch them.
You’ll soon discover that the Pi doesn’t let you look inside certain files and folders. In fact, you’re locked out of most of the file system!
There is a reason for this. The Pi’s Linux operating system locks you out deliberately so that you can’t break something byaccident. As an ordinary user, you’re not allowed to touch the Pi’s moving parts or stick your finger into any power sockets.
Frustrating, huh? It would be even more frustrating if you were locked out forever. But there is a back door. If you know the magic words, you can promote yourself to a special god-user called root and gain superpowers that let you do whatever you want.
Chapter 10 has more about becoming the god-user. You don’t need to worry about it for now. You only need god-mode if you’re installing new software or changing something important in your Pi.
Your Pi often needs to think for a while when you ask it to do something. Windows computers show you an hourglass while they’re thinking. Mac computers show a spinning colored wheel, which is sometimes called the pizza wheel even though no one has ever seen a pizza with all those colors.
The Pi has the Activity Monitor. It’s the box with a scrolling graph and a percentage at the right of the taskbar.
The Activity Monitor is more important than it looks because it shows you how hard your Pi is working. At 0 percent your Pi is doing nothing. At 100 percent, your Pi is working very hard. If you ask it to do something when it’s working very hard, it’s going to take longer than usual to do it.
The Desktop menu includes a selection of useful apps. To open the menu, click the Menu button at the top left of the taskbar.
On the old desktop, click the spiky shape (it’s the logo for the desktop, but you’d never guess) at the bottom left.
You can drag the mouse over the menu items to see more items in each group. Click an app to launch it.
Figure 5-7 shows the Accessories.
The desktop includes an editor. You can make a small change to the Pi to make it easier to use on a network.
To edit a file using the Leaf text editor, start by clicking the taskbar Menu button and drag the mouse over the Accessories item. Move it to the right and down a bit and click the big green leaf icon labeled Text Editor.
The text editor loads with a blank window. You can type text into the window with your keyboard, edit the text with your keyboard and mouse, and choose File ⇒ Save As to save the file.
You can also load an existing file by choosing File⇒Open. The editor displays a file selector.
The selector works a bit like a smaller version of File Manager. It has a list of folders and shortcuts at the left and a window showing the files in each location at the right.
But it doesn’t show the super-important folder named /. Instead, it has a shortcut labeled File System, — which takes you to / because / is the file system.
Double-click File System and work your way through the folders to
/etc/network
Double-click the file named interfaces, as shown in Figure 5-8. You can also click the file once and then click the Open button.
The editor loads the file. You’ll see some cryptic computer gobbledeegook, as shown in Figure 5-9. The gobbledeegook is a collection of magic words. They tell your Pi how to connect to the local network and the Internet.
If you know the right magic words, you can edit the file to make your Pi work differently.
Linux is more hands-on than Windows or OS X, and a lot of important settings are hidden in text files.
How do you know which file to edit, and how to change it? You don’t. Linux is complicated. You will never, ever be able to guess how to find most of its settings or how to change them after you find them.
You have to look them up online. Whenever you want to change a setting in your Pi, search online for instructions.
This isn’t cheating! Professional developers do it all the time when they don’t know how to do something. It’s not as neat and easy as changing a few settings in a preferences panel. But once you figure out how to do it, you can customize your Pi and make it do things you can’t do with other computers.
3.145.206.43