Вы находитесь на странице: 1из 16

LINUX 1.Introduction To Linux Do I really want to read this? What is Linux? Why do I want to use Linux?

Overview of Unix/Linux Features Multitasking Multiuser Programmable Shells Communications and Networking Brief History of Linux/Unix 2.Understanding Linux Distributions Choosing the Right Hardware CPU BUS Memory Disk Drive & Space Requirements Monitor CD-Rom 3.Installing Linux Preparations-Floppies & Backups MS-DOS Boot Disk Backing Up Creating Boot & Root Disks Partitioning Explaining Partitions Using FDISK Preparing HD for Linux Booting Linux Partitioning Drive For Linux Using Linux FDISK Adding Necessary Partition Creating Swap Partition Installing the Linux System Problems 4.Running Linux Applications Moving Around In Linux Managing Users Logging On and Off Adding Users Changing Passwords Basic Commands Shutting Down Linux Running Linux Programs 5.X Windows What is X Windows? Installing XFree86 Hardware Support Configuring XFree86 X Windows Resource Files 6.Improving System Security Password Security Logon Security Accounts w/o Passwords

File Security Permissions SUID & SGID Programs Recording Use of the su command 7.Linux Shells Logging On Understanding Shells 8.Command Line Reference 9.The End A Few Words Credits ---------------------------------------------------1.Introduction To Linux Do I Really Want to read this? Well, this is up to you I'm not going to say sure read this. Usually my writings are casual an d very beginner, this is my "writing revolution." This doc is for beginner Unix/ Linux Users or advanced Windows 95/NT users, who want to switch o/s's. These are my notes and just something I put together for others. Let me know what you thi nk. What is Linux? Linux is an o/s for Intel-Based PC's. It's free of commerci al copyrights and a Unix clone. Thousands of programmers put it together, starti ng with Linus Torvalds. Why do I want to use Linux? Linux is the only o/s today that is freely ava ilable to provide multitasking, multiprocessing capabilities for multiple users on IBM PC-compatible hardware platforms. You can also access to the kernel sourc e code to modify & expand it to your needs. Overview of Linux/Unix Features Multitasking-describes the ability to seemingly execute multiple programs at the same time without plication Multiuser- uses same user interfaces as WinNT but quicker Programmable Shells- gives Linux its trademark ailable" Communications & Networking-tightly coupled ities, also has the built-in flexibility of those features. "most flexible o/s av networking capabil

hindering each ap

History on Unix/Linux Linux originated from Minix, created by Andrew tannebaum. But Linux's hist ory is tied to the history of Unix. AT&T's Ken Thompson started the Unix idea. B SD released their first version in 1978. USL-Unix System Laboratories-developed Unix operating systems since the early '80's. Microsoft developed their Unix ver sion in the late 70's to early 80's. (Microsoft in Unix production, one word: wo w) Sun Microsystems is mostly responsible for the marketability of Unix systems, because of SunOS and now Solaris. In 1993 Novell Inc. (maker of Novell Netware, ya think?) purchased USL from AT&T making them the owner of the "Unix" copyrigh t. 2.Choosing the right hardware for Linux

System CPU-Intel 80386 or later, clone chips included System Bus-ISA & EISA. MCA bus used on IBM's PS/2 is NOT supported. The ne w PCI bus is supported. Memory-Linux itself requires little RAM. 4M is recommended. For XFree86(cl one of X windows) requires at least 16M of virtual memory Disk Space-150-200M, my full install including XFree86 uses 699M depending on what packages you will install. Monitor-text based terminal CGA-EGA-VGA-SVGA cards & monitors. Also provid es support for vendors of-TSENG, WESTERN DIGITAL, TRIDENT, ATI, NCR, CIRRUS LOGI C, OAK, S3, COMPAQ, PARADISE CD-Rom-Most IDE/ATAPI CD-Rom 3.Installing Linux(woohoo here we go) Preparing- First Off, Calm Down, this is EASY! MS-DOS Boot Disk-Place a formatted floppy in the drive. Copy your CONFIG.S YS, AUTOEXEC.BAT,FDISK.EXE, FORMAT.COM, and any driver files you'll need. Keep t his disk, it'll ber important I promise. Backing Up Your System- Most computer users today use tape drives or one o f those groovy zip drives (i want one!) So you can back up with that or with flo ppies (lots of them) syntax for backing up is: backup from to (EX: backup c: a:) Creating Boot/Root Disk- Well this is where you read the readme files prov ided on the CD. Using RAWRITE.EXE you'll copy the files for booting. I may comeb ack and add the distribution setups but I need to research to do that, and I'm a lready behind on this as it is NOW! Partitioning- Okay, please make sure your drive is backed up, max. data lo ss is assured. Partitioning will split your hard drive into sections. In case yo u want to keep another o/s, such as Win95, NT, or O/S2, maybe even another distr ibution of Linux. Using FDISK-First plan out what you're going to have on your system, o/s's I mean. If you're going to have let's say LINUX & WINNT, split the drive in two partitions, etc.. then you get into FDISK ("fdisk" @ the dos prompt) delete all the partitions then "create dos partition of Logical DOS drive" (option "1") th at will be when you fix the partitions to half, then go to option 2 and set the "primary" Then exit FDISK and reboot your computer, make sure you put the DOS bo ot disk from earlier in drive a. At the DOS prompt type FORMAT C: /S. After it's finished formatting, reboot with the LINUX boot disk. Preparing your HD for LINUX- LILO(LInux LOader) loads and uncompresses Lin ux, follow the directions for installation on your distrib. Partitioning Drive for Linux- At the shell prompt type FDISK, the fdisk wi ll startup, hit "m" and study the commands. To began partitioning hit "p" and re turn to display the partition table, make sure your partitions are correct. Some Linux distribs. add their own swap partition, if not, swap partitions are expla ined earlier allowing your memory to move faster. Swap Partitions are 2 times yo ur memory size(16M Ram=32M swap) so follow the help section(m) to create a new p artition. Hit "t" at fdisk prompt then select the partition you set up for swap

and put "82" You can install Linux on a FAT filesystem so make the decision to k eep FAT or change it to Linux Native(option 83 or the "t" command) Installing the Linux System- If you got the last section you're doing good . I made that a bit broad, find me if you need help, no problem at all. Well, to install your Linux use the boot disk and have the cd handy and follow the promp ts for the install, no biggie. Pick your packets to install select the partition s to install and bam finished. Problems??- LILO should load after Linux installation, if it doesn't go ba ck to DOS and reformat, then redo the steps above. Simplest worry, any other pro blems find me and I'll help you out, or at least point you in the right directio n. 5.Running Linux Applications-woohoo! you are now running Linux...well why'd you get it? well let's check it out. You get a login prompt enter "root" and your pa ssword. Managing UsersLogging On and Off- LOGOUT <return> at the prompt Adding Users- ADDUSER(NAME) then follow prompts Changing Passwords- PASSWD at prompt, Admins use SU USER-NAME then PA SSWD to change clients passwords Basic Commandscd- change directory ls- = to DOS DIR cp- copy file (cp from to) mv- move files(mv from to) rm- delete files mkdir- make dir rmdir- remove dir man- Online Help (man [topic]) more- displays file content less- ^^^^^^^^^^ clear- clear screen Shutting Down Linux- IMPORTANT! never just shut off the power, hard drive problems may occur use SHUTDOWN, see command line references. Running Linux Programsbc- command line calculator workbone- text based cd player sc- spreadsheet calculator minicom- pretty basic communication software 6. X Windows What is X Windows? Simple, graphical operating environment. Installing XFree86- XFree is the free x-windows software provided. Setup w ill usually ask you if you want XFree86 installed.

Hardware Support- check docs on cd Configuring- run /usr/share/Program_Groups/Admin_Tools/XFree86Setup X Windows Resource Files- see man pages for startx or xrdb Start XWindows- startx @ shell prompt 7. Improving System Security Physical Security- don't worry about this, unless of course parents, enemi es, etc are around Password Security- change passwords regularly, 6 characters long, maybe so mething with a symbol like root!root or bob&bob Logon SecutiyAccounts w/out Passwords- disable them or add pw Unused accounts- delete them Command Accounts- logon ID's that run a given command and then exit. Lower risks by ensuring no command line input will run. File Security- make sure users cannot access system files Permissions- see CHMOD in command line SUID & SGID Programs- check for holes Recording SU command- SU is usually stored in /va/adm/syslog

8. Linux ShellsLogging on- Enter user id & password this information is stored in etc/pas swd Understanding Shells- after you logon to Linux you are in a shell. Linux s hells can be compared to MS-DOS's COMMAND.COM. Changing Shell Variables- This is self explainatory after you find the fil e to edit. bash/bourne- .profile (in home dir) c - .login In the syntax of Variable=Value In the beginning of this I was going to have alot more on shell programm ing but the length is a bit too long so I've editted out TONS of stuff out of th is 4-5 sections and limiting tthis one, and a few others ones coming ahead, gott a have a few docs to write :) 9. Command-Line Reference at- schedule jobs to execute

Usage: at -q queue time at -l at -r job-ids batch banner- produces large banner Usage: banner [-w[n]] strings Ex: banner hello (produces hello in large format) bash- starts bash shell Usage: sh [options] file Options: -c string - If -c flag is present, command are read from string, a fter string, they're assigned to the positional parameters, starting with $0 -i - shell is interactive -s - commands are read from standard input - - signals the end of options -norc - Do not read & execute ~/.bashrc -profile - do not read either system startup file /etc/profile or personal ini batch- see "at" cal- calendar Usage: cal [-day] [-month] [-year] cat-concatenates files, display-files Usage: cat [options] filelist Options: filelist- optional list of files -b - number all nonblank output lines -e - = to vE -n - number all output lines -s - Replaces multiple, adjacent blank lines with a single bl ank line -t - = to -vT -v - Displays control characters with ^notation -A - = to -vET -E - Displays a $ after each line -T - Display TAB as ^I cd-changes directory Usage: cd dirname chgrp-changes group ownership of a file Usage: chgrp [options] group filelist Options: -c - Verbosely describes files who change -f - No error messages -v - Verbosely describes ownership changes -R - changes ownership of dir's & their contents chmod-changes permissions of files Usage: chmod [options] mode filelist Options: see above (chgrp) chown: change ownership of the file Usage: chown [options] user filelist Options: see above also

clear: clears screen Usage: clear compress- compresses specified files Usage: compress [options] [file-name] Options: -c - no files changed, written to stdout -C - prevents subdivision of the file into blocks -d - Uncompresses files -f - Overwrites output files -v - while each file is compressed cp- copies files Usage: cp [options] sourcefile destfile cp [options] sourcelist destdirectory Options: -a - preserves structure and attributes of the original -b - makes backups of the files about to be overwritten -d - copies symbolic links as symbolic links -f - removes existing destination files -i - prompts whether to overwrite existing crontab- informs cron daemon of the programs Usage: crontab -l [-u user] crontab -e [-u user] crontab -d [-u user] Options: -l - lists your crontab file -e - edits crontab file -d - deletes a user's crontab file -u user - specifies a particular user's crontab file to manipula te. MUST BE ROOT csh- See tcsh cut- extracts fields from a list of files Usage: cut -cchar=pos filelist cut -ffields =dfield -sep -s filelist date- displays system date and time Usage: date MMDDhhmm df- reports the amount of space that is free on the disk Usage: df [options] filesystems Options: filesystems-optional list of filesystem -a - lists file system that have 0 blocks -i - lists inode usage info instead of block usage -k - prints sizes in 1k blocks instead of 512-byte blocks -P - uses POSIX output format -t fstype- limits the listing to filesystems of type fstype -x fstype- opposite of ^^^ -v - Ignored, (included for System V versions of df) diff= compares two text files & reports what needs to be changed to make it look like the other Usage: diff [options] oldifle newfile Options: oldfile - the file you want compared to newfile - the file you are comparing

-b e as = -e -f

- causes leading and trailing blanks and tabs to compar - generates a script suitable for the ed editor - similar to the -e flag of space being used b directories or files name list of directories or files causes only a total for each of the specified names causes each file encountered to be displayed with its

du- displays amount Usage: du [options] Options: names -s -a size -b -x -L ymbolic link

- prints sizes in bytes - only directories in currently mounted file system - shows disk space used by the file appointed to by a s

echo- takes arguments passed to it and writes them to standard output. Usage: echo [-n] [-e] string Options: -n - normally, echo follows with all the output with a new line. This command stops that. -e - enables interpretation of the following character seq uences: \a Alert (bell) \b Backspace \c don't print a newline at end \f Formfeed \n a new line \r Carriage return \t Tab \v Vertical Tab \\ Backslash string - string of characters you want to output ed= line editor Usage: ed [-] [-s] [-x] Options: - suppresses the messages produced by e,r,w,q! -s - suppresses diagnostics -x - prompts the encryption key to read and write -p prompt- enables you to specify your own prompt string filename- name of file you want to edit env- modifies the environment for the execution of a command without chan ging current environment Usage: env [-] [-i] [-u name] [name=value] [command] Options: - restricts the environment to only those values to fol low in the name=value list -u name - removes variable name from the environment -i - starts with an empty environment, ignoring any enviro nment informationg inherited by the process name=value- allows you to pass environment variables to the com mand specifying the value of the variables for this execution of the command command - name of command nad its arguments to be run with the specified environment

fgrep- see grep file- determins the type of file Usage: file [-c] [-z] [-L] [-f file] [-m mfile] filelist Options: -c - prints out the parsed form of the magic file -z - looks inside compressed file and tries to figure out its type -L - this option causes symbolic links to be followed -f ffile- tells file that the list of files to identify is foun d in ffile find- finds file and directories Usage: find dirlist match-spec Options: dirlist - where what you want to find is match-spec-name file -user user-id finger- displays information about users Usage: finger [options] users Options: users - optional list of user names -s - displays user logon, real name, terminal name & write status, idle time, logon time -l - process multi-line processes -p - prevents -l option -m - restricts matching of the user arguments to the logon name grep- finds patterns in files Usage: grep [options] reg-expres filelist egrep [options] reg-expres filelist fgrep [options] string filelist Options: filelist - optional space-seperated list of files reg-expres- regular expression to search for string - string you want to find in files -v - lists lines that don't match string or reg-expres -c - counts match lines -l - only the names are displayed -h - suppresses the displays of name of the file the matc h found in -n - matching line is displayed along with its relative l ine number head- prints out the first number of specified lines of the file Usage: head -lines filelist Options: -lines - number of lines to print beginning of the file. Defa ult=10 filelist - list of filenames you want displayed id- display your identification to the sytem Usage: id [options] Options: -g - Prints Group ID -G - Prints supplementary groups

-n -r -u

- Prints user or group name - Pritns the real user or group ID - Prints only the User ID

join- extracts the common lines from two sorted files Usage: join [options] file1 file2 Options: file1 - first file used in the join file2 - second file used in join -an - unmatching lines from either file -e string- replaces empty output fields with string -j n m - joins the two files on the mth field of file n kill- allows you to send a signal to a process that is currently executin g Usage: kill [-signal] pid kill -l Options: -signal - optional signal that can be sent pid - process id of the process you want to sedn the speci fied signal less- general purpose file pager, similar to move Usage: less file-names ls- equal to DOS's dir command Usage: ls [options] [filelist] Options: -a - Show all files -C - Columnar output, down -x - Columanr output, across -d - treats each entry as a directory -l - Long Listing mesg- control where you allow other to message your terminal Usage: mesg [n:y] Options: n - Does not allow messages y - Allows messages mcd- used to report & set the current MS-DOS device and directory Usage: mcd [ms-dos directory] mcopy- copies files to and from MS-DOS filesystem Usage: mcopy [options] sourcefile targetfile Options: -t - Text file transfer -n - no warning for overwrite -v - Verbose Mode -m - preserves modification time sourcefile- MS-DOS file being copied targetfile- destination of file mdel- deletes an MS-DOS file from DOS file system Usage: mdel [-v] msdos-file Options: -v - Verbose Mode ms-dosfile- file to delete mdir- displays contents of an MS-DOS directory

Usage: mdir [-w] name Options: -w - display listing in "wide format" name - name of directory mkdir- create new directories Usage: mkdir [-m mode] [-pdirnames] dir Options: -m mode - sets directory to permissions to mode -p dirnames- creates all non-existent parent directories dir - directory to create more- general purpose pager, used to view text that scrolls off the scree n Usage: more [options] file-names Options: -n - interger used to set window size to n lines long -c - clears one line and draws another -d - displays "Press Space To continue" -f - counts logical lines instead of screen lines -l - does not treat ^L (form feed) character -s - multiple blank lines suppressed -p - clears screen & displays text -u - suppresses underlining file-names- list of files you want displayed mv- renames a file, moves a file to new directory, renames directory Usage: mv [-f] [-i] file1 file2 mv [-f] [-i] dir1 dir2 mv [-f] [-i] filelist dir Options: -f - moves without prompting -i - Interactive Mode file1 - source file file2 - new filename dir1 - source directory dir2 - new directory name filelist - space seperated list of file names dir - destinationg directory newgrp- changes Group ID Usage: newgrp group Options: group - group ID you want to become active in passwd- maintain user passwords Usage: passwd [name] Options: name - changes password of username SUPER USER ONLY paste- produces columnar output from files, usually used with cut Usage: paste -ddelim filelist paste -s -ddelim filelist Options: -ddelim - shows what character to delimit each column filelist - list of files to paste -s - causes paste to traverse each file pr - allows formatting to a file while printing it to standard output Usage: pr [options] filelist

Options: filelist -page -col -m -d space= delimited list of files begins printing with page page specifies col columns of output merges file double spaces the output

ps- reports the status of processes Usage: ps [options] Options: -l - long listing -u - prints in user format -j - output in jobs format -s - output in single format -v - output in virtual memory format -m - displays memory information -a - shows processes without a terminal -x - displays processes without a terminal -S - adds child CPU time and page faults -c - lists command name from kernel task structure -e - shows environment -w - dispalys in wide format -h - no header -r - displays running processes only -n - provides numeric output (user) pwd- reports your current directory Usage: pwd recp- used to copy files between computers Usage: rcp [options] file1 file2 Options: -r - copies subdirectories -p - preserves times and access modes -k - requests kerberos tickets -x - turns on DES encryption for all data file1,file2- source/destination files - source files directory- destination directory rm- removes files and directory structures Usage: rm [options] filelist Options: filelist - space-delimited list of files to delete -r - deletes directories in filelist -i - interactive mode -f - forced mode -v - verbose mode rmdir- removes directory Usage: rmdir -p dirlist Options: -p - deletes parent directories dirlist - list of directory names sh- see bash shutdown- shuts down system Usage: shutdown [options] time [warning] Options:

-k -r -h -n -f -c

sends warning message, no shutdown reboots after shutdown halts after shutdown doesnt sync disks fast reboot cancels already running shutdown

sleep- suspends execution for interval of time Usage: sleep n Options: n - specifies amount of time split- breaks up a text file Usage: split -numlines file tagname Options: -numline - specifies number of lines file - file to split stty- sets terminal device driver line controls Usage: stty -a =g settings Options: -a - shows all settings -g - like above but produces 12 hexadecimal number sepera ted by colons settings - series of stty command sync- writes the current disk image to HD Usage: sync tail- enables you to view the end of a text file Usage: tail beg-offset -f file Options: beg-offset- offset, in lines, within the file tar- see tar man pages tcsh- command interpreter similar Usage: tcsh tee- splits output in a pipline to 1 or more files Usage: tee [options] filelist Options: filelist - list of files you want to capture the output in -i - ignores interrupts -a - filelist is appended with the output instead of ove rwritten test- see man pages time- determines how long a program takes to execute Usage: time command Options: command - command you want to time touch- changes access and modification times of a file/creates new file with a specified times Usage: touch [options] MMDDhhmmYY filelist Options: MMDDhhmmYY- time to which to set the file

filelist - list of files you want to have specified time -a - changes access times -m - same as -a but for modified time tr- translates or maps characters in a file from one form to another Usage: tr [options] from-string to-string Options: from-string- characters to map fro \octal - specifies octal value to-string - string of characters to map into -c - appends from-string to to-string -d - deletes characters specified in from-string -s - strips repeated characters true- returns a zero exit status that means true in the shell Usage: true tty- reports currently logged on device name Usage: tty -s Options: -s - tests standard input umask- specifies what the default permissions are Usage: umask mask Options: mask 0-no restrictions 1-restrict execute permissions 2- restrict write permissions 4- restrict read permissions uname- reports the system name and catalog information Usage: uname [options] Options: -s - reports system name -n - reports node name -r - reports release number of o/s -v - reports version number of o/s -m - reports machine hardware name -a - reports all the above uniq- strips out lines that are identical, producing one unique(hence th e command) line Usage: uniq [options] input output Options: input - name of file which to read output - name of file to create -u - makes uniq to output lines that arent repeated -d - forces uniq to output lines that were repeated- on ly one copy of them -c - produces a report with left column -fields - counts of fields is skipped +chars - skips char number of character uudecode- see uuencode uuencode- used to format a binary file so that it can be sent over media that does not support ASCII Usage: uuencode[file] name uudecode[file] Options:

file name vi- text editor Usage: vi file-name

- name of the file to format with uuencode uudecode - name to be used for the decoded file

wall-writes to all users currently logged onto the system Usage: wall [file-name] wc- counts characters, words, lines in a file Usage: wc [options] filelist Options: filelist - files to count -c - counts only the number of characters -w - counts number of words -l - counts only lines which- searches through your path for specified program Usage: which program Options: program - command you want to find who- reports users on the system Usage: who [options] utmp-like-file who am i Options: utmp-like-file- alternate file to obtain logon info -u - reports users -T - indicates terminal acceptance of messages -H - prints header line -q - quick version of output write- communcates with a user Usage: write user tty Options: user- username of the user to contact tty- specifies tty That was a big section, just keep this close to your computer, read over it more than once. A Few Words, I've cut out 5 major sections of this, so you'll see them coming out soon. Sorr y about the delay , I'm behind about 2-3 weeks, due to the fact that i'm in grou ps and we've all been working. :) Including a local one we're starting.. Then th ere's my projects, some java/TCL things. This is about 50-65 hours of work, hope you get somethin outta it . 15 hours of it was without A/C in TX weather (acckk k) Special Thanks to Spirithawk for sendin me a book on linux :) Lemme Know what yo u think 0utkast (hmm i signed my handle..weird...) p.s. 35 kb ..not bad i was expecting at least a meg..hehe

... texts ...