1、目錄操作
windows系統,硬盤分區管理,包含c盤、d盤,每一個盤符下面包含若干個目錄,目錄中包含不同文件,並有光驅。
linux所有設備以目錄方式管理(一個光驅就是掛載在某個目錄下面),目錄有一個統一根目錄
home:創建admin用戶,就會在home目錄下對應admin目錄。創建vsftp用戶,就會在home目錄下對應vsftp目錄
usr:通常將軟件安裝在/usr/local目錄下面
安裝jdk /usr/local/jdk/….(安裝的jdk)
root:超級用戶目錄
2、目錄操作
pwd(print working directory)打印當前目錄 cd:(come todirectory) 進入某個目錄 cd .. 回到上一層目錄 ls:(list) 列表展示目錄里面信息 ll:(list) 詳細展示目錄里面信息 mkdir:(make directory)創建新的目錄 rm:(remove) 刪除文件或者目錄 目錄 rm 目錄名 -r(recursive遞歸)f 文件 rm 文件名 -f tailf(tail -f):輸出文件內容 tar zxvf 壓縮文件名:解壓 ~:當前用戶所在目錄 cd 操作 [root@localhost usr]# cd --回到當前用戶所在目錄 [root@localhost ~]# pwd /root [root@localhost ~]# ls anaconda-ks.cfg install.log install.log.syslog 公共的 模板 視頻 圖片 文檔 下載 音樂 桌面 [root@localhost ~]# ll 總用量 100 -rw-------. 1 root root 1612 11月 30 18:31 anaconda-ks.cfg -rw-r--r--. 1 root root 46478 11月 30 18:31 install.log -rw-r--r--. 1 root root 10033 11月 30 18:26 install.log.syslog drwxr-xr-x. 2 root root 4096 11月 30 19:02 公共的 drwxr-xr-x. 2 root root 4096 11月 30 19:02 模板 drwxr-xr-x. 2 root root 4096 11月 30 19:02 視頻 drwxr-xr-x. 2 root root 4096 11月 30 19:02 圖片 drwxr-xr-x. 2 root root 4096 11月 30 19:02 文檔 drwxr-xr-x. 2 root root 4096 11月 30 19:02 下載 drwxr-xr-x. 2 root root 4096 11月 30 19:02 音樂 drwxr-xr-x. 3 root root 4096 11月 30 19:16 桌面 [root@localhost ~]# mkdir testDir [root@localhost ~]# cd testDir/ [root@localhost testDir]# ls [root@localhost testDir]# cd .. [root@localhost ~]# rm testDir/ -rf 遞歸刪除testDir目錄 [root@localhost ~]# mkdir testDir [root@localhost ~]# touch testJpg.jpg [root@localhost ~]# ls anaconda-ks.cfg install.log install.log.syslog testDir testJpg.jpg 公共的 模板 視頻 圖片 文檔 下載 音樂 桌面 [root@localhost ~]# rm testJpg.jpg –f [root@localhost ~]# rm testDir/ -rf [root@localhost ~]# vi testJpg.jpg --新建testJpg.jpg文件,並進行編輯(一般模式 iàinsert模式escà一般模式 :wqà) [root@localhost ~]# tailf testJpg.jpg 查看文件內容 hello world hi ^C ctrl+c:強制退出 [root@localhost ~]# ls anaconda-ks.cfg install.log install.log.syslog testJpg.jpg 公共的 模板 視頻 圖片 文檔 下載 音樂 桌面 [root@localhost ~]# mkdir testDir [root@localhost ~]# ls anaconda-ks.cfg install.log install.log.syslog testDir testJpg.jpg 公共的 模板 視頻 圖片 文檔 下載 音樂 桌面 [root@localhost ~]# cp testJpg.jpg testDir [root@localhost ~]# cp testDir/ /usr/local -r [root@localhost ~]# cp testDir/ /usr/local/test -r [root@localhost ~]# cd /usr/local [root@localhost local]# rm test* -rf --或者 rm test testDir –rf 將jdk壓縮包上傳至/root/temp目錄下 [root@localhost temp]# tar zxvf jdk-7u51-linux-x64.gz