文件解压缩tar

请参考文档:http://blog.csdn.net/eroswang/article/details/5555415/

tar -zcvf ${standardpath}${filename}.tar.gz ${filename}

文件删除rm

rm -r /dir
rm file
rm -rf /dir
-r, -R, --recursive
remove directories and their contents recursively
-f, --force
ignore nonexistent files and arguments, never prompt
-i prompt before every removal

文件复制cp

cp /sourcefile /destinationfile
cp sources /directory
-R, -r, --recursive
copy directories recursively
-n, --no-clobber
do not overwrite an existing file (overrides a previous -i option)
-f, --force
if an existing destination file cannot be opened, remove it and try again (this option is ignored when the -n option is also
used)

文件移动,重命名mv

mv sourcefile destfile/path
mv sourcedir destdir
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
-f, --force
do not prompt before overwriting
-i, --interactive
prompt before overwrite
-n, --no-clobber
do not overwrite an existing file

改变工作目录cd

cd -   回到上一次的工作目录
cd
cd ~
cd /

创建目录mkdir

mkdir dirname
-p, --parents
no error if existing, make parent directories as needed
mkdir -P /path

创建文件touch

touch file

查看文件路径pwd

pwd

查看文件大小du

du -h
du -h /path
stat -c%s /home/hadoop/test.txt

查看目录下文件数量

ls -l | grep '^-' | wc -l

查看目录下子目录的数量

ls -l | grep '^d' | wc -l

查看文件详细信息ls

ls
ls -l / ll
ls -ash
-a, --all
do not ignore entries starting with .
-h, --human-readable
with -l and/or -s, print human readable sizes (e.g., 1K 234M 2G)
-s, --size
print the allocated size of each file, in blocks
-l use a long listing format

查找文件find,which

find [路径] [参数]
参数说明:
时间:
-atime n :在 n*24小时内被 access 即存取过的文件列出来!
-ctime n :在 n*24小时内被 changed 即改变、新增的文件或目录印出
-mtime n :在 n*24小时内被 modified 即修改过的文件印出
-newer file :比 file 还要新的文件就列出来! 使用名称: -gid n :寻找 群组 ID 为 n 的文件
-group name :寻找群组名称为 name的文件
-uid n :寻找拥有者 ID 为 n 的文件
-user name :寻找使用者名称为 name 的文件
-name file :寻找档名为 file 的文件名称(可以使用万用字符)
-type type :寻找档案属性为 type 的档案,type 包含了 b, c, d, p, l, s,这些与前一章的属性相同!例如 l 为 Link而 d 为路径之意! which ls(which也可以查找)
例如

[root@bestlinux ~]# find / -nametesting           //查找名为 testing  的文件
[root@bestlinux ~]# find / -name'test*' //查找以test开头的文件
[root@bestlinux ~]# find . -ctime1 //查找当前目录下一天内新增的文件
[root@bestlinux ~]# find /home -usertest //查找 /home下拥有者为 test 的文件

查看文件内容cat,head,tail

cat /etc/services
head -n /etc/services(查看文件前n行的内容)
tail -n /etc/services(查看文件后n行内容)
more /etc/services (文件内容会一屏一屏的显示出来,你只需用空格键就可以下翻了)
cat /etc/services | more(cat显示出来的内容重新输出给 more 命令就可以达到想要效果)

查看文件内容的行数

 wc -l /etc/services

以上内容参考了:http://www.cnblogs.com/lanse-yan/archive/2012/11/29/2794300.html

shell文件相关指令的更多相关文章

  1. llinux文件相关指令

    一---导读 首先我们来看这样一个小案例,假设张三要出差,按照 这样的路线进行 北京->上海,之后回到北京.再按照北京->天津->石家庄这样的路线进行出差(北京是根据地).假设现在张 ...

  2. linux查看文件相关指令

    以下内容整理自以下两篇文章: http://www.cnblogs.com/xilifeng/archive/2012/10/13/2722596.html Linux 查看文件内容的命令 http: ...

  3. adb相关指令 笔记

      adb相关指令 笔记 1.adb devices 查看物理测试设备或模拟器的相关信息,有三个状态: (1)device 设备已连接到adb服务器上,但该状态并不代表设备已启动完毕可以进行操作: ( ...

  4. ADB相关指令实例详解

    1.获取物理设备相关信息: adb devices 2.apk安装 2.1 新的应用(该应用未安装) adb -s 设备序列号 install apk路径 2.2 应用已安装,重安装覆盖 adb -s ...

  5. [ARM] Cortex-M Startup.s启动文件相关代码解释

    1. 定义一个段名为CSTACK, 这里: NOROOT表示如何定义的段没有被关联,那么同意会被优化掉,如果不想被优化掉就使用ROOT. 后面的括号里数字表示如下: (1):这个段是2的1次方即2字节 ...

  6. Linux Shell系列教程之(十七) Shell文件包含

    本文是Linux Shell系列教程的第(十七)篇,更多Linux Shell教程请看:Linux Shell系列教程 通过文件包含,可以引用其他文件的内容,也可以将复杂内容分开,使程序结构更加清晰. ...

  7. Linux相关指令

    Linux相关指令 1.find文件搜索功能 find [目录列表] [匹配参数] [匹配标准] -name :按文件名称进行搜索 -group :按文件所属组进行搜索 -user :按文件拥有者进行 ...

  8. 3_Linux_文件搜索指令

    .3文件搜索命令 1)which 查找一个命令所在的路径 whereis 提供命令的帮助文件的信息 whatis 显示命令的概要信息whatis ls which提供命令的别名信息 2)find,基本 ...

  9. Linux指令--性能监控和优化命令相关指令

    原文出处:http://www.cnblogs.com/peida/archive/2012/12/05/2803591.html.感谢作者无私分享 性能监控和优化命令相关指令有:top,free,v ...

随机推荐

  1. asp.net core mvc视频A:笔记3-6.视图数据共享之session/cache

    第一部分:Session讲解 会话级别的,怎么区分呢?以浏览器为单位,比如IE,搜狗等等,都算一个单独的会话 修改3.5项目 控制器代码 前端显示 startup.cs中配置并启用Session 运行 ...

  2. 利用nginx搭建https服务器

    一.HTTPS简介 HTTPS其实是有两部分组成:HTTP + SSL / TLS,也就是在HTTP上又加了一层处理加密信息的模块.服务端和客户端的信息传输都会通过TLS进行加密,所以传输的数据都是加 ...

  3. mysql的UNIX_TIMESTAMP用法

    UNIX_TIMESTAMP 一般是用于unix的时间戳. 例子: SELECT UNIX_TIMESTAMP("2016-07-11")-- 1468166400SELECT U ...

  4. secureCrt 开启Linux上的oracle服务

    IP   :  192.168.0.21 user:  root pwd:     123456 --------------------------------------------------- ...

  5. Android Material Design-Defining Shadows and Clipping Views(定义阴影和裁剪视图)-(四)

    转载请注明出处:http://blog.csdn.net/bbld_/article/details/40539131 翻译自:http://developer.android.com/trainin ...

  6. unity shader学习笔记(1) shader基础结构以及Properties面板

    首先是shader的基础结构: Shader "Custom/Example { Properties//变量属性面板 { } SubShader { Tags { "Render ...

  7. PHP中使用POST发送请求的常用方式

    前提概要: 在PHP进行项目开发过程中,使用post发送请求的情况很多,以下总结了项目中主要用的两种方式. 总结下: 在我接触到的项目中用到第二种情况较多,比如写:短信接口.....总体来说比较简单便 ...

  8. Laravel开发:Laravel核心——Ioc服务容器

    服务容器 在说 Ioc 容器之前,我们需要了解什么是 Ioc 容器. Laravel 服务容器是一个用于管理类依赖和执行依赖注入的强大工具. 在理解这句话之前,我们需要先了解一下服务容器的来龙去脉:  ...

  9. PHP邮箱的正则表达式

    邮箱的正则:/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i

  10. JS 创建对象(常见的几种方法)

    贴个代码先: function O(user,pwd){ //use constructor this.user=user; this.pwd=pwd; this.get=get; return th ...