linux 命令(一)

来源:互联网 发布:网络密匙 编辑:程序博客网 时间:2024/05/23 10:44
  1. ls |wc -l

计算文件的个数

  1. crtl+z

暂停一个任务

  1. fg

继续暂停的任务

  1. jobs

列出暂停的任务

5.bg

后台运行

  1. sleep 100

100秒后运行

  1. cat 2.txt|head -2

显示头两行

  1. cat 2.txt| head -2|cut -d “c” -f 1-4

显示分割符

  1. cat 1.txt|tee 2.txt

把1.txt的内容追加到2.txt 并且把内容显示出来

  1. cat 1.txt>>2.txt

追加到cat 2.txt

  1. echo “ass” |tr “[s]” “[S}”

输出:aSS

  1. find /home/vagrant/ -type f -name “*.txt”

输出 结尾为.txt的文件路径+文件名

  1. du -sh 1.txt

计算文件大小

  1. [-d aminglinux1]||mkdir aminglin]

  2. seq -s “w” 1 10

打印结果:1w2w3w4w5w6w7w8w9w10

  1. seq 1 3 9

打印结果: 1 4 7

  1. sed -n 100,110p test.txt

打印 记事本的100 -110 行

awk ‘{if(NR>19&&NR<41)print $0}’ test.txt

打印文本的20-40行

sed -i(改变原文件) s#aaa#bbb#g 1.tct

把1.tct的aaa 改为bbb

xargs

把find/ls 交给后面处理

cat /etc/redhat-release

查看linux版本

uname -r

版本号

uname -m

64位操作系统

原创粉丝点击