1.用16进制查看文件
hexdump -C [file]
2.文件linux<->windows格式转换
windows to linux: dos2unix [file] linux to windows: unix2dos [file]
3.查看系统codepage
locale charmap
4.Error output
echo >&2
5. awk '{if($4~/NRW1/ && $4!~/NRW0/)next}{print $0}' /home/zdlolnxa/PDSNZ.FFB.HBA.NZ.WTAX.BS.IN.FILE
awk ' $4 ~/[0]$/{print $0}' /home/zdlolnxa/PDSNZ.FFB.HBA.NZ.WTAX.BS.IN.FILE
6.批量替换文件中的字符串
find -name '目标文件' | xargs perl -pi -e 's|要被替换的字符串|替换的字符串|g'
可用 .* 匹配任何字符串
在find中使用变量
find -name ''"$staticFile"'' | xargs perl -pi -e 's|'"$preJobName"'|'"$jobName"'|g'
注意,是用单引号包含双引号来引用变量
7.script传入参数
全部参数: $* 或 $@
参数个数: $#
最后一个参数: ${!#}
8.在变量中使用传入参数,用 ! 代替 $,并{}起来
paramNum=$#
echo $paramNum
for((i=0;i do
echo parameter $i is ${!i}
done
9.shift , 用在当传入参数不确定的情况
count=1
while [ -n "$1" ]
do
echo "Parameter #$count = $1"
count=$[ $count + 1 ]
shift
done
10.Show directory ls -d */
11.永久重定向
exec 2>testerr
12.创建临时文件
本地临时文件
mktemp XXXXXX.tmp
/tmp临时文件
mktemp -t XXXXXX.tmp
13.在sed中使用循环指定输出行
for((i=1;i<=$commFB;i++))
do
commMsg=grep 'Feedback' $tempLog | sed -n "$i"p | awk '{print $1}'
echo commMsg $commMsg
done
在sed中使用变量
$ sed -n ‘/’”$var”‘/p’ /tmp/test.log
注意,是用单引号包含双引号来引用变量
14.切割字符
echo $DCB | gawk -F, '{print $1}'
15.sftp between two server without password
genKey:
1. ssh-keygen -t rsa (press “ENTER” for each questions)
2. Then you can find the key under user/.ssh/id_rsa.pub (public key) and id_rsa
exchange key
copy id_rsa.pub content to another server's authorized_keys
3. chmod 600 .ssh
16.Find out files last modify day is over ? days ago
find . -mtime +n -type d
17.远程ssh调用script
ssh -qp 22 user@FQDN "/hp/ICCM/scripts/xxx.sh"
18.Unzip 常用command
unzip -l 列出zip包中所有文件
unzip A.zip b.txt -d /hp/ICCM/xx/ 解压zip包中指定文件到指定目录
19.grep 多个关键字
grep -a -E "AAA|BBB" input > output
相关推荐
You've experienced the shiny, point-and-click surface of your Linux computer-now dive below and explore its depths with the power of the command line. The Linux Command Line takes you from your very ...
本书是The Linux Command Line 的中文版,帮助新手入门和老鸟进阶,可以中英文对照着读,效果更佳(小小搬运工,省的大家去找,不喜勿喷)
All Linux users and administrators tend to like the flexibility and speed of Linux administration from the command line in byte–sized chunks, instead of fairly standard graphical user interfaces....
The Linux Command Line; 2019/1/28; 19.01; This book is part of the LinuxCommand.org project
Linux Command Background Linux Command Background Linux Command Background
This book is part of the LinuxCommand.org project, a site for Linux education and advocacy devoted to helping users of legacy operating systems migrate into the future. You may contact the Linux...
linux command (全) 介绍各种linux指令代码,相当的全。
command line to tell a Linux system what to do. Here’s an example command that counts lines of text in a file, myfle: wc -l myfile We’ll cover the most important Linux commands for the aver‐ age ...
linux command line.pdf 介绍关于linux命令行的知识。
Designed for the new command line user, this 555-page volume covers the same material as LinuxCommand.org but in much greater detail. In addition to the basics of command line use and shell scripting,...
The Linux command line.pdf 英文版 此书英文本是免费的
The Linux Command Line英文版
The Linux Command Line 中文版 高清
The Linux command line tool(快乐的linux命令行)中文高清版,无水印
Complete Linux Command Reference
NULL 博文链接:https://lindows.iteye.com/blog/223297
The Linux Command Line: A Complete Introduction
Linux command tutorial It's easy
Apress - Beginning The Linux Command Line, 2009.zip