Linux常用基本命令(file,chown)
1,file命令作用,查看文件的类型
ghostwu@dev:~$ dirname ./linux/rename/.htm
./linux/rename
ghostwu@dev:~$ file ./linux/rename/.htm
./linux/rename/.htm: empty
ghostwu@dev:~$ echo 'this is a html file' > ./linux/rename/.htm
ghostwu@dev:~$ file ./linux/rename/.htm
./linux/rename/.htm: ASCII text
ghostwu@dev:~$ which ls
/bin/ls
ghostwu@dev:~$ file /bin/ls
/bin/ls: ELF -bit LSB executable, x86-, version (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-.so., for GNU/Linux 2.6., BuildID[sha1]=d0bc0fb9b3f60f72bbad3c5a1d24c9e2a1fde775, stripped
ghostwu@dev:~$ file ./python/
for.py func3.py func5.py global2.py while1.py
func2.py func4.py func.py global.py while.py
ghostwu@dev:~$ file ./python/for.py
./python/for.py: ASCII text
ghostwu@dev:~$ file ./python/
./python/: directory
2,chown: 改变文件或者目录的用户和用户组
用法:chown [option] [owner]:[group] [file]
注意:
>:可以用.代替
>用户和组要真实存在
常用参数: -R,递归修改目录的用户和用户组
把两个字符的 以.html结尾的文件删除,剩下少一点的文件,比较好看结果
ghostwu@dev:~/linux/rename$ ls
.htm .htm .htm .htm .htm .htm .htm .htm .htm .htm
.htm .htm .htm .htm .htm .htm .htm .htm .htm .htm
.htm .htm .htm .htm .htm .htm .htm .htm .htm .htm
.htm .htm .htm .htm .htm .htm .htm .htm .htm .htm
.htm .htm .htm .htm .htm .htm .htm .htm .htm .htm
.htm .htm .htm .htm .htm .htm .htm .htm .htm .htm
.htm .htm .htm .htm .htm .htm .htm .htm .htm .htm
.htm .htm .htm .htm .htm .htm .htm .htm .htm .htm
.htm .htm .htm .htm .htm .htm .htm .htm .htm .htm
.htm .htm .htm .htm .htm .htm .htm .htm .htm .htm
ghostwu@dev:~/linux/rename$ find . -name "??.htm" | xargs rm
ghostwu@dev:~/linux/rename$ ls
.htm .htm .htm .htm .htm .htm .htm .htm .htm .htm
2,改变用户和组 需要root权限
root@dev:/home/ghostwu/linux/rename# ls -l
total
-rw-rw-r-- ghostwu ghostwu 5月 : .htm
-rw-rw-r-- ghostwu ghostwu 5月 : .htm
-rw-rw-r-- ghostwu ghostwu 5月 : .htm
-rw-rw-r-- ghostwu ghostwu 5月 : .htm
-rw-rw-r-- ghostwu ghostwu 5月 : .htm
-rw-rw-r-- ghostwu ghostwu 5月 : .htm
-rw-rw-r-- ghostwu ghostwu 5月 : .htm
-rw-rw-r-- ghostwu ghostwu 5月 : .htm
-rw-rw-r-- ghostwu ghostwu 5月 : .htm
-rw-rw-r-- ghostwu ghostwu 5月 : .htm
root@dev:/home/ghostwu/linux/rename# chown root.root .htm
root@dev:/home/ghostwu/linux/rename# ls -l .htm
-rw-rw-r-- root root 5月 : .htm
root@dev:/home/ghostwu/linux/rename# chown root:root .htm
root@dev:/home/ghostwu/linux/rename# ls -l .htm
-rw-rw-r-- root root 5月 : .htm
root@dev:/home/ghostwu/linux/rename# mkdir -p a/{b,c}
root@dev:/home/ghostwu/linux/rename# tree a
a
├── b
└── c directories, files
root@dev:/home/ghostwu/linux/rename# man tree
root@dev:/home/ghostwu/linux/rename# tree -ug a
a
├── [root root ] b
└── [root root ] c directories, files
root@dev:/home/ghostwu/linux/rename# chown -R ghostwu.ghostwu a
root@dev:/home/ghostwu/linux/rename# tree -ug a
a
├── [ghostwu ghostwu ] b
└── [ghostwu ghostwu ] c directories, files
root@dev:/home/ghostwu/linux/rename# ls -ld a
drwxr-xr-x ghostwu ghostwu 5月 : a
root@dev:/home/ghostwu/linux/rename#
Linux常用基本命令(file,chown)的更多相关文章
- Linux常用基本命令(less)
转: Linux常用基本命令(less) LESS:跟more命令的功能类似,都是用于分页显示内容,但是他的性能比more更高,功能比more更丰富,他读取文件是按需加载 格式: less [opti ...
- Linux 常用基本命令及应用技巧
需要pdf 版 联系我 我的文件中有目录一.Linux 的常用基本命令................................................................. ...
- Linux常用基本命令(chmod)
chmod命令用来改变文件或者目录的权限,只有文件的属主和超级用户才能够执行这个命令 格式: chmod [option] [mode] [file] >常用参数选项 -R : 递归修改目录以及 ...
- 【Linux】linux常用基本命令(转)
(转自:http://blog.csdn.net/xiaoguaihai/article/details/8705992) Linux中许多常用命令是必须掌握的,这里将我学linux入门时学的一些常用 ...
- 【Linux】linux常用基本命令
Linux中许多常用命令是必须掌握的,这里将我学linux入门时学的一些常用的基本命令分享给大家一下,希望可以帮助你们. 这个是我将鸟哥书上的进行了一下整理的,希望不要涉及到版权问题. 1.显示日 ...
- linux常用基本命令
Linux中许多常用命令是必须掌握的,这里将我学linux入门时学的一些常用的基本命令分享给大家一下,希望可以帮助你们. 系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器 ...
- linux常用基本命令整理小结
linux系统遵循的基本原则 由目标单一的小程序组成,组合小程序完成复杂任务: 一切皆文件: 尽量避免捕捉用户接口: 配置文件保存为纯文本文件: Linux命令行常识 命令格式 命令+选项+参数 选项 ...
- Linux常用基本命令:三剑客命令之-sed
sed是一个很强大的文件处理工具,主要是以行为单位进行处理,可以将数据行进行替换.删除.新增.选取等特定工作 格式:sed [option] [command] [file] 常用命令: a ∶新 ...
- Linux常用基本命令:grep-从文件或者管道中筛选匹配的行
grep命令 作用:从文本文件或管道数据流中筛选匹配的行及数据,配合正则表达式一起使用,功能更加强大. 格式: grep [options] [pattern] [file] 1,匹配包含" ...
随机推荐
- 201621123018《java程序设计》第11周作业总结
1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结多线程相关内容. 2. 书面作业 本次PTA作业题集多线程 1. 源代码阅读:多线程程序BounceThread 1.1 BallR ...
- Yarn 资源调度框架
Yarn 资源调度框架 实现对资源的细粒度封装(cpu,内存,带宽) 此外,还可以通过yarn协调多种不同计算框架(MR,Spark) 概述 Apache Hadoop ...
- UI的设计,适配器,以及RecyclerView无法加载的解决办法
这本书里讲到的界面设计都是用最基本的方式实现的,即编写xml文件 所有的控件都具有宽度和高度属性,即android:layout_width和android:layout_height,这两个属性对应 ...
- [0day]微软VS全版本DLL却持漏洞(VS2015 VS2013 VS2012 VS2010 VS2008)
<无敌破坏王>大师兄说的 "我不是针对谁,而是在座的各位,都是垃圾"前几天在国外论坛看到一个VS2010 DLL却持漏洞 测试发现是全版本 实际上2014年在某越南黑客 ...
- vue教程2-05 v-for循环 重复数据无法添加问题 加track-by='索引'
vue教程2-05 v-for循环 重复数据无法添加问题 加track-by='索引' 解决问题的代码示例: <!DOCTYPE html> <html lang="en ...
- [Umbraco] document type里的父节点与子节点的设置
虽然我们不能像做数据库设计那样建立主外键关系.但我们建立xml里父子关系,父子关系其实是指是否允许在一个页面(如频道,分类,栏目等)下创建子页面,这就相当于建立站点的树状结构,对于筛选数据会有很大的作 ...
- Identity Server4学习系列三
1.简介 在Identity Server4学习系列一和Identity Server4学习系列二之令牌(Token)的概念的基础上,了解了Identity Server4的由来,以及令牌的相关知识, ...
- 【Canal源码分析】整体架构
本文详解canal的整体架构. 一.整体架构 说明: server代表一个canal运行实例,对应于一个jvm instance对应于一个数据队列 (1个server对应1..n个instance) ...
- IdentityServer4 Hybrid 模式
原文参考:Switching to Hybrid Flow and adding API Access back 接上篇:IdentityServer-Protecting an API using ...
- mpvue图片轮播遇到的问题
小程序官方写法: <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" i ...