系统目录结构
bin 可执行文件
sbin
etc 类似C盘 配置文件
mnt 挂载相关
具体参考:Ubuntu根目录结构说明
命令操作
ls:蓝色:表示目录 青色:表示链接 黑色:表示文件
ls -l:显示所有属性:
drwxr-xr-x 2 root root 4096 2月 12 16:59 bin
d不用管 rwx 可读可写可执行 (对应第一个root) r-x 可读不可写可执行(对应第二个root组-群组)组是指相同权限的组?
- cd
- pwd
- mkdir
- rmdir 删除目录
- passwd
- 新建文件 touch
- 改变权限:chmod
Linux/Unix 的文件调用权限分为三级 : 文件拥有者、群组、其他(除了1\2外的)
rwx属性为 4+2+1 =7;rw-为4+2=6;r-x为4+1=5
touch 111 ls -l 111 chmod 777 111 ls -l 111
- chown改变文件所属的用户 chown stu fzu :将fzu的所属用户改为stu
- tar:
#tar cvf backup.tar /etc 把etc目录压缩成名为backup.tar的压缩文件 c -压缩 详情tar
若压缩后缀.gz 使用tar -zxvf
若压缩后缀..bz2 使用tar-jxvf
- man 命令帮助 :man mkdir
- cat 文件名
root@cxq-X550VX:/home/cxq# vim 123
root@cxq-X550VX:/home/cxq# cat 123
fuck u
root@cxq-X550VX:/home/cxq#
- comm
- cmp 比较两个文件
- cp 拷贝 cp 33 44 拷贝33到44
- mv移动
- rm 删除文件
练习1:
cxq@cxq-X550VX:~$ cd /
cxq@cxq-X550VX:/$ su
密码:
root@cxq-X550VX:/# cd /opt
root@cxq-X550VX:/opt# mkdir Document
root@cxq-X550VX:/opt# ls
Document eclipse-cpp-kepler-SR2-linux-gtk-x86_64.tar.gz jvm
eclipse eclipse-SDK-4.9-linux-gtk-x86_64.tar.gz
root@cxq-X550VX:/opt# cd Document/
root@cxq-X550VX:/opt/Document# touch test.exe
root@cxq-X550VX:/opt/Document# chmod 775 test.exe
root@cxq-X550VX:/opt/Document# ls -l test.exe
-rwxrwxr-x 1 root root 0 5月 5 14:46 test.exe
root@cxq-X550VX:/opt/Document# tar cvf test.tar test.exe
test.exe
root@cxq-X550VX:/opt/Document# ls
test.exe test.tar
练习2:gcc helloworld
gcc编译helloworld
删除系统文件 rm -rf/
详情参考:Linux 命令大全