当前位置 博文首页 > 数据分析与统计学之美的博客:万字肝货 | 超全总结,Linux常用磁
??1、知识引入
??2、linux操作系统的产生过程
??3、linux优点
??4、linux体系结构
??5、linux内核及发行版本
??6、文件系统和目录结构
??7、终端和常用命令
??8、磁盘命令
??9、文件命令
??10、其他常用命令
??11、案例讲解
windows 桌面系统/服务器端
linux 服务器端
mac/unix
android/ios
桌面系统:主要是面对大众用户,以美观、易用为原则,有图形化界面。
服务器端:知道使用命令行进行调试的那个小黑窗口,就知道什么是服务器端。
刚刚买回来的计算机:仅有硬件;
硬件:主要包括CPU、内存、主板、硬盘驱动器、光盘驱动器、各种扩展卡、连接线、电源等;外部设备包括鼠标、键盘等。
只有装上了操作系统、应用软件后,才使得电脑世界变得丰富多彩;
仅有硬件(裸机)
操作系统软件:windows系统
应用软件:qq、微信
操作系统的作用是什么?为什么不在硬件上面直接安装“应用软件”,还需要安装一个操作系统呢?
操作系统可以提供磁盘管理、内存管理、资源调度,避免杂乱无章。
什么是linux?
1)Linux操作系统属于开源操作系统,主要应用于服务器端。
2)基于posix和unix的多用户、多任务、多线程和多cpu的操作系统。
3)Linux继承了UNIX以网络为核心的设计思想,是一个性能稳定的多用户的网络操作系统。
注意:linux之所以叫做linux,这个名字是由linus和unix组合而来的。
Linux内核:内核建立了计算机软件与硬件之间通讯的平台,内核提供系统服务,比如文件管理、虚拟内存、设备I/O、进程管理等。
"软件调用内核,内核操作硬件"
内核版:是系统的心脏,用于运行程序和管理硬件的核心。内核通过系统调用来管理计算机硬件,而终端命令用来检测系统调用是否正确,
使得更加方便的调用计算机硬件。系统调用主要是方便程序间接访问计算机硬件。
发行版:发行版包含了Linux内核,发行版就是在Linux内核之上再搭建一套应用程序,有桌面管理程序,视频播放程序等一套程序。因为
Linux内核已经实现了跟计算机硬件进行交互,所以发行版可以通过系统内核的系统调用来跟计算机硬件进行访问,大大缩短了开
发系统的时间。
发行版本:
Windows : NTFS(FAT16 FAT32)
Linux: centos5 : ext3 文件系统
centos6 : ext4 文件系统
centos7 : xfs 文件系统
树结构如下:
注意:/(根目录)底下的二级目录不要删除、也不要添加目录。
使用建议:
[root@image_boundary ~]# ls -l anaconda-ks.cfg
-rw------- 1 root root 1598 Sep 17 15:57 anaconda-ks.cfg
为大家奉上 linux命令大全 宝贝网站:http://man.linuxde.net/
cd 相对路径/绝对路径。利用相对路径或绝对路径,切换到某个目录之下;
cd . 表示当前路径;
cd .. 返回上一层目录;
cd ~ 若为root用户,就是切换到root用户的家目录【/root】;
若为普通用户,就是切换到普通用户的家目录【/home/普通用户名】;
cd / 直接返回到"/"根目录;
cd - 返回上一次操作目录;"(这个很好用)"
操作如下:
[root@image_boundary ~]# cd /
[root@image_boundary /]# cd home
[root@image_boundary home]# cd ../usr
[root@image_boundary usr]# cd -
/home
[root@image_boundary home]# cd ..
[root@image_boundary /]# pwd
/
[root@image_boundary ~]# su hadoop
[hadoop@image_boundary root]$ cd ~
[hadoop@image_boundary ~]$ pwd
/home/hadoop
[root@image_boundary /]# pwd
/
[root@image_boundary /]# cd ~
[root@image_boundary ~]# pwd
/root
[hadoop@image_boundary ~]$ pwd
/home/hadoop
-l:展示详细信息
-a:查看隐藏内容。(显示以.开头的那些文件)
-A:查看隐藏文件。(显示.开头的那些文件,与a不同的是不显示.和…)。“注意:.表示当前文件夹 …表示上一级文件夹”
-h:友好的方式展示(文件以K、M…结尾)
-R:递归展示所有文件。
常用组合操作:ls -l 可以简化为ll。ll -h 显示文件的具体信息,并以友好的方式展示。
操作如下:
[root@image_boundary ~]# ls -l 可以写成ll
total 108
-rw-r--r--. 1 root root 9 Sep 17 19:10 aa.txt~
-rw-------. 1 root root 1598 Sep 17 15:57 anaconda-ks.cfg
[root@image_boundary ~]# ls -lh 可以写成ll -h
total 108K
-rw-r--r--. 1 root root 9 Sep 17 19:10 aa.txt~
-rw-------. 1 root root 1.6K Sep 17 15:57 anaconda-ks.cfg
操作如下:
[root@image_boundary Desktop]# ll
total 8
drwxr-xr-x. 2 root root 4096 Oct 15 20:02 aa
drwxr-xr-x. 2 root root 4096 Oct 15 20:05 bb
[root@image_boundary Desktop]# du -sh
28K .
操作如下:
[root@image_boundary Desktop]# df -h
文件系统 容量 已用 可用 已用% 挂载点
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_image-lv_root
35G 3.6G 30G 11% /
tmpfs 931M 296K 931M 1% /dev/shm
/dev/sda1 477M 42M 411M 10% /boot
/dev/sr0 3.7G 3.7G 0 100% /media/CentOS_6.9_Final
操作如下:
[root@image_boundary Desktop]# ll
total 8
drwxr-xr-x. 2 root root 4096 Oct 15 20:02 aa
drwxr-xr-x. 2 root root 4096 Oct 15 20:05 bb
[root@image_boundary Desktop]# mkdir cc
[root@image_boundary Desktop]# ll
total 12
drwxr-xr-x. 2 root root 4096 Oct 15 20:02 aa
drwxr-xr-x. 2 root root 4096 Oct 15 20:05 bb
drwxr-xr-x. 2 root root 4096 Oct 15 20:21 cc
# 不写-p会报错。
[root@image_boundary Desktop]# mkdir dd/ee
mkdir: cannot create directory `dd/ee': No such file or directory
# 参数-p表示递归产生一个目录。
# 创建一个递归目录dd/ee。
[root@image_boundary Desktop]# mkdir -p dd/ee
[root@image_boundary Desktop]# cd dd
[root@image_boundary dd]# ll
total 4
drwxr-xr-x. 2 root root 4096 Oct 15 20:22 ee
[root@image_boundary Desktop]# ll
total 16
drwxr-xr-x. 2 root root 4096 Oct 15 20:02 aa
drwxr-xr-x. 2 root root 4096 Oct 15 20:05 bb
drwxr-xr-x. 2 root root 4096 Oct 15 20:21 cc
drwxr-xr-x. 3 root root 4096 Oct 15 20:22 dd
[root@image_boundary Desktop]# cd cc
[root@image_boundary cc]# ll
total 0
[root@image_boundary cc]# touch sum.txt
[root@image_boundary cc]# ll
total 4
-rw-r--r--. 1 root root 0 Oct 15 20:28 sum.txt
操作如下:
"file 文件名:可以显示其到底是一个文件,还是一个目录"
[root@image_boundary ~]$ file aa
aa: directory
[root@image_boundary cc]# ll
total 0
-rw-r--r--. 1 root root 0 Oct 15 20:28 sum.txt
"查看当前文件夹的类型(这里指的就是cc):文件夹"
[root@image_boundary cc]# file .
.: directory
"如果sum.txt中没有内容,显示empty"
[root@image_boundary cc]# file sum.txt
./sum.txt: empty
"如果sum.txt中有内容,显示sum.txt的文件类型"
[root@image_boundary cc]# file sum.txt
./sum.txt: ASCII text
[root@image_boundary cc]# file -b sum.txt
ASCII text
操作如下:
"注意以下两个命令的区别"
rmdir dd/ee/ff 表示删除dd下面ee下面的这一个空目录ff。
rmdir -p dd/ee/ff 表示同时递归删除dd/ee/ff这3个目录。