working with GNU/Linux

This is a small resource here covering the small number of issues I have dealt with in the early days of using Linux, in this case, Ubuntu or its Kubuntu variant (most tips apply to other distros as they use the command line). This is for a person new to Linux.

before you 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 now prefer Gnome to KDE and have tried Xfce (nice and straightfoward) 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 or Gnome's "System > Help and Support". 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 Groups. 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 email. 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 most 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? There is a splendid tome called "The Linux Command Line" "A LinuxCommand.org Book" by William E. Shotts, Jr. available as a pdf. 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 (well 500 by default) available at . This is an excellent way to hold the results of your researches if they end up wih command line work. Typing "history" will list all your history for a quicker way to find an older command.

However, you may prefer to delve into your computer system administration options to discover if you can do what you want with recourse to some widget or other. Otherwise just type in exactly what your researches tell you. If it doesn't work, check your typing first, then check if you need to vary something to suit your computer as it is, in the network it sits in. For example, you may have a url assigned by your router. In my case, hovering the mouse pointer over the wireless connection indicator shows the name of the router I have connected to, and the allocated IP address, usually 192.168.1.13.

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".

playing dvds

Interestingly Windows and Mac computers will play dvds instantly, as they have come with the appropriate codecs (coder-decoders - to code and decode digital data) installed. Linux distros often do not contain them, to avoid any potential legal problems in certain countries. This means we have to install them ourselves. Some popular distros like PCLinuxOS and Mint do have them. Test first. Then consult your distro web site for details of installing such as libdvdcss (css is the content scrambling system) and perhaps libdvdread4. Instructions for my ubuntu based distro are here.

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. If you know the name of the process, such as "firefox", type pkill (process name).

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.

printer not in CUPS

Not all drivers have been written for Linux/other Unix systems (such as Mac), especially new ones, so will not appear in CUPS. I tried to setup our new WP-2630 and was directed round in circles until I discovered that there was a recommended generic printer ESC/P-R driver package called "epson-inkjet-printer-escpr_1.6.3-1lsb3.2_i386.deb" which I installed from their web site into my new Mint 17.3 upgrade (others for other OSs). This apparently works on all Epson printers. Just enter your printer name into Epson drivers and software. Install through CUPS > administration > add printer > check the printer it found for you and continue. Your printer should be listed now.

using a desktop printer from a laptop

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

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". There is also a utility called "Mtink" in Accessories (Gnome).

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 "FREECOM" in Windows!

To copy only all documents, change the source in the above line to /~james/Documents/ and create and 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, probably 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. I should probably back up my .evolution files separately to save space! I have not tried the "--exclude=PATTERN" option - see "man rsync" for the whole range and examples of how to do it.https://help.ubuntu.com/10.04/internet/C/networking-shares.html (different if you have a later distro!) I satill have not upgraded because of all the changes. I may try ROSA soon as it is reputed to render flash like Chrome.

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. However, old, forgotten files in your archive can be retrieved in the usual way. It seems incredibly versatile.

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 with root privileges. Closing konqueror means returning to ordinary (safe!) control. I do like konqueror but other file managers will do the same. Just check their name.

accessing files remotely within the LAN (Local Area Network)

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" (you might subsitute gedit for kate)
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 may 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 (directory) is now available on any reboot.

To set up the client machine I first created a receiving directory in the client machine: in my case /home/james/office-desktop-2. Then I used the command:
"sudo kate /etc/fstab" to edit the file system table (fstab) with details of where to find the file, and therefore where to put the data 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.

gui for this in Ubuntu 10.04 LTS

All the above is now automated in the (not the) latest LTS version of Ubuntu. In the Places menu there is a Network option which shows all files available on the network. To make them available, right click on any folder or file you wish to share and find the menu option "sharing options". If this is your first time, you will be prompted to install the necessary packages. Remember to set the password otherwise you won't get in. If you do forget you can modify the one automatically set for you as follows in a terminal:
"sudo smbpasswd -a (your username)" and follow the instructions as if you were accessing Windows files. For full details see networking-shares.

streaming dvds/videos

I have just needed to stream a dvd as it would not play in my laptop but would in my desktop. I have no idea why. However, VLC has many capabilities including streaming dvds and videos to the network or to a specific network computer. I found the information at videolan's website. I already had VLC installed - a widely used programme for many OSs - I had tried using its GUI without success. No longer afraid of the command line, I put in
$ sudo vlc -vvv --color dvdsimple:// --sout udp://192.168.1.13 --ttl 3 --sout-all
into my server and
$ sudo vlc -vvv rtp://
in the laptop. The former opened VLC and started serving it - it did need the client open first! dvdsimple is supposed to start the dvd at the beginning of the actual film. The url is that of my laptop. ttl --3 is because I have a router and a wireless relay (2 routers + 1=3). It works very well.

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

Rubbish bin full!

Having the message "Trash has reached maximum size" was a mystery to solve. Google search provides many answers. The simplest is to navigate to ~/.local/share/Trash. You can do this by opening your file manager and going to your Home folder i.e. home/james/ in my case, checking "show hidden files", navigating down to .local>share>Trash. You will see folders and a file called metadata. Delete it after right clicking on the Trash icon in your panel (if it is not there, right click on the panel and add it!) and deleting all files ("Empty the Rubbish Bin" in 10.04 - yes I will upgrade soon!) Now you can delete more files and folders and Trash will recreate the metadata - if you keep the Trash folder open, you will see this happen.

usb stick has no accessible data!

Saving data to a usb stick has one potential flaw. When you remove the stick, you must "Safely Remove" it. This completes the file-saving process. If you "Eject" or take it out prematurely, you break the file system. I did this having moved my music collection using the GUI instead of copying it. When I checked it, it told me I had no file system. Even the Disk Utility (in System in mine) could not mount it. It could tell there was a "disc" and it had a partition, but little more.

The programme "TestDisk" and its companion "PhotoRec" (photo recovery) came to my rescue. It can be installed from the software centre or synaptic as long as the universe of programmes is one of your sources. apt-get install testdisk does the job. sudo testdisk gets it going and tells you what is going on. sudo photorec opens the recovery programme and guides you to save any data recovered in a different folder. I used my Temp folder and retrieved all files without their original names - lost in the file system manager. Opening them shows the content so it is easy to rename them. See TestDisk web site. Thankyou Christophe Grenier.

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 Febraary 8 2016; hand-coded to xhtml strict standard