Documente Academic
Documente Profesional
Documente Cultură
File Mgmt.
# cat test
1
2
3
4
5
# file test
5. Touch cmd can create an empty file and update time stamp
# touch test1
# touch test11 test12 test13
# touch test{21,22,23}
# touch test-{1,2,3}.log
# touch {1,2,3}.log
# rm test1
# rm test11 test12 test13
# rm {1,2,3}.log
# rm *.log
Directory Mgmt.
1. To make directory
# mkdir chn
# mkdir chn1 chn2 chn3
# mkdir chn{11,12,13}
# mkdir -p universe/world/india/TN/chn/nsn
# tree universe
# cd chn
# pwd
6. To go to parent directory.
# cd ..
7. To go to 4 level up
# cd ../../../../
# cd -
# cd
# cd ~
# rmdir chn
# rmdir chn1 chn2 chn3
# du -sh /etc <--- List specific dir. size in human readable format.
--------------------------------------------------------------
# df -h /boot
# df -h /
# df -h /home
Compression/Uncompression Utilities:
1. gzip/gunzip/zcat
2. bzip2/bunzip2/bzcat
3. xz/unxz/xzcat
History Commands:
# !c
# !cl<--- To repeat the cmd. begining with cl
-----------------------------------------------------------------
Database Files:
4. /etc/resolv.conf <--- It holds default domain to search and nameserver i.e. DNS
server IP Addresses.
5. /etc/nsswitch.conf <--- It holds name server search wrt. local system or dns or
nis or nisplus or ldap.
Exer:
1. Add network system's HN and IP Address entry to local system in /etc/hosts file.
Check connectivity using name and IP Address.
2. To set temp. hostname to the computer
# hostname nsnchennai
* It is set temp. If system is rebooted then the hostname mentioned in the file
/etc/sysconfig/network will be loaded by kernel.
3. To setup IP manually.
# system-config-network
4. To check IP Address
# ifconfig
# ifconfig eth0
# ip addr show
# ip addr show eth0
# ip route
# netstat -r ( r <--- Routing Table )
# /etc/rc.d/init.d/network stop
# /etc/rc.d/init.d/network start
# /etc/rc.d/init.d/network restart
------------------------------------------------------
cmd:
usermod <-- To modify existing user a/c properties wrt. UID,GID,Home Dir., Login
Shell etc.
groupmod <-- To modify group properties wrt. GID and Group Name
* We can add member to the group while user a/c creation using "useradd" cmd.
If user a/c exist then we can use "usermod" cmd. to add existing user to the group
as its member.
Exer:
# useradd raj
# passwd raj
# finger loginname
# finger raj
# id loginname
# id raj
UID=1000
Comment=System Crasher
Login Shell= csh ( /bin/csh )
-u <-- UID
-c <-- Comment
-s <-- Login Shell
5. Setup login shell /bin/ksh and comment "system analyst" to user a/c prabhakaran.
6. Rename user a/c "prabhakaran" to "karan" and rename its home dir.
# userdel james
12. Setup Minimum, Maximum and Warning days for user a/c raj.
# chage -m 1 -M 30 -W 3 raj
-m <-- Min
-M <-- Max
-W <-- Warn
# chage -E -1 raj
# groupadd tech
19. Add existing user a/c "raj" to group "tech" and "support"
* User a/c "raj" has its own group called "raj" which is his primary group. Groups
"tech" and "support" will be his secondary groups.
20. Create user a/c priya and add it to secondary groups "tech" and "support".
# groupdel support
# gpasswd research
# newgrp GroupName
# newgrp research
Exer.:
------------------------------------------------------------------
Exer:
# vi /etc/inittab
id:3:initdefault:
(save and quit the file.)
---------------------------------------------------------------------
Exer:
* Go to "single user mode" from Grub menu. System will enter in shell without
"root" user password.
Execute,
# passwd root
then
# exit
* System will boot into default runlevel, now login by new password.
---------------------------------------------------------------------
Managing Processes
# ps
# ps -a <--- all
# ps -e <-- Every
# ps -ef
# kill -l
# kill <PID>
# kill 123
# Kill -9 <PID>
To set process priority.
# renice -n 10 -p 3787
# top
---------------------------------------------------------------
Managing Services
----------------------------------------------------------------