$((expression))

echo $(2+2) :wrong

echo $((2+2))  : right

echo Front-{A,B,C}-Back

Front-A-Back Front-B-Back Front-C-Back

echo start{1..5}end
start1end start2end start3end start4end start5end

echo start{A..Z}end

$(cmd)

命令替换 一个命令的输出作为另一个命令的参数

uses back quotesinstead of the dollar sign and parentheses:

ls -l `which cp` 等价于

ls –l $(which cp)

It is also common to use escaping toeliminate the special meaning of a
character in a filename. For example, it is possible to use characters in filenames that normally have special meaning to the shell. These would include
$, !, &,  (a space), and others. To include a special character in a filename,
you can use \ to escape.

file filename #determine the file type
ls -lt #show files sort by time
less filename #allow you scroll down and up to see the file content
ln -s target linkname #used to create a soft link for one file or folder

wc—Print newline, word, and byte counts for each file.

tee—Read from standard input and write to standard output and files.

执行一个shell的时候,可以在屏幕上打出日志,同时又保存在文件中。

sh mysh.sh 2>&1 | tee mysh.log

sh mysh.sh >mylog.log 2>&1

1 : standard output

2: standard error output

if you want to throw the error away, you can output to

sh mysh.sh 2> /dev/null

> output content to a new file

>> append data to file

< read data from file

1.过滤今天产生的文件?(日志文件)

find / –type f –mtime –1

find –name ‘pattern’ –exec rm {} \;

find / –name test | xargs rm –rf;

2.根据年月快速创建一些文件夹?

mkdir {2009..2011}-0{1..9} {2009..2011}-{10..12}
[me@linuxbox Pics]$ ls
2009-01 2009-07 2010-01 2010-07 2011-01 2011-07
2009-02 2009-08 2010-02 2010-08 2011-02 2011-08
2009-03 2009-09 2010-03 2010-09 2011-03 2011-09
2009-04 2009-10 2010-04 2010-10 2011-04 2011-10
2009-05 2009-11 2010-05 2010-11 2011-05 2011-11
2009-06 2009-12 2010-06 2010-12 2011-06 2011-12

jobs—List active jobs.

bg—Place a job in the background.
fg—Place a job in the foreground.

if [ -f  file ]    如果文件存在
if [ -d ...   ]    如果目录存在
if [ -s file  ]    如果文件存在且非空
if [ -r file  ]    如果文件存在且可读
if [ -w file  ]    如果文件存在且可写
if [ -x file  ]    如果文件存在且可执行    
if  [ -n $string  ]             如果string 非空(非0),返回0(true)  
if  [ -z $string  ]             如果string 为空

command1  && command2
 &&左边的命令(命令1)返回真(即返回0,成功被执行)后,&&右边的命令(命令2)才能够被执行;换句话说,“如果这个命令执行成功&&那么执行这个命令”。
 command1 || command2
 ||则与&&相反。如果||左边的命令(命令1)未执行成功,那么就执行||右边的命令(命令2);或者换句话说,“如果这个命令执行失败了||那么就执行这个命令。
 
 dirname :用于取路径
 basename:用于取文件名

Linux Commands intro1的更多相关文章

  1. 10 Linux Commands Every Developer Should Know

    转载:http://azer.bike/journal/10-linux-commands-every-developer-should-know/ As a software engineer, l ...

  2. The common Linux Commands

    Linux的命令总结 1. man:在线请求系统帮助 例:man mkdir NAME:这个命令的完整全名 mk(make directories) SYNOPSIS:这个命令的基本语法 mkdir ...

  3. linux commands

    abrt-cli --since ;查看abrt捕捉的异常 alias ;别名,alias rm='rm -i':使用“ \rm ” 使用原命令 alsamixer ;图形音量调节,q 增加左声道, ...

  4. [reprint]useful linux commands

    linux一说都是搞开发玩的,敲敲键盘就能完成所有的工作.其实你也可以这么玩,玩游戏的除外哦. 那我们就来侃侃如何玩,linux是命令的天下,高级的命令那是相当的多,但是我们正真用到的也就那么几个看你 ...

  5. Learning Linux Commands: awk--reference

    http://how-to.linuxcareer.com/learning-linux-commands-awk 1. Introduction In this case, the title mi ...

  6. The.first.glance.at.linux.commands

    ## Get Ubuntu Version Info lsb_release -a ## Get Linux kernal info uname -a ## Get Computer name ech ...

  7. Common Linux Commands 日常工作常用Linux命令

      How to know CPU info      cat /proc/cpuinfo      arch   How to know memory info: cat /proc/meminfo ...

  8. linux commands - 一次性解压多个tar.gz文件

    tar -zxvf list所有tar.gz文件,然后利用xargs将其作为参数传给tar命令.-n 1表示每次传一个参数. xargs: https://www.cnblogs.com/wangqi ...

  9. some useful linux commands

    # best way to see log file less +F /var/log/syslog (equals: less /var/log/syslog, then shift+f) # se ...

随机推荐

  1. ajax post提交的方式

    ajax的post注意事项 注意post请求的Content-Type为application/x-www-form-urlencoded,参数是在请求体中,即上面请求中的Form Data(后台通过 ...

  2. 重新想象 Windows 8 Store Apps (69) - 其它: 自定义启动屏幕, 程序的运行位置, 保持屏幕的点亮状态, MessageDialog, PopupMenu

    [源码下载] 重新想象 Windows 8 Store Apps (69) - 其它: 自定义启动屏幕, 程序的运行位置, 保持屏幕的点亮状态, MessageDialog, PopupMenu 作者 ...

  3. ActiveReports 报表控件官方中文入门教程 (1)-安装、激活以及产品资源

    本系列文章主要是面向初次接触 ActiveReports 产品的用户,可以帮助您在三天之内轻松的掌握ActiveReports控件的基本使用方法,包括安装.激活.创建报表.绑定数据源以及发布等内容.本 ...

  4. 用PHP实现Windows域验证

    系统集成中,可能会有这种需求 Windows 域验证本质上是LDAP验证 但在网上居然找不到详细的技术文档,可见不受待见之极.

  5. 树状数组---Squared Permutation

    BNUOJ   51636 最近,无聊的过河船同学在玩一种奇怪的名为“小Q的恶作剧”的纸牌游戏. 现在过河船同学手有张牌,分别写着,打乱顺序之后排成一行,位置从左往右按照标号. 接下来小Q同学会给出个 ...

  6. c++中stl容器的常用示例

    1. set(集合)——包含了经过排序了的数据,这些数据的值(value)必须是唯一的. 也就是说输入set容器后得到数据,会去重并排序.    s.insert()插入一个元素    s.begin ...

  7. ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了

    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了   ps -A | gr ...

  8. python peewee.ImproperlyConfigured: MySQLdb or PyMySQL must be installed.

    最近在学习Python,打算先看两个在线教程,再在github上找几个开源的项目练习一下,在学到“被解放的姜戈”时遇到django同步数据库时无法执行的错误,记录一下. 错误现象: 执行python ...

  9. Android 手机卫士14--Widget窗口小部件AppWidgetProvider

    1.AndroidManifest.xml根据窗体小部件广播接受者关键字android.appwidget.action.APPWIDGET_UPDATE 搜索android:resource=&qu ...

  10. NYOJ 21 三个水杯

    三个水杯 时间限制:1000 ms  |  内存限制:65535 KB 难度:4   描述 给出三个水杯,大小不一,并且只有最大的水杯的水是装满的,其余两个为空杯子.三个水杯之间相互倒水,并且水杯没有 ...