Vector Linux 5.9 Documentation |
Discover the Power of the CLI |
CONTENTS1. IntroductionHave 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 applications2.1 FilemanagerType "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 edit files (with its mcedit file editor), change file ownership, file permissions, create symbolic links, view tar files and packages, install packages, etcetera. 2.2 FTP clientmc 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 managerThere 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 removerYet again, mc proves to be incredibly useful.
F2 -> select install current .tgz package -> press [Enter]
F2 -> remove a package listed in [...] -> press [Enter] 2.6 Mounting drives by CLIBefore 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:
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. 3. Other CLI ReferencesThe 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. CreditsCopyright 2008
Vector Linux |