Linux Fun
Linux Fun
0
Prepared by: Eng. Anwar Fouad NTI
What is Linux?
4
Prepared by: Eng. Anwar Fouad NTI
How do you get it?
7
Prepared by: Eng. Anwar Fouad NTI
Popular Linux Distributions
8
Prepared by: Eng. Anwar Fouad NTI
Why is it significant?
Growing popularity
Powerful
Runs on multiple hardware platforms
Users like its speed and stability
No requirement for latest hardware
It‘s ―free‖
Licensed under GPL
Vendors are distributors who package Linux
9
Prepared by: Eng. Anwar Fouad NTI
Linux’s place in the market
Impacts:
Applications:
Web servers (65%)
Web Infrastructure (mail, DNS) (15%)
File/Print (15%)
DB & DB Applications (2%)
Observations
Linux/Apache share of Web serving high
Many SMB and small ISP
Strong mindshare among developers
Update : w3techs.com
12
Prepared by: Eng. Anwar Fouad NTI
NTI
Device Drivers
14
Prepared by: Eng. Anwar Fouad NTI
Linux Operating System
3 main components
Kernel
Command interpreter (Shell)
Utilities
17
Prepared by: Eng. Anwar Fouad NTI
Linux Operating System
Kernel
Manage Physical (hardware) resources
Set of Procedure (written mainly in C)
Command interpreter (SHELL)
Several shell (Bourn-Shell, TC or C-shell, k-shell, Bash-shell …)
Language of command (script or command Line)
Commands (executable programs)
Utilities
Text editors (vi, emacs, gedit, nano ….)
Programming languages (C, Fortran,…)
Syntax analyzer (yacc,…)
Web tools
...
18
Prepared by: Eng. Anwar Fouad NTI
NTI
Linux Fundamentals
Linux User
20
Prepared by: Eng. Anwar Fouad NTI
Login and Logout
After validation, the user's current directory is set to his Home directory
and the associated executable file is launched:
– most frequently, the latter will be a command interpreter (shell):
sh, csh, ksh. Bash, tcsh
At the end of his work, the user closes the session: logout
21
Prepared by: Eng. Anwar Fouad NTI
Logging In : local side
22
Prepared by: Eng. Anwar Fouad NTI
Logging In: Command Line
23
Prepared by: Eng. Anwar Fouad NTI
Logging In : GUI
24
Prepared by: Eng. Anwar Fouad NTI
Logging In : remote side
Example:
C:> telnet 41.65.222.215
Username : student#
Password : rootadmin
25
Prepared by: Eng. Anwar Fouad NTI
Rule Number 1
26
Prepared by: Eng. Anwar Fouad NTI
Linux File
27
Prepared by: Eng. Anwar Fouad NTI
Linux File Types
28
Prepared by: Eng. Anwar Fouad NTI
Regular File
Linux/Unix philosophy:
the way in which the information contained within a file
should be interpreted is the concern of the software
application that uses it.
29
Prepared by: Eng. Anwar Fouad NTI
Linux File System Basics
Data files
30
Prepared by: Eng. Anwar Fouad NTI
Special directories
31
Prepared by: Eng. Anwar Fouad NTI
Naming Files
/home/neale/b
32
Prepared by: Eng. Anwar Fouad NTI
The Current Directory
Current working
directory
doc/letter
./doc/letter
/home/neale/doc/letter
33
Prepared by: Eng. Anwar Fouad NTI
Some Special File Names
34
Prepared by: Eng. Anwar Fouad NTI
File Pathname
Pathname of a file:
Used to refer to a file (whatever its type)
Sequence of physical links
May be absolute or relative.
Absolute pathname of a file:
Sequence of physical links describing the path to follow from the root
directory to reach the file.
Examples:
/home/marty
/etc/passwd
/home/neale/doc/letter
35
Prepared by: Eng. Anwar Fouad NTI
Relative Pathname
Relative pathname:
Sequence of physical links describing the path to follow from the
working directory to reach the file.
Examples:
Action
Reach the letter directory founded in directory doc:
working directory relative pathname
neale doc/letter
scully ../neale/doc/letter
marty ../../dev/fd0
36
Prepared by: Eng. Anwar Fouad NTI
Relative Pathname
/dev/fd0
doc/letter ../../dev/fd0
../neale/doc/letter
/home/neale/doc/letter
37
Prepared by: Eng. Anwar Fouad NTI
Linux Process
38
Prepared by: Eng. Anwar Fouad NTI
Parent And Child Process
The child process inherits many attributes and information from its
parent. For example:
table of descriptors of opened files
owners
environment variables, and so on
39
Prepared by: Eng. Anwar Fouad NTI
NTI
Linux Fundamentals
NTI
42
Prepared by: Eng. Anwar Fouad NTI
Execute a command line
ls -l /etc
43
Prepared by: Eng. Anwar Fouad NTI
Simple Commands
44
Prepared by: Eng. Anwar Fouad NTI
Getting Help
45
Prepared by: Eng. Anwar Fouad NTI
The whatis Command
46
Prepared by: Eng. Anwar Fouad NTI
The --help Option
47
Prepared by: Eng. Anwar Fouad NTI
The man Command
48
Prepared by: Eng. Anwar Fouad NTI
Navigating man Pages
49
Prepared by: Eng. Anwar Fouad NTI
The info Command
50
Prepared by: Eng. Anwar Fouad NTI
Navigating info Pages
51
Prepared by: Eng. Anwar Fouad NTI
Listing Directory Contents
52
Prepared by: Eng. Anwar Fouad NTI
Changing Directories
cd changes directories
To an absolute or relative path:
cd /home/joshua/work
cd project/docs
To a directory one level up:
cd ..
To your home directory:
cd ~
To your working directory:
cd .
53
Prepared by: Eng. Anwar Fouad NTI
Viewing File Contents : less and cat
54
Prepared by: Eng. Anwar Fouad NTI
Basic Commands On Files
more file1
Writes on stdout one page at a time
55
Prepared by: Eng. Anwar Fouad NTI
Copying Files and Directories
56
Prepared by: Eng. Anwar Fouad NTI
Copying Files and Directories: The Destination
57
Prepared by: Eng. Anwar Fouad NTI
Moving and Renaming Files and Directories
58
Prepared by: Eng. Anwar Fouad NTI
Creating and Removing Files
rm - remove files
Usage:
rm [options] <file>...
Example:
rm -i file (interactive)
rm -r directory (recursive)
rm -f file (force)
59
Prepared by: Eng. Anwar Fouad NTI
Creating and Removing Directories
60
Prepared by: Eng. Anwar Fouad NTI
NTI
Linux Fundamentals
Command Line Shortcuts The Tab Key
62
Prepared by: Eng. Anwar Fouad NTI
Command Line Shortcuts History
63
Prepared by: Eng. Anwar Fouad NTI
More History Tricks
64
Prepared by: Eng. Anwar Fouad NTI
Command Line Expansion :The tilde
Tilde ( ~ )
May refer to your home directory
$ cat ~/.bash_profile
May refer to another user's home directory
$ ls ~julie/public_html
65
Prepared by: Eng. Anwar Fouad NTI
Commands and Braced Sets
66
Prepared by: Eng. Anwar Fouad NTI
Command Editing Tricks
67
Prepared by: Eng. Anwar Fouad NTI
Lab Exercise NO. ( 1 )
http://41.65.222.215/
68
Prepared by: Eng. Anwar Fouad NTI
File Permissions
Every file
Is owned by someone
Belongs to a group
Has certain access permissions for owner, group, and others
Default permissions determined by ―umask‖
69
Prepared by: Eng. Anwar Fouad NTI
File Permissions
Every user:
Has a uid (login name), gid (login group) and membership of a
"groups" list:
The uid is who you are (name and number)
The gid is your initial ―login group‖ you normally belong to
The groups list is the file groups you can access via group
permissions
70
Prepared by: Eng. Anwar Fouad NTI
File Permissions
71
Prepared by: Eng. Anwar Fouad NTI
File Permissions
The long version of a file listing (ls -l) will display the file
permissions:
Permissions Group
Owner
72
Prepared by: Eng. Anwar Fouad NTI
Interpreting File Permissions
-rwxrwxrwx
Other permissions
Group permissions
Owner permissions
Directory flag (d=directory;
l=link)
73
Prepared by: Eng. Anwar Fouad NTI
Interpreting Permissions
74
Prepared by: Eng. Anwar Fouad NTI
Changing Permissions – Symbolic Method
75
Prepared by: Eng. Anwar Fouad NTI
The most common file permissions.
Permission Meaning
--- No access is allowed
r-- Read-only access
r-x Read and execute access, for programs
and shell scripts
rw- Read and write access, for files
rwx All access allowed, for programs
76
Prepared by: Eng. Anwar Fouad NTI
Permissions and numeric equivalents.
--- 000 0
--x 001 1
-w- 010 2
-wx 011 3
r-- 100 4
r-x 101 5
rw- 110 6
rwx 111 7
77
Prepared by: Eng. Anwar Fouad NTI
Changing File Permissions
78
Prepared by: Eng. Anwar Fouad NTI
Changing File Ownership
79
Prepared by: Eng. Anwar Fouad NTI
Lab Exercise NO. ( 2 )
http://41.65.222.215/
80
Prepared by: Eng. Anwar Fouad NTI