人數

2010年6月27日 星期日

LINUX之CENTOS操作指令101及102陳師平

Linux之操作指令


su – 【最高使用者權限】
pwd 【驗証所在之目錄】
ls 【查閱檔案】
cd .. 【回到上一層目錄】
touch 【修改檔案時間或建置新檔】
後面有接檔案,則該檔案的三個時間(atime,ctime,mtime)都會更新為目前的時間;若檔案不存在,則主動建立一個新的空檔案。
-a 修改access time
-c 修改檔案的時間,檔案不存也不建立新檔
-d 後面可以接欲修定的日期,不用目前日期也可用 -–date=”日期or 時間”
-m 僅修改mtime
-t 可接時間格式[YYMMDDhhmm]
Modification time (mtime):當檔案內「內容資料」變更時,更新時間
Status time (ctime):當檔案「狀態」改變時,更新時間
Eg.權限、屬性更改時
Access time (atime):當「該檔案內被取用」時,就更新讀取時間
Eg.使用cat讀檔時
ifconfig
whoTAB (1)系統指令
(2)子資料夾name
cat test.txt
cat test.txt
more
cd /root
ls –al 檢查歷史指令
cat .bash-history
more
ln –s aaa.txt bbb.txt 【把bbb連結到aaa主檔】

chmod –R 777 class01 【更改權限】
chown –R “ “ 【改變擁有者】
※ (連結數) (檔案所屬群組) (最後修改日期)
-rw-r—r- 1 root root 42304 sep 4 18:26 install.log
(檔案類型權限) (檔案擁有者) (檔案大小) (檔名)
- rw- r-- r--
.[d]指目錄,檔名為「.gconf」
.[-]指檔案,檔名為「install.log」
.[
]表示連結檔(link file)
.[b]表示裝置裡面的可供儲存的周逼設備(可隨機存取裝置)
.[c]表示裝置檔面的序列設備,例:鍵盤、滑鼠(一次性讀取裝置)
可以用cat,tail,也可以用joe,VI編輯
/etc/passwd (進入到etc目錄下之後,執行passwd變更密碼)
/etc/shadow
useradd (2-3) groupadd (2)
userdel groupdel
usermod groupmod
passwd gpasswd
id , finger
mkdir 【建立一個新目錄】
rmdir 【刪除一個空目錄】
mv 【移動檔案】
cp 【複製】
rm 【刪除】
chsh (chang shell)
cnfn (change finger)
完整搜尋: 快速搜尋:
Find /home/ filename locate filename
tail find
“source”以及”.” Locate 搜尋作業系統中的檔案
history以及113 whereis
type
unset
echo
cd ~
alias
grep/egrep 搜尋檔案中的字串
ls –al /boot/
/sbin/init
/etc/init
/bin/init
cat /etc/inittab
/etc/rc.d/rc.sysinit
ls –al /dev
cat /etc/rc.d.rc.local
runlevel
init / telinit
ls –al /etc/rc.d/rc3.d
chkconfig –list
shutdown –r now
-h now
poweroff
ls –al /boot/grub
cat /boot/grub/grub.conf
grub-install


eny “”
export
-p
declare
set / unset


/etc/profile
/etc/profile.d/ *.sh Bash Shell
*.csh C Shell
/etc/bashrc
/etc/sysconfig/x18n
~/.bash_profile
~/.bashrc
~/.bash_history
~/.bash_logout V.S. history


Startx , xorg , xhost


ip , ping
traceroute
tcpdump
netstat
ifconfig
ifdown / ifup
route


ps , pstree
top
nice , renice
kill , killall
service


lpadmin –p new-printer –v usb:/dev/usb/lp0 -E

VI指令:
命令模式:Esc 命令模式下刪除:
編輯模式:Insert l
存檔:w d w
離開:q d
搜尋:/keyword
?keyword

2010/5/26上課的Summary:
(1) 三大安裝方式: PC→ 架站,test
A. 純系統(100%):centOS/Ubuntu 4G
Server 8CPU


B. Windows: VMWare(分時系統) Virtual OS 【效能不好】
(虛擬)
C. 雙系統安裝: boot menu (開機選單)
(n)
(2) X Window (Gnome使用)
(3)Terminal(終端機) command line mode
(4) 套件安裝
(5) Joe使用
(6) 基本指令:ls,cat,su -,cd,whoami,history
(7) 網路設定


Homework:
(1) 安裝UMWare,centOS
(2) 熟悉終端機介面
(3) 學習上網找尋問題解答(EX. google,鳥哥)
鳥哥:http://linux.vbird.org/


Psswd groupadd finger
p.159~160.163中間
附錄VI command insert lsline模式
2010/6/24上課的Summary:

http://localhost:631/ (要在Linux下執行)
or
http://127.0.0.1/ :631
Linux驅動程式之安裝(印表機):
http://www.tmes.mlc.edu.tw/wiki/index.php/Printer


軟體套件之安裝、查詢、刪除:
1. cd /root
2. wget http://www.sunyell.com.tw/rpm/joe-3.1-6.i386.rpm
wget http://www.sunyell.com.tw/rpm/webmin-1.290-1.noarch.rpm
3. 安裝
4. 執行joe
5. 查詢&刪除joe套件
rpm –ivh jo 【安裝指令】
rpm –qa
grep jo


rpm –e jo


http://www.webmin.com/download.html 【一定在Linux下download,才能安裝】


rpm Red Hat Enterprise
Fedora
CentOS
dpkg apt-get Debian,Ubuntu


1. download .tgz
2. tar zxvf ******** 【解壓縮】
3. ./configure –k –v ----------- 【check】
4. make 【編譯】
5. make install 【安裝】
6. config檔設定


Eg.
1.建資料夾 /root/work/ , /root/backup/
2.建檔案 root/work/ a01.txt ,a02.txt
3.寫一個shell script ,可將/root/work/中的檔案搬移到/root/backup/
Sovle:
(1) 使用Joe寫,存檔名稱為h1.sh 【要把檔案放置在/root/下】
mv /root/work/* /root/backup/
echo ‘OK.’
(2) chmod 744 h1.sh 【執行權限h1的開啟】
(3) file h1.sh 【查詢h1的檔案型態】
(4) ./h1.sh 【執行h1】
Eg. echo `date +%u`
5 【顯示今天星期幾】


Eg.如何在每一分鐘於/root/work/ 下新增檔案,檔案的命名規格為file時分,例如:file1516,file1517,file1518,………
solve:
(1) 使用Joe寫,存檔名稱為h2.sh 【要把檔案放置在/root/下】
touch /root/work/file`date +%H%M`
(2) a. 使用crontab -e寫入資料
b. 按’a’鍵可插入
*/1 * * * * /root/h2.sh
C. 輸入”:wq”,跳出crontab程式
(3) chmod 744 h2.sh
(4) ./h2.sh
(5)crontab –r 【刪除排程】


tar -zxvfp


-zcvfp

沒有留言: