Top Banner
LINUX LINUX INSTALL UNINSTALL BASIC LINUX COMMANDS ADVANCE LINUX COMMAND LINUX SETUP LINUX CONFIGURE
27
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Linux

LINUXLINUX

INSTALL UNINSTALL BASIC LINUX COMMANDS ADVANCE LINUX COMMAND LINUX SETUP LINUX CONFIGURE

Page 2: Linux

THE LINUX INSTALLATION HOW TO

Installation overview First installation steps:The Easy Way Continuing The Installation Basic Parts Of An Installation Kit

Page 3: Linux

INSTALLATION OVERVIEW

It's wise to collect configuration information on your hardware before installing.

Know the vendor and model number of each card in your machine; collect the IRQs and DMA channel numbers.

If you want to run a "dual-boot" system (Linux and DOS or Windows or both), rearrange (repartition) your disk to make room for Linux.

If you're wise, you'll back up everything first!.

Page 4: Linux

FIRST INSTALLATION STEPS: THE EASY WAY

If you have an EIDE/ATAPI CDROM, check your machine's BIOS settings to see if it has the capability to boot from CD-ROM. Most machines made after mid-1997 can do this.

If yours is among them, change the settings so that the CD-ROM is checked first. This is often in a 'BIOS FEATURES' submenu of the BIOS configuration menus.

Then insert the installation CD-ROM. Reboot. You're started.

If you have a SCSI CDROM you can often still boot from it, but it gets a little more motherboard/BIOS dependent.

Page 5: Linux

CONTINUING THE INSTALLATION

Prepare the Linux filesystems. (If you didn't edit the disk partition table earlier, you will at this stage.)

Install a basic production Linux from the CD-ROM.

Boot Linux from the hard drive. (Optional) Install more packages from CD-

ROM.

Page 6: Linux

BASIC PARTS OF INSTALLATION KIT

The README and FAQ files. These will usually be located in the top-level directory of your CD-ROM and be readable once the CD-ROM has been mounted under Linux. It is a good idea to read these files as soon as you have access to them, to become aware of important updates or changes.

A number of bootdisk images (often in a subdirectory). If your CD-ROM is not bootable, one of these is the file that you will write to a floppy to create the boot disk. You'll select one of the above bootdisk images, depending on the type of hardware that you have in your system.

Page 7: Linux

BASIC PARTS OF INSTALLATION KIT

The issue here is that some hardware drivers conflict with each other in strange ways, and instead of attempting to debug hardware problems on your system it's easier to use a boot floppy image with only the drivers you need enabled. (This will have the nice side effect of making your kernel smaller.)

A rescue disk image. This is a disk containing a basic kernel and tools for disaster recovery in case something trashes the kernel or boot block of your hard disk.

Page 8: Linux

UBUNTU LINUX:UNINSTALL/REMOVE ANY INSTALLED SOFTWARE

GUI Package Management Tool Command Line Package Management

Tool

Page 9: Linux

GUI PACKAGE MANAGEMENT TOOL

synaptic is graphical management tool of software packages. It allows you to perform all actions of the command line tool apt-get in a graphical environment.

This includes installing, upgrading, downgrading and removing of single packages or even upgrading your whole system.

Just click on System > Administration > Synaptic Package Manager

Now you can select any package and click on Mark for Removal popup meni. You can also start GUI tool from command line, enter:

$ synaptic $

Page 10: Linux

COMMAND LINE PACKAGE MANAGEMENT TOOL

apt-get is the command-line tool for handling packages. It is used for adding / removing / updating packages.

Uninstall / Delete / Remove Package

Just use the following syntax:

sudo apt-get remove {package-name}

$ sudo apt-get remove mplayer

Remove package called lighttpd along with all configuration files, enter:$ sudo apt-get --purge remove lighttpd

To list all installed package, enter:/dpkg --list

dpkg --list | less

dpkg --list | grep -i 'http'

Page 11: Linux

BASIC LINUX COMMANDS

mkdir - make directories Usagemkdir [OPTION] DIRECTORYCreate the DIRECTORY(ies), if they do not already exist. Mandatory arguments to long options are mandatory for short options too.

-m, mode=MODE set permission mode (as in chmod), not rwxrwxrwx - umask

-p, parents no error if existing, make parent directories as needed

-v, verbose print a message for each created directory

-help display this help and exit

-version output version information and exit

Page 12: Linux

BASIC LINUX COMMANDS

cd - change directories

mv- change the name of a directoryEx: mv testdir newnamedir

pwd - print working directory

rmdir - Remove an existing directory

rm -Removes directories and files within the directories recursively.

chown - change file owner and group

Page 13: Linux

Change the owner and/or group of each FILE to OWNER and/or GROUP. With --reference, change the owner and group of each FILE to those of RFILE.

-c, changes like verbose but report only when a change is made -dereference affect the referent of each symbolic link, rather than the symbolic link itself -h, no-dereference affect each symbolic link instead of any referenced file (useful only on systems that can change the ownership of a symlink)-from=CURRENT_OWNER:CURRENT_GROUP

change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attributes

Page 14: Linux

-no-preserve-root do not treat `/' specially (the default)-preserve-root fail to operate recursively on `/'-f, -silent, -quiet suppress most error messages-reference=RFILE use RFILE's owner and group rather than the specifying OWNER:GROUP values-R, -recursive operate on files and directories recursively-v, -verbose output a diagnostic for every file processedThe following options modify how a hierarchy is traversed when the -R option is also specified. If more than one is specified, only the final one takes effect.-H if a command line argument is a symbolic link to a directory, traverse it-L traverse every symbolic link to a directory encountered-P do not traverse any symbolic links (default) g - Group that owns the file.

Page 15: Linux

o - Other.a - All.r - Read the file.w - Write or edit the file.x - Execute or run the file as a program.Numeric Permissions:

CHMOD can also to attributed by using Numeric Permissions:400 read by owner040 read by group004 read by anybody (other)200 write by owner020 write by group002 write by anybody100 execute by owner010 execute by group001 execute by anybody ls - Short listing of directory contents-a list hidden files-d list the name of the current directory

Page 16: Linux

executable files with a trailing '*'-g show group ownership of file in long listing-i print the inode number of each file-l long listing giving details about files and directories-R list all subdirectories encountered-t sort by time modified instead of name

cp - Copy files

cp myfile yourfileCopy the files "myfile" to the file "yourfile" in the current working directory. This command will create the file "yourfile" if it doesn't exist. cp -i myfile yourfileWith the "-i" option, if the file "yourfile" exists, you will be prompted before it is overwritten. cp -i /data/myfile Copy the file "/data/myfile" to the current working directory and name it "myfile". cp -dpr srcdir destdir Copy all files from the directory "srcdir" to the directory "destdir" preserving links (-poption), file attributes (-p option), and copy recursively (-r option). With these options, a directory & contents

Page 17: Linux

BASIC LINUX COMMANDS

n - Creates a symbolic link to a file.ln -s test symlink

locate - A fast databasedriven file locator.slocate -umore - Allows file contents or piped output to be sent to the screen one page at a timeless - Opposite of the more commandcat - Sends file contents to standard output. This is a way to list the contents of short files to the screen. It works well with piping.whereis - Report all known instances of a commandwc - Print byte, word, and line counts.bg:

Page 18: Linux

cal month year - Prints a calendar for the specified month of the specified year.

cat files - Prints the contents of the specified files.clear - Clears the terminal screen.cmp file1 file2 - Compares two files, reporting all discrepancies. Similar to the diff command, though the output format differs.diff file1 file2 - Compares two files, reporting all discrepancies. Similar to the cmp command, though the output format differs.dmesg - Prints the messages resulting from the most recent systemBoot.fgfg jobs - Brings the current job (or the specified jobs) to the foreground.file files - Determines and prints a description of the type of each specified file.find path -name pattern -printSearches the specified path for files with names matching the specified pattern (usually enclosed in single quotes) and prints their names. The find command has many other arguments and functions; see the online documentation. finger users - Prints descriptions of the specified users.free - Displays the amount of used and free system memory.

Page 19: Linux

head files - Prints the first several lines of each specified file.ispell files - Checks the spelling of the contents of the specified files.kill process_idskill - signal process_idskill -lKills the specified processes, sends the specified processes the specified signal (given as a number or name), or prints a list of available signals.killall programkillall - signal programKills all processes that are instances of the specified program or sends the specified signal to all processes that are instances of the specified program. mail - Launches a simple mail client that permits sending and receiving email messages.man titleman section title - Prints the specified man page.ping host - Sends an echo request via TCP/IP to the specified host. A response confirms that the host is operational.reboot - Reboots the system (requires root privileges).shutdown minutesshutdown -r minutesShuts down the system after the specified number of minutes elapses (requires root privileges). The -r option causes the system to be rebooted once it has shut down.

Page 20: Linux

sort files - Sorts the specified files. The command has many useful arguments; see the online documentation.split file - Splits a file into several smaller files. The command has many arguments; see the online documentationsync - Completes all pending input/output operations (requires root privileges).telnet host - Opens a login session on the specified host.top - Prints a display of system processes that's continually updated until the user presses the q key.traceroute host - Uses echo requests to determine and print a network path to the host.uptime - Prints the system uptime.

w - Prints the current system users.wall - Prints a message to each user except those who've disabled message reception. Type Ctrl-D to end the message.

Page 21: Linux

ADVANCE LINUX COMMANDThis page contains commands that are not essential for newbies but can be fun and/or very productive if you take the time to learn them. Above all, they can be very educational--linux is a great learning platform. There are thousands of free programs available on Linux, but some of them may be missing on your system, depending on your distribution. You can always find the hompage with google, and then download them.banner/usr/games/banner -w79 "Happy Birthday, Marie" > marie.txtCreate an ascii "banner" with the width of 79 characters. The output is sent to file marie.txt. Script Log my current session in the text terminal into a text file typescript (the default filename). The log finishes when I type exit or press <Ctrl>d. Emacs (in X-terminal) The emacs text editor. Advanced and sophisticated text editor. Seems for gurus only: "emacs is not just an editor, it is a way of living". Emacs surely seems rich or bloated, depending on your point of view. There are likely 3 versions of emacs installed on your system: (1) text-only: type emacs in a text (not X-windows) terminal (I avoid this like fire); (2) graphical-mode: type emacs in an X-windows terminal (fairly usable even for a newbie if you take some time to learn it); and (3) X-windows mode: type "xemacs" in an X-windows terminal.

Page 22: Linux

khexedit(in X terminal) Simple hexadecimal editor. Another hexadecimal editor is hexedit (text based, less user friendly). Hex editors are used for editing binary (non-ASCII) files. diff file1 file2 > patchfileCompare contents of two files and list any differences. Save the output to the file patchfile. sdiff file1 file2Side-by-side comparison of two text files. Output goes to the "standard output" which normally is the screen.patch file_to_patch patchfileApply the patch (a file produced by diff, which lists differences between two files) called patchfile to the file file_to_patch. If the patch was created using the previous command, I would use: patch file1 patchfile to change file1 to file2. Regular expression(regexpr)SedGawkcvsConcurrent versions system. Try: info cvs for more information. Useful to keep the "source code repository" when several programmers are working on the same computer program.cervisia

Page 23: Linux

file -z filenameDetermine the type of the file filename. The option -z makes file look also inside compressed files to determine what the compressed file is (instead of just telling you that this is a compressed file).

To determine the type of content, file looks inside the file to find particular patterns in contents ("magic numbers")--it does not just look at the filename extension like MS Windows does. The "magic numbers" are stored in the text file /usr/share/magic--really impressive database of filetypes.Touch file namestrings filename | moreDisplay the strings contained in the binary file called filename. "strings" could, for example, be a useful first step to a close examination of an unknown executable.wc(=word count) Print the number of lines, words, and bytes in the file.

Examples: dir | wc cat my_file | wc wc myfil od

Page 24: Linux

cksum filenameCompute the CRC (="cyclic redundancy check") for file filename to verify its integrity.md5sum filenameCompute a md5 checksum (128-bit) for file filename to verify its integrity.mkpasswd -l 10Make a hard-to-guess, random password of the length of 10 characters.sort -f filenameArrange the lines in filename according to the ascii order. The option -f tells sort to ignore the upper and lower character case. The ascii character set is (see man ascii):Dec Hex Char Dec Hex Char Dec Hex Char Dec Hex Charuniq(=unique) Eliminate duplicate lines in sorted input. Example: sort myfile | uniq fold -w 30 -s my_file.txt > new_file.txt

Wrap the lines in the text file my_file.txt so that there is 30 characters per line. Break the lines on spaces. Output goes to new_file.txt.

Page 25: Linux

LINUX SET UP

Linux: Setup as DNS Client / Name Server IP AddressMany new Linux user finds it difficult to setup / modify new name server address (NS1 / NS2).Local name resolution is done via /etc/hosts file. If you have small network, use /etc/hosts file. DNS (domain name service is accountable for associating domain names with ip address, for example domain yahoo.com is easy to remember than IP address 202.66.66.12) provides better name resolution. To configure Linux as DNS client you need to edit or modify /etc/resolv.conf file. This file defines which name servers to use. You want to setup Linux to browse net or run network services like www or smtp; then you need to point out to correct ISP DNS servers:/etc/resolv.conf fileIn Linux and Unix like computer operating systems, the /etc/resolv.conf configuration file contains information that allows a computer connected to the Internet to convert alpha-numeric names into the numeric IP addresses that are required for access to external network resources on the Internet. The process of converting domain names to IP addresses is called "resolving."The resolv.conf file typically contains the IP addresses of nameservers (DNS name resolvers) that attempt to translate names into addresses for any node available on the network.

Page 26: Linux

Setup DNS Name resolution

Steps to configure Linux as DNS client, first login as a root user (use su command):

Step # 1: Open /etc/resolv.conf file:

# vi /etc/resolv.conf

Step #2: Add your ISP nameserver as follows:

search isp.comnameserver 202.54.1.110nameserver 202.54.1.112nameserver 202.54.1.115

Note Max. three nameserver can be used/defined at a time.Step # 3:Test setup nslookup or dig command:

$ dig www.nixcraft.com$ nslookup www.nixcraft.com

Page 27: Linux

CONFIGURING LINUX

Bridged vs PPPoX Networks Bridged/DHCP PPPoX ATM Configuring the WAN Interface Static IP Configuration Bridged/DHCP Configuration PPPoE Configuration PPPoA