Console-Only Communication: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
(Copy from old)
 
No edit summary
Line 15: Line 15:
* Basic file management operations (<tt>cp</tt>,<tt>rm</tt>,etc);
* Basic file management operations (<tt>cp</tt>,<tt>rm</tt>,etc);
* Using a console-based file editor (<tt>pico</tt>,<tt>vi</tt>,etc);
* Using a console-based file editor (<tt>pico</tt>,<tt>vi</tt>,etc);
* [http://www.casino-spielen.biz online casino spiele]


== Virtual Consoles ==
== Virtual Consoles ==

Revision as of 09:18, 14 July 2010

HOWTO: access on-line resorces on the internet using only console-based tools.

Overview

Many times, particularly when things aren't working as expected, you may find yourself restricted to a console-only (non-X or non-graphical) session. If you have networking running, you can still access on-line support tools through your console. This tutorial shows you how to:

  • Use virtual consoles to increase the number of consoles you can use simultaneously;
  • Use the screen to create sessions that are persistant even after you close the console;
  • Use irssi to access the irc network and ##slackware on irc.freenode.org;
  • Use lynx and wget to access HTTP (web) server information;
  • Use lynx to pastebin a file when you need to send configuration information to an IRC channel, and;
  • Use wget to download a pastebin file to your local machine.

Prerequisites

This tutorial will assume you are comfortable with the following concepts:

  • Basic file management operations (cp,rm,etc);
  • Using a console-based file editor (pico,vi,etc);
  • online casino spiele

Virtual Consoles

One of the handiest features if you're relegated to working from a console is the use of virtual consoles. This allows you to start multiple login sessions from the same console keyboard, mouse, and monitor. That way, you can have one virtual console logged into IRC so you can talk to ##slackware, one that you can use for web access, and another that you can use to test commands.

Using virtual consoles is easy. Simply hold the ALT key while hitting the F2 key (ALT+F2) to switch to the second console. To switch back to the first console, use ALT+F1. You have virtual consoles available on F1 through F6.

If you're using X, you can still access one of the virtual consoles, which is useful if X is hung up for some reason (especially if X won't restart using ctrl+alt+backspace). To access this virtual console, hold CTRL *and* ALT while pressing the F6 key (CTRL+ALT+F6). To switch back to your X session, press CTRL+ALT+F7.

Using screen

The screen utility allows you to start a console session which is persistent across login and logout. This is useful, for example, if you're using IRC -- perhaps you want to stay logged into your IRC channel even after you have logged out of your console session. The concept is straightforward: when you run screen, it gives you a bash prompt "inside of" the screen session. At this new bash prompt you can start your IRC session. When you wish to log out, you can detach from screen and log out -- but screen continues to run in the background. When you log back in, you can re-attach to your screen session and resume your IRC session.

Visit this page for the specifics on attaching and detaching sessions using screen.

Using irssi

The irssi program is a console-based IRC client. Using irssi, you can access the ##slackware IRC channel on irc.freenode.net.

  • WARNING*: Whenever you are using any type of IRC client on any type of machine, make sure that you are not doing so as the superuser (root). Doing so is a security risk, since if for some reason an attacker is able to successfully attack your IRC client, the attacker will have root access to your machine.

To access the ##slackware channel on irc.freenode.org using irssi, perform the following steps:

  • Start irssi:
user@slackbox:~$ irssi
  • At the (status) prompt, connect to irc.freenode.org:
[(status)] /connect irc.freenode.org
  • Once connected, set your nick:
[(status)] /nick Myl33tNick
  • Join the ##slackware channel:
[(status)] /join ##slackware
  • To exit irssi:
[(status)] /quit

Visit this page for more information on using irssi.

Using lynx and wget

You can use lynx and wget to access http (web) servers from your console session. Lynx allows you to access a web site interactively, much like using a graphical browser such as Firefox, but through a text-only console session. Wget allows you to retrieve documents from web servers non-interactively, which is handy when you need to retrieve a certain document (say a tarball or a script file) from a web server in a very quick way.

To start using lynx, from a bash prompt simply type:

user@slackbox:~$ lynx "http://www.slackware.com"

to visit Slackware's official website. To exit lynx, use CTRL+C. In the example above, the double-quotes are not strictly required. However, many URLs contain characters which have special meaning to the bash interpreter (such as the ampersand), and the double-quotes stop bash from trying to interpret those characters.

Although wget has a wide array of options (visit man wget sometime), its basic use is very simple. For example, to download the latest kernel patch (as of this writing) from kernel.org, simply do:

user@slackbox:~$ wget "http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.20.3.bz2"

Again, the quotes here are not strictly required for this URL, but are required for certain URLs. It's good to get in the habit of always double-quoting URLs from a bash prompt.

Using lynx in conjuction with pastebin

You may find yourself on ##slackware and another channel member may ask you to "pastebin" information to them. The purpose of pastebin is so that you can share technical information (for example, the contents of a configuration file) with the other channel members, without pasting that information directly into IRC itself (which is generally disliked by other IRC members and will get you banned if you try it). "Pastebin" is a generic term for a web site which offers this sort of service. There are many pastebin sites out there; for simplicity's sake, this tutorial uses pastebin.ca.

You can use lynx to access the pastebin site, but what if you need to pastebin the contents of an entire file? You can do this using the lynx program:

  • use lynx to access pastebin.ca:
user@slackbox:~$ lynx "http://pastebin.ca"
  • Page down until you see the large textbox area, move your cursor to the first line (where you see the X below):
Create a New Pastebin Post

   Welcome  to the Pastebin. For information on what this is, take a look
   at  the  What  is This? page. You may also want to see the most recent
   post to the pastebin.
 
   Please enter your new post below (or upload a file instead):

paste below


   X_____________________________________________________________________
   ______________________________________________________________________
   ______________________________________________________________________
   ______________________________________________________________________
   ______________________________________________________________________
(NORMAL LINK)   Use right-arrow or <return> to activate.
  Arrow keys: Up and Down to move.  Right to follow a link; Left to go back.
 H)elp O)ptions P)rint G)o M)ain screen Q)uit /=search [delete]=history list
  • Press Ctrl+X, then i, and enter the location of the file you wish to pastebin.
 Enter a filename: /etc/ssh/sshd_config
  • Page down until you see the "Submit Post" link, select it (it will turn yellow), and press the enter key.
  • On the next page, scroll down until you find the URL to your pastebin file. It will look something like this:
paste added to database

  Your  paste  has  been  accepted an added to the database. You will be
  redirected to it momentarily. The URL for it is:

  http://pastebin.ca/398871

  You may use that URL for referencing your submission from now on.
  • Give this URL to the person who requested the information on IRC.

Using wget in conjunction with pastebin

Every pastebin site should have a way to request any pastebin file in "raw" format, meaning without the added HTML code so that the pastebin information displays properly in a browser. Accessing the "raw" format means you can access exactly what was pastebinned, with nothing else added. This is useful if you want to download a configuration file from pastebin. If you know the raw URL of the pastebin page you need, you can use wget to retrieve the file.

  • Find the raw URL associated with the pastebin page. For pastebin.ca, this is just the regular URL with an extra "raw" directory inserted. For example, if your regular pastebin url is http://pastebin.ca/398871, then the raw version is at http://pastebin.ca/raw/398871.
  • use wget to retrieve the file, but rename it so that it's not named 398871 (in this example, the output is named "this.cfg"):
user@slackbox:~$ wget "http://pastebin.ca/raw/398871" -O this.cfg

You'll find you'll use commands like wget over and over again this way, even when you have access to a fully graphical web browser.