Linux 101 crash course a VERY Brief Introduction by htt39969

VIEWS: 8 PAGES: 4

									                              Linux 101 crash course: a VERY Brief Introduction
                                                    Michael Ward
                                                    www.mward.ca

The goal of this session is to get you comfortable using Linux . This is barely scratching the surface, but you will
learn some basics about :
    • The Window Manager
    • The Desktop
    • Editing your Web-page
    • File Permissions
    • Basic vi commands, bash scripts & shortcuts
    • Transferring files from windows
    • Remote X sessions
THE WINDOW MANAGER & DESKTOP
   •   Window managers are comparable to a car makes (Cadillac - Chevy - SmartCar)
   •   Anyone of them will take you from point A to point B
   •   they look different, they are organized differently
   •   speed will vary
NOTICE the option for session – click session select “xfce”
Login                                                                            When you have more time
Your “Start button” is the mouse icon on the bottom Bar
- start button is the mouse (or right click anywhere on the desktop)
                                                                                 Try kwrite, kate
- terminal
- basic editor
                                                                                 Manual pages are your friend.
- file browser
                                                                                 Type
- web browser
                                                                                 man <command_name>
- LOGOUT
* see various desktop at the top

 TRY KDE (notice it's slower)
 - your “Start button” is the CentOS icon at the BOTTOM left                                When you have more
 - at the right of the start button is your desktop shortcut (right click to manage)        time
 - browse Start -> internet -> (right click) firefox -> "Add item to main panel"             Later
                                                                                            man ls
 - right click anywhere on your desktop (see the various option)-> logout                    When you have
                                                                                            info ls
 TO EXIT -> Start button                                                                     more time

 Try Gnome
 - your “Start button” is the CentOS icon at the TOP left
 - browse Start -> internet -> (right click) firefox -> "Add this launcher to panel"
 - right click anywhere on your desktop (see the various option)
 *TO EXIT -> from any windows manager [ctrl + alt + backspace] all at once – better to log out though


Launch a web browser (click on the globe)
Visit your home page http://www.ece.ualberta.ca/~username
Launch terminal                                                        Why use a command prompt?
type "pwd" (print working directory) <enter>                           - powerful
type echo $HOME <enter>                                                - fast
try autocompletion                                                     - uses minimal system resources
- type cd web<tab>                                                     - many tasks can be automated with scripts
You can get away with typing only one letter, like will work here, but I'm a hard worker, I'll type at least 3
characters then hit <tab>
our prompt should read "cd web-docs/" press <enter>
- type gedit ind<tab> index.html <enter>
Looking at your screen your desktop is starting to get busy (well, it can - I have on average more than 16 windows
open at all time ) > MULTIPLE DESKTOPS
- see the tabs at the top? right click the tab "index.html" -> select "send to " -> workspace 2
notice the view of your desktop at the top left (see which application is visible on each desktop)
- right click "Terminall" -> select "send to " -> workspace 3
resize the terminal by click and drag a corner of the the terminal windows - check the desktop icon in the top left
EDITING your homepage HTML
there is a line that begins with "<h2>Home page for username..."
make a change like add "Welcome to username webpage"
- save it
now go back to your web-browser refresh and notice your masterpiece
====== HTML basic TAGS ===========
<html>
       <head>
              <title>HTML title Document</title>
       </head>
       <body>
              <p>
                      This illustrates in a very <i>simple</i> way,
                      the basic structure of an HTML document.
              </p>
       </body>
</html>
FILE PERMISSIONS (basic file system) – in a terminal
type “ls -la” (l for long, a for “all” = see hidden files)
1       drwxr-xr-x 2 sctest7 grad 4096 Mar 7 07:46 .
2       drwx--x--x 29 sctest7 grad 4096 Mar 7 07:59 ..
3       -rw-r--r-- 1 sctest7 grad 716 Feb 17 14:29 index.html
line #1 : there is a single dot at the end "." this indicates the current directory (and its permission)s
line #2 : there are two dots at the end ".." this indicates the parent directory (and its permissions)
line #3 : is the file information of index.html
d | rwx--x—x | 29 | sctest7 | grad | 4096 | Mar 7 07:59 | ..
file type | permissions | # of links | owner | group | size | time-stamp | file name
Permissions are broken down in three sections - user (u), group (g), and others (o)
                            Num.
 Letter        Meaning      Value
 r             read         4
 w             write        2
 x             execute      1
 d             directory    -
 -             file         -
 l             link         -
x is required on a directory (folder) to be able to read the contents, even by you!
For your file to be viewed on the WEB it must be a) readable by (o) other, and b) the      When you have more
folder must be executable.                                                                 time
Use chmod (change mode) to change permissions Looks like:                                  man chmod
chmod 644 filename                                     -rw-r--r--                          info chmod
chmod 664 filename (for collaboration)                 -rw-rw-r--
chmod 755 foldername                                   drwxr-xr-x
Wild cards are valid: chmod 644 *.html will change all html files in the current folder.
REALITY CHECK be careful
When using template or when other people work in your space
                                                                                                 Less is More
- Especially php template, they can be executed from the web browser
                                                                                           Later when you have
what do you think will happen to user sctest7 fool_index.html
                                                                                           more time
ls -l ~username/web-docs/
                                                                                           man less
-rw-rw-rw- 1 sctest7 grad 716 Mar 7 07:45 fool_index.html
                                                                                           info less
                                                                                           man cat
BASIC vi COMMANDS
Why vi - it is a terminal text editor and it is everywhere in Unix, Linux, OS X, and BSD
Before modifying a file it's a good practice to make a backup first with cp filename filename.bak
commands: press...
[       twice to go to the top of the page
]       twice to go to the bottom of the page
$       to go to the end of the line
^       to go to the beginning of the line
d       twice to delete a line
4       (or any no.) will repeat the next action 4 times
I       to insert or a to append
u       to undo
x       to delete a single character forward
X       to delete a single character backward
r       to replace a single character
cw      to change a single word (change any words - hit <esc> when you are done)
<esc> to leave insert mode
now just for fun press 5, then "i" to insert
type hello
press <esc> and watch what happens
try again but press <enter> after typing hello, then <esc>
Saving and quitting vi
<esc> :q         to quit; <esc> :q! to quit without saving changes
<esc> :w         to write the file (cannot undo write)
<esc> :wq        to write and quit at the same time
<esc> u          to undo last action (some versions only allow 1 undo)
CREATING SHORTCUTS
shortcuts are called symbolic links – let's make one to start the konqueror browser, called “konq”
cd; mkdir -p bin; cd bin       # make sure you're in $HOME; create ~/bin if it doesn't exist
locate konqueror | less        # find the program
locate konqueror | grep bin # another way to find the program; it's in /usr/bin/konqueror, so:
ln -s /usr/bin/konqueror konq
now launch konqueror by typing “konq”
YOUR FIRST bash SCRIPT                                                 Tip: at the command prompt
type cd <enter> we want to make sure you are in your home folder, top  use up and down arrows to scroll thru
cd ~/bin                                                               previous commands, or the scroll bars;
vi home <enter>                                                        type “history” to see whole buffer.
type “i” to insert, and then this:
#!/bin/bash                                                            Customized prompt:
# this is a comment                                                    Add this to your .bash_profile file:
konqueror http://www.ece.ualberta.ca/~username                                 PS1="\u@\h \w> "
<esc> :wq                                                              Log off and login again.
chmod 700 home
Now run it; type “home” - Konqueror will open displaying your home page
TRANSFERRING FILES FROM WINDOWS – WinSCP http://www.ualberta.ca/CNS/SOFTWARE/
-start XP virtual machine
- double-click on WinSCP icon
- click new
hostname (129.128.211.[101-168])
enter username -> click save -> OK
select username@129.128.211.101
click login
continue Connecting and add host key to the cache? YES
enter password and press <enter>
Browse - drag & drop - exit when done
In Linux, try gFTP
Remote X Session: ssh -X username@129.128.211.[101-168] OR e5-12-[01-68].ece.ualberta.ca
NOTE see if anyone else is using the computer (check often): type "w" or "who" and <enter>
change your password from anywhere (you must be “on campus” remember?):
type "konq https://www.ece.ualberta.ca/support/” <enter>
MidnightCommander – quick & dirty command line file manager
type mc <enter> - tab to switch panes, use F9 to access menus or mouse usually works too

There is so much free stuff it's funny that people pay for software: Firefox, Thunderbird, OpenOffice, The
GIMP, Skype . . . tons of it.
Linux equivalents of Windows applications
       short list: http://clubweb.interbaun.com/~mward/gmc/freesw.html
       long list: http://wiki.linuxquestions.org/wiki/Linux_software_equivalent_to_Windows_software
AICT software page                                 http://www.ualberta.ca/CNS/SOFTWARE/
How to run multiple Operating Systems on one computer
                                                   http://clubweb.interbaun.com/~mward/multiboot.html
What is Linux? Why use it?                         http://clubweb.interbaun.com/~mward/gmc/freesw.html#linux
GIANT List of Linuxes                              http://www.livecdlist.com
Most Popular Linuxes                               http://www.centos.org/
                                                   http://www.ubuntu.com/
                                                   http://fedoraproject.org/
                                                   http://knoppix.net/
                                                   http://damnsmalllinux.org/
Linux Course online (there are many others)        http://coewww.rutgers.edu/www1/linuxclass2008/
Basic HTML, CSS                                    http://clubweb.interbaun.com/~mward/html_index.html

								
To top