working with GNU/Linux

I am building a small resource here covering the small number of issues I have dealt with in the early days of using, in this case, Ubuntu and its Kubuntu variant (most tips apply to other distros as they use the command line - though as administrator, Ubuntu prefers sudo to su for "superuser" - look up what these mean and why it may be preferable to use sudo!).

before despair

Before you start flailing around if you cannot do something you want to do (or worse, give up and go back to W****), examine the help files in the distro. I prefer KDE to Gnome and have not tried Xfce and other desktop environments so the first port of call if you do likewise may be "K menu > Help" - the KDE Help Centre is a marvellous resource and is worth browsing to get an idea of its scope. After that go to your distro web site and have a look around. In the Free Software environment it is expected that you do a bit of research before you ask your questions on a forum such as a distro forum or your local GNU/Linux Users Group. When you do, you will be guided to give sufficient information to define your problem so someone can resolve it for you. You may even be taken by the hand step by step, for example, being asked to copy the contents of a log file or other essential file to your emmail. You are quite likely to be asked to say what distribution and edition you are using. Don't forget that many people have been where you are now and many of these will be very willing to assist a newcomer as they were helped themselves.

command line

Some of the methods I have used have required me to learn how to use the command line. Any Graphical User Interface (GUI) for any task or function on the computer can actually be replaced by typing in commands in a terminal (console or shell). Indeed mome experts actually prefer to use the command line for all activities as the commands can be very succinct indeed - additionally there is not a GUI/applet/widget for all commands. To do this, find the terminal in your menu or in your task bar and type away. A useful place to start is with the tutorials in the downloadable file called "rute" - google search? You should familiarise yourself with basic commands like "ls" (list all files in the current directory) and "cd" (change directory). Note that the folder "Documents" may be shown with a capital D. This is needed if you want to cd to "Documents". It will not find "documents"!

You can also always find any command you have previously used by using the up arrow key which will take you through the history of all your command line adventures. This is an excellent way to hold the results of your researches if they end up wih command line work.

manuals

The "manual" for a command or programme can always be found by typing "man command". It is always rather cryptic and condensed - not for the faint-hearted! Try "man ps" or "man kill" - if you use an epson printer, try "man escputil".

killing a process

Occasionally a programme will lock and nothing seems to close it. Use the command line: type "ps ux" and you will get a long list of all the processes open. If the terminal window is not wide enough and cuts off half your lines, just widen it and repeat the command. Find the offending process by examining the information in the end right column. For your selected process, in the left hand column, headed PID, note the number (x). Then type "kill x", where x is the PID of the process you wish to kill.

printers

Printers are extraordinarily easy to install as they "plug and play" after you boot up. There is a wonderful GUI for printers which you can access using your browser.

For more detail, open a browser and enter http://localhost:631 and you will find everything about your installed printer in the CUPS pages. CUPS is the Common Unix Printing System and is maintained by Apple Inc. In many ways it is easier to work from these pages than from the distro interfaces - but it is one of many options Linux offers you.

using a desktop printer from a laptop

On the desktop you will publish your printer to the network and on your laptop you will set it to show all network printers. Open a a terminal and type http://localhost:631 > select manage printers and then > publish your selected printer. On your laptop in the same CUPS page > select administration, then > check show printers shared by other systems.

epson ink level

On the command line in (k)ubuntu I use the following: "sudo escputil --ink-level --raw-device /dev/usb/lp0"
This can be shortened to "sudo escputil -i -r /dev/usb/lp0"
or even "sudo escputil -ir /dev/usb/lp0".
This invokes administrator prerogatives so the next thing is to type in the requested password. The output is the % ink remaining in all the colours. I usually wait until one is zero! If you have not got escputil in your computer, if it is a debian variant such as ubuntu, type "sudo apt-get install escputil".

backups with rsync

In a terminal, I type
"rsync -avz ~james/.* /media/FREECOM/rsyncjameshiddendesk/". What this means is open the rsync programme and copy all the files in the folder james including the hidden files. In /media/ all my media are listed, including my usb disk, named FREECOM in which I had created a folder called rsyncjameshiddendesk. In the first instance, it copies all the files and folders, though some may not be copyable (usually unimportant ones). The next time I do this, it runs through all the files and will copy only changes since the last backup. Any individual file can be retrieved from the backup at any time as needed.

To copy in your computer, change my user name (james) to your own and change the disk to whatever your computer calls it. Note that if there is a space between 2 or more words (e.g. USB DISC), these cannot be typed as just the space. Either enclose the whole name in apostrophes as "USB DISC" or replace all spaces with \(space) where space is a single space thus in inverted commas "\ " so USB\ DISC. The \ is command line code for "read the next character as is". In my case, the name was FREECOM HDD and it took a while to cotton on. In the end, before I discovered the above, I renamed it in Windows!

To copy only all documents change the source in the above line to /~james/Documents/ and create nd mount a directory which tells you that you will have only documents from your Documents folder. In my case, I copy all the hidden files, problably mostly redundant, because all my evolution emails, contacts and folders are stored there in the hidden file .evolution. If you use another programme - find out where these are stored and ensure you back them up too.

Restoring files if you lose them all is the reverse - all your latest backup can be completely restored in one line and a short wait! I just haven't needed to do this yet.

access to blocked files

One time, I could not access my backup files because I needed to be root (actually I had booted the computer with the backup disk connected, so it mounted with root permission only). To change ownership back to me I used a terminal and the command "sudo chown -R james /media/FREECOM/". I can also do this by opening konqueror in a terminal with sudo konqueror and navigating to FREECOM and changing permissions as root. Closing konqueror means returning to ordinary (safe!) control.

using files remotely within the LAN

Linux has always had superb networking capabilities. To set up my desktop as the server I first amend the exports file using
"sudo kate /etc/exports"
add the line
"/home/james/Documents 192.168.1.13(rw,sync,no_subtree_check)"
This will make the file /home/james/documents available to 192.168.1.13, the url of my laptop (note this may change if another computer is logged in before the laptop and therefore need amending) then use the command
"sudo exportfs -ra"
This did not work first time so I had to also use the following
"sudo /etc/init.d/nfs-common restart"
"sudo dpkg-reconfigure portmap" and
"sudo /etc/init.d/portmap restart"
This file is now available on any reboot.

To set up the client machine I first created the directory in the client machine: in my case /home/james/office-desktop-2. Then used the command:
"sudo kate /etc/fstab" to edit the file system table (fstab) with details of to find the file and where to put it by adding the following line so it mounts at every boot:
"192.168.1.12:/home/james/Documents /home/james/office-desktop-2 nfs rsize=8192,wsize=8192,timeo=14,intr"
then I mount the file for this session: "sudo mount 192.168.1.12:home/james/Documents home/james/office-desktop-2".
What you have to do is provide a directory for the files to go to - you mount one - in this case it is called office-desktop-2 and it resides in my home directory. The server has the url of 192.168.1.12 located by my router. This is more or less constant. I have to mount it each time I reboot, though as as I usually suspend to disc, the desktop is accessible as long as it is switched on. So I can work in bed on my desktop. source article

There is version of this to access any computer from outside the LAN, say home from office or desktop from laptop in a remote location such as by a cafe on a beach. I have not yet wished to do this.

This document is at http://www.kilty.demon.co.uk/linux/working.htm

site map | home > back to top

Note all pages print in Times New Roman without navigation

Valid XHTML 1.0 Strict Valid CSS!

content last modified October 3 2009; hand-coded to xhtml strict standard