Linux Administration Tips
Linux Administration Tips
Linux Administration Tips
vi
Umask value
umask -- > default value during
installation is 022, default permission
= 644 on file and on Directory 755
To make umask value permanent edit
.bashrc
Links
System generated number for a file is called INODE
NUMBER
ls il <file_name> // gives the inode number
ls ial // all hidden files with inode number
mv fil2 fil3 // inode num of fil1 will be given to fil3
ln s <regular_file1> <SYMBOLIC_LINK_file2> -- creates a
symbolic link, whatever changed in file2 will be reflected
to file1
We can also create ln s <sym__link1> <sym__link2>
rm <regular_file> affects both sym_link files
If 2 files have same inode number then link count(second
column in ll) is 2
ln <FILE_1> <HARD_LINK_2> // Same inode numbers for
HARD LINKS
USER ADMINISTRATION
useradd, adduser, userdel, usermod, groupmod
Files for user administration - /etc/password,
/etc/shadow, /etc/group, /etc/gshadow
chmod
chown
usermod l nologin unix1 //unix1 will not be
able to login to the server
usermod L unix1 // lock the user account
usermod U unix1 //unlocks the user account
chage l unix2 //password policy command
boot priority
Jobs
#jobs displays the jobs in the
foreground
#bg displays the jobs in the
background
#ps processes running all
processes
#kill -9 pid
Vgname
LV .LV
FS
COMMANDS
1. Fdisk /dev/had
2. n //creates a new partition
3. +500M
4. T //to change the partitions system ID
5. Mention the Partition number i.e, a number
6. L // list the partitions (Next Page A)
7. 8e // Linux LVM (Next Page B)
8. p // print the partition table
9. w // writes the partition to disk
pvdisplay (nothing)
pvcreate /dev/hda6
pvdisplay
vgdisplay
Lvdisplay
Lvol0 created
lvrename /dev/volume6/lvol0 logic1
Lvol0 created
Lvrename /dev/volume/lvol0 logic2
#mkfs.ext3 /dev/volume6/logic1
Mount
Df -h
DELETING A
LOGICAL VOLUME
umount the logical
volume #umount
/dev/volume6/logic1
#lvdisplay
Vgremove
/dev/volume6
pvremove
/dev/hda6 //this will
wipe off the volume
Network Configuration
#system-config-network
Eth0 (Enter the following)
Name, Device, use DHCP, Static IP,
Netmask, Default Gateway IP
Service network restart
Ifup eth0
Boot Process
=
=
=
=
=
=
=
POST
Boot strap Loader
Boot Loader
Kernel
init run levels
OS Boot
Network
Nfs
Web
ftp
DNS
Mail
Iscsi
Iptables
NIS
dhcp
Scp/ssh
telnet
Daemons
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
Network
Nfs
https
Vsftps
Named
Sendmail
Tgtd, iscsci
Iptables
Ypserv, ypbind, yppasswd
Dhcpd
Sshd
telnet, xinetd
File management
#cat new >> new1 // this would apend
the contents from new to new1
#du h new
#zcat file.gz // we will be able to view
contents of zipped file
#gzip
#gunzip
#tar cvf <Name_of_backupfile>
<file/directory_that_we_need_to_backup>
Session management
ftp port#20(for data transfer), port 21(for FTP control)
telnet port#23
Ssh port#22
FTP
To restart ftp service #service vsftpd restart
#ftp ip_address
ftplogin:
/var/ftp/pub directory where ftp files are stored
#cat /ets/vsftpd/ftpuser //users not authorised to perform ftp
ftp> get //take files from other server
ftp>put //send to other file
NFS
IP Tables
#iptables -L
#iptables t filter A input s 192.168.10.55 j
drop j port port#
// 192.168.10.55 not
accepted to the system
#iptables t filter A input s 192.168.10.55 j
accept // 192.168.10.55 is accepted
#service iptables start
Block the ping requests => change 1 to 0 in
the file
#cat /proc/sys/net/ipv4/icmp_echo_ignore_all
DHCP to provide IP
Address
Web Service
KICKSTART
Boot:linux ask method n/w inter
ftp httpd
#system-config-kickstart =>
kickstart.cfg