Linux
文章平均质量分 84
summer_sunrise
知行合一
展开
-
字节序: big-endian vs little-endian
如何快速记忆big-endian又名大尾序,就是数值的尾巴存储在大地址上。尾是相对我们认识的变量值,大是指地址;相对应,little-endian又名小尾序,数值的尾巴存储在小地址上。一句话大小是尾巴的地址,尾巴是数值的尾巴,指的是0xABCD(十进制43981)的D 如何判断字节序是大端还是小端通过二进制工具查看: readelf -h mainint main(){ return 0;}编译出二进制g++ main.cpp -o main使用readelf查看字节序原创 2021-10-31 17:57:56 · 331 阅读 · 0 评论 -
Linux磁盘占满问题分析步骤
本文主要介绍当Linux出现磁盘占满时,如何分析是哪些文件引起;1. 查看磁盘占用情况命令: df -h运行结果:root@host:~$ df -hFilesystem Size Used Avail Use% Mounted onudev 16G ...原创 2019-10-10 09:55:16 · 5145 阅读 · 1 评论 -
Linux内存--虚拟内存,buffer/cache
Linux内存相关上图是32位的操作系统的地址空间情况。申请虚拟内存首先获取寻址大小:查看cat /proc/cpuinfoyms@ubuntu:~$ cat /proc/cpuinfoprocessor : 0vendor_id : GenuineIntelcpu family : 6model : 79model nam...原创 2019-09-16 18:45:53 · 986 阅读 · 0 评论 -
shell浮点运算
shell浮点运算bash内置了对整数四则运算的支持,但不支持浮点运算。有两种方法:借助bc(需系统安装)yms@ubuntu:~/sunrise/shell$ echo $((5-4))1yms@ubuntu:~/sunrise/shell$ echo $((5.9-4.1))-bash: 5.9-4.1: syntax error: invalid arithmetic oper...原创 2019-07-27 15:45:37 · 458 阅读 · 0 评论 -
shell 数组(含"map")操作总结
shell 数组操作总结字符含义举例#个数相关$#:shell的参数个数 KaTeX parse error: Expected '}', got '#' at position 2: {#̲array[@]}/{#array[*]}: 数组个数@、*所有元素$@ $: shell的所有参数列表 array[@]/{array[@]}/array[@]/ar...原创 2019-07-27 14:10:42 · 10631 阅读 · 0 评论 -
Linux下dev/console、tty、pts、ttySn的理解
dev设备按照读取方式:字符设备(Character devices):无缓冲且只能顺序读取。块设备(Block devices):有缓冲且可以随机(乱序)读取。按照是否对应物理实体:物理设备:对实际存在的物理硬件的抽象。虚拟设备:不依赖特定的物理硬件,仅是内核自身提供的某种功能。(虚拟设备与真实设备的关系是多对多)无论哪种设备,在dev目录下都有一个对应的文件(节点),并...原创 2019-02-12 09:58:06 · 2540 阅读 · 0 评论 -
vimrc配置
"----------------normal setting------------------------------------------------set nocompatible "去掉vi的一致性set number "“显示行号”set showtabline=1原创 2018-11-13 21:27:06 · 772 阅读 · 0 评论 -
linux 用户及密码
linux 用户及密码涉及文件,及各个文件内容详解涉及文件:/etc/passwd、/etc/shadow、/etc/group、/etc/gshadow/etc/passwd:属性:-rw-r--r-- 1 root root 1787 Nov 24 01:12 /etc/passwd内容:root:x:0:0:root:/root:/bin/bash... ...以":...原创 2018-11-24 17:58:11 · 10430 阅读 · 0 评论 -
查看文件编码格式
How can I see which encoding is used in a file? (查看文件编码格式)vi模式下查看:set fileencoding设置:set fileencoding xxx file命令:check a file encodingfile -bi [filename]OptionDescription-...原创 2018-11-05 17:04:15 · 6852 阅读 · 0 评论 -
Shell脚本规范
Shell脚本规范Google 开源项目风格指南Google 开源项目风格指南英文版Google Shell脚本规范背景使用哪一种ShellBash是唯一被允许执行的shell脚本语言文件扩展名可执行文件应该没有扩展名(强烈建议)或者使用.sh扩展名。库文件必须使用.sh作为扩展名,而且应该是不可执行的。当执行一个程序时,并不需要知道它是用什么语言编写的。而且sh...原创 2018-11-05 17:03:01 · 3061 阅读 · 0 评论 -
linux日志管理系统logrotate
linux日志管理系统logrotateDescriptionlogrotate is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of l...原创 2018-11-05 17:00:54 · 1535 阅读 · 2 评论