Linux Commands intro1

$((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}
[[email protected] 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.

时间: 2024-08-22 23:24:52

Linux Commands intro1的相关文章

Linux Commands 彻底研究(04):cat

NAME cat - concatenate files and print on the standard output SYNOPSIS cat [OPTION]... [FILE]... DESCRIPTION Concatenate FILE(s), or standard input, to standard output. -A, --show-all equivalent to -vET -b, --number-nonblank number nonempty output li

Linux commands

lsof http://ehaselwanter.com/en/blog/2009/03/13/tomcat-too-many-open-files/ http://alvinalexander.com/blog/post/linux-unix/linux-lsof-command http://www.thegeekstuff.com/2012/08/lsof-command-examples/ http://unix.stackexchange.com/questions/163351/ho

Basic Linux Commands :date, clock, hwclock, cal, ls, pwd, whereis, which, who, w, whoami

作业01:自行学习如下命令 date, clock, hwclock, cal ls, cd, pwd, tty, whereis, which stat, echo, shutdown, halt, reboot, poweroff who, w, whoami date: 显示系统时间, [时间日期] date 查看系统当前时间 参数-u显示utc时间 格式化显示年月日 用+号连起来如:date +%Y-%m-%d(如果我们用date +%Y - %m - %d 会发现出错,因为系统看见空格

[reprint]useful linux commands

linux一说都是搞开发玩的,敲敲键盘就能完成所有的工作.其实你也可以这么玩,玩游戏的除外哦. 那我们就来侃侃如何玩,linux是命令的天下,高级的命令那是相当的多,但是我们正真用到的也就那么几个看你是不是都知道,如果你都知道的话,说明你已经会玩了. 当然第一步是打开Terminal终端又了这个linux才会听你的话. ls ls 列出文件和目录 ls /home (列出home下面的所有文件和目录) ls -alh 列出当前所有文件包括隐藏文件及文件大小权限和时间,我一般都这么使用,它的使用太

Linux Commands 彻底研究(03):tput

NAME tput, reset - initialize a terminal or query terminfo database SYNOPSIS tput [-Ttype] capname [parms ... ] tput [-Ttype] init tput [-Ttype] reset tput [-Ttype] longname tput -S << tput -V DESCRIPTION The tput utility uses the terminfo database

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

How to know CPU info cat /proc/cpuinfo arch How to know memory info: cat /proc/meminfo or sudo dmidecode -t memory free How to know Linux release info CentOS: vim /etc/redhat-release How to check if Mysql running? sudo netstat -tap | grep mysql How t

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

1 echo *.tar.gz | xargs -n 1 tar -zxvf list所有tar.gz文件,然后利用xargs将其作为参数传给tar命令.-n 1表示每次传一个参数. xargs: https://www.cnblogs.com/wangqiguo/p/6464234.html 阅读目录 为什么要用xargs,问题的来源 xargs是什么,与管道有什么不同 xargs的一些有用的选项 回到顶部 为什么要用xargs,问题的来源 在工作中经常会接触到xargs命令,特别是在别人写的

linux commands ---2 ,学习vim编辑器如何使用的方法。

vim /data/yst.txt   打开一个文件之后,然后在命令行模式下,输入:help 可以调出 vim 的帮助文档. 然后会进入: 然后就可以查阅具体的帮助文档了,再也不用再网上找一些零散的vim编辑器的使用介绍了..累

Linux commands frequently used

touch <filename>.sh gedit <filename>.sh bash <filename>.sh & ps auxw|grep <command>