Linux操作練習

2021-10-12 08:00:22 字數 1291 閱讀 8452

1、在根下建立乙個目錄ceshi,在測試目錄下建立乙個user目錄,將/etc/passwd和/etc/shadow檔案複製到/ceshi/user目錄中,給/ceshi//user/passwd檔案建立乙個硬鏈結檔案為passwd.bak ,給/ceshi/user/shadow檔案建立乙個軟鏈結為sh.link。

[root@localhost /]

# mkdir -p /ceshi/user/

[root@localhost /]

# cp /etc/ /ceshi/user/

[root@localhost /]

# ln /ceshi/user/passwd passwd.bak

[root@localhost /]

# ln -s /ceshi/user/shadow sh.link

2、將/etc/ssh/sshd_config檔案複製到/ceshi目錄中並重命名為sshd.

[root@localhost /]

# cp /etc/ssh/sshd_config /ceshi/sshd

3、找出檔名為passwd的檔案並將找出的結果寫入/passwd.txt檔案中。

[root@localhost /]

# find -name passwd > /passwd.txt

4、在root使用者的家目錄下面建立乙個test目錄,將/ceshi/sshd檔案和/ceshi/user/passwd.bak移動到test目錄中。

[root@localhost ~]

# mkdir test/

[root@localhost ~]

# mv /ceshi/sshd test

[root@localhost ~]

# mv /passwd.bak test

[root@localhost test]

# tar zcvf us.tar.gz /ceshi/user sshd

6、將第五題中的壓縮檔案解壓到普通使用者的家目錄中,從解壓檔案中找到以b或者c開始的行內容並將其內容寫入普通使用者家目錄下的file檔案中。

[root@localhost ~]

# tar xvf us.tar.gz -c /home/zx

[root@localhost zx]

# grep ^[bc] sshd > file

Linux操作練習 demo

201311639李爽2016 9 6 中作業linux 1.進入 tmp目錄,建立mytest目錄,在其下建立兩個目錄dir1,dir2 cd tmp mkdir mytest cd tmp mytest mkdir dir1 dir2 ls2.把 etc passwd檔案拷貝到 tmp myte...

Linux操作小練習 demo

3.完成 1.使用root使用者建立 tmp test目錄 su root mkdir tmp test 2.使用tom使用者進入 tmp test目錄,並在其下建立資料夾 su tom cd tmp test mkdir 如果建立不了,則把 tmp test的所屬使用者及使用者組改為tom 3.t...

Linux 簡單檔案操作命令練習

今天練了練linux檔案的操作。文件的建立 touch a 資料夾的建立 mkdir a 文件的刪除 rm a 檢視資料夾檔案 ls 進入資料夾 新的目錄 cd a 將t檔案複製到資料夾a中 cp t a 刪除檔案 rm t 暴力刪除 rm t fr 剪下檔案t到a mv t a 進入根目錄 cd ...