Tải bản đầy đủ (.ppt) (46 trang)

linux crash course

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (240.91 KB, 46 trang )

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 do 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
$$$


Features Overview





Multiuser
Multiprocess / Multitasking
Hierarchical Filesystem
BASH Shell command line interface /
programming language
• Many useful utilities built-in
• Rich networking support


How do I start?
• Console vs. terminal vs. terminal emulator
• Text-based vs. graphical
• Where’s the box at?


Consoles and terminals
• Monitor, keyboard (and maybe mouse) attached

to the box
• The console often locked away in a closet or
server farm somewhere
• Terminals usually found in mainframe
environment
• Recently ‘thin clients’ gaining popularity again


Terminal Emulation
• Using a separate system, connect 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
• Translates 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 read/write access to filesystem
Can execute privileged commands and programs
Use sparingly and with extreme caution


Admin Priv, con’t
• We’re using Ubuntu, which treats root in a
unique fashion
• Don’t logon as root
• To execute privileged commands:
– sudo [command] or gksudo [command]
– Will prompt for your credentials – are you sure??


Getting help
• Most GNU commands and utilities have built in
help and usage information
• --help (sometimes -h or -help)
• Too much information? Pipe results to less or
more
– ls --help | less


man Pages
• man program_name
• Displays online documentation, formatted with a
pager
• SPACE to advance, q to quit

• Depending on the system sometimes you can also
use PAGE UP/DOWN


Typing Commands
• Beware of special characters
• Characters that have special meaning to the
shell
• Shell expands, modifies and interprets
special characters before issuing the
command


Special Characters
• &;|*?‘“`[]()$<>{}^#/\%!~+
• Plus whitespace (tabs, spaces, newlines)
• Do not use these in filenames unless you
have to
• To use them, either put in single quotes,
or proceed with a backslash
– ls ‘filename with special chars!!’
– ls \[cat\]


Utilities
• Linux & Unix come with thousands of utilities
• Some used explicitly, others implicitly
• Some text-based, some GUI, some both



Some tips before we start
• Tab completion
– When typing a filename or command name, you
can type the first few letters then hit TAB to autocomplete the command

• Command history
– Use the up and down arrow keys to cycle
through recently executed commands
– You can edit them before issuing again


ls: LiSt files
• Used to list files contained in a directory
• Can narrow the search using pattern
matching
• Examples
– ls  displays ‘all’ the files in the directory
– ls cats  displays the file cats in the directory
– ls ca*  displays files starting with ‘ca’


cat: catenate a file
• Displays the contents of one or more files
• Beware – don’t try with binary files
• Examples
– cat myfile  displays contents of myfile
– cat file1 file2  displays contents of file1
followed by contents of file2



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×