kelsoo's beginners guide

Share your wisdom. Not for support questions!

Moderator: How-to Curator

Building a desktop

Postby kelsoo » July 9th, 2011, 1:57 am

B2.1)Building your own desktop:

In some cases you might not want to have a full desktop environment. Old hardware, and poor or expensive internet connections and the desire for speed, are a major reasons for considering a lighter system. If you did a minimal installation of Debian without any desktop environment, you will need to build your gui by hand. You will need, as an absolute minimum, two things: the X-server (xorg) and a window manager.

You boot your debian gnu/linux system and you will see a black screen with a login prompt. Login as user and become root with typing su and your root password afterwards.

Lets assume you want to install fluxbox:

su (to become root)
apt-get install xorg fluxbox (to install the necessary packages)
xorg --configure (to create the xorg configuration file)
cp xorg.conf /etc/X11 (to copy this file to its proper final location)
exit (to exit root. )

You may of course replace fluxbox with any window manager or minimal environment you prefer.


Now you will need to create a file in your home directory called .xinitrc. This contains basic instructions for starting up your gui. Make sure you are in your home directory ( /home/your_user_name). pwd should tell you and cd will take you there if necessary.

The file .xinitrc doesnt exist yet. Let's create it with the nano editor, as this is always installed and is easy to use (it shows the cheat-codes at the bottom of the screen).

nano .xinitrc
to be absolutely sure you will create it in your home directory type
nano /home/your_user_name/.xinitrc
(but replace your_user_name with your actual user name)

nano opens and you enter the following:
exec startfluxbox
Hit Ctrl and X to exit nano, you will be asked if you want to save the changes, type Y to say Yes, you will be offered to save it under the name you opened it (.xinitrc) and you hit the enter-button to accept that.

To start a fluxbox session you simply enter your user name and password to log in and then type:
startx
Your session should start.

As not everyone is using fluxbox here are some examples for the .xinitrc commands to start other window managers:
exec gnome-session
exec enlightenment_start
exec e16
exec icewm-session
exec startlxde
exec startxfce4
exec startkde
exec openbox-session
exec openbox-session-kde
exec openbox-session-gnome
exec startfluxbox

Usually the command you need is to be found under /usr/bin, so check for a promising command there:

ls /usr/bin | grep name_of_window_manager

If at some later date you decide that you want a graphical login, you can simply install a display manager like gdm or slim.

More options:
http://wiki.debian.org/xinitrc
If you want to auto-login, check this how-to:
viewtopic.php?f=9&t=313#p3900


table of content
Last edited by nadir on July 9th, 2011, 3:00 am, edited 2 times in total.
"It's warm in the crowd, but it stinks" -- Miroslav Krleža
kelsoo
 
Posts: 65
Joined: February 13th, 2011, 1:21 pm
Location: Scotland

Window Managers

Postby kelsoo » July 9th, 2011, 1:58 am

B2.2) Window Managers:compositing, Stacking,Tiling.

An overview of window managers:Stacking:
A lot of Debian users don't use a full desktop environment like gnome or kde-full (composting window manager http://en.wikipedia.org/wiki/Compositing_window_manager ). Some prefer to install a smaller version of the desktop environment they like: gnome-core or kde-minimal. Some prefer installing a window manager. Desktop environments also make use of a window manager (to manage how windows are shown on the screen).
Gnome uses metacity
Kde uses kwin
Xfce uses Xfwm4
and lxde uses openbox
but they also come with a whole environment. It's kind of a comfort, you get all kinds of applications and tools that you need, for example automounting of partitions, a display (login) manager, etc.
When using a window manager on its own, you will need to add the applications and tools that you want yourself.
http://en.wikipedia.org/wiki/Comparison ... w_managers
http://en.wikipedia.org/wiki/Metacity
http://en.wikipedia.org/wiki/KWin
http://en.wikipedia.org/wiki/Xfce#Xfwm

Which way to go?
In general there seem to be two ways to make use of a window manager:
a) you can install it on top of the desktop environment you already have. At the login-window choose to boot into it and you are done.
The advantage is that you may use all of the applications you already know and don't need to worry about an application going missing
b) you can also choose to install a minimal Debian system without a desktop environment during the installation (tasksel).
As a minimum you have got to install xorg and a window-manager to be able to make use of a graphical environment. Perhaps you want to add a display manager (gdm, kdm, xdm, slim),
so that you will get a graphical login screen.
After that you can add all the applications that you need and will have to configure the look&feel to your needs.

About how to install with the second method and how to do the fine-tuning you may want to have a look at one of the following how-to`s:
-http://forums.debian.net/viewtopic.php?f=16&t=5450 ### icewm configuration by Lou
-http://forums.debian.net/viewtopic.php?f=16&t=5382 ### fluxbox configuration by Lou
-http://forums.debian.net/viewtopic.php?f=30&t=47561 ###enlightenment configuration by Bro.Tiag

Tiling window managers: Overview:
Tiling window manager are window managers without frames. This means that there is no "window", as such to grab and move with a mouse. Instead they tend to be keyboard driven. They also tend to use your screen real-estate to the maximum. The advantages of tiling window managers is they are faster, slimmer and don't tend to rely on a mouse. The disadvantages is they tend to be the hardest to configure and assume much prior knowledge.
As a Beginner, unless there is an over riding need to use one. It is recommended that you become familiar with a Desktop environment or an ordinary window manager first. That said, if you are wanting to learn and run an often command line based system they are well worth looking at.

http://en.wikipedia.org/wiki/Tiling_window_manager

Awesome window manager:
http://forums.debian.net/viewtopic.php?f=16&t=36453
http://en.wikipedia.org/wiki/Awesome_(window_manager)

EvilWM
http://www.6809.org.uk/evilwm/

Rat poison
http://www.nongnu.org/ratpoison/

XMonad
http://xmonad.org/
http://xmonad.org/tour.html
http://en.wikipedia.org/wiki/XMonad

I may add to this section. You may want to....

File managers:GUI:overview
Konqueror
Dolphin
Nautilus
Thunar
PCManFM
Rox-filer
gentoo
xfe
xfehttp://roland65.free.fr/xfe/index.php?page=home

I may add to this section. You may want to....

File managers:CLI:overview
GNU Midnight Commander
http://www.midnight-commander.org/


table of content
Last edited by nadir on July 9th, 2011, 2:25 am, edited 1 time in total.
"It's warm in the crowd, but it stinks" -- Miroslav Krleža
kelsoo
 
Posts: 65
Joined: February 13th, 2011, 1:21 pm
Location: Scotland

Terminal Emulators

Postby kelsoo » July 9th, 2011, 1:59 am

B3) The command line:

B3.1) terminal emulators

The Terminal window:overview

windowed:
mrxvt:
http://code.google.com/p/mrxvt/

Aterm:
http://www.afterstep.org/aterm.php

Konsole:
http://konsole.kde.org/

Eterm:
http://en.wikipedia.org/wiki/Eterm

xterm:
xterm is the default terminal, so it always is there. Why not get used to it and use it ?
copy and paste the following and create an .Xdefaults in your home-directory:
nano /home/your_user_name/.Xdefaults
and insert it:

!after editing .Xdefaults it may be reloaded with:
!xrdb -load ~/.Xdefaults

xterm*VT100*geometry: 94x28
xterm*font: -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-1
xterm*background: black
xterm*foreground: lightblue
xterm*loginShell: true
xterm*scrollBar: true
xterm*rightScrollBar: true
xterm*title: XTerm
xterm*iconName: XTerm
xterm*saveLines: 50000
xterm*jumpScroll: true
xterm*scrollTtyOutput: false
xterm*scrollKey: true
xterm*alwaysUseMods: true
xterm*metaSendsEscape: true
xterm*utf8Title: true

check for different fonts in: /usr/X11/fonts/
run:
xrdb -load
and voila: you got a useful or readable xterm
http://invisible-island.net/xterm/xterm.faq.html
http://en.wikipedia.org/wiki/Xterm

Dropdown: Quake style:
guake:
http://www.guake-terminal.org/
tilda:
http://tilda.sourceforge.net/wiki/index.php/Main_Page

Splitscreen:
terminator:
http://software.jessies.org/terminator/


table of content
Last edited by nadir on July 9th, 2011, 2:25 am, edited 1 time in total.
"It's warm in the crowd, but it stinks" -- Miroslav Krleža
kelsoo
 
Posts: 65
Joined: February 13th, 2011, 1:21 pm
Location: Scotland

Editors

Postby kelsoo » July 9th, 2011, 1:59 am

B3.2) Editors:

Command-line editors: CLI.

Every Linux distribution includes at least one command-line editor. These editors work independently of the graphical X interface and can therefore be used for rescue and repair work even if X is down. They can also be used, of course, in a terminal window within X. The most commonly used command-line editors are nano, vi and emacs.


The nano editor
This, as its name implies, is the smallest and simplest of the command-line editors. Almost every Linux distribution includes it. It is derived from pico, which was originally an editor that came with the pine email client. Nano does not include "bells and whistles" like syntax highlighting.

Most nano commands consist of keystrokes modified with either the CONTROL key or the ALT key. The function keys along the top of your keyboard can be used as alternatives to some of these. Printable characters are not commands and are always treated as text to be input. Nano is thus not a modal editor like vi. The most commonly used commands are displayed in two lines at the bottom of the nano screen. These include the output (save) command (^O or F3), the exit command (^X or F2) and the help command (^G or F1). The arrow keys (plus HOME, END, PAGE UP, PAGE DOWN) are used for navigation.

The help command displays all the commands used in nano.

Because nano displays its most commonly used commands as "cheat codes", novices often find it the easiest of the command-line editors to use.

http://www.debianadmin.com/nano-editor-tutorials.html
http://www.nano-editor.org/docs.php

The vi Editor
vi (pronounced vee-aye for Visible Interface) is an old Unix command line editor, still much loved and used. It was the first editor to show the whole of a file rather than just the current line. The version of vi used in Linux is called vim (vi improved). It is adapted to the PC keyboard and has a lot of extra functionality such as syntax highlighting. vi has a rather steep learning curve but is a very fast and powerful editor.

vi is a modal editor; what you enter via the keyboard will be interpreted differently according to what mode or internal state the program is in. There are three main modes: normal, insert and command line.

You start in normal mode. All keystrokes are interpreted as vi commands, which are executed immediately; if the keystroke does not correspond to a valid command, you get an error bleep.

There are several vi commands that switch you to insert mode. In this mode, what you type is interpreted as text and put into the file. There is a variant of insert called replace, in which new text overwrites old. You can toggle between insert and replace with the insert key. In vim (but not in the original vi), the word INSERT or REPLACE is displayed at the bottom of the screen to show you when you are in either of these modes. You return to normal mode by pressing the escape key.

The ":" command switches you to command line mode. A command line appears at the bottom of the screen where commands can be typed and entered with the return key. The read, write and exit commands belong to this mode. You can even access shell commands.

There is a graphical form of vim called gvim which is perhaps easier for novices to use. It has a menu bar and a toolbar and supports the usual mouse operations as well as all vi commands.

vim comes with an excellent online manual. Simply type "vim" without specifying a file and press F1.


emacs:
http://www.gnu.org/software/emacs/tour/


table of content
Last edited by nadir on July 9th, 2011, 2:26 am, edited 1 time in total.
"It's warm in the crowd, but it stinks" -- Miroslav Krleža
kelsoo
 
Posts: 65
Joined: February 13th, 2011, 1:21 pm
Location: Scotland

text processing commands

Postby kelsoo » July 9th, 2011, 2:00 am

B4) Commands:

B4.1) Commands for processing the contents of files:

Linux has a number of commands which enable you to look inside files. Here are a few of them.

cat filename: Lists the contents of a file to the terminal.

file filename: Shows the type of data that a file contains: e.g. ascii text, shell script, executable program, image file, etc.

grep pattern filename[s]: Searches for a text pattern within one or more files. The pattern may be a literal string or a more complex regular expression involving partial wild cards. The output consists of the line matching the pattern (and optionally some context lines). If a group of files is searched, the output also contains the file name within which the pattern was found.

head [-n] filename: Lists the first n lines of a file (default 10)

less
filename: Lists the contents of a file page by page. You can move backwards and forwards using Page Up and Page Down and also search forward for particular patterns or strings using /, or backwards using ?. less is the pager used internally by the man command.

more filename: Similar to less but less flexible. You move forward by pressing the spacebar and backwards with b or ctrl-b. You can only search forwards. One advantage of more when processing files is that it tells you what percentage of the file you have covered. Another common use for more is to page the output of commands. So ls -l|more gives a full listing of a directory, page by page.

readlink filename: This only produces output when filename is a soft link (shortcut file). It shows the file or directory that the link points to.

tail [-n] filename: Lists the last n lines of a file (default 10). The opposite of head.

Regular expressions have been mentioned under grep. They can also be used in search mode within more or less, within the vi and emacs editors, and in a number of other traditional UNIX utilities for analysing text. A regular expression can be something as precise as a literal string or as vague as a wildcard – or anything in between. Regular expressions allow you to include everything you know about a string without making any unwarranted assumptions about what you don’t know.


Regular expressions can be quite complex but here are a few rules for making simple ones:

1) Most characters represent themselves. A few have special uses: the most important of these are "\", ".", "*", "+", "^", "$", "()", "[]", and "{}".

2) "\" is the escape character. Put in front of any special character, it makes that character literal and non-special. \ also works on itself! "\\" is the way to specify a literal backslash character.

3) "." represents a single wild character (the equivalent of "?" in a filename).

4) Digits within braces {} are multipliers. ".{3}" means three wild characters. Otherwise digits represent themselves.

5) "*" and "+" are wild multipliers. ".*" means any number of wild characters (including zero!) while ".+" means any number of wild characters but at least one.

6) Characters in square brackets map to a single character which may be any one of them. So "[0-9]" means any digit, "[aeiou]" means any lower-case vowel. If the first character of the group is "^", then the characters that follow are excluded. "[^,;:?!]" maps to one character which may not be a comma, semicolon, colon, question mark or exclamation mark. Note that "^" is only special when it is the first character of the group; in any other position it just represents itself.

7) Parentheses are used simply to group characters. So "(ac){3}" means "acacac" whereas "ac{3}" means "accc" .

8 ) Outside of square brackets, "^" represents the beginning of a line. "$" represents the end of a line.


table of content
Last edited by nadir on July 9th, 2011, 2:26 am, edited 1 time in total.
"It's warm in the crowd, but it stinks" -- Miroslav Krleža
kelsoo
 
Posts: 65
Joined: February 13th, 2011, 1:21 pm
Location: Scotland

file/folder handling commands

Postby kelsoo » July 9th, 2011, 2:00 am

B4.2) File and folder handling commands:

These commands duplicate the work of graphical file managers like nautilus, Konqueror and thunar, but they are often a lot faster, especially when processing large directories.

cd pathname Goes to the specified directory. Without pathname, goes to the home directory. cd $OLDPWD is a convenient way to get back to the previous directory (OLDPWD is a variable automatically created by the bash shell).

chgrp new_group filename Changes the group ownership of a file that you own personally. The new group must be one that you belong to.

chmod [u][g][o][a]±[r][w][x] filename

Changes the access permissions for a file, granting or refusing read (r), write (w) or execute (x) access to the user/owner (u), the group (g), others (o) or all of them (a).

chown [new_owner].[new_group] filename Changes the ownership (personal, group or both) of a file. For security reasons, only root can use this command.

cp filename1 filename2 or cp file[s] directory The first form creates a copy of a file with a new name; the second copies the file into another directory. This second form can be used with multiple filenames or a wildcard. To copy files to the current directory use ‘cp pathname[s] .’ Here the dot serves as a synonym for the current directory .

ln [-s] target linkname Makes a link to a file. The -s option produces a soft link like a Windows shortcut. Otherwise a hard link is made. Hard links are simply synonymous names for the same file, whereas a soft link is a separate file that accesses another file by name.

ls pathname Lists the specified directory. Without pathname, lists the current directory. ls has many options. The most useful are probably:

-a to list all files including hidden ones

-l to list in long format: type, access permissions, owner and group owner, size, creation date and name. For a symbolic link file, the target file is also shown

-h used in conjunction with -l gives file sizes in bytes, kilobytes or megabytes as appropriate (otherwise only bytes are used)

-R lists recursively, i.e. contents of subdirectories as well.

mkdir pathname Creates a directory

mv filename1 filename2 or mv file[s] directory Renames a file or moves it to another directory. To move files to the current directory use ‘mv pathname[s] .’ cp and mv use very similar options. Useful ones include -R, which copies or moves directory trees recursively, -d, which copies link files rather than their targets, and -f which forces overwriting of any files of the same name. Otherwise if a file with the same name as the target file already exists, you are asked if you want to overwrite it.

pwd (print working directory) This displays which directory (folder) you are currently in, in the file system

rm filename Deletes a file. This command has several useful options: rm -i asks for confirmation before deleting. You can set this as a personal default. The system default is not to ask. Rm -f cancels the previous option if you have chosen it as your normal way of deleting. Deletion takes place without asking for confirmation. rm -R deletes directories with all the files in them.

rmdir pathname Removes an empty directory. It is also possible to delete directories that contain files but not with this command.


table of content
Last edited by nadir on July 9th, 2011, 2:27 am, edited 1 time in total.
"It's warm in the crowd, but it stinks" -- Miroslav Krleža
kelsoo
 
Posts: 65
Joined: February 13th, 2011, 1:21 pm
Location: Scotland

miscellaneous commands

Postby kelsoo » July 9th, 2011, 2:01 am

B4.3) Miscellaneous useful commands:

There is no limit to the commands that can be run from a terminal, since the name of every program that is installed in your command path becomes a useable command. However the following commands are particularly useful.

`apropos string` lists commands whose brief descriptions contain string. It is a good way to find out if there is a command that does a particular thing.

date prints the current date and time. It can also be used, with suitable options, to reset these.


dmesg prints out the recent kernel messages. Usually these are the boot messages, as the kernel seldom has anything to say once the system is running smoothly. This is a good way to check for recent kernel error messages.


echo prints its argument to the terminal. It is a good way of finding out the values of current shell variables. For example echo $PATH will print out your current command path.

find searches for files in the current directory (or in a specified directory) and its sub-directories. It is a very powerful utility which can search by name, ownership, permissions, date, size and many other properties, including combinations. Most commonly you search by name: find -name filename. Note that if the filename includes special characters, including wild characters, you will have to enclose it in quotes.

`kill process_ID` or `kill command` is used as an emergency killer for processes that have stalled or are otherwise misbehaving. A process running on a terminal can usually be crashed with CTRL-C or CTRL-\. However the kill command may be necessary for background or graphical processes.

locate search-string searches for files anywhere in the system. Unlike find, which works in real time, locate uses a precompiled database which needs to be updated regularly (preferably every day). It is thus much faster than find but not as reliable. locate interprets its argument as a string, not a filename; it will return all filenames that contain the string. It also accepts regular expressions (see paragraph on Regular expressions in file content processing document below) which allows for more precise matching.

mount
devicename mounts a storage device such as a floppy, cdrom, dvdrom or pen-drive. Desktop environments like gnome automount devices when they are plugged in, but if you want to use a simpler desktop in order to save resources, you will need to mount them by hand. This simple form of the command works if the device is listed in /etc/fstab with the user option set. Without this option, you will need root access. For devices not in fstab you need root access and, in addition, you must specify the mount point and the file system used:
e.g. mount devicename mount_directory -t filesystem.


umount
devicename unmounts a storage device mounted with mount. If it has the user option set in fstab, it can be unmounted by the user who mounted it; otherwise you will need root access. You can also use umount mount_directory.

whatis command gives a brief summary of what a command does. This will work for any command that has an associated manual page, whether it is on the current command path or not.

which command is a quick way to find out if a command is available. If it is, the full pathname will be returned. Note that which only searches your current command path; by default, the command path of ordinary (non-root) users does not include the system directories /sbin and /usr/sbin so, unless you have added them, commands in these directories will not be displayed


table of content
Last edited by nadir on July 9th, 2011, 2:27 am, edited 1 time in total.
"It's warm in the crowd, but it stinks" -- Miroslav Krleža
kelsoo
 
Posts: 65
Joined: February 13th, 2011, 1:21 pm
Location: Scotland

GTK, QT et al.

Postby kelsoo » July 9th, 2011, 2:01 am

B5) Graphical user interface (GUI):

GTK + QT:
Are tool kits used to create GUI's, for applications. Because these tools kits offer a slightly different look and feel. Many people try to stick to one or the other when choosing applications. Some popular applications are available built with either tool kit. There are also "themes" that are available to make them look similar.

GTK:
http://www.gtk.org/
http://en.wikipedia.org/wiki/Gtk
GTK+ is a highly usable, feature rich toolkit for creating graphical user interfaces which boasts cross platform compatibility and an easy to use API. GTK+ it is written in C, but has bindings to many other popular programming languages such as C++, Python and C# among others. GTK+ is licensed under the GNU LGPL 2.1 allowing development of both free and proprietary software with GTK+ without any license fees or royalties.

QT:
http://qt.nokia.com/products
http://en.wikipedia.org/wiki/Qt_(toolkit)
Qt is a cross-platform application and UI framework. Using Qt, you can write web-enabled applications once and deploy them across desktop, mobile and embedded operating systems without rewriting the source code.

Features

* Intuitive C++ class library
* Portability across desktop and embedded operating systems
* Integrated development tools
with cross-platform IDE
* High runtime performance and small footprint on embedded


table of content

Discuss kelsoo's beginners guide here.
Last edited by cynwulf on July 11th, 2011, 3:22 pm, edited 1 time in total.
Reason: added link to the discussion thread
"It's warm in the crowd, but it stinks" -- Miroslav Krleža
kelsoo
 
Posts: 65
Joined: February 13th, 2011, 1:21 pm
Location: Scotland

Previous

Return to HowTo

Who is online

Users browsing this forum: No registered users and 1 guest

x