添加用户
1 | useradd [用户名] //添加用户 |
权限管理命令
chmod
change the permissions mode of a file——修改文件的使用权限,包括read、write、execute权限。
1 | chmod (u/g/o)(+/-/=)wrx [文件名] //为用户、用户组、其他增加、减少、设定相关权限 |
chown
change file ownership——修改文件的所有者
1 | chown [用户] [文件或目录] |
chgrp
change file group ownership——修改文件的所有用户组的权限
1 | chgrp [用户组] [文件或目录] |
文件和目录的权限与执行
类型 | read权限 | write权限 | execute权限 |
---|---|---|---|
文件 | cat/more/head/tail/less | vim | script command |
目录 | ls | touch/mkdir/rmdir/rm | cd |
注:删除一个文件的前提是对文件所在的目录有r写权限,而非对该文件有w写权限
挂载移动设备
1 | fdisk -l /dev/sda //查看系统分区信息 |
挂载u盘
1 | sudo apt-get install exfat-fuse //安装支持exfat文件系统 |
挂载移动硬盘
1 | sudo apt-get install ntfs-3g //安装支持ntfs文件系统 |
服务类命令
centos6
注册在系统中的标准化程序
有方便统一的管理方式(常用的方法)
- service 服务名 start
- service 服务名 stop
- service 服务名 restart
- service 服务名 reload
- service 服务名 status
查看服务的方法 /etc/init.d/服务名
通过chkconfig命令设置开机自启动
- 查看服务 chkconfig –list | grep xxx
- chkconfig –level 5 服务名 on
centos7
注册在系统中的标准化程序
有方便统一的管理方式(常用的方法)
- systemctl start 服务名(xxx.service)
- systemctl stop 服务名(xxx.service)
- systemctl restart 服务名(xxx.service)
- systemctl reload 服务名(xxx.service)
- systemctl status 服务名(xxx.service)
查看服务的方法 /usr/lib/systemd/system
查看服务的命令
- systemctl list-unit-files
- systemctl –type service
通过systemctl命令设置自启动
- systemctl enable service_name
- systemctl disable service_name