什么是linux以及如何安裝軟件
登錄
linux的基本命令及作業(yè)
練習cd操作:進入tmp目錄谆级,然后查看當前路徑烤礁,然后返回主目錄
bio04@VM-0-6-ubuntu:~$ cd tmp
bio04@VM-0-6-ubuntu:~/tmp$ pwd
/home/bio04/tmp
bio04@VM-0-6-ubuntu:~/tmp$ cd ~
bio04@VM-0-6-ubuntu:~$ pwd
/home/bio04
練習刪除操作:
mkdir rm_test
cd rm_test
touch doodle.txt #touch是正經(jīng)的新建命令仪芒,但是不如vi好使罢维,vi是直接新建并打開編輯欢际。
mkdir huahua
cd huahua
touch haha.txt
cd ..
刪除doodle.txt
刪除整個huahua目錄
刪除rm_test(已經(jīng)是空目錄了)
bio04@VM-0-6-ubuntu:~/rm_test/huahua$ cd -
/home/bio04/rm_test
bio04@VM-0-6-ubuntu:~/rm_test$ rm doodle.txt
bio04@VM-0-6-ubuntu:~/rm_test$ rm -r huahua
bio04@VM-0-6-ubuntu:~/rm_test$ rmdir rm_test
rmdir: failed to remove 'rm_test': No such file or directory
bio04@VM-0-6-ubuntu:~/rm_test$ cd ~
bio04@VM-0-6-ubuntu:~$ rmdir rm_test
練習: 查看剛才自己的文件
bio04@VM-0-6-ubuntu:~$ cd tmp
bio04@VM-0-6-ubuntu:~/tmp$ vi hello_world.txt
bio04@VM-0-6-ubuntu:~/tmp$ cat hello_world.txt
i have learned a skill about how to put words into text through linux system
keep learning now
練習:將剛才新建的文件復制一個眯杏,叫做new_file.txt
bio04@VM-0-6-ubuntu:~/tmp$ cp hello_world.txt new_file.txt
bio04@VM-0-6-ubuntu:~/tmp$ cat new_file.txt
i have learned a skill about how to put words into text through linux system
keep learning now
練習:將新文件new_file.txt鸟雏,重命名為home.txt 兽叮,移動到主目錄下(路徑是~)
bio04@VM-0-6-ubuntu:~/tmp$ mv new_file.txt home.txt
bio04@VM-0-6-ubuntu:~$ cd tmp
bio04@VM-0-6-ubuntu:~/tmp$ mv home.txt /home/bio04
解決問題
ls輸出的是橫向的列表爽茴,怎樣輸出長格式列表(提示:搜索ls)
ls -l 命令會列出文件或者目錄的具體信息厨姚,即長格式列表
bio04@VM-0-6-ubuntu:~$ ls -l
total 20
drwxrwxr-x 2 bio04 bio04 4096 Apr 20 21:00 biosoft
-rw-rw-r-- 1 bio04 bio04 95 Apr 20 21:43 home.txt
drwxrwxr-x 2 bio04 bio04 4096 Apr 20 21:01 project
drwxrwxr-x 2 bio04 bio04 4096 Apr 20 21:01 src
drwxrwxr-x 2 bio04 bio04 4096 Apr 20 21:48 tmp
如何查看長格式列表中文件的大新蓝洹猎醇?(提示:ls)
在命令框 輸入命令:ls -lht 將會一一列出當前目錄下所有文件的大小,以及所有文件大小的統(tǒng)計總和努溃×蛩唬或者直接打入ll命令。
bio04@VM-0-6-ubuntu:~$ ls -lht
total 20K
drwxrwxr-x 2 bio04 bio04 4.0K Apr 20 21:48 tmp
-rw-rw-r-- 1 bio04 bio04 95 Apr 20 21:43 home.txt
drwxrwxr-x 2 bio04 bio04 4.0K Apr 20 21:01 src
drwxrwxr-x 2 bio04 bio04 4.0K Apr 20 21:01 project
drwxrwxr-x 2 bio04 bio04 4.0K Apr 20 21:00 biosoft
查看Linux系統(tǒng)版本梧税、內(nèi)存與硬盤空間沦疾?(提示:分別是三個命令)
查看系統(tǒng)版本:lsb_release -a
bio04@VM-0-6-ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
查看內(nèi)存:free -m
bio04@VM-0-6-ubuntu:~$ free -m
total used free shared buff/cache available
Mem: 1833 152 285 5 1394 1498
Swap: 0 0 0
查看硬盤空間情況df -lm
bio04@VM-0-6-ubuntu:~$ df -lm
Filesystem 1M-blocks Used Available Use% Mounted on
udev 885 0 885 0% /dev
tmpfs 184 6 178 4% /run
/dev/vda1 50332 6340 41846 14% /
tmpfs 917 1 917 1% /dev/shm
tmpfs 5 0 5 0% /run/lock
tmpfs 917 0 917 0% /sys/fs/cgroup
tmpfs 184 0 184 0% /run/user/1003
tmpfs 184 0 184 0% /run/user/1002
tmpfs 184 0 184 0% /run/user/1005
tmpfs 184 0 184 0% /run/user/1009
怎樣建立類似/tmp/tmp1/tmp1.1 這樣的層級目錄(提示:搜索mkdir)
mkdir的-p選項允許你一次性創(chuàng)建多層次的目錄称近,而不是一次只創(chuàng)建單獨的目錄。
bio04@VM-0-6-ubuntu:~$ mkdir -p tmp/tmp1/tmp1.1
怎樣刪除這些層級目錄(提示:搜索rm)
實例四:將 test1子目錄及子目錄中所有檔案刪除
命令:rm -r test1
bio04@VM-0-6-ubuntu:~/tmp$ rm -r tmp