Introduction to Linux

Introduction to Linux

Resource Seminar 2007: Introduction to Linux Eun-seo Choi Oct 11, 2007 1 Resources ² Senior grads ² System administrators ([email protected]) ² Documents in /home/datalib/Resource Class ² Internet and magazines – Google, Wikipedia, etc. – Linux Journal (http://www.linuxjournal.com/), Linux Magazine (http://www. linux-mag.com/), Linux Format (http://www.linuxformat.co.uk/), and many others (http://en.wikipedia.org/wiki/List_of_Linux_magazines). – Source of the up-to-date information. ² http://tldp.org – The Llinux Documentation Project. – Guides and FAQs are excellent introductions. ² http://www.ibm.com/developerworks/linux – Contains a vast collection of toturials on many Linux-related subjects. – Go to “How do I get started with Linux?” (http://www.ibm.com/developerworks/ linux/newto/#6) to get started with linux. 1 2 Accessing a remote linux server 2.1 SSH ssh is a remote login program, meaning “secure shell”. ssh and the associated programs such as scp and sftp are the only allowed methods to remotely access division servers. There are many different ways of using ssh, but a real basic one is ssh -X -lusername server or ssh -X username @server For example, ssh -X -lces74 narsil.gps.caltech.edu or ssh -X [email protected] where -X option forwards X windows programs (running on the remote host) to a local dis- play. For more about ssh, type ‘man ssh’ on a terminal’s command line or visit http://www. openssh.org/manual.html. There are numerous on-line documents including the 3-part tu- torial on IBM DeveloperWorks (http://www.ibm.com/developerworks/library/l-keyc. html). Several ssh clients for MS Windows are available. Putty is quite popular (http://www. chiark.greenend.org.uk/~sgtatham/putty/). 2.2 X server on Microsft Windows You might want to have an “X windows system” available on your MS Windows desktop or laptop. Then, you can keep working as if you locally logged in a linux server. Let’s imagine a situation where you are wokring on your MS Windows laptop at home but want to finish up your Ge161 homework using GMT wihtout going back to the office. Moreover, you left some partially working scripts in your home directory on the division’s linux system. You can log in the linux server through the normal terminal emulators and edit the GMT scripts. However, those terminal programs cannot pop up a window showing the EPS files you made. To see the results in this particular case or to run other X windows programs, you need an X server running on your local computer. You can set up an X windows system on MS Windows using Cygwin (http://www. cygwin.com/), Xming (http://www.straightrunning.com/XmingNotes/), or X-Win32 (http: //www.starnet.com/products/xwin32/). The first two are free; the latter is commercial but is freely downloadable from http://software.caltech.edu. 2 2.3 Virtual machines and dual booting Instaling a linux system on your computer is an obvious way of getting a linux-compatible working environment. You have two options for installing linux while keeping your current non-linux OS. One is to partition your physical hard drive, install linux on one of the parti- tions, and use “dual booting”. Further information on dual booting is available on wikipedia (http://en.wikipedia.org/wiki/Dual_boot). The other is to install linux on a “virtual machine”. If interested, try out one of these: VMWare (commercial, http://www.vmware. com/), Parallel Workstation (commercial, http://www.parallels.com), Microsoft Virtual PC (free, http://www.microsoft.com/windowsxp/virtualpc/). Dual booting can be an- noying because you need to reboot everytime you want to switch to a different OS, while the virtual machine softwares suffer performance overhead. These techniques might be an overkill if you just want to work on linux servers. 3 Frequently used programs For complete documentation of any of the following programs, try man command , or info command (‘q’ to quit while reading.) 3.1 Overview of file system Excerpted from Wikipedia’s “Filesystem Hierarchy Standard” (http://en.wikipedia.org/ wiki/Filesystem_Hierarchy_Standard). [ces74@elendil]/% cd [ces74@elendil]~% cd / [ces74@elendil]/% ls bin/ etc/ lib/ mnt/ proc/ scratch1@ sys/ var/ boot/ export/ lost+found/ net/ root/ selinux/ tmp/ dev/ home/ media/ opt/ sbin/ srv/ usr/ / Primary hierarchy root and root directory of the entire file system hierarchy. /bin/ Essential command binaries that need to be available in single user mode; for all users (e.g., cat, ls, cp). /boot/ Boot loader files (e.g., kernels, initrd). Often a separate partition. /dev/ Essential devices (e.g., /dev/null). 3 /etc/ Host-specific system-wide configuration files (the name comes from et cetera). /etc/opt/ Configuration files for /opt/. /etc/X11/ Configuration files for the X Window System, version 11. /etc/sgml/ Configuration files for SGML. /etc/xml/ Configuration files for XML. /home/ Users’ home directories - containing saved files, personal settings etc. Often a sep- arate partition. /lib/ Libraries essential for the binaries in /bin/ and /sbin/. /media/ Mount points for removable media such as CD-ROMs (appeared in FHS-2.3). /mnt/ Temporarily mounted filesystems. /opt/ Optional application software packages. /proc/ Virtual filesystem documenting kernel and process status as text files (e.g., uptime, network). /root/ Home directory for the root user. /sbin/ Essential system binaries (e.g., init, route, ifup). /srv/ Site-specific data which is served by the system. /tmp/ Temporary files (see also /var/tmp). /usr/ Secondary hierarchy for user data; contains the majority of (multi-)user utilities and applications. /usr/bin/ Non-essential command binaries (not needed in single user mode); for all users. /usr/include/ Standard include files. /usr/lib/ Libraries for the binaries in /usr/bin/ and /usr/sbin/. /usr/sbin/ Non-essential system binaries (e.g. daemons for various network-services). /usr/share/ Architecture-independent (shared) data. /usr/src/ Source code (e.g. the kernel source code with its header files). 4 /usr/X11R6/ X Window System, Version 11 Release 6. /usr/local/ Tertiary hierarchy for local data, specific to this host. Typically has fur- ther subfolders, e.g. bin/, lib/, share/. /var/ Variable files, such as logs, spool files, and temporary e-mail files. /var/lock/ Lock files. Files keeping track of resources currently in use. /var/log/ Log files. Various logs. /var/mail/ Users’ mail-boxes. /var/run/ Information about the running system since last boot (e.g. currently logged- in users and running daemons). /var/spool/ Spool for tasks waiting to be processed (e.g. print queues and unread mail). /var/spool/mail/ Deprecated location for users’ mail-boxes. /var/tmp/ Temporary files to be preserved between reboots. 3.2 Getting system information uname : Print system information. df : Report file system disk space usage. du : Estimate file space usage. top : Display Linux tasks. While running, hit ’u’ for a user id; ’k’ to kill a process; ’q’ to quit. w : Show who is logged on and what they are doing. finger : User information lookup program. date : Print or set the system date and time. time : Time a simple command or give resource usage. echoi@echoi-laptop:~$ uname -a Linux echoi-laptop 2.6.20-16-generic #2 SMP Sun Sep 23 19:50:39 UTC 2007 i686 GNU/Linux 5 echoi@echoi-laptop:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 38G 18G 19G 49% / varrun 1013M 144K 1013M 1% /var/run varlock 1013M 0 1013M 0% /var/lock procbususb 1013M 120K 1013M 1% /proc/bus/usb udev 1013M 120K 1013M 1% /dev devshm 1013M 0 1013M 0% /dev/shm lrm 1013M 15M 999M 2% /lib/modules/2.6.20-16-generic/volatile /dev/sda1 67G 42G 26G 62% /media/sda1 /dev/sda2 5.9G 5.1G 808M 87% /media/sda2 echoi@echoi-laptop:~$ du -sh 13G . echoi@echoi-laptop:~$ top top - 17:39:06 up 9:58, 5 users, load average: 0.15, 0.16, 0.14 Tasks: 140 total, 2 running, 137 sleeping, 0 stopped, 1 zombie Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 99.2%id, 0.0%wa, 0.0%hi, 0.8%si, 0.0%st Mem: 2074620k total, 970440k used, 1104180k free, 205656k buffers Swap: 489972k total, 19428k used, 470544k free, 136692k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3606 echoi 15 0 2320 1184 880 R 1 0.1 0:00.04 top 1 root 15 0 2912 1808 488 S 0 0.1 0:01.79 init 2 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/0 3 root 34 19 0 0 0 S 0 0.0 0:00.00 ksoftirqd/0 4 root RT 0 0 0 0 S 0 0.0 0:00.00 watchdog/0 8 root 10 -5 0 0 0 S 0 0.0 0:00.73 events/0 10 root 10 -5 0 0 0 S 0 0.0 0:00.00 khelper 11 root 10 -5 0 0 0 S 0 0.0 0:00.00 kthread 35 root 10 -5 0 0 0 S 0 0.0 0:00.00 kblockd/0 37 root 10 -5 0 0 0 S 0 0.0 0:01.44 kacpid [ces74@narsil]~% w 17:40:08 up 3 days, 1:40, 4 users, load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT danb pts/0 rockpile Wed15 25:04m 0.69s 0.69s -tcsh carltape pts/1 denali Tue08 2days 0.03s 0.03s -bash 6 ces74 pts/2 dhcp-65-221 17:40 0.00s 0.37s 0.00s w carltape pts/4 denali 06:53 10:45m 0.02s 0.02s -bash [ces74@narsil]~% finger danb Login: danb Name: Daniel Bower Directory: /home/danb Shell: /bin/tcsh Office: 358 South Mudd On since Wed Oct 3 15:56 (PDT) on pts/0 from rockpile 1 day 1 hour idle No mail.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    23 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us