Linux Portion

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 10

Clover Academy

Portion for the Linux Review

Day 1: Linux Installation

Overview of Linux 5.4(5.5) Features

Kernel and RHEL OS

Prerequisites for installation

Understanding partitions

Compulsory partitions for installation

Runlevels – how many are there

 Significance of each runlevel


 Command runlevel

 Command init –runlevelnumber to go from one runlevel to another

 /etc/inittab – to check the default runlevel which is the current for server

 chkconfig -

Text mode Installation, Graphical Installation, NFS through Installation

 Before the review Kick start Installation of Linux

Day 2: Linux Files Systems/ Linux Directory Structure

Linking and unlinking of file


Different file systems in linux, difference between ext2 & ext3.

Understanding the concept of Journaling

Understanding all default directories of Linux and need of each of them

Understanding all configuration and system folders/files like / or /etc or


/etc/fstab(File System Table which is a file)

Day3: File and Shell Basics

 pwd – to see present working directory

 mkdir – create directory(-m, -p, -v)

 rmdir – removes empty directory(-p, -v)

 cp – copy file/ directory(-b, -f, -i, -r, -R, -s, -u, -v). By default cp overwrites the
existing file without prompt(-f option); -I will prompt before overwrite

 ls – listing the directory contents(-aA, -c, -C, -w, -d, -f, -F, -gG, -h, -i, -kl, -o, -r, -R,
-s, -S, -t, -U, -u, -1)

 lsof – This command shows you files opened by process which are running. lsof
is an increadibly powerful command-line utility for unix systems. It lists open
files, displaying information about them. And since most everything is a file on
unix systems, lsof can give sysadmins a ton of useful diagnostic data.

If we delete a file and a process is writing on it before we delete, a process keeps


on writing to it. because when you erase a file in unix - it simply "unlinks" it. Any
process that has it open - STILL HAS IT OPEN.
DBWR had the datafile open. You "erased" the file (which simply removed the
directory entry in effect, everyone that has it open, still does). You then wrote to
that file by checkpointing. Anything that had the file open would still have it
open. Until that process that had it open closed it, and tried to open it again
would it discover "oh, it isn't there anymore..."

lsof has many useful switches.

 cd – change directory(cd.., cd . ; cd ../XYZ, Absolute & Relative path)


 mv – moving file to another directory/ renaming existing (-f, -I, -u, -v). By
default it rename the file if destination file is already exists(-f), with –i it
prompts before overwrite.

 rm – removes a file or directory(with –r option) (-d,-f,-i, -r, -R, -v). By default it


does not ask for the confirmation unless used –i option.

 more & less - (less is advance of more in which scroll upward is also allowed)

 head /tail – displays start/end of the file. Mainly tail is used to see end of a
logfile(-n, -f with tail, -v, -q, --pid with tail)

 cat – displays contents of file, concatenate contents of two/more files

 touch – change modify/access time of a file if file does not exists. It creates the
file(-a,-c,-d,-m,-t)

 du – displays disk usage. It gives summary of disk usages of each and every
files/ directory (-h, -k, -m, -S, -X). #du - This command will show the usages of
disk by files and folder. Output of this command show in bytes.

To show it in KB use –h switch. #du -h [file name]

To know that how much space is consumed by any specific file. For example

#du –h test 12 Kb test

 df – displays space information(used and free) for partitions(-h, -I, -k)

Know how much space is available - #df [partition]

df command is used to know the available space on any given partitions.

For example to know available space on / partition use this command

#df /

 fdisk- (making partition) -l –n –p –d etc. (other imp commands to know with


fdisk are partprobe, mkfs )
(Practically asking to make a new partition and save and mount – use of
commands fdisk, partprobe, mkfs and editing of /etc/fstab)

 chkconfig
 which – gives path of the command(user created/ system commands) i.e
where the command comes from for example if you give which

How to locate any command path


#which [command]

#which ln

 whatis - tells what the command do? It searches commands in whatis


database created by /usr/bin/makewhatis

 uname – gives you the system information like OS, kernel version, os bit,
processor type etc ( -s kernel name, -r kernel release, -v kernel version, -m
hardware name, -p processor type, -i hardware platform, -o operating system)

(Note: bit information about the os bit is also find by command getconf for e.g.
getconf LONG_BIT – it will straight away displays 32 bit of os or 64 bit
of os. Apart from bit info we can even get the page size info if we
write getconf PAGE_SIZE, it will display page size on rhel system. Try
to understand all the options used with getconf)

Day4: Users & Groups

 Ranges for uids & guids


 groupadd – adding a group(-r, -g, -o, -K Key=value)

 groupmod – modifying a group (-n new_grp_nm, -g gid)- effect of it

 groupdel – deleting a group – effect of deleting

 useradd – adding a user (-c, -b, -d, -m, -g, -G, -K, -r, -u, -o)

 usermod – modifying user(-g, -G, -l)


 userdel – deleting a user (-f,-r) effect of deleting

 passwd – change password for user

 groups – list groups of user

 id – print groups/user id details (-u, -r, -n, -g, -G)

 users – who is currently logged in. You can specify input file also

 whoami – currenly logged in user

 who am i

 who – who all is logged-in in the system(-b, -d, -r, -u)

 w – who is logged in and what they are doing. Understand the output of it

 last – gives history of logins & reboot of systems (when last time the server had
reboot)

 uptime

 su – switch(substitute) user (-, -m, -p)

 finger – gives user info like Login name, real name, terminal name, home
directory

 env

Creation of user and directory /etc/.skel

Profile of a user

/etc/profile

/home/username/.bash_profile

/home/username/.bashrc

Nologin shell and login shell


Day 5: Files & Permissions

 ugo+rwx; chown, chmod, chgrp, umask


 umask for root 022(permission for file=666-022=644, directory=777-022=755)

 for others 002(permission for file=666-002=664, directory=777-002=775)

Sticky bit, command setfacl , s permission on file and directories

Day 6: Vi Editors and communication command

 Opening and editing multiple files with options to open, edit, save a file. Also
cursor movement options
 Communication Command : mail, mesg, write

Day 7: More commands & STDIO

 find – Search a file based by name, size, permission

How to find any files


#find [where to find] – name [what to find]

find command is used to find any object in linux. For searching object you can
also use locate command but locate command is based on mlocate database. For
example to find vinita directory on entire linux use

#find / -name vinita

Or to find only in /home partition use

#find /home –name vinita

 locate/slocate- find v/s locate, locate v/s slocate


 gzip, bzip2 – other zipping tools, How to zip and unzip. Gzip v/s bzip

 tar – Need of tar. (Using –c,-v,-f, -t, -x options with tar) Zipping using tar.
Extract single file from tar

 ln – soft link v/s hard link. Creating soft link & hard link. What if original file is
deleted

 Understanding diff between soft link and hard link. What is symbolic link?
 wc – count no. of character, words, lines etc

grep (egrep, fgrep)– search a pattern in a file- grep is a command-line utility for
searching plain-text data sets for lines matching a regular expression. Grep was
originally developed for the Unix operating system, but is available today for all
Unix-like systems. Its name comes from the ed command g/re/p (global / regular
expression / print)

cut

awk – fetch/ display column from a file (awk command combines the functions of grep
and sed) - AWK was created at Bell Labs in the 1970s, and its name is derived from the
family names of its authors – Alfred Aho, Peter Weinberger, and Brian Kernighan. The
name is not commonly pronounced as a string of separate letters but rather to sound the
same as the name of the bird, auk (which acts as an emblem of the language such as on The
AWK Programming Language book cover - the book is often referred to by the abbreviation
TAPL). awk, when written in all lowercase letters, refers to the Unix or Plan 9 program that
runs other programs written in the AWK programming language.

 sed-
 gawk

STDIO: redirect i/o, redirect errors, using pipes, & >, >>, <, <<, 2>, 2>>, | (output of
first is given to next command

Day 8: Processes

 ps - status of a process (-e, -f)


 top – top running processes, understanding output header and the column
output (Dynamically changes the output for the processes which are running)

 kill – kill a process, kill with signals or without signals

 nice/renice – change priority of running process(renice)

Day 9: Networking

 ping – check network connectivity


 netstat – gives network statistics (understanding output of it) (-a, -n, -t, -u, -p)

Services and their ports, what is port?


 System Ports (0-1023)
 User Ports (1024-49151)

 Dynamic / Private Ports (49152-65535)

On Linux machines, the following file consists all the list of port assignments for
the specific machine:

 /etc/services

Starting of a service, stopping a server and checking status of a service

 hostname – displays or set hostname


 ssh, scp – remote connection & remote copy. Which port it uses, which service
should be started

 ifconfig – display Ethernet info, IP, subnet mask, interface up/down and other
statistics. Also use to change system IP.

Day 10: System Tools

 rpm – package manager used to install, upgrade, uninstall packages (-I, -v, -h,
U, e, q)
 cron – Job scheduler. -

Understanding format & tryout setting Cron entry.

What is cron.allow. Go inside /etc/corn.d

Taking backup of cron tab

 free – gives memory usage


 iostat – input/ output statistics. Understanding output

 vmstat – virtual memory stats. Understanding output

 sar – system analysis report ( RPM required to be installed for sar is - sysstat)

 mount – mounting external drives & partitions


 Environment variables (command printenv, echo $variable_name, to check user
set environment command #env )

 Profiles

 last - give u when last the server was rebooted

 to find out information about cpu do the following

cat /proc/cpuinfo

Extra :

put hard and soft limit on file size for a particular user – use of fsize in /etc/limits.conf –

Diff between hard limit and soft limit

nfs sever – share the mount point and mount it on local machine

create ftp server - commands at ftp prompt and ftp to be accessed by web browser

ftp command and using ftp for internet browser to connect to client –

 ftp command will make the prompt to come as

ftp>

 for internet browser

ftp://user:password@ip address

 Checking /etc/vsftpd – directory


 Starting vsftpd service

NFS uses portmap! Means what

Command and its alias

create yum server

configure yum client

mail command – find alternative for it


neat , setup commands

Samba server

You might also like