Vector Linux 5.8

Documentation

 

Discover the Power of the CLI

CONTENTS

  1. Introduction
  2. Useful CLI applications
    1. mc - File manager
    2. mc - FTP client
    3. Lynx - web browser
    4. wget - download manager
    5. mc - package installer and remover
    6. mount - disk mounting
  3. Other CLI References
  4. Credits



1. Introduction

Have you ever found yourself in a situation where a system refuses to enter the GUI and you need to edit some configuration file or download a patch or a driver? Some operating systems are almost useless if you can´t access their GUI, but a strong point in Linux is that you can do a LOT from the Command Line Interface (CLI), often called "text mode", to administer or rescue your operating system.

If you are unable to enter the GUI (X windows system) you will probably find yourself in a text console. You then login using your login name and your password. Many of the commands below can be run as a normal user, but for system type commands (installing packages, mount and many others) you will need to login as "root". If you are in a GUI you can enter CLI commands in a console terminal program such as aterm, xterm, mrxvt, xfterm or konsole.


2. Useful CLI applications

2.1 Filemanager

Type "mc" to open Midnight Commander. It is a filemanager (so you can move, copy and delete files with it). But mc is much more than a file manager. Press F2 to see its extended menu capabilities. Press F1 to read the Help File and/or type "man mc" in a console. With mc you can also change file ownership, file permissions, create symbolic links, view tar files and packages, install packages, etcetera.

2.2 FTP client

mc is also an ftp client. You start mc, then press F9, press "P" or select "FTP" on the menu. You will reach a dialog where you must enter the connection details; press F1 to see instructions about the format. Or you can use the Linux command line ftp client: "ftp". Read "man ftp".

2.3 CLI web browser.

Type "lynx ftp.nluug.nl/pub/os/Linux/distr/vectorlinux/" and you will be browsing in CLI mode a mirror of the VectorLinux server. Browse around to get the files you need, then move them with mc to their appropriate location.

2.4 Download manager

There is a command line utility named wget wich can be used as a Download Manager. It is not interactive but is rather a "set and forget" application. Basically, you need to type ´wget´ followed by the address of a file and it downloads that file (or an entire directory) to your current directory.

wget http://www.someserver.com/files/thisfile.tgz

Among other features, it can be used for http and ftp links, just type "man wget" to learn about it´s many options. It excels at the automatic downloading of an entire website.

2.5 Package installer and remover

Yet again, mc proves to be incredibly useful.

  • Install packages.
    To install a package, open mc, browse to the directory where the package is located, select it and then press
F2 -> select install current .tgz package -> press [Enter]

You could also install it by using the command installpkg <packagename>, but you need to be in the directory where the .tgz file is located.

  • Remove Packages.
    To remove a package, open mc, then browse to the /var/log/packages directory, select the one you want to remove and press
F2 -> remove a package listed in [...] -> press [Enter]

2.6 Mounting drives by CLI

Before attempting a mount via the command line we suggest you read the Vector Linux Mounting Manual. Attaching another device to your filesystem is easy. All you have to do is use the mount command, along with a few options. Using mount can also be made much more simple if the device has an entry in the /etc/fstab configuration file. For example, let's say that I wanted to mount my CD-ROM drive and that my fstab file looked like the example from the previous section. I would call mount like this:

# mount /mnt/cdrom

Since there is an entry in fstab for that mount point, mount knows what options to use. If there wasn't an entry for that device, I would have to use several options for mount:

Mounting a CDROM Drive:

# mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom

Mounting a Windows Fat32 partition with root-only access:

# mount -t vfat -o rw /dev/hda1 /mnt/win

The -t iso9660 is the filesystem type of the device to mount. In this case, it would be the iso9660 filesystem which is what CD-ROM drives most commonly use. The -o ro tells mount to mount the device read-only. The /dev/cdrom is the name of the device to mount, and /mnt/cdrom is the location on the filesystem where we will mount the drive.

Before you can remove a floppy, CD-ROM, or other removable device that is currently mounted, you'll have to unmount it. That is done using the umount command - note that there is no "n" in "umount"! You can use either the mounted device or the mount point as the argument to umount. For example, if you wanted to unmount the CD-ROM from the previous example, either of these commands would work:

# umount /dev/cdrom
# umount /mnt/cdrom


Note: Since version VectorLinux 5.0 you can create and remove "mount points" using VASM, however, devices will not be mounted automatically; so this guide can prove useful when you need to mount a device but you can´t use a GUI application for some reason.

Top


3. Other CLI References

The above information only touches the surface of the power of the CLI. Newbies may be interested in reading the following online reference materials concerning other useful Linux CLI commands:


4. Credits

Copyright 2007 Vector Linux
Released under GNU Free Document License (http://www.gnu.org/licenses/fdl.html )
Contributed by: UKBill, Lagagnon, LLL

Top