cat

linux基础学习系列 -- 系统配置查看

匿名 (未验证) 提交于 2019-12-02 21:59:42
如题,我们来共同学习一下如何查看计算机的一些关键配置信息。其中,CPU还有内存信息在配置文件中有存储。 查看CPU信息命令 cat /proc/cpuinfo 查看物理CPU的个数 cat /proc/cpuinfo |grep 'physical id'|sort |uniq|wc -l 查看逻辑CPU的个数 cat /proc/cpuinfo |grep 'processor'|wc -l 查看CPU是几核 cat /proc/cpuinfo |grep "cores"|uniq 查看CPU的主频 cat /proc/cpuinfo |grep MHz|uniq 查看当前操作系统内核信息 uname -a 查看当前操作系统发行版信息 cat /etc/issue 查看内存信息命令 cat /proc/meminfo 查看硬盘信息命令 fdisk -l 除此之外还有其他类的信息,后期逐步完善! 文章来源: linux基础学习系列 -- 系统配置查看

Why can't you use cat to read a file line by line where each line has delimiters

好久不见. 提交于 2019-12-02 21:58:35
I have a text file that contains something like this: abc 123, comma the quick brown fox jumped over the lazy dog comma, comma I wrote a script for i in `cat file` do echo $i done For some reason, the output of the script doesn't output the file line by line but breaks it off at the commas, as well as the newline. Why is cat or "for blah in cat xyz " doing this and how can I make it NOT do this? I know I can use a while read line do blah balh blah done < file but I want to know why cat or the "for blah in" is doing this to further my understanding of unix commands. Cat's man page didn't help

Linux常用命令

匿名 (未验证) 提交于 2019-12-02 21:56:30
本文总结一些在开发中常用到的Linux命令。 1. vim vim命令用于编辑文件。 普通模式(命令行模式) 123456789 set number/set nu:vim时显示行号 或通过修改vim的配置文件使得每次vim时都显示行号HOME:快速移动到当前行首部END:快速移动到当前行尾部w:移动到下一个单词b:移动到上一个单词:+行号+回车:快速移动到某一行:+$+回车:快速移动到最后一行dd:删除当前行dj:删除当前行和下一行 由普通模式进入插入模式 12345 i:在当前光标处进行编辑I:在行首插入A:在行尾插入o:在当前行后插入一个新行O:在当前行前插入一个新行 由插入模式进入普通模式 1 ESC 2. grep grep命令用于查找文件里符合条件的字符串。 1234567891011 以nba.txt文件为例:cat nba.txt | grep "curry":查找nba.txt中包含curry字符串的所有行并返回cat nba.txt | grep "curry" -v:查找nba.txt中不包含curry字符串的所有行并返回(第一条的取反)cat nba.txt | grep "CuRry" -i:忽略大小写cat nba.txt | grep "curry" -n:显示匹配到的行号cat nba.txt | grep "curry" -c:统计匹配到的结果行数

标准io和管道练习

匿名 (未验证) 提交于 2019-12-02 21:56:30
【例1】把/etc/fstab文件内容重定向到/tmp目录下文件名为fstab.out 写法: 13:54:35 root@centos ~]#cat /etc/fstab > /tmp/fstab.out [13:55:02 root@centos ~]#cat /tmp/fstab.out # # /etc/fstab # Created by anaconda on Fri Sep 20 14:23:49 2019 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=b7becd8b-fb18-48cf-810b-953944dcf82e / xfs defaults 0 0 UUID=a74c9411-1dd4-44ff-929d-ba505baaec2c /boot xfs defaults 0 0 UUID=cc79eddd-a461-46e9-96ab-3489b7de0db3 /data xfs defaults 0 0 UUID=23047094-ac08-4c27-bfd9-f6cb8c34b185

Linux:OS Kernel Parameters : shmmax

匿名 (未验证) 提交于 2019-12-02 21:56:30
解决方法: [root@*** oracle]# vim /etc/sysctl.conf 修改配置如下: kernel.shmmax = 4101355520 emmm,问题还是存在,但是又有一点不一样: 解决方法: [root@*** database]# cat /proc/sys/kernel/shmmax 4098955264 [root@*** database]# echo 4101355520 > /proc/sys/kernel/shmmax [root@*** database]# cat /proc/sys/kernel/shmmax 4101355520 再次check时,问题解决。 如果有写的不对的地方,请大家多多批评指正,非常感谢! 文章来源: https://blog.csdn.net/suchenbin/article/details/96478100

linux中求和/平均值/最值

匿名 (未验证) 提交于 2019-12-02 21:56:30
求和、平均值、最值 [root@redis-server1 ~]# cat a 1 2 3 4 5 2333 0)求和 [root@redis-server1 ~]# awk '{a+=$1}END{print a}' a 2348 1)求最大值 [root@redis-server1 ~]# awk '$0>a{a=$0}END{print a}' a 2333 2)求最小值(思路:先定义一个最大值) [root@redis-server1 ~]# awk 'BEGIN{a=9999999}{if($1<a) a=$1 fi}END{print a}' a 1 3)求平均值 第一种方法:在上面求和的基础上,除以参数个数 [root@redis-server1 ~]# awk '{a+=$1}END{print a/NR}' a 391.333 第二种方法:写脚本 [root@redis-server1 ~]# cat avg.sh 1 2 3 4 5 6 #!/bin/bash let sum=0 for num in $*;do let sum=$sum+$num done echo "scale=3;$sum/$#"|bc [root@redis-server1 ~]# chmod 755 avg.sh [root@redis-server1 ~]# ./avg.sh

javascript 原型继承 与class extends 继承对比

匿名 (未验证) 提交于 2019-12-02 21:52:03
//父类 Animal function Animal (name) { this.name = name; this.sleep = function () { console.log(this.name + '正在睡觉!') } } //cat 是 Animal 的子类 function Cat (name,age) { Animal.call(this,name); //子类 Cat 新增加的 成员 age eat() Cat.prototype.age = age; Cat.prototype.eat = function () { console.log(this.name + 'is cat ' + '正在吃东西'+' my age is '+ this.age) } } //---------调用代码--------------------- var animal_obj = new Animal('动物'); animal_obj.sleep(); var cat_obj = new Cat('è',10); cat_obj.sleep(); cat_obj.eat(); //-------------------------------------------------------class------------------------------------

Linux基础巩固--Day1

Deadly 提交于 2019-12-02 21:22:57
操作系统   OS:     Operating System,通用目的的软件程序       硬件驱动       进程管理       内存管理       网络管理       安全管理       文件管理     OS分类:       服务器OS:RHEL,CentOS,Windows Server,AIX       桌面OS:Windows 10,Mac OS,Fedora       移动设备OS: Andriod, IOS, YunOS   开发接口标准      ABI : Application Binary Interface       ABI描述了应用程序与OS之间的底层接口,允许编译好的目标代码在使用兼容ABI的系统中无需改动就能运行      API: Application Programming Interface       API定义了源代码和库之间的接口,因此同样的源代码可以在支持这个API的任何系统中编译      POSIX: Portable Operating System Interface       IEEE在操作系统上定义的一系列API标准       POSIX兼容的程序可在其它POSIX操作系统编译执行      运行程序格式 :       Windows:EXE,.dll,.lib       Linux:ELF,

Howto merge two avi files using ffmpeg?

六月ゝ 毕业季﹏ 提交于 2019-12-02 20:28:00
I'm unable to merge two avi videos together. google is full of below examples: cat file1.avi file2.avi file3.avi > video_draft.avi after appending the data together using cat above, you need to re-index the draft movie like this: mencoder video_draft.avi -o video_final.avi -forceidx -ovc copy -oac copy Now you're video_final.avi file will be right to go. but it doesn't work for me, the first video is converted and that's it. cwgem You should look into the concat demux and concat protocol that was added in ffmpeg 1.1. Assuming the codecs are the same you create a file (example mylist.txt ):

K8S pod hosts和resolv.conf

余生长醉 提交于 2019-12-02 18:58:13
通过 HostAliases 增加额外的hosts条目 注:只能修改非hostNetwork的pod apiVersion: v1 kind: Pod metadata: name: hostaliases-pod spec: hostAliases: - ip: "127.0.0.1" hostnames: - "foo.local" - "bar.local" - ip: "1.2.3.4" hostnames: - "foo.remote" - "bar.remote" containers: - name: cat-hosts image: busybox command: - cat args: - "/etc/hosts" 自定义resolv.conf 来源: https://www.cnblogs.com/lingfenglian/p/11758828.html