操作系統提供的提供的基本服務程序
1.文件系統
2.設備驅動層序
3.用戶接口
4.系統服務程序
開啓vi
vi filename 打開文件或新建
vi +n filename 打開文件光標位於第幾行
vi + filename 打開文件,光標位於最後一行
[root@localhost ~]#pwd //linux根目錄(系統的根目錄)
/root
[root@localhost ~]#cd / 切換到根目錄
[root@localhost ~]#ls 產看目錄內容
光標的移動:命令模式
h: 光標左邊移一個字符
l: 光標右邊移一個字符
Ctrl+f 向文件尾翻一屏幕
Ctrl+d 向文件尾翻半屏幕
Ctrl+b 向文件首翻一屏幕
Ctrl+u 向文件首翻半屏幕
H 光標椅子屏幕頂行
M 中間
L 最後一行
$行尾
dd 當前這行刪除
ndd 刪除當前行以後的行數
d$刪除到行尾
do刪除到行首
G 文本尾部
文件掛載
[root@localhost /]#cd mnt
[root@localhost mnt]#mkdir cdrom
[root@localhost mnt]#pwd
/mnt
[root@localhost mnt]#mount -t auto /dec/cdrom /mnt/cdrom/
[root@localhost mnt]#cd cdrom/
[root@localhost cdrom]#ll
total 22
dr-xr-xr-x 3 root root 2048 May 7 2007 Centos
grep 查找、替換
cd ~ 返回當前目錄
[root@localhost ~]#ll 產看顯示文件的詳細信息
[root@localhost ~]#grep "^php" 查找一php開頭的文件(有問題,因爲沒東西可查)
[root@localhost ~]#ll | grep php
info.php
phpinfo.php
[root@localhost ~]#grep "^php" phpinfo.php 在phpinfo.php文件查找一php開頭的文件
[root@localhost ~]#grep "php" phpinfo.php 在phpinfo.php文件查找php的文件的行
[root@localhost ~]#grep "php" phpinfo.php > test.php 把查找到的內容寫入到test.php
如果有test.php文件就是覆蓋
[root@localhost ~]#grep "php" phpinfo.php >> test.php 追加到文件的最後面
ll | grep php >> test.php
ps查看一些進程列表
[root@localhost ~]#ps -ef | more
超過一個屏幕時
[root@localhost ~]#ps -ef | grep httpd
mv文件的剪切,文件的重命名
[root@localhost ~]#mv info.php info.php.save 重命名了文件
[root@localhost ~]#mv info.php.save test 把info.php.save移動到test文件夾下
[root@localhost ~]#cd test
[root@localhost test]#ll
total 16
-rw-r--r-- 1 root root 25 Apr 7 18:23 info.php.save
[root@localhost test]#mv info.php.save ../
[root@localhost test]#cd ..
[root@localhost ~]#ll
-rw-r--r-- 1 root root 25 Apr 7 18:23 info.php.save
cp 複製
[root@localhost ~]#cp info.php.save info.php 複製info.php.save生成一個新文件info.php
rm刪除文件
[root@localhost ~]#rm -f info.php.save
[root@localhost ~]#cp infolphp info.php.save
[root@localhost ~]#cp info.php test/
[root@localhost ~]#cd test
[root@localhost test]#ll
-rw-r--r-- 1 root root 25 Apr 7 18:23 info.php
.....
[root@localhost ~]#cp info.php test/info2.php
[root@localhost test]#ll
-rw-r--r-- 1 root root 25 Apr 7 18:23 info.php
-rw-r--r-- 1 root root 25 Apr 7 18:23 info2.php
.......
複製文件
[root@localhost ~]#cp -r test test2
cat 查看文件的內容
[root@localhost ~]#cat test.php 直接查看文件的內容
<?php
phpinfo();
?>
[root@localhost ~]#cat -n test.php
1<?php
2phpinfo();
3?>
鏈接(快捷鍵)linux
1.硬鏈接
2.軟鏈接
[root@localhost ~]#
[root@localhost ~]#ln -s /mnt/cdrow/ /root/test/
軟連接
[root@localhost ~]#cd test
[root@localhost test]#ll
lrwxrwxrwx 1 root root 11 Apr 7 18:52 cdrom ->/mnt/cdrow
[root@localhost test]#cd cdrom/
[root@localhost cdrow]#cd
/root/test/cdrom
......刪除軟連接
[root@localhost test]#rm -f cdrom 文件而不是目錄cdrom/
infile
dd (if讀取的文件 of 保存的文件
[root@localhost ~]#dd if=info.php of=test2.php
0+1 records in
0+2 records out
[root@localhost ~]#ll
-rw-r--r-- 1 root root 25 Apr 7 18:23 test2.php
find 查找文件
/etc/-name updatedb.conf;
[root@localhost ~]#find test.php
test.php
[root@localhost ~]#find *php
[root@localhost ~]#find /root -name *php
df查看磁盤空間
[root@localhost ~]#df -h
/dev/sda1 boot系統啓動文件哦
none
/dev/hdc(串光驅口) 利用率 100%
free 查看內存
[root@localhost ~]#free -m
[root@localhost ~]#free -m -s2