Linux软件基础实验,linux基本操作的实验
linux基本操作的實(shí)驗(yàn)
發(fā)布時間:2008-10-02 00:37:30來源:紅聯(lián)作者:sfwjeo
實(shí)驗(yàn)一、linux基本操作
1.實(shí)驗(yàn)?zāi)康?/p>
了解linux的基本命令,熟練掌握其基本操作
2.相關(guān)知識
使用命令操作,往往會帶來更高的效率,外殼提示符界面和其他命令行借口類似,用戶在提示符后面輸入命令,然后外殼解釋命令,根據(jù)命令告訴操作系統(tǒng)需要進(jìn)行什么操作。
3.實(shí)驗(yàn)內(nèi)容與基本操作
操作1:以user_login用戶身份并使用telnet登錄Linux服務(wù)器,按照提示創(chuàng)建自己的賬戶和口令。
________________________
首先要保證telnet的端口23打開,然后可從windows下telnet
telnet>
open 192.168.0.12
login:user_login
password: (輸入密碼)
#su root
輸入密碼: (root密碼)
#useradd test
#passwd (輸入test的密碼)
_________________________
操作 2:使用新創(chuàng)建的用戶賬戶和口令登錄Linux系統(tǒng),察看登錄后的界面。
________
登錄后的界面是一個全新的初始化的桌面
________
操作3:使用pwd命令察看當(dāng)前的工作目錄,然后用ls命令查看當(dāng)前目錄下的內(nèi)容,嘗試使用-a,-l,-F,-A,-lF等不同選項(xiàng)并比較不同之處。
______
[user@localhost home]$ pwd
/home
[user@localhost home]$ ls -a
. .. lan test user
[user@localhost home]$ ls -l
總計(jì) 3
drwx------ 19 lan lan 1024 09-29 02:46 lan
drwx------ 6 test test 1024 09-30 01:14 test
drwx------ 14 user user 1024 09-29 01:46 user
[user@localhost home]$ ls -F
lan/ test/ user/
[user@localhost home]$ ls -A
lan test user
[user@localhost home]$ ls -lF
總計(jì) 3
drwx------ 19 lan lan 1024 09-29 02:46 lan/
drwx------ 6 test test 1024 09-30 01:14 test/
drwx------ 14 user user 1024 09-29 01:46 user/
________________
操作4:在當(dāng)前目錄下建立一個名為test的新目錄,然后將工作目錄切換到test下,嘗試將/etc目錄下的文件passwd拷貝到該目錄下(cp
源文件 目的目錄)。察看當(dāng)前目錄下的passwd文件的屬主和文件權(quán)限。
________
[user@localhost /]$ cd /home/user
[user@localhost ~]$ mkdir test
[user@localhost ~]$ cd test
[user@localhost test]$ cd /home/user/test
[user@localhost test]$ ls
[user@localhost test]$ cp ./etc/passwd /home/user/test/
cp: 無法 stat “./etc/passwd”: 沒有那個文件或目錄
[user@localhost test]$ cp /etc/passwd /home/user/test/
[user@localhost test]$ ls
passwd
_____________
操作5:嘗試向當(dāng)前目錄下的passwd文件和/etc/passwd文件分別寫入一些新內(nèi)容(可使用echo "字符串" >>文件
的命令),看看操作能否成功,如果不能成功,請說明原因。用cat命令瀏覽文件password的內(nèi)容,用more命令進(jìn)行瀏覽翻頁操作,再用less命令瀏覽文件的內(nèi)容。比較這幾個命令的不同之處
More: 一次翻一頁
Less: 一次翻一行
按Q 返回
_________________
[user@localhost test]$ cp /etc/passwd /home/user/test/
[user@localhost test]$ ls
passwd
[user@localhost test]$ echo -h
-h
[user@localhost test]$ echo this is me >> passwd
[user@localhost test]$ echo this is me >> /etc/passwd
bash: /etc/passwd: 權(quán)限不夠
_____________________
操作6:用ls命令查看test下文件的權(quán)限,用mv命令更改文件password的文件名為test.txt,嘗試用chown和chgrp更改文件的屬主為root、組為root,看看能否成功,不成功,請說明原因。嘗試用chomd將文件權(quán)限為"-rw-------"??纯茨芊癯晒?#xff0c;不成功,請說明原因。
_____________
[user@localhost test]$ ls -l
總計(jì) 2
-rw-r--r-- 1 user lan 1686 09-30 01:39 passwd
________________
chown: 正在更改 “test.txt” 的所有者: 不允許的操作
因?yàn)閏hown的使用權(quán)限是root
________________
[user@localhost test]$ chmod 600 test.txt
[user@localhost test]$ ls -l
總計(jì) 2
-rw------- 1 user lan 1686 09-30 01:39 test.txt
______________
操作7:用rm命令刪除test目錄下的所有文件,再用rmdir命令刪除test目錄。
(想一想有沒有一條命令將目錄及目錄下的所有文件刪除,寫出這條命令)。刪除test目錄命令為:rmdir /home/wh/test
___________
[user@localhost test]$ rm test.txt
[user@localhost test]$ ls
[user@localhost test]$
[user@localhost test]$rmdir /home/user/test
___________
操作8:使用ps命令查看當(dāng)前系統(tǒng)內(nèi)的進(jìn)程,并利用man命令獲取ps命令的參數(shù),寫出獲取當(dāng)前終端進(jìn)程執(zhí)行情況的ps命令。
____
[user@localhost ~]$ ps
PID TTY TIME CMD
2922 pts/1 00:00:00 bash
3102 pts/1 00:00:00 ps
_____
操作9:使用df命令查看當(dāng)前系統(tǒng)已安裝的文件系統(tǒng)的空間使用情況,記錄結(jié)果。
_________________
[user@localhost ~]$ df
文件系統(tǒng) 1K-塊 已用 可用 已用% 掛載點(diǎn)
/dev/sda2 7856665 4326007 3125017 59% /
/dev/sda1 101086 12340 83527 13% /boot
/dev/shm 79228 0 79228 0% /dev/shm
__________________
操作10:使用du命令查看用戶的工作目錄占用了多少空間,記錄結(jié)果。
____________
[user@localhost ~]$ du
1 ./.local/share/Trash/files
1 ./.local/share/Trash/info
3 ./.local/share/Trash
4 ./.local/share
5 ./.local
3 ./.kde/Autostart
………………
______________
操作11:使用free命令查看內(nèi)存資源的使用情況,記錄結(jié)果。
_______________________
[user@localhost ~]$ free
total used free shared buffers cached
Mem: 158456 155168 3288 0 4072 43284
-/+ buffers/cache: 107812 50644
Swap: 168672 88872 79800
________________________
操作12:使用man獲取tar和gzip的幫助信息,嘗試將test目錄下的文件打包并壓縮,然后到另外一目錄tmp下解包,寫出這幾條命令。
______________
[root@localhost /]#man gzip
NAME
gzip, gunzip, zcat - compress or expand files
SYNOPSIS
gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name ... ]
gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name ... ]
zcat [ -fhLV ] [ name ... ]
DESCRIPTION
………………………………
______________
操作13:嘗試執(zhí)行"ls -l /tmp",看看這條命令的執(zhí)行會出現(xiàn)什么結(jié)果,解釋一下這條命令。
_________
[root@localhost /]# ls -l /tmp
總計(jì) 15900
-rw-r--r-- 1 root root 10601390 09-19 20:20 album_info.xml
drwxr-xr-x 3 root root 1024 09-19 15:29 base
drwxr-xr-x 2 root root 1024 09-21 02:07 bluedjgames
-rw------- 1 root root 236056 09-26 20:00 ct.pdf
drwxr--r-- 2 root root 1024 09-19 02:24 dta
drwx------ 2 lan lan 1024 09-28 20:48 gconfd-lan
drwx------ 3 root root 1024 09-30 13:37 gconfd-root
drwx------ 2 user user 1024 09-28 03:34 gconfd-user
-rw------- 1 root root 5108223 09-19 06:29 initrd.img.vd7402.gz
drwx------ 2 root root 1024 09-30 13:33 kde-root
-rw------- 1 root root 248677 09-26 19:47 kpvod.pdf
drwx------ 3 root root 1024 09-30 13:34 ksocket-root
drwx------ 2 root root 1024 09-30 13:37 orbit-root
…………………………………………………………
____________
操作14:嘗試執(zhí)行find /usr/src -name *.c -print | xargs grep
"#include",看看這條命令的執(zhí)行會出現(xiàn)什么結(jié)果,解釋一下這條命令。
__________
內(nèi)核所用的函數(shù)庫
__________
操作15:執(zhí)行cal和date命令,說說這兩條指令的用途。
____________________
[user@localhost ~]$ cal
九月 2008
日 一 二 三 四 五 六
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
[user@localhost ~]$ date
2008年 09月 30日 星期二 02:52:39 CST
_____________________
操作16:執(zhí)行命令clear和logout,退出系統(tǒng)。(想一想有沒有其他的方法,寫出這種方法)
________
logout 還可以用shutdown -h now
________
操作17:執(zhí)行命令shutdown,關(guān)閉系統(tǒng)。(想一想有沒有更簡單的命令,寫出這條命令)
___________________
halt,reboot、及init
___________________
實(shí)驗(yàn)要求:
1 必須作實(shí)驗(yàn)預(yù)習(xí),對預(yù)習(xí)報(bào)告不做形式要求。
2 按時完成實(shí)驗(yàn)并按時提交實(shí)驗(yàn)報(bào)告。
實(shí)驗(yàn)報(bào)告要求:
1 寫明實(shí)驗(yàn)題目
2 詳細(xì)描述操作過程
3 寫出輸入和輸出結(jié)果,結(jié)果應(yīng)該正確
4 對實(shí)驗(yàn)做簡要總結(jié)
評價標(biāo)準(zhǔn):
合格:完成實(shí)驗(yàn)內(nèi)容,按時提交實(shí)驗(yàn)報(bào)告,實(shí)驗(yàn)報(bào)告符合要求。
總結(jié)
以上是生活随笔為你收集整理的Linux软件基础实验,linux基本操作的实验的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 电脑连接手机热点失败(树莓派无法连接电脑
- 下一篇: linux 其他常用命令