0% found this document useful (0 votes)
16 views22 pages

Linux Training L1

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 22

F Introduction

F Necessary Commands
F Directory Introduction
F Installation
F Swap Partition
F Users, Groups and Permissions
F RPM
F Network Configuration
F Printing
F Mounting and Driver Installation
F Vi Editor and Backups
F Directory Sharing
F Changing Run Level
F File Transfer Protocol
F Telnet
F Troubleshooting
F Contacts
F Linux Origins

Linus Torvalds announced Linux in August, 1991

F Why Linux

Linux is a UNIX like OS. Linux is as similar to UNIX as the


various UNIX versions are to each other.

F Multi-user and multi -tasking

Linux is a multi-user and multi -tasking operating system. Tha t


means that more than one person can be logged on to the same
Linux computer at the same time. (Of course, each user needs his
own terminal.) Linux is also multi-tasking that is a user can have
more than one process (program) executi ng at the same time.

F Difference Between Windows and Linux

In Windows In Linux
F Terminals Changing

In linux there are seven terminals f rom F1 to F6 are the text base
terminals and F7 is the grap hics terminal. We can log any
terminal by pressing Ctrl key + Alt key + F1 for 1 no. terminal,
Ctrl + Alt + F2 for 2 no. terminal etc ….
If we already logged the text terminal (i.e. F1 to F6) and can jump
into graphical terminal by pressing Ctrl+Alt+F7.

If we want to logout from text base terminal then simply type the
command --
# logout.

F How to See The Version


# uname –r
# cat /etc/redhat-release

F How to See the Current Working Directory


# pwd

F Changing The Date and Time

In graphics mode just clic k the open terminal after that type the
command --
# system-config-date
Or
# system –config-time
now we can edit our date and time.
F Create a Directory and File
# mkdir dirname
# touch filename

F Remove a Directory or File


# rm –rf dirname/filename

F Rename a Directory/File
# mv olddirname/filename newdirname/filename

F To See the List of Files and Directory


# ls for all files
# ls -d for directory only
# ls -l for files only
# ls -a for hidden and all file
# ls |less for display page by page
# ls -h for show size in MB

F How to copy
# cp source destination
# cp –f for forcefully
# cp –a for all

F How to See the Con tents of a File


# cat filename

F How to Change a Directory


# cd for parent directory
# cd .. for current directory
F How to Find a File
# find / -name filename
# whereis filename

F How to Archive a File


# tar option filename (options- c for create, v for verbose, f for
archive, x for extract)
# tar option output filename.tar input filename
# tar cvf test.tar grub.conf Archive the grub.conf file to test.tar
# tar xvf test.tar Extracted the test.tar file

F How to Open Help File


# man commandname

F How to See the Memo ry Size


# free

F How to See the CPU Details


# cat /proc/cpuinfo

F How to See the Partion Table


# df –T

F How to Change Root Password


# passwd root

F How to Change User Password


# passwd username
F /bin
This is the binary directory which contents all executable files. When
a program is installed its binary files are stored here.

F /dev
Devices contains files that point to the hardware.

F /boot
The boot loader files are stored here.

F /etc
The folder contains various configuration files that can be manually
edited to effect the system.

F /home
It contains the users files.

F /root
This is the home directory of the root user.

F /lib
Library files frequently used system files needed by program or the
operating system are stored here.

F /mnt
All storage media other than Linux partitions are mounted here.
F /opt
It stores add on components such as desktop environments, data base
etc.

F /tmp
This is the temporary directory.

F /usr
Non critical system files are stored here.

F /var
It contains log files, spools etc.

F /proc
It contains all hardware information.
In Linux at least three partition required that is root,
boot and swap partition

F Insert the bootable disk and write at the boot option

linux askmethod For Graphics method


linux textmethod For Test method
linux rescue For Rescue method

Note : linux rescue method is used for troubleshooting purpose only.

F Create the Partition manually

F Give the swap size atleast double of RAM


F How to Increase Swap Partition After Installation
# free See the Swap Memory and Note it

# fdisk /dev/sda For SATA HDD

Press n For New Partition


Press Enter
Give the partition size +1024M (size is according to choice)
Press Enter
Press p For Display the partition, the last one is
the new partition

Press t For Changing the Partition ID


Give the partition number
Give the ID that is 82 ID 82 is the Swap ID
Press wq For Save and Exit

# partprobe For Upgrade the Partition Table


# mkswap /dev/hdax Where x is the Partition Number
# vi /etc/fstab Add the following line in the fstab file

/dev/hdax swap swap defaults 00

# mount -a
# swapon -a
# free See the Swap Memory Increases or Not
F How to Create a User
# useradd username
# passwd username

F How to Delete a User


# userdel –r username

F How to Create a Group


# groupadd groupname

F How to Delete a Group


# groupdel groupname

F Permission
4 for r – read 2 for w – write 1 for x – execute

Group/User Group Other

# chmod 771 dirname That is group and user get read, write,
execute permission and others only get
the execute permission.

Changing the group ownership of a Directory


# chown .groupname dirname

F How to Change the Group for a Particular User


# usermod –G groupname username

After login as that User enter the following command


# newgrp groupname
F How to Install the RPM Package
# rpm –options packagename Options : i – install, v – verbose,
h – hashmarks, e – erase, q–quarry
qa – quarry all, qf – quarry file

# rpm –ivh packagename --aid –-force --nodeps

(here -–aid means resolution, --force means forcefully, --nodeps


means dependency)

F How to Quarry a Package whether it is Install or Not


# rpm –qa packagename

F How to Uninstall a Package


# rpm –e packagename
F How to Configure the IP
# netconfig
Or
# system-config-network

After changing the network IP enter the following command

# service network restart

F How to Stop the Networking Services


# service network stop

F How to See the IP


# ifconfig

F How to Ping
# ping ipaddress

F How to Check the Link


# ethtool eth0
F How to Add a new Printer
# system-config-printer

Click new
Click forward
Name : printer (give any name for local)
Click forward
Select the locally connected
Click forward
Select the printer driver ( that is HP, Epson etc.)
Click forward
Click finish

F How to Install the Share Printer at Client


At first share the locally installed printer into the whole network.

For Printer Sharing


#system-config-printer
Select the printer icon
Click Action – sharing - - queue - Select the options :- this que is
available to other computers

From the client enter the following steps


# system-config-printer
Click new –Name : put any name for local – Click forward – Select
the Printer type : Networked CUPS (IPP)
Server : IP address or Printer Server Name – Path : /printers/server
printer name – Click forward – Select : raw print que – Click forward
– Click finish - Yes
F How to Mount a CD-Rom Device
Insert a disc into CD drive
# mount /dev/cdrom /mnt
Now all the data of CD is mounted under the /mnt directory

F How to Unmount a CD-Rom Device


# umount /mnt Or # umount /dev/cdrom

F How to Install a LAN Driver


Insert the Lan Driver disc and copy it to any folder like /tmp folder
It contains either a rpm file or Make file and a help file. If it is Make
file then follow the example which is given below or we can follow
the instruction which is given in the help file.

# cd /tmp
# tar xvf e1000.tar (e1000.tar is a driver file name)
# cd e1000
# cd src ( src folder is found under the e1000 dir
where is make file located )
# pwd
/tmp/e1000/src

# make install
# modprobe e1000
# kudzu
now follow the steps which is appears on the screen

# netconfig or # system-config-network (Put the IP etc.)


# service network restart
F How to Edit a file under the Vi Mode
# vi filename
Press I For Insert and edit

Press Esc key


:wq For save the changes and exit from vi
mode

:wq! For forcefully save and exit

:q For quit without save

:q! For forcefully quit without save

F The Backup and Restore


To back up a file or directory to a device
# tar cvzf /dev/st0 file/directory ( st0 is a device name,
z means gzip compression)
To extract
# tar zxf /dev/st0

Using Dump for Full Backup


# dump -0u –f /dev/st0 /home

Using Dump for Incremental Backup


# dump -4u -f /dev/st0 /home

Using Restore
# restore –rf /dev/st0
F How to Share a Directory into the Network
# mkdir /test ( /test is the directory name)
# chmod 777 /test

# vi /etc/exports ( write the following line )

/test 192.168.0.0/255.255.255.0(rw,sync)

# export –a

# service nfs restart


# chkconfig nfs on

For testing
# showmount –e ipaddress

From Client
# service nfs restart
# chkconfig nfs on
# showmount –e ipaddress ( Share PCs ipaddress)

For Mounting the Share Directory from Client


# mount ipaddress:/test /mnt
# cd /mnt

Now all the datas are mounted under the /mnt directory from the
share directory /test
F Number of Run Level
There are 7 numbers of run level from 0 to 6.The default run level is 5

F How to Check the Run Level


# runlevel

F How to Change the Run Level


# init 3 Run only in the text method

# init 5 Run only in the graphics method

# init 0 Means Shutdown the System

# init 6 Means Reboot the System


F How to Start the Services of FTP

Install the ftp package

# service vsftpd restart


# chkconfig vsftpd on

F How to Login
# ftp ipaddress

Give user name : anonymous


Password not required

F How to Download and Upload a File


Using the command : put and get
( make sure it is enable or not )

F How to Quit from FTP site


Using the command : bye
F How to Enable the Telnet Services

Install the telnet-server package

# vi /etc/xinetd.d/telnet ( Edit the following line )


disable = no

# vi /etc/securetty ( Add the following line )


Pts/0
Pts/1
Pts/2

# service xinetd restart


# chkconfig xinetd on

F How to Login via Telnet


# telnet ipaddress

Give the root password

F How to Quit from Telnet Site


Using the command : quit or exit
F Forgot the Root Password

Go to the Single User mode and change the root password


sh# passwd root
sh# reboot

F User account Expired

From root login


# chage username ( Extend the password expiration date)

F Monitor Display Shows No Signal

It occurs because of the high graphics resolution


Go to the Text mode and change the graphics resolution
# system-config-display
# reboot

F After BIOS booting the System shows a black Screen or


no operating system found

It means the grub boot loader is corrupted.


Insert the linux bootable disc 1 and boot as a linux rescue method
sh-2.04# chroot /mnt/sysimage
sh-2.04# grub-install /dev/hda
sh-2.04# exit

You might also like