linux哪些命令对应rwx,Linux常用命令基础总结

1.命令帮助

1.–help参数(用于简单的命令参数帮助查询)

frank@ubuntu:~$ ls --help

Usage: ls [OPTION]… [FILE]…

List information about the FILEs (the current directory by default).

Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.

-a, --all do not ignore entries starting with .

-A, --almost-all do not list implied . and …

–author with -l, print the author of each file

-b, --escape print C-style escapes for nongraphic characters

–block-size=SIZE with -l, scale sizes by SIZE when printing them;

e.g., ‘–block-size=M’; see SIZE format below

-B, --ignore-backups do not list implied entries ending with ~

-c with -lt: sort by, and show,

2.在线帮助查询

(1)man page

它以一种非常具体的形式来给出帮助

frank@ubuntu:~$ man cal

CAL(1) BSD General Commands Manual CAL(1)

NAME

cal, ncal — displays a calendar and the date of Easter

SYNOPSIS

cal [-31jy] [-A number] [-B number] [-d yyyy-mm] [[month] year]

cal [-31j] [-A number] [-B number] [-d yyyy-mm] -m month [year]

ncal [-C] [-31jy] [-A number] [-B number] [-d yyyy-mm] [[month] year]

ncal [-C] [-31j] [-A number] [-B number] [-d yyyy-mm] -m month [year]

ncal [-31bhjJpwySM] [-A number] [-B number] [-H yyyy-mm-dd] [-d yyyy-mm]

[-s country_code] [[month] year]

ncal [-31bhJeoSM] [-A number] [-B number] [-d yyyy-mm] [year]

它里面可以用一些vim的命令来进行搜索和关闭,例如q离开,/向下搜索,page up翻页等等

(2)info page

此命令与man 用途相似 ,只不过 info 用 超文本链接的形式将每个段落用自己的页面来写

**q离开 Tab在节点之间移动 Enter进入节点 u回到上一层 **

options::.

‘-d’

‘–dir’

Remove the listed directories if they are empty.

‘-f’

‘–force’

Ignore nonexistent files and missing operands, and never prompt the

user. Ignore any previous ‘–interactive’ (‘-i’) option.

Next: Block size, Prev: Exit status, Up: Common options

这是其中的一个子目录

Some GNU programs (at least ‘cp’, ‘install’, ‘ln’, and ‘mv’) optionally

make backups of files before writing new versions. These options

control the details of these backups. The options are also briefly

mentioned in the descriptions of the particular programs.

‘-b’

‘–backup[=METHOD]’

2.文件权限及管理

Linux是一个多用户系统,因此对于一个文件来说有(用户组,用户,其他人)三种权限

权限中的x并不代表它有被执行的能力

frank@ubuntu:/$ ls -l

total 970048

lrwxrwxrwx 1 root root 7 Aug 12 20:09 bin -> usr/bin

drwxr-xr-x 3 root root 4096 Jan 24 21:57 boot

drwxrwxr-x 2 root root 4096 Aug 12 20:12 cdrom

drwxr-xr-x 18 root root 4280 Jan 24 21:45 dev

drwxr-xr-x 129 root root 12288 Jan 24 21:56 etc

drwxr-xr-x 3 root root 4096 Aug 12 20:31 home

lrwxrwxrwx 1 root root 32 Jan 16 18:04 initrd.img -> boot/initrd.img-5.0.0-38-generic

lrwxrwxrwx 1 root root 32 Jan 16 18:04 initrd.img.old -> boot/initrd.img-5.0.0-37-generic

lrwxrwxrwx 1 root root 7 Aug 12 20:09 lib -> usr/lib

lrwxrwxrwx 1 root root 9 Aug 12 20:09 lib32 -> usr/lib32

lrwxrwxrwx 1 root root 9 Aug 12 20:09 lib64 -> usr/lib64

lrwxrwxrwx 1 root root 10 Aug 12 20:09 libx32 -> usr/libx32

drwx------ 2 root root 16384 Aug 13 04:09 lost+found

drwxr-xr-x 3 root root 4096 Apr 16 2019 media

drwxr-xr-x 2 root root 4096 Apr 16 2019 mnt

drwxr-xr-x 2 root root 4096 Aug 12 20:46 opt

dr-xr-xr-x 299 root root 0 Jan 24 21:43 proc

drwx------ 3 root root 4096 Jan 20 04:24 root

drwxr-xr-x 34 root root 1040 Jan 24 21:57 run

lrwxrwxrwx 1 root root 8 Aug 12 20:09 sbin -> usr/sbin

drwxr-xr-x 11 root root 4096 Aug 12 20:44 snap

drwxr-xr-x 2 root root 4096 Apr 16 2019 srv

-rw------- 1 root root 993244160 Aug 12 20:09 swapfile

dr-xr-xr-x 13 root root 0 Jan 24 21:44 sys

drwxrwxrwt 18 root root 4096 Jan 24 22:10 tmp

drwxr-xr-x 14 root root 4096 Apr 16 2019 usr

drwxr-xr-x 14 root root 4096 Apr 16 2019 var

lrwxrwxrwx 1 root root 29 Jan 16 18:04 vmlinuz -> boot/vmlinuz-5.0.0-38-generic

lrwxrwxrwx 1 root root 29 Jan 16 18:04 vmlinuz.old -> boot/vmlinuz-5.0.0-37-generic

前十个字符为该文件对于各个用户的权限,第一个字符为文件类型,后九个每三个一组分别对应(用户组,用户,其他人)三种权限

文件类型

“-” 表示常规文件 (有ASCII 纯文本文件,binary二进制文件,data数据文件)

“d”为目录

”l“为链接文件

”s“为数据接口文件

1.权限管理命令

chgrp 修改所属用户组

charp 用户组名 文件名

-R 为递归修改

chown 修改所属用户

chown 用户名(:所属用户组名) 文件名

-R 为递归修改

chmod 修改所属用户

u 代表用户 g组名 o代表其他人

chmod u=rwx,g=r 文件名

可以用 + -等来增加减少权限

也可以用二进制来计算权限

chmod 774 文件名

. 代表本目录 …代表上一级目录

umask 修改默认权限

-S 以 u g o 输出

2.文件管理命令

1.cd 切换目录

2. ls 显示目录下的文件

-a 全部文件

-l 详细信息显示

3. pwd 显示当前目录

4. mkdir 建立新目录

-m 设置文件权限

5. rmdir 删除目录

-p删除上层空的目录

6. cp 拷贝文件

cp 源文件 目标文件

-a 相当于 -dr --preserve-all 复制链接文件属性和递归复制

-r 相当于递归复制

-p 相当于连同文件属性复制(备份常用)

-i 询问是否覆盖

-f 强制 忽略不存在的文件,不会出现提示信息

7. rm 删除文件

rm 文件或目录

-f 强制 忽略不存在的文件,不会出现提示信息

-i 询问是否这样操作

-r 递归删除

8. mv 移动文件

mv 源文件 目标文件 可以是多项源文件

-f 强制 如果已经存在的文件,直接覆盖不会出现提示信息

-i 如果已经存在的文件,询问是否覆盖

9.touch 新建文件

3.文件内容查看命令

1.cat 直接查看

cat 文件

-n 打印出行号

**tac 反向显示 先显示后面 **

2.more 可翻页查看

4.文件查找

1.whereis 在一些特定目录下找,通常较快

whereis 文件或目录名

2.locate

locate 关键字

-i 忽略大小写

3.find

find PATH option action

-mtime (n 几天之前 +n为几天之前不含n天 -n为几天之内修改过的)

还可以通过uid gid 限制使用者id的账号

1071f09969702aeaacb2f704b450b37a.png

de638df49f1d5a3342eecff86bcb011e.png

weixin_44780878

发布了2 篇原创文章 · 获赞 0 · 访问量 50

私信

关注

标签:总结,文件,20,Aug,常用命令,Jan,Linux,xr,root

来源: https://blog.csdn.net/weixin_44780878/article/details/104083188

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值