Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Beginner's Guide (Updated for 2023)

New to Debian (Or Linux in general)? Ask your questions here!
Message
Author
beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

The command line

#16 Post by beginners-guide »

5) Running Debian:

5.1)The command line:

You may never want to use the command line interface (CLI). If that's the case, fine, but there will be times when you need to, and have to. It's a fundamental part of running a GNU/Linux system, so it's worth getting used to the basics at least...
http://linuxcommand.org/
http://www.linfo.org/command_index.html
http://www.linfo.org/command_line_lesson_1.html


back to the table of contents
Last edited by beginners-guide on 2016-01-14 16:13, edited 1 time in total.

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

Installing software

#17 Post by beginners-guide »

5.2) Installing software:

A default desktop installation will already be set up to let you update, install, and uninstall software from the internet.

Getting software from the Debian repositories or CD's and DVD's if you have no internet or a poor connection, can be done with the command line tools, dpkg, apt, and aptitude. You can also install a GUI (Graphical user interface) application manager like synaptic. Some DEs have their own package manager frontends such as KDE Discover or Gnome Software.

Dpkg:
https://www.debian.org/doc/manuals/debi ... .html#dpkg
Apt:
https://www.debian.org/doc/manuals/debi ... ml#apt-get
Aptitude:
https://www.debian.org/doc/manuals/debi ... l#aptitude
Synaptic - The graphical package installer remover and updater:
http://www.nongnu.org/synaptic/
https://www.debian.org/doc/manuals/debi ... l#synaptic

Adding repositories and CD's or DVD's to your system:
In order for your system to know where to get new applications, libraries, plugins, and security updates, it needs to know where to get them from. This is done by adding details of the repositories and CD's to your sources.list file. This is a text file that resides in /etc/apt/sources.list

By editing this file you can completely change the software available to your system. On a normal desktop PC you can expect to have over 58,000 “packages” available depending on the exact version you installed, and if you chose to include the “contrib” and “non-free” sections of the repositories.

Debian is a Free system and as you saw from the “social contract” only includes, and depends upon free software in the core system. All software in the “main” section of the repositories in your sources.list is Free-software.

For the convenience of it users Debian also links to “contrib” and “non-free” repositories. The “contrib” section is free software that links to or depends on some non-free software. The “non-free” section is non-free software as in proprietary, rather than cost.

This is what my current Bullseye/Stable sources.list looks like with comments. You will notice a hash "#" sign in front of some lines. This "comments out" or disables it and is common practice when wanting to retain information but disable it's action, or to add comments to any configuration file.

Code: Select all

#deb cdrom:[Debian GNU/Linux bullseye-DI-alpha3 _Bullseye_ - Official Snapshot amd64 NETINST 20201203-12:50]/ bullseye main

deb https://deb.debian.org/debian/ bullseye main contrib non-free
# deb-src http://deb.debian.org/debian/ bullseye main

deb https://deb.debian.org/debian-security bullseye-security main
# deb-src http://deb.debian.org/debian-security bullseye-security main

deb https://deb.debian.org/debian bullseye-updates main contrib non-free

deb http://deb.debian.org/debian bullseye-backports main contrib non-free
 
# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.
#A short explanation: the deb part refers to the native Debian pre-compiled binary file, a deb. It's similar to a Microsoft .exe file or Mac OSX .dmg. Cdrom can point to any cdrom(s) from the package list that you may have downloaded (this was installed from a minimal netinstall image). Then we have the mirror URL address. deb.debian.org is the universal load balancer URL which is default and recommended to use in most cases. Next we have "bullseye" the version of Debian I'm running, followed by main the official free repository.

#comment: deb-src indicates that this is linking to a source file repository. You can download the source code for any program on the system, modify it, and even build and package your own software with other tools in the repository. In most cases it is advisable to comment these out to avoid updating unused lists unnecessarily.

#comment: Security updates are automatic by default.

#comment: Backports are packages which are more current than those in the default stable repositories and have been rebuilt specifically to work in the stable release. Occasionally these have new features or bug fixes which are not available in the main repository but have not been deemed to be security essential updates.

Take care to only add Debian specific repositories. Never ones for Ubuntu or other Debian based distributions. Installing a .deb package from such sources or downloaded from the internet does not mean it will run on any Debian system. The deb may have been compiled with different setting not compatible with a real Debian system.
Some third-party repositories contain packages which are built specifically for Debian, but some can destroy your system because of incompatibilities if certain packages are installed from them. These are not supported by Debian and may be difficult to find help for if something goes wrong. If you break it, you get to keep all the pieces.
Essential reading:- https://wiki.debian.org/DontBreakDebian


back to the table of content
Last edited by beginners-guide on 2022-10-24 08:57, edited 3 times in total.

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

X: the graphical display

#18 Post by beginners-guide »

5.3) The graphical display: (referred to as "X" or as "X Windows")

The X Window System is a Free (Mit licensed), cross-platform system for managing a windowed GUI (graphical user interface). If you don't want to be looking at a blank screen with a flashing cursor you will need this. Sometimes, now rarely, “X” can fail to be configured correctly on installation. It may fail completely (blank screen and said cursor) or, for example, not use the highest resolution that your monitor supports. This is why it's so useful to gather information on your graphics card and monitor first. Debian has tools to help you configure X from the command line interface (CLI).

http://en.wikipedia.org/wiki/X_Window_System
http://www.x.org/wiki/
https://xorg-team.pages.debian.net/xorg/

Wayland:
Wayland is a newer graphical system designed to replace X11. It is now default in Gnome for most cases.
https://wiki.debian.org/Wayland


back to the table of content
Last edited by beginners-guide on 2022-10-24 08:58, edited 1 time in total.

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

The basic system file structure

#19 Post by beginners-guide »

5.4)The basic system file structure:

If you come from Microsoft Windows you may well be wondering where the C, D, or E drive is! It's gone. If you come from Mac OSX, being based on BSD, the file structure may be more familiar. In Debian there is a single / root directory (folder) with everything placed in it. You can see a general view of how the subsequent directories are organised in the links below.
http://www.freeos.com/articles/3102/
https://www.linuxfoundation.org/blog/bl ... -explained
https://tldp.org/LDP/intro-linux/html/sect_03_01.html


back to the table of contents
Last edited by beginners-guide on 2022-10-24 02:54, edited 2 times in total.

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

Root and user

#20 Post by beginners-guide »

5.5) The concept of Root and user:

"root is the user name or account that by default has access to all commands and files on a Linux or other Unix-like operating system. It is also referred to as the root account, root user and the superuser. "
Ref: http://www.linfo.org/root.html
An ordinary user only has control over files in his/her own "home" directory, though they may be "allowed" access to other files and applications.

SU and SUDO:

The su and sudo commands are used in a terminal to give you root access to the system. You can of course log on as root but this is not generally a good idea; once logged on in a particular identity, you tend to continue in that identity until you log off again, and it is bad practice to work as root for long periods.

Instead you should use su to become root "for the duration". You will need to give the root password which you set when you installed Debian. Your prompt will change to show that you are now root. When you have done what you need to do as root, type exit to get back to your own identity.

The sudo command is a more selective alternative to su, particularly useful if there are several users of your system. By editing, as root, the file /etc/sudoers, you can give root access to a specific individual for specific commands only. This is much safer than letting them know the root password. The man page for sudoers gives details of the syntax for this file.

To use sudo, simply preface the command you wish to execute as root with the word sudo. You will be asked to enter your own password to prove your identity. The system will then check whether you have been given permission to execute this particular command as root; if so, it will be executed. Sudo "remembers" you for a short time so that you can give a group of sudo commands without entering your password each time.


back to the table of content
Last edited by beginners-guide on 2022-10-30 05:36, edited 2 times in total.

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

Desktop environments

#21 Post by beginners-guide »

6) Desktop environments, available repackaged on CD:

Under Windows and Mac OS you have a very limited choice as to your desktop environment (the actual interface displayed on the screen), DE for short. You get what you're given. It's a monoculture based on their file manager - Windows explorer in Micosoft Windows, and the Finder in Mac OSX.
Under Debian you get choices of several desktop environments, each with their own idea of what a good DE should be. Your choice may be influenced by which one you've used before, what your friends are familiar with, which is most similar to your current OS, or what you want to do and your PC's capabilities. You can forgo a DE altogether, if for example you want to create a server, or have an old PC so use a window manager, instead.
The look, feel and control of a Debian system can depend on many things. It can be extremely complex due to the flexibility of the system, and the users needs. Desktop environment or Window manager, and how they fit together with the huge range of applications and tool-kits, all have a bearing. Even if you choose to have no GUI, the CLI offers an amazing variety of looks and feel. The best place to start for changing the look and feel of your Debian system is the Debian repository's. Always be careful installing anything from other 3rd party external sites. If you have any doubts don't install. See: http://forums.debian.net/viewtopic.php?f=3&t=47866&

Search the repositories first with synaptic, apt or aptitude.

apt-cache search themes
apt-cache search icons
apt-cache search wallpaper

Desktop environments: (DE)
If you downloaded the first Debian CD. You will get the default Gnome Desktop which uses the GTK graphics libraries. The other most popular DE is KDE, which uses the QT libraries. There is also the XFCE (using GTK) desktop that is slightly lighter than Gnome and KDE. LXDE (GTK) is a very light DE. XFCE and LXDE are present on the same CD. Check their prospective sites before you decide which one you think is for you. You only need the first CD to get up and running. Just choose the Desktop you want. Don't download all 20 odd disks unless you need them. If your computer is powerful enough and has enough space you can install more then one DE. Then you get to choose which one you want to run at login.

https://en.wikipedia.org/wiki/Compariso ... vironments

back to the table of contents
Last edited by beginners-guide on 2016-01-14 16:32, edited 1 time in total.

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

Gnome

#22 Post by beginners-guide »

6.1) GNOME:

From the Gnome site.
"GNOME is easy to use and easy to learn: the usability project team makes sure of it. GNOME has all the software you need every day: games, browser, email, office suite, and more. In addition, excellent Windows file compatibility means you can work with files that Windows users send you, and extensive manuals and help systems mean you're never without resources. "

http://www.gnome.org/
http://en.wikipedia.org/wiki/GNOME
3rd party Themes, Wallpapers, and icon can be found here.
http://gnome-look.org/


back to the table of content

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

KDE

#23 Post by beginners-guide »

6.2) KDE:

From the KDE site.
"KDE or the K Desktop Environment, is a network transparent contemporary desktop environment for UNIX workstations. KDE seeks to fulfill the need for an easy to use desktop for UNIX workstations, similar to desktop environments found on Macintosh and Microsoft Windows operating systems."

http://www.kde.org/
http://en.wikipedia.org/wiki/KDE
http://wiki.kde.org
3rd party Themes, Wallpapers, and icon can be found here.
http://kde-look.org/


back to the table of content

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

XFCE4

#24 Post by beginners-guide »

6.3) XFCE:

From the XFCE site.
"About Xfce
"Xfce is a lightweight desktop environment for various *NIX systems. Designed for productivity, it loads and executes applications fast, while conserving system resources." - Olivier Fourdan, creator of Xfce
Xfce 4.6 embodies the traditional UNIX philosophy of modularity and re-usability. It consists of a number of components that together provide the full functionality of the desktop environment. They are packaged separately and you can pick and choose from the available packages to create the best personal working environment. "

http://www.xfce.org/
http://en.wikipedia.org/wiki/Xfce
http://wiki.xfce.org/

3rd party Themes, Wallpapers, and icon can be found here.
http://xfce-look.org/


back to the table of content

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

LXDE

#25 Post by beginners-guide »

6.4) LXDE:

From the LXDE site.
"The "Lightweight X11 Desktop Environment" is an extremely fast-performing and energy-saving desktop environment. Maintained by an international community of developers, it comes with a beautiful interface, multi-language support, standard keyboard short cuts and additional features like tabbed file browsing. LXDE uses less CPU and less RAM than other environments. It is especially designed for cloud computers with low hardware specifications, such as, netbooks, mobile devices (e.g. MIDs) or older computers. "

http://lxde.org/
http://en.wikipedia.org/wiki/LXDE
http://wiki.lxde.org/en/Main_Page
Other 3rd party Themes, Wallpapers, and icon can be found here.
http://box-look.org/
http://debian-art.org/


back to the table of content

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

Building your own system with a netinstall

#26 Post by beginners-guide »

6.5) Building your own system with a net install:

With Debian you have the choice of doing a net install a from a minimalistic CD.
http://www.debian.org/CD/netinst/
You may want to do a net install if you have a poor internet connection or old hardware that would struggle with a full DE. You could then build your own lighter system using a window manager and a file manager of your choice.


back to the table of content

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

Window managers

#27 Post by beginners-guide »

7) Window Managers:overview.

see more in the additional information section.
http://forums.debian.net/viewtopic.php? ... 91#p338591

A window manager controls the window your GUI applications run in. How you Move ,expand, hide, shrink, them, and how they inter-react with each other. There are three basic types. Composting, Stacking, and Tiling. Composting tend to be part of a Desktop environment. Some common window-managers you may use are: The "Boxes" blackbox,flux, openbox. Others include icewm, fvwm, Pekfm. All of these are quite popular with new users, so one of those might be a good start for a window manager.
http://en.wikipedia.org/wiki/Window_managers

File managers:
Quote ref: http://en.wikipedia.org/wiki/File_manager

"A file manager or file browser is a computer program that provides a user interface to work with file systems. The most common operations used are create, open, edit, view, print, play, rename, move, copy, delete, attributes, properties, search/find, and permissions. Files are typically displayed in a hierarchy. Some file managers contain features inspired by web browsers, including forward and back navigational buttons."
https://en.wikipedia.org/wiki/Compariso ... e_managers


back to the table of contents
Last edited by beginners-guide on 2022-10-24 09:01, edited 2 times in total.

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

Additional Info; intro

#28 Post by beginners-guide »

B) Additional information:

B1) Learning more: common tasks:

I may add to the sections below as and when. If anyone wants to contribute any of the below or suggest new section's in the same or similar "bite sized chunks" feel free to PM me on the debian.forums. If I can add it with out destroying the flow for new users I shall. If you find your addition is growing to big please post in into the "tips from our members" section or try and break it down. If it becomes overly technical please post to the how to section instead. I see this as an over view of facts, with each section linking to tips and solutions for the "stable" release in as few words a possible. Not a huge list of detailed tips and solutions, they should be in suitable sections of the forum in their own right.


back to the table of content

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

systemd

#29 Post by beginners-guide »

B1.1) systemd

systemd is a software suite that provides an array of system components for Linux[7] operating systems. Its main aim is to unify service configuration and behavior across Linux distributions;[8] Its primary component is a "system and service manager"—an init system used to bootstrap user space and manage user processes. It also provides replacements for various daemons and utilities, including device management, login management, network connection management, and event logging.

https://en.wikipedia.org/wiki/Systemd

Managing Services with systemd


back to the table of contents
Last edited by beginners-guide on 2022-10-30 05:46, edited 1 time in total.

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

file permissions

#30 Post by beginners-guide »

B1.2) File Permissions:

In Linux, every file and folder belongs to some user who can, in principle, control other users' access to it. Access rights are known as "permissions" and there are three types: read, write and execute. Read allows you access to the file on a read-only basis; applied to a directory (folder), it allows you access to the files within. Write allows you to modify a file or to create, remove or rename files within a directory. Execute allows you to run a program or script contained in a file or to explore the contents of a directory.

Separate permissions are granted to the file's owner, to other members of the owner's group, and to the rest of the world. The full permissions can be seen if you use the command ls -l to list the contents of a directory in "long" form, i.e. full details.The file permissions then appear on the left-hand side of the output as a string of nine characters. The first three are the read, write and execute rights for the owner, the next three are for the group, and the final three for the world. A hyphen indicates that the corresponding right has not been granted.

So rw-r----- means that the owner has read and write access, the group read access only and the rest of the world no access at all. These would be suitable permissions for a data file. rwxr-xr-x means that the owner has read,write and execute access, and everyone else (group and world) has read and execute access only. These are typical permissions for a data directory or a Linux command.

All files that you create belong to you but you do not have to set the file permissions explicitly. New files are given sensible default permissions controlled by your user mask or "umask". You can use the chmod command to change the permissions on particular files from their default values; you can also use the umask command to change the defaults permanently if you do not like them.

Note that, as a security precaution, new files do not have execute access set, although directories may. Execute access to a directory is harmless; it merely allows you to browse the contents. Execute access to a file allows any program or script contained in the file to be run, which is potentially dangerous. So if you download something from the Internet, it will not be executable unless you explicitly make it so by using chmod.


back to the table of content

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

Building your own desktop

#31 Post by beginners-guide »

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:
http://forums.debian.net/viewtopic.php? ... 33&start=0


back to the table of content

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

Window managers

#32 Post by beginners-guide »

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 (compositing 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-plasma-desktop. 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 Mutter
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
https://wiki.archlinux.org/title/window_manager

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, sddm, 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
http://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/
Double Commander
https://doublecmd.sourceforge.io/


back to the table of content
Last edited by beginners-guide on 2022-10-30 05:23, edited 2 times in total.

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

Command line; terminal emulators

#33 Post by beginners-guide »

B3) The command line:

B3.1) terminal emulators

The Terminal window:overview

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

rxvt-unicode
http://software.schmorp.de/pkg/rxvt-unicode.html

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:
yakuake:
https://apps.kde.org/en-gb/yakuake/
guake:
http://guake-project.org/
tilda:
https://github.com/lanoxx/tilda

Splitscreen:
terminator:
https://gnome-terminator.org/
tmux
https://www.hamvocke.com/blog/a-quick-a ... e-to-tmux/



back to the table of content
Last edited by beginners-guide on 2022-10-24 09:30, edited 2 times in total.

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

Editors

#34 Post by beginners-guide »

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/


back to the table of content

beginners-guide
Forum Account
Forum Account
Posts: 68
Joined: 2010-12-20 19:18
Been thanked: 4 times

Commands

#35 Post by beginners-guide »

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


back to the table of content
Last edited by beginners-guide on 2022-10-24 02:58, edited 1 time in total.

Locked