my net watch press
TRANSCRIPT
-
8/3/2019 My Net Watch Press
1/27
What Is Linux?
Linux is a clone of the Unix operating system (OS)that has been popular in academia and manybusiness environments for years. Formerly usedexclusively on large mainframes.
Unix and Linux can now run on small computerswhich are actually far more powerful than themainframes of just a few years ago.
Because of its mainframe heritage, Unix (andhence also Linux) scales well to perform todaysdemanding scientific, engineering, and networkserver tasks.
-
8/3/2019 My Net Watch Press
2/27
Understanding Command-LineBasics
Linux borrows heavily from Unix, and Unixbegan as a textbased operating system (OS).Unix and Linux retain much of this heritage,which means that to understand how to useand, especially, administer Linux, you must
understand at least the basics of its command-line tools.
-
8/3/2019 My Net Watch Press
3/27
Shell
If you log into Linux using a graphical userinterface (GUI) login screen, though, youllhave to start a shell manually.
Some GUIs provide a menu option to start aprogram called a terminal, xterm, Konsole, orsomething similar. These programs enable youto run textmode programs within Linux, and
by default they come up running your shell.
-
8/3/2019 My Net Watch Press
4/27
Learning the Bash Shell
To change the directory use cd
cd /usr/share/doc
To show current working directory usepwd command
To list contents of a directory use ls
ls /root , ls -la /root , ls -lh /root
-
8/3/2019 My Net Watch Press
5/27
Using I/O redirection
To catch certain expression use grep
grep root /etc/passwd
To send stdout to a file
ls > file1.txt
Append stdout to the end of a file
ls /etc >> file1.txt
-
8/3/2019 My Net Watch Press
6/27
Cont..
To pipe stdout to command2
ls /etc | mail -s list root@localhost
To send stderr to a file
lss 2> cmdnotfound.txt
To append stderr to the end of a file
lsk 2>> cmdnotfound.txt
mailto:root@localhostmailto:root@localhost -
8/3/2019 My Net Watch Press
7/27
Environment Variables
When you log in as a user, you get a
set of environment variables that con-trol many aspects of what you see andwhat you do on your OS.
-
8/3/2019 My Net Watch Press
8/27
cont..
To see the environment variable
env
echo $HOSTNAME
echo $hostname
echo $USER
The values are case sensitive
-
8/3/2019 My Net Watch Press
9/27
Viewing process information
Every time the shell acts on a commandthat you type, it starts a process. The
shell itself is a process.
ps aux
ps aux |grep bash
-
8/3/2019 My Net Watch Press
10/27
Terminating a process
A process can be terminated
Kill a process id
kill 3400
Kill all specific process at one time
killall firefox-bin
-
8/3/2019 My Net Watch Press
11/27
Viewing the command history
To make it easy for you to repeat longcommands, Bash stores the old
commands. history
history |grep ls
history |more
-
8/3/2019 My Net Watch Press
12/27
Package management
The RPM package Manager greatlysimplifies the distribution, installation,upgrading and removal of software.
Software to be installed using rpm isdistributed through rpm package file,which are essentially compressedarchives of files, associated dependency
information and instructions.
-
8/3/2019 My Net Watch Press
13/27
cont..
rpm is both a command and a back-endfor other programs such as yum or pirut.
These tools provide significant
advantages such as automaticdependency resolution.
e.g to install a package
rpm -ivh zip-2.3-8.i386.rpm e.g to remove a package
rpm -e zip
-
8/3/2019 My Net Watch Press
14/27
cont.. yum is the front-end to rpm
Designed to resolve packagedependencies
Can locate packages across multiplerepositories
Replacement for up2date
-
8/3/2019 My Net Watch Press
15/27
cont..
To list all package from repositories
yum list all
To grep packages from repositories
yum list all |grep zip
To list group of package
yum grouplist
To install a group of package
yum groupinstall open office
-
8/3/2019 My Net Watch Press
16/27
Runlevel
The idea behind operating differentservices at different runlevels revolvesaround the fact that different systemscan be used in a different ways.
Some services can not be used until thesystem is in a particular states or mode
such as being ready for more than oneuser or having networking available.
-
8/3/2019 My Net Watch Press
17/27
cont..
0 Halt
1 single user mode
2 Not used (user definable) 3 Full multiuser mode with networking
4 Not used (user definable)
5 Full multiuser mode (with x windows)
6 - reboot
-
8/3/2019 My Net Watch Press
18/27
cont..
To view current runlevel
runlevel
To switch to other runlevel
init 3, init 1, init 6, init 0
-
8/3/2019 My Net Watch Press
19/27
Managing services
Services can be manually start or stopby accessing the scripts on /etc/init.d
chkconfig manages services definitionsin run levels
to start the apache web server oncurrent runlevel, chkconfig httpd on
to start apache on runlevel 3 and 5
chkconfig --level 35 httpd on
-
8/3/2019 My Net Watch Press
20/27
Text Editor The vi text editor is a full-screen text
editor that enables you to view a fileseveral lines at a time.
Most UNIX systems including Linux comewith vi.
If you learn the basic features of vi,
therefore you can edit text files on almostany UNIX systems.
-
8/3/2019 My Net Watch Press
21/27
cont..
To start the text editor just type vi
To edit or view a file, type vi filename
To start inserting or editing a file press aafter opening the file
To exit without saving press escapeshift : and q!
To save file and exit press escape : andwq!
To find a phrase press escape and /
-
8/3/2019 My Net Watch Press
22/27
Network connectivity
The OS requires an IP Address to communicate Verify that the OS having correct IP Address
IP address can be set
static (manually set) dhcp (auto discover from DHCP server)
View current setting of network interface
ifconfig
Restart network service in case changes aremade
service network restart
-
8/3/2019 My Net Watch Press
23/27
cont..
There are many ways you can verifyconnectivity from your host to the others
ping
ping 10.20.10.53
ping www.google.com.my
Telnet to port number
telnet www.google.com.my 80
http://www.google.com.my/http://www.google.com.my/http://www.google.com.my/http://www.google.com.my/ -
8/3/2019 My Net Watch Press
24/27
cont..
Telnet can be used to verify the connectivitybetween host e.g client and server
A successful attempt to connect to a web server
telnet www.google.com.my 80
Trying 64.233.181.99...
Connected to www.google.com.my
(64.233.181.99).Escape character is '^]'.
http://www.google.com.my/http://www.google.com.my/ -
8/3/2019 My Net Watch Press
25/27
cont..A failed attempt to connect to an ftp server
telnet www.oscc.org.my 21
Trying 10.20.10.52...
telnet: connect to address 10.20.10.52: Connection refused
telnet: Unable to connect to remote host: Connectionrefused
Reason
A firewall blocking the communication
There is no such service running on port 21on the server
The service is down
-
8/3/2019 My Net Watch Press
26/27
Port Number
Every network service requires portnumber to operate
Http (80)
Ftp (21) Smtp (25)
Pop3 (110)
Ssh (22)
We can view list of registered port in/etc/services
cat /etc/services |grep smtp
-
8/3/2019 My Net Watch Press
27/27
Help and Manual
Help and manual usually come with theinstalled program e.g to read manual forls
man ls
Also can view from the help option
ls --help Google for more advanced topics