Transcription of Linux, Shell Programing and Perl - University of …
1 Linux, Shell Programing and PerlbyWilli-Hans Steeb, Gert Cronje and Yorick HardyInternational School for Scientific ComputingContents1 Linux Some Basic Commands .. Working with Files and Directories .. Introduction .. The Home Directory and Path Names .. Important Directories in the Linux File System .. Basic Files and Directories Commands .. File Name Substitution .. Standard Input/Output, and I/O Redirection .. 352 Linux Commands433 Advanced The Unix File System .. Mounting and Unmounting .. MTools Package .. Swap Space and the Loopback Device.
2 Network File-System .. Linuxconf .. Compressed Files .. The vi and emacs Editors .. vi Editor .. emacs Editor .. Programming Languages .. C and C++ Compiler .. perl .. Lisp .. Java .. 1034 Linux and Introduction .. Basic Commands .. email .. ftp Commands .. Telnet .. Remote Shell .. Web .. INETD and Socket Programming .. 1295 Shell What is a Shell .. The Shell as a Programming Language .. Creating a Script .. Making a Script executable .. Shell Syntax .. Variables .. Conditions .. Control Structures.
3 Logical AND and Logical OR .. Functions .. Shell Commands .. Builtin Commands .. Command Execution .. Advanced examples .. 1776 Introduction .. My First perl Program .. Data Types .. Arithmetic Operation .. Standard Input .. Basic String Operations .. Conditions .. Logical Operators .. Loops .. goto Statement .. Mathematical Functions .. Bitwise Operations .. List Operations .. Associative Arrays Operations .. Pattern Matching .. Regular Expressions .. Map Operator .. Two-Dimensional Arrays .. Subroutines .. Recursion.
4 The system Function .. File Manipulations .. Networking .. 231iiBibliography234 Index235iiiPrefaceLinux is a Unix-like operating system. It is the result of an international collabo-ration, directed by Linus Torvalds, the original author. It s free - no licensing feepayable to anybody. The Linux kernel is licensed under Free Software Foundation sGeneral Public License. The source code comes with the system. It s dependent it contains no code written by Bell Labs or its successors. Supported architectures:Pentium PentiumPro AmigaAtariPowerPC SUN SPARC DEC AlphaPorts in progress: ARM and MIPS (SGI machines).
5 Standards: Linux implements a superset of the POSIX OverviewLinux did not appear out of thin air. It is the outcome of years of computer systemdevelopment: Multics 1964-1965 General Electric, Bell Telephone laboratories and Project MAC at MIT. Security rings, Multiple command interpreters (or shells), A file system for secondary storage, Dynamic libraries. High level language (PL/I). Unix 1969 Bell Telephone Laboratories. Input/output redirection. ( > temp_file) Pipes - the output form one program is the input for Unix the programs execute simultaneously, the pipe implmentation in DOSdoes not support simultaneous execution.
6 ( | command2) Hierarchical file system, SUID flag. A process started by a executable file takes on the identity andprivileges of the owner of the PhilosophyUnix prescribes a unique philosophy of how system tools should be designed: Make each program do one thing well. Rather write a new program than compli-cate old programs by adding new features . Expect the output of any program to become the input of any other program -Don t insist on interactive input. Design and build software to be tried early. Do not hesistate to throw out clumsyparts and rebuild them. Use tools to lighten a programming task, even if we have to detour to build reslt of the above is that a typical Unix system has hundreds of obscure pro-grams, commands and tools.
7 Unix has been described as an operating system kernelwith twenty years of nifty add on , TUNIS, Xinu and Minix. Teach operating systems design. Minix was written for the cheap Intel 8086 platform. Minix prompted the development of Linux also on the Intel number of other systems have made contributions which have become an essentialpart of Linux and current Unix systems. These are: Multi-User Virtual Memory Filename expansion in command lines (globbing or wildcard expansion), Bit mapped display - the X-window systemApplication Programs for Linux Motif and the Command Desktop environment Several commercial X-servers AplixWare (Office Suite) CorelDraw (Graphics program) WordPerfect(Office Suite) StarOffice (Office Suite - Free for non-commercial use) SymbolicC++v Mathematica Reduce Maple Matlab Octave (Matlab-like package - Free) Scilab (Matlab-like, Excellent for control systems - Free) Khoros (Image processing and visualization - Free) PV Wave (Visualisation)
8 Microstation (CAD program) NexS (Internet enabled spreadsheet) Netscape (WWW browser) The GNU Project SUN Java Developer Kit DevelopmentAvailable programming languages include:CADAS chemeC++APLE iffelObjective C BasicModula 2 and 3 PascalLogoJavaFortranSmalltalkPrologFort hPerlRexxSimulaPostscriptCORC and CUPLO beronCommon Lisp INTERCALTCL/TKCompatibilityBinary compatibilityIntel Linux runs several other x86 Unix binaries (for example SCO Unix). SPARCL inux runs SunOs and some Solaris Ethernet Token ring TCP/IP IPX (Novell) SMB (OS/2 Warp server / NT Server / Windows for Workgroups) AppletalkWe note that MS-DOS and OS/2 use different control characters for carriage returnand linefeeds that Unix note that this difference between MS-DOS and Unix may also produce problemswhen printing.
9 A well known error is the staircase effect. To fix this problem underOS/2, edit the file under OS/2 and delete and retype the frist two uses libraries that store dates as 32-bit integers, which count the secondssince 1970. This counter will not overflow until the year 2038, by which time thelibrary programmers will have upgraded the system software to store dates as email addresses of the author web sites of the author are: 1 Linux Some Basic CommandsHere we introduce some basic command line commands in LINUX and UNIX. Wenotice that LINUX and UNIX commands are case-sensitive. Under DOS and Win-dows command line commands are not case-sensitive.
10 The command prompt isindicated by>in the following. We assume the use of the Bourne Shell or a com-patible UNIX and LINUX command is ended with the pressing of the RETURN (orENTER) key. RETURN (or ENTER) says that we are finished typing things in andare ready for the UNIX system to do its the Date and Time. ThedateCommandThedatecommand tells the system to print the date and time:> dateTues Jun 27 11:38:37 SAST 2000>This meansdateprints the day of the week, month, day, time (24 hour clock, SouthAfrican Standard Time), and year. DOS and Windows also have > clockprovidesFri Feb 20 15:34:07 2004 seconds12 CHAPTER 1.
