1. Trang chủ
  2. » Công Nghệ Thông Tin

linux crash course

46 89 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 46
Dung lượng 642,5 KB

Nội dung

Linux Crash Course Selected snippets from CIS52 Long ago, in a galaxy far away … • Computing power was costly – UNIVAC cost $1 million • CPU time was a premium – Most mainframes had less computing power than a calculator on the shelf at Wal-Mart • Jobs were submitted into a queue – Only one process at a time – scheduling nightmare What was needed • Allow multiple users to access the same data and resources simultaneously • Service many users more cheaply than buying each their own machine • The ability to run multiple processes at once • And so while maintaining user segregation and data integrity Enter Unix, pride of Bell Labs • Originally written in PDP-7 assembly language by Ken Thompson • To make it work on multiple architectures (portable), Thompson rewrote Unix in B • Dennis Ritchie developed C, and with Thompson, rewrote Unix in C What was so great about it? • • • • • Multiuser Multiprocess Non-proprietary Economical for business Initially given for free to colleges and universities (great tactic!) What happened? • UNIX became commercialized • Proprietary code, specialized distributions • Costs started to become a hindrance • So … let’s make our own Unix … GNU • Richard Stallman decides that there should be a free version of Unix available • Forms the GNU project – GNU’s Not Unix • Writes all of the system programs and utilities to mimic Unix variants • Everything but a kernel (Hurd) Final piece • Universities trying to teach Unix and OS design can’t afford Unix • Andrew Tanenbaum writes Minix • Linus Torvalds, dissatisfied with Minix, writes his own – Linux GNU-Linux • Torvalds has a perfectly functioning kernel – but no system programs • Finds a perfect candidate in GNU • Together, the operating system world was changed dramatically Why Linux? • • • • • Software Hardware Portability Standards $$$ Filenames con’t • Spaces and other special characters a bad idea • Instead of spaces use underscores or periods – Ex: my_file or my.file Hidden Files • To make a file hidden, start it with a period – Ex plan • A normal ls will not show hidden files • Use ls –a to reveal ALL files • Startup files, containing configuration settings for your account, hidden mkdir – create directory • Syntax: mkdir directory • Directory can be a relative or absolute pathname (we’ll get to that in a minute) • You can use ls –F to show directories with a forward slash at the end of the name • If using a color terminal, directories will be a different color than ordinary files Working Directory • The directory you are currently working in • pwd will tell you what your working directory is • Helpful to know when using relative pathnames (again, coming up) Home Directory • Not to be confused with working directory • The directory you start in when you first logon • Most users it is /home/username • For root, it is /root • Can be changed by system administrator cd – change working directory • Syntax: cd [directory] • Again, directory can be absolute or relative • If no argument given, changes working directory back to your home directory Absolute Pathnames (finally) • Absolute pathname for a file gives the file’s location relative to the root of the filesystem • Sometimes long • Ex: /home/jhowell/Assignment1/animals • Shortcut: ~ represents your home directory • So the above could also be ~/Assignment1/animals Relative Pathanmes • A pathname relative to the current working directory • Make sure you know what your working directory is! • Shorter • Ex, in my home directory: Assignment1/animals and Directories • is an alias for the working directory • is an alias for the parent of the current working directory • These pointers are placed in every directory when created by mkdir • Can be used in relative pathnames Common Directories • • • • • • • / (root) – root of the filesystem /bin – essential system binaries (commands) /boot – files for the bootloader /dev – device files /etc – system configuration files /home – user home directories /lib – standard libraries and modules Common con’t • /mnt – mount point for temporary filesystems (floppies, CD-ROMs, non-native partitions) • /opt – optional add-on software • /proc – kernel and process information • /root – root’s home directory • /sbin – essential system binaries • /tmp – temporary space (not swap) Common con’t • /usr – common area for data / program users use frequently • /var – frequently changing data like system logs, caches, spools and mailboxes • That said, all these can reside on the same partition • Only / and a swap partition required Permissions • Use a ls –l (for long view) and you might see something like this: drwxr-xr-x -rw-rw-r-drwxrwxr-x jhowell jhowell 4096 Aug 18 15:46 Desktop jhowell jhowell Sep 18:08 myfile jhowell jhowell 4096 Aug 22 15:32 public_html # of links Type of file File Permissions filename group user size Date and time created / accessed chmod – CHange MODe • Changes permissions • Syntax: chmod [ugoa][+-][rwx] • Ex: grant everyone (all) read and write chmod a+rw myfile • Ex: remove execute permission for other chmod o-x myfile Permissions Caveats • To execute a shell script you must allow both read and execute permissions • To get into a directory, you must have execute permission • root can still read and write to files without read and write permissions ... Linux GNU -Linux • Torvalds has a perfectly functioning kernel – but no system programs • Finds a perfect candidate in GNU • Together, the operating system world was changed dramatically Why Linux? ... a virtual terminal to the server • telnet, ssh, X Windows • Most common way to interact with a Linux/ UNIX machine • Ubuntu – Applications->Accessories->Terminal The Shell • Command interpreter... commands issued by user into commands sent to the kernel • Common shells: bash, tcsh, csh, zsh, ksh • Linux default is bash (Bourne Again Shell) Administrative privleges • • • • root or superuser Full

Ngày đăng: 06/02/2018, 09:56

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN