You are on page 1of 39

1.

/bin : ផ្ទុករាល់ Commands របស់ User Account ទាំងអស់


2. /boot : ផ្ទុកនូវ File System របស់ Linux ដូចជា [boot kernel file] and [boot loader]
3. /dev : ផ្ទុកនូវ File System របស់ Devices ដែលបាន Install រួច
4. /etc : ផ្ទុករាល់ការ Install Package របស់ Linux ដូចជា DNS, DHCP, Samba, … ដើម្បីធ្វើការ
កែប្ Configuration
5. /home : ផ្ទុកនូវ Home Folder (Profile) របស់ User Account
6. /lib : បណ្ណា ល័យសំខាន់មយ ួ សំរាប់ផុ ្ទកនូវ​Program File
7. /sbin : ផ្ទុករាល់ Commands របស់ User root
8. /root : ផ្ទុករាល់ Directory Partitions
9. /opt : ផ្ចុកនូវ Application Software Package Add-on
10. /proc : ផ្ទុកនូវស្ថា នភាពតំនើរការរបស់ File រ​ឺFile system, Uptime, Downtime, Network.
11. /mnt : ផ្ទុកនូវ Temporary Mount File System.
12. /tmp : ផ្ទុកនូវ Temporary file
13. /usr : ផ្ទុករាល់ Application and Program File, Share Data
14. /var : ផ្ទុក Source Web Application, Log, Database
15. /srv : ផ្ទុកនូវទិនន ្ន យ
័ ជាក់លាក់មយួ សំរាប់ Website.
16. /media : ជាកន្ងមួយមួយសំ ​ រាប់ធ្វើការ Mount ទៅកាន់ Removable Device ដួចជា
CDROM​​​ឬ Flash drive ជាដើម
Basic command line in CentOS
• #mkdir [folder name]
• #rmdir [folder name]
• #touch [file name.extension]
• #rm –rf [file name]
• #vim [file name] (:q! = exit without save, :x! or :wq! =exit with save)
• #cat [file name] (view content)
• #more
• #cd
• #pwd
Basic command line in CentOS
• #ls
• #cp (-r: copy folder)
• #mv
• #su
• #find
• #man mkdir (explain the command)
• #fdisk –l
• #free –m
• #cat /proc/cpuinfo
Shell Variables
Shell Variables
Globbing
Globbing
Quoting
Quoting
Quoting
Quoting
Control Statements
Control Statements
Control Statements
Archiving (tar)
• Archiving collapses multiple files into one
• An archive file is a collection of files and directories stored in one file.
• The archive file is not compressed — it uses the same amount of disk space as
all the individual files and directories combined.
• Be polite and add “.tar” extension
Archiving (tar)
[root@server1 Desktop]#tar –cvf data1.tar data2 (create)
Archiving (tar)
• View tar file contents
#tar –tf ArchivingBackup.tar
Archiving (tar)
• Untar tar Archive File
To untar or extract a tar file, just issue following command using option
x (extract). For example the below command will untar the file test.tar
in present working directory.
tar -xvf test.tar
Basic command line in CentOS
• #gzip (#gzip –l test.tar.gz)
• #gunzip (#gunzip test.tar.gz , #ls –lh test.tar)
• #hostname
• #who
• #whoami
• #date
Linux Shell Script
• Why should you write and use shell scripts?
• Save time
• Typing
• Error
Linux Shell Script
• Create shell script file
• #vim myscript.sh
• Ex: #vim myscript.sh
Echo –n “ today is “
Date
Echo “ the user who log on the server are: “
Who

• Execute shell script


• #sh myscript.sh
Linux Shell Script
• User variables
first_name=”chan”
last_name=”dara”
echo “My name is $first_name $last_name”
echo “My login name is $LOGNAME
Linux Shell Script
• Shell Arithmetic
Linux Shell Script
• The read Statement
Linux Shell Script
• If Condition
Linux Shell Script
Linux Shell Script
#!/bin/sh
echo –n “input user id: “
read id
if [ $id –eq 0 ]; then
echo “It is super user”
elif [ $id -gt 0 -a $id -lt 500 ] ; then
echo “It is system user”
elif [ $id -ge 500 -a $id -ne 65534 ] ; then
echo “It is regular user”
fi
Linux Shell Script
• The case Statement
Linux Shell Script
Linux Shell Script
• For Loop
Linux Shell Script
• While Loop
Linux Shell Script
• Function
Linux Shell Script
• Function
Linux Shell Script
• Function
The End

You might also like