随笔分类 - linux shell
摘要:linux系统中每一个硬件也被视作文件,包括硬盘、光盘、鼠标等(linux系统中,一切皆是文件) 系统内核中的udev设备管理器会自动把硬件名称规范起来,目的是让用户通过设备文件的名称可以猜出设备大致的属性以及分区信息等。 linux系统中几乎所有的硬件设备都这/dev 目录下: 1、linux系统
阅读全文
摘要:linux系统中,一切文件都是从跟目录“/”开始,按照文件系统层次化标准(FHS)采用树形结构来存放文件,并规定了常见目录的用途。 在早期的 UNIX 系统中,各个厂家各自定义了自己的 UNIX 系统文件目录,比较混乱。Linux 面世不久后,对文件目录进行了标准化,于1994年对根文件目录做了统一
阅读全文
摘要:1、在linux系统中一切皆是文件 除了常见的文件比如文本文件、图形文件、程序文件外;设备文件像鼠标、键盘;网络文件(socket)等都抽象为文件。 普通文件:存放数据、程序等信息的文件。 目录文件:指的文件目录。 链接文件:包含软链接文件和硬链接文件。 设备文件:包含块设备文件(硬盘、软盘、光盘等
阅读全文
摘要:1、linux系统中sudo服务是的普通用户能够执行较大权限的命令 使用sudo -l 命令 查看是否具有sudo权限: [root@linuxprobe test]# ls [root@linuxprobe test]# whoami root [root@linuxprobe test]# su
阅读全文
摘要:1、linux系统中su 和 su - 都是用于登录用于切换的命令 su:切换用户,环境变量不变,路径不变 su - : 切换用户,环境变量随切换用户发生改变,回到家目录 测试 su 命令: [root@linuxprobe test]# ls [root@linuxprobe test]# who
阅读全文
摘要:1、linux系统中普通权限的设置主要是针对一类情形,比如针对所有者、所属组或者其他人的设置。 linux系统中的文件访问控制列表是针对特定具体的用户或者用户组来进行权限设置。 直接测试: ## 为了对比,先测试未分配ACL之前的情况[root@linuxprobe test]# ls [root@
阅读全文
摘要:linux系统中文件除了具备一般权限和特殊权限外,还有一种隐藏权限,即被隐藏起来的权限 chattr命令用于增减文件和目录的隐藏权限 1、 chattr -i 选项 不能删除文件、不能对文件进行修改 [root@linuxprobe home]# whoami root [root@linuxpro
阅读全文
摘要:1、linux中SBIT权限用于对目录进行设定 使只有文件或者目录的所有者才能删除文件或者目录 测试不加 SBIT权限的情况: [root@linuxprobe home]# mkdir test01 test02 [root@linuxprobe home]# chmod 777 test01 #
阅读全文
摘要:linux系统中chgrp命令用户改变文件或者目录的所属组 chgrp 为 change group的缩写 用法: chgrp 【选项】 文件/目录 1、创建测试文件 [root@linuxprobe test]# ls [root@linuxprobe test]# whoami root [ro
阅读全文
摘要:1、创建测试文件 [root@linuxprobe test]# whoami root [root@linuxprobe test]# touch a.txt b.txt ## 测试文件 [root@linuxprobe test]# su - liujiaxin01 ## 切换至普通用户 [li
阅读全文
摘要:1、linux系统中文件和目录的权限 按照用户可分为所有者、所属组和其他人。 所有者用u代表(user) 所属组用g代表(group) 其他人用o代表(other) 按照具体的权限可以分为可读、可写、可执行、无权限 可读用r代表(read),用数字4表示 可写用w代表(write),用数字2表示 可
阅读全文
摘要:1、创建测试用户 [root@linuxprobe home]# for i in liujiaxin{01..05};do useradd -g root $i;echo "123456" | passwd --stdin $i;done##创建测试用户,指定所属组为root,密码为123456
阅读全文
摘要:1、linux系统中一共有七种文件类型,参考:https://www.cnblogs.com/songgj/p/8890710.html linux一共有7种文件类型,分别如下: -:普通文件 d:目录文件 l: 软链接(类似Windows的快捷方式) (下面四种是特殊文件) b:块设备文件(例如硬
阅读全文
摘要:1、使用usermod -L 选项限制用户登录 [root@linuxprobe home]# usermod -L linuxprobe ##禁止用户linuxprobe登录 [root@linuxprobe home]# passwd -S linuxprobe ## 查看状态,锁定状态 lin
阅读全文
摘要:1、linux系统中usermod命令用于修改已创建用户的信息 用法:usermod [选项] username [root@linuxprobe home]# tail -n 3 /etc/group tcpdump:x:72: linuxprobe:x:1000: apache:x:48: [r
阅读全文
摘要:1、linux中groupadd命令用于创建新的用户组 直接测试,创建用户组: [root@linuxprobe home]# tail -n 3 /etc/group ## 查看用户组信息后三行 tcpdump:x:72: linuxprobe:x:1000: apache:x:48: [root
阅读全文
摘要:1、linux系统中useradd命令用于创建新的用户 使用方法 useradd name [root@linuxprobe home]# ls linuxprobe software [root@linuxprobe home]# pwd ##路径 /home [root@linuxprobe h
阅读全文
摘要:1、crontab命令用于创建系统能够周期性、有规律地执行某些具体的任务 直接测试:crontab -e 进行创建、编辑任务 [root@linuxprobe test]# ls ## 查看测试文件 a.txt [root@linuxprobe test]# ll -h total 6.6M -rw
阅读全文
摘要:1、一次性计划任务服务顾名思义只执行一次,直接测试 [root@linuxprobe test]# date ## 查看系统当前日期 Mon Oct 19 12:45:10 CST 2020 [root@linuxprobe test]# at 12:48 ## 使用格式, at + 时间,表示在1
阅读全文
摘要:1、case命令选择执行 [root@linuxprobe test]# ls test.sh [root@linuxprobe test]# cat test.sh ## 查看脚本 #!/bin/bash echo "This is a test!" echo "you can choose 0-
阅读全文

浙公网安备 33010602011771号