Kubuntu Guide 08

08 — Software and Files

In Windows you may have encountered seeing parts of the file system designated with C:\something\stuff. The backward slashes are opposite of what you see in things like URLs on the Internet. That’s in part because the Internet was born on Unix machines and the Unix/Linux file system uses the forward slash. Linux treats everything as a file, and can incorporate it into it’s own file system. Thus, you don’t have to worry about that C: business; if Linux is aware of something being part of the file system, it doesn’t need to note the drive letter. The starting point — the “root” — of the file system tree is simply / with nothing else. If someone wants to tell you where to look in the Linux/Unix file system on a computer, it simply starts with that first slash and builds from there, dropping down into the file structure. You’ll see this anytime you seek information or help with Linux.

As you might expect, Linux puts the software into a somewhat different structure than Windows does. We won’t take a tour of that structure right now, but if you want a technical overview, this is where to start. Just don’t be surprised when instructions indicate you need to navigate within the file system, or that you have to do it on the CLI.

The software collection that comes with Kubuntu is comprehensive for most purposes. Linux distributors tend to offer a wide range of whatever could be available for use on Linux, building the software for you so that it all fits neatly and you can be comfortable installing just about everything you need from the same people who built the underlying OS. If you dig in the K menu, you’ll find something about software; the application is called Muon. It’s not bad for helping you find common stuff, but it’s really not too helpful if you need something special.

Part of what makes this difficult is that the underlying Debian OS breaks everything up into tiny little sub-packages and installing just about anything necessitates extra goodies. We call those “dependencies” — having and using one thing you understand depends on having a lot of other stuff you might not understand so well. The names of these packages can be quite obscure. You can eventually get used to it, but it probably takes awhile. Muon tends to oversimplify, but the alternative means jumping into the most complicated thing you can imagine. But that’s a part of the DIY philosophy.

To introduce both the packaging system and the CLI at one time, we will add a few packages so you can observe how it works, and learn a little CLI work in the process. It’s going to be very easy, because all of the commands can be cut-n-paste from this document into your CLI, using the mouse-paste mentioned earlier.

Look in the K-menu under System and find Konsole. Open this up, size and position it according to your tastes. If you poke around in the menu for this thing, you’ll find something called Profile that can be edited; there’s an Appearance tab and you can select a different font and color scheme. This where you do CLI on Kubuntu. In generic Linux terminology, Konsole is a type of “terminal window” or “console,” as the name indicates.

If you’ve ever used the CLI in windows (cmd.exe) it’s not that different, though the specific commands are. In theory, everything you type will be a (1) command, (2) some parameters or switches and (3) the object on which the command operates. Sometimes (2) and (3) might be assumed by the command itself, but this is the basic idea. There may also be multiple objects and multiple switches, but the basic concept is those three. On the Linux CLI, everything is case sensitive, and most system commands are lower-case.

Our first command is ls — lower-case LS — follwed by hitting the ENTER key. (You always have to hit the ENTER key to execute a command.) This is basically the command to list the files and directories in the current location in the file system. That’s normally your Home directory. What you see is not everything there because Linux/Unix has an old tradition of keeping stuff out of the way that might not interest you most of the time. By adding a period to the front of any file or folder name, it becomes “hidden” in the sense of not intruding unnecessarily. If you want to see the hidden stuff, just add a switch to the last command telling it to list all files, like this: ls -a. What you see now includes a few items with periods in front of their names. Typically the folders are in blue letters and normal files are in white (particularly if you keep the black background). Other file types may be given other colors, and we’ll learn as we go along.

Like Windows, Linux is conscious of who owns file and folders. In Linux the scheme is much simpler and much more strictly enforce. If you really want to understand the technical details, you can read this tutorial. Then you can use yet another switch on that list command to see who owns the files and what permissions are included: ls -l. What matters is that, unlike Windows, you can decide whether a file can be executed like a command. We call that “setting the execute bit,” which is tagging a file with execution permission. You can set these things graphically in Dolphin when you right-click on any file icon and check the Permissions.

The other thing that matters about this is another thing familiar from Windows: administrator privileges or super-user privileges. In Linux, the administrator is called root, and you need root permission to change the system files. There’s more than one way to do this, but in Kubuntu it’s handled on a temporary basis using a special command in front of any other command: sudo. Think of it as “super-user do” — not technically accurate, but close enough. When you use sudo with any other command, you’ll need to supply your password. You’ll be asked to type it blindly, because that prevents anyone else seeing it over your shoulder — it’s an old Unix thing and unlikely to change. Once you succeed in typing it correctly, the command executes. For the next few minutes, you can continue executing sudo commands without having the enter your password every time.

We need to install a few packages that are not included by default, and change how one of them works. Don’t be afraid; be cautious and precise. The system tends to complain if you do something wrong, but this is no place to clown around. It’s like a three-year-old with a very highly developed vocabulary, and will do exactly what you say, but only if it knows how.

The package system underlying Muon is called apt. This is how Debian-based systems keep track of what is installed and what each thing depends on to work. There is no “registry” in Linux; all of that management is divided up in different ways. We use the CLI and apt commands to query and change the packages installed. Let’s get started. In a separated blockquote below is the first command to execute; use your mouse. Press the left button and wipe it across the command with all the spaces in between, none before or after the line.

sudo apt-get update

That’s invoking the sudo privilege, apt-get is the specific form of the apt command, followed by the update switch. When you have that in your mouse buffer, move over to the Konsole window and press the middle mouse button. If you have only two mouse buttons, use them both precisely together at the same time. If all else false, highlight the command, type CTRL+V (as in Windows), the go to the Konsole window and use the menu: Edit > Paste. It will do just that and the results are the same either way. Hit ENTER (always) and be ready to type in your password blindly (you can also paste it if you have it in a file somewhere, I suppose). What happens after you succeed in gaining access to the command is the system queries the servers at Kubuntu and checks to see if the available list of packages is up to date.

You’ll see a lot of feedback on the screen. When it’s all finished, you’ll get back the prompt waiting for you to issue the next command. Do you still want those nice screensavers? Let’s ask apt what we can get.

sudo apt-cache search screensaver

This time we query the cache of apt data. The list you get back includes a lot of things you simply don’t need, but the query feedback is typically generous. Get used to that. It’s not just names of packages, but functions within the package or things even simply associated with it. This is how you find out what apt thinks might provide what you seek. If what you need is simply some particular capability or a way to handle certain file types, using apt to search for the packages related to those things can be very educational. You’d be surprised what a huge collection of software is out there for your system. In this particular list of search results, I will save you some research and tell you that we need some packages based on the term xscreensaver. Installing some of those will increase the list of screensaver options in your System Settings. Here’s how you install them; it’s all one line.

sudo apt-get install xscreensaver xscreensaver-data-extra xscreensaver-gl-extra

This tells apt to fetch these three items, plus anything that they depend on. You’ll get back a fairly big list of extra stuff and a question if you really want to do this, to which you must answer yes (y) or no (n). Then it will download and install them, giving you lots of feedback about what it’s doing. Give it time; watch to see so you can get used to this process. When it’s finished, the prompt comes back to wait on the next command. By the way, if you go now to System Settings to pick a new screensaver, it will probably tell you it needs one more package to make it work properly. Go through the drill and click the right buttons, give your password again, and let it finish installing. I’m not sure what it’s not included when you install the new screensavers in the first place, but that’s how it works.

Do you intend to try learning how to connect your Kubuntu machine to a shared printer on a Windows machine on your home network? You’ll need one more package: python-smbc. You’ve just been shown how to install it, so use the same command but change the package. Oh, wait; you can repeat the previous command on the CLI the same way you do in Windows — hit the up arrow key. Then hit the END key and backspace to remove the three xscreensaver packages and type in the one shown here. Hit ENTER again and it executes regardless where the cursor is sitting on the command line. Using the printer setup dialog, you connect using the Samba protocol: smb://winbox/winprint — change “winbox” to whatever your Winbox calls itself (host name). We assume you already have your Winbox printers set up for sharing with a nice nickname for the printer share, because that’s what goes on the end. Be ready to give the login credentials to the administrator account on that Windows computer.

We need to do one thing while we are here and turn on your firewall. Unless you know for certain you don’t need one, it’s a good idea to protect your system from bad guys trying to gain control from the outside. We need to issue two separate commands to the firewall already installed by default on Kubuntu — the Uncomplicated Firewall.

ufw enable
ufw default deny

Each of those is a separate command. The first turns on the firewall; the second tells it to use some simplified default rules to deny improper access to your system from outside.

That’s enough for this lesson.

This entry was posted in meta and tagged , , , , , , . Bookmark the permalink.

One Response to Kubuntu Guide 08

  1. Pingback: Outline: KDE on Debian 8 | Do What's Right

Comments are closed.