0% found this document useful (0 votes)
67 views8 pages

Smnyrertomrblg Epñk 1 Erbismrab Ma:Siun - Erbismrab Ma:Siun - Etakan - 2 - . - . - . - . - . - . - 3 - . - . .

The document discusses various Linux commands and concepts. It covers system environment commands like shutdown and restart, user and group commands, file commands, directory commands, and information about key Linux directories. It also discusses run levels, boot loaders, Linux users, disk quotas, RPM and YUM package installation, task scheduling with cron, and script testing examples.

Uploaded by

Don't HateTemmo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views8 pages

Smnyrertomrblg Epñk 1 Erbismrab Ma:Siun - Erbismrab Ma:Siun - Etakan - 2 - . - . - . - . - . - . - 3 - . - . .

The document discusses various Linux commands and concepts. It covers system environment commands like shutdown and restart, user and group commands, file commands, directory commands, and information about key Linux directories. It also discusses run levels, boot loaders, Linux users, disk quotas, RPM and YUM package installation, task scheduling with cron, and script testing examples.

Uploaded by

Don't HateTemmo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

sMnYreRtomRblg S1

I. Epñk Commands ³
1> System environments commands :
 shutdown -h now : eRbIsrM ab; Shutdown ma:sIun Computer .

 shutdown -r now : eRbIsrM ab; Restart ma:sIun Computer .

 su - sovann : Switch eTAkan; User sovann .

2> User & Group commands :


 useradd -u $uid -d /tmp/test -c $comment -s /bin/bash $user .
 usermod -u $uid -g $gid -d $directory -c $comment -s $shell_login $user .
 userdel -r $user .
 usermod -L $user (Locked User) .
 usermod -p “” $user (Unlocked User) .
 chage -d 0 $user (set User expired ) .
 cat /etc/passwd | more (View user account) .
 usermod -g $gid $user (Add user to group account) .
 pwconv (User and Password encrypted) .
 pwunconv (User and Password decrypted) .
 groupadd -g $gid $gName (Add Group) .
 groupdel $gName (delete group) .
 cat /etc/group | more (View Group account) .
3> File Commands :
 touch sovann.txt (Create file name sovann.txt) .
 vi sovann.txt (Edit sovann.txt file) .
 cp .
source dest (Copy file from source file to dest file)
 mv source dest (Move file from source file to dest file) .

 mv old new (Rename file from old to new file name) .

 rm -i sovann.txt (delete file sovann.txt) .

1 (Pre Exam 1 Linux Administation)


4> Directory commands :
 mkdir test (Create directory name test) .
 cp -r source dest (Copy folder from source to destination) .
 mv .
source dest (Move folder from source to destination)
 mv old new (Rename folder from old to new directory) .

 rm -fr test (delete directory name test) .

5> Directory Information :


 /: The root directory .
 /bin: Essential commands, it contains essential commands used by the system when running and booting Linux;
about 5MB for full install .
 /boot: Boot loader files, Linux kernel .
 /dev: Device files: IDE (/dev/hda, /dev/hdb), CDROM, SCSI ( /dev/scd0), serial port (/dev/ttys0—COM1,
/dev/ttys1—COM2), printer (/dev/lp0) .
 /etc: System configuration files .
 /home: User home directories .
 /initrd: Initial RAM disk boot support (used during boot time) .
 /lib: Shared libraries, kernel modules .
 /lost+found: Directory for recovered files (if found after a file system check) .
 /media: Mount point for removable media such as DVDs and floppy disks .
 /mnt: Usual mount point for local, remote file systems .
 /opt: Add-on software packages .
 /proc: Kernel information, process control .
 /root: Super-user (root home) .
 /sbin: System commands (mostly root only) .
 /selinux: Holds the data for SELinux, the security component of Fedora .
 /sys: Real-time information on devices used by the kernel .
 /tftpboot: Network boot support .
 /tmp: Temporary files .
 /usr: Secondary software file hierarchy .
 /var: Variable data (such as logs); spooled files .

2 (Pre Exam 1 Linux Administation)


6> Note :
edIm,I mount flash rw External device eKeRbIR)as;viFIsaRsþdYcxageRkam ³
 begátI folder myflash .
 mount flash # mount /dev/sda1 /myflash .
 cUleTA flash #cd /myflash .
 Copy file EdlRtUvkarcUl flash )anehIy .
 cakecjBI Flash # unmount /myflash .
Permission group Cakarpþl;sT i §enAkñúgkar access file . Edl Permission group man 3 KW
 Owner Permision
 Group Permision
 Ohter Permision .

II. EpñksMnYr ³
1> rbs; Linux manlkçN³dUcxageRkam ³
Run level
 level 0: sMrab; shutdown .
 level 1: sMrab; single user and Maintenance .
 level 2: sMrab; multiple user, Network connection .
 level 3: sMrab; multiple user, network connection text mode and switch to GUI .
 level 4: sMrab; unused level .
 level 5: sMrab; GUI .
 level 6: sMrab; Root System .
 Command EdleRbIsMrab; Switch Level Kw ³ init levelName .
2> Boot loader : Ca File eRbIsrM ab;kMnt;eGay Computer eFVIkar Boot BI operating system NamYy
Edlman Master file RtUv)ankMNt; .
3> enAkñgú Linux eKEck user Ca 3 RbePT KW :
 Administrator: Ca super user eRbIsrM ab; Root user .
 day to day user: Ca Normal user EdlbegáIteday Root/ Administrator .
 system user: Ca Created user sMrab; system service nig Application .

3 (Pre Exam 1 Linux Administation)


4> Disk quota Gacpþll; T§PaBeGay System GackMNt;eGay User eRbIR)as; disk space enAelI system )an . vaman ³
 block limitation: sMedAelI disk space EdlkMNt;eday Physical device .
 File limitation: sMedAelIcMnYn File rW directory EdlrkSaTukenAkñúg Quota partition .
 Quota GacdMeNIrkarelI User nig Group Edlman Step dUcxageRkam ³
 Edit file /etc/fstab edIm,IkMNt; Quta rule eTAeGay Partition NamYy EdleyIgcg;kMNt; .

 Create Quota file sMrab; Quota database .

 Create and Start a Quota script .

 Create Quota rule (for Block and File limitation) .

 Check quota (delete rule/ Updating/ Reporting) .

4> Installation :
 RPM manlkçN³dUcxageRkam :
 man application name .

 man Version sMrab; platform release number .

 man Revision sMrab; Revision number .

 man Architecture sMrab; RPM nimYy² .

 yum Ca Installer mYy EdlGaceGayeyIg Install package BI Server rW Repository (vaCa online storage
Edl Store ral; Package) enAelI Online storage .
5> Task Scheduler :
 Checking Package rW
# rpm -qa | grep cron rpm –ql crontabs .
 Checking Cron service # chkconfig --list crond
 Enable Cron service # /etc/init.d/crond start
 Edit Task Scheduler KW crontab -u eQµaH User -e : Edit
-l : List
-r : Remove .
 Syntax edition : *1 *2 *3 *4 *5 <command, Script>
 *1 : naTIkgñú 1 em:ag (0 60 Edl 0=6) Edl * dMenIrkarral;naTI .
 *2 : em:ag 1 éf¶ (0 24 Edl 0=24) Edl * dMenIrkarral;em:ag .
 *3 : éf¶kgñú 1 Ex (0 31 Edl 0=6) Edl * dMenIrkarral;éf¶ .
 *4 : Exkñgú 1 qñaM (0 12 ) Edl * dMenIrkarral;Ex .
 *5 : éf¶kgñú 1 GaTitü (0 7 Edl 0=6) Edl * dMenIrkarral;éf¶kgñu 1 GaTitü .

4 (Pre Exam 1 Linux Administation)


6> Script testing:
 Test1:

#!/bin/bash
echo “Environment variable testing”
echo “OS type is $OSTYPE”

 Test2:

echo –n “Input first name:”


read fname
read –p “Input last name:” lname
read –p “address and phone:” addr phone
echo “Full name $fname $lname”
echo “Address: $addr”
echo “Phone: $phone”

 Test3:

if read –p “Input password:” –s –t 10 pass # -s stand for silent


then
echo –e “\nypur password is $pass”
else
echo –e “\nyou are too late”
fi

 Test4:

read –p “input n:” n


for ((i=0;i<$n;i++))
do
read –p “value $i=” num[$i]
done
echo ${num[*]}

 Test5:

read –p “input a:” a


read –p “input b:” b
if test $a –gt $b # or if [ $a –gt $b ]
then
echo “Max: $a”
else
echo “Max: $b”
fi

5 (Pre Exam 1 Linux Administation)


 Test6:

read –p “Input file1:” f1


read –p “Input file2:” f2
if test $f1 –nt $f2
then
echo “$f1 is newer than $f2”
else
echo “$f1 is older than $f2”
fi

 Test7:

read –p “input day:” day


case $day in
0 | 7 ) echo “Sunday” ;;
1 ) echo “Monday” ;;
2 ) echo “Tuesday” ;;
3 ) echo “Wednesday” ;;
4 ) echo “Thursday” ;;
5 ) echo “Friday” ;;
6 ) echo “Saturday” ;;
* ) echo “Invalid parameter” ;;
esac

 Test8:

function sum{ or sum(){


s=$[ $a + $b ] // or let s= a + b s=$[ $a + $b ]
return $s return $s
} }
read –p “input a:” a
read –p “input b:” b
sum
echo “sum: $?”

6 (Pre Exam 1 Linux Administation)


 Installation.sh :

#!/bin/bash
Echo “Demonstration Installation”
rpm -i -force packageName # No processing bar
rpm -ih packageName # Have processing bar
# rpm –i : Installation
# rpm –u : Update
# rpm –e : Uninstallation
# rpm –q : Query all installation
# rpm –v : verify package

 GroupAdd.sh :

#!/bin/bash
echo “Create Group Series :”
echo -p “Group name :” g
echo -p “Start from :” s
echo -p “To :” t
for i in `seq $s $t`;
do
groupadd $g$i && echo “$g$i has been created”
done

 UserAdd.sh :
#!/bin/bash
echo “Create series user for Group :”
echo -p “Group name :” g
echo -p “User name :” u
echo -p “Start from :” s
echo -p “To :” t
for i in `seq $s $t`;
do
useradd -g $g $u$i && echo “$u$i has been created”
read -p “password :” p
echo $p | passwd --stdin $u$i
done

 DeleteUser.sh :

#!/bin/bash
echo “Delete User Account :”
read -p “User name :” u
x=0
for i in `cut -d: -f1 /etc/passwd`;
do
if Test %u==$i; then
userdel -r $u && echo $u has been delete
x=1
break
fi
done
if Test $x -eq 0; then
echo $u not found
fi

7 (Pre Exam 1 Linux Administation)


 CountUserInGroup.sh :

#!/bin/bash
Echo “Count User in group :”
read -p “Group id” g
for i in $ (cut –d: -f4 /etc/passwd);
do
if Test $i –eq $g; then
let count=count +1
fi
done
echo There are $count Users in Group id $g

III. Network Connectivity ³


1. Check network configuration ³ # /sbin/ifconfig

2. ping network connectivity ³ # /bin/ping -c 3 localhost

3. Network Protocol ³ mandUcCa ³


 Internet Protocol (IP) .
 Transport Control Protocol (TCP) .
 and Universal Datagram Protocol (UDP) .
4. IP address for class mandUcCa ³
 Class A : 10.0.0.0 to 10.255.255.255 .
 Class B : 172.16.0.0 to 172.31.255.255 .
 Class C : 192.168.0.0 to 192.168.255.255 .
5. Port Service mandUcCa ³
 ftp 21/tcp .
 http 80/tcp www www-http # WorldWideWeb HTTP
 pop3 110/tcp pop-3 # POP version 3

 /etc/ssh/sshd_config. #Port 22

 an unused port number man Port 2224 .


 ssh -p 2224 remote_host_name_or_IP (Remote access Port to server) .
³
IV. Notaion Backup and Restore Command
# tar –cf cf home.tar home.tar /home /home
# tar –czf czf home.tar.gz home.tar.gz /home /home
# tar –tzf tzf home.tar.gz home.tar.gz
# tar –tf tf home.tarome.tar
# tar –xzvf xzvf home.tar.gz home.tar.gz
# tar –czvf czvf /dev/ /dev/hdc hdc /
# tar –xzf xzf /dev/ /dev/hdc

8 (Pre Exam 1 Linux Administation)

You might also like