GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ramwin/linux-reference

BranchesTags
Open more actions menu

Latest commit

 

History

869 Commits
869 Commits

Folders and files

NameName
Last commit message
Last commit date
_static
_static
 
 
ai
ai
 
 
article
article
 
 
celery
celery
 
 
ceph
ceph
 
 
daemon
daemon
 
 
database
database
 
 
expect
expect
 
 
fedora
fedora
 
 
git
git
 
 
latex
latex
 
 
linux
linux
 
 
mac
mac
 
 
manjaro
manjaro
 
 
mysql
mysql
 
 
nas
nas
 
 
network
network
 
 
nginx
nginx
 
 
octave
octave
 
 
rabbitmq
rabbitmq
 
 
redis
redis
 
 
restructed
restructed
 
 
script
script
 
 
shadowsocks
shadowsocks
 
 
shellprogramming
shellprogramming
 
 
software
software
 
 
sqlite
sqlite
 
 
syncthing
syncthing
 
 
test
test
 
 
vim
vim
 
 
vscode
vscode
 
 
.gitignore
.gitignore
 
 
.readthedocs.yaml
.readthedocs.yaml
 
 
CLAUDE.md
CLAUDE.md
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
TODO.md
TODO.md
 
 
conf.py
conf.py
 
 
contents.md
contents.md
 
 
database.md
database.md
 
 
e8e67f31d2c9d913227f6df4b430bf6b.txt
e8e67f31d2c9d913227f6df4b430bf6b.txt
 
 
gitconfig
gitconfig
 
 
index.rst
index.rst
 
 
make.bat
make.bat
 
 
pylintrc
pylintrc
 
 
requirements.txt
requirements.txt
 
 
run_server.sh
run_server.sh
 
 
software.md
software.md
 
 
发布.sh
发布.sh
 
 
自动发布.sh
自动发布.sh
 
 

Repository files navigation

linux基础知识

  • system 系统 优化
  • user & group 用户和组
  • markdown
  • linux命令搜索网站

mac

  • homebrew
brew services stop|start redis

shell编程

:maxdepth: 2
./shellprogramming/README.md

cache

操作系统

./linux/fstab.md
./linux/system.md
./manjaro/manjaro.md
./linux/gnome.md
./linux/windows.md
./linux/user_group.md

文件系统

  • 文件类型 通过ls看文件时, 可以看到文件类型

    • -: 普通文件
    • d: 目录
    • b: 块设备(支持seek读写)
    • l: 链接
    • s: socket链接
    • p: 管道
  • stat 查看某个文件的 inode 号, 状态

  • losetup 把某个文件挂载到某个设备.但是wsl现在还不支持

  • chroot 把某个文件夹当作根目录,并执行 /bin/bash

  • lsof -p $$ 查看当前进程的文件描述符, 或者直接进入 /proc/<processid>/fd 查看

  • exec 8< 把当作我的输入, 赋予8号

page cache

修改/etc/sysctl.confg后运行 sysctl -p

vm.dirty_background_ratio  # 用了多少百分比内存后开始写入磁盘, 默认10(我觉得20不错)
vm.dirty_ratio  # 达到多少后,系统会阻塞IO, 默认20(我觉得80不错)
vm.dirty_expire_centisecs = 3000  # 30秒后, 脏页一定被写入磁盘

文件架构 hier

man hier
  • /usr/
    usr目录一般是从其他地方挂载的. shareable, read-only. 多个机器可以公用一个usr
  • /usr/local/lib 个人理解, local就是从本地挂载了.

websocket

孙同学的文章
rfc6455

command

./shellprogramming/echo.md
./network/http.md

apt

sudo apt-get install <software>
* -y 默认yes
* -q 输出到日志
* -qq 不输出信息,错误除外
apt-cache search <software>  # 搜索

chardet3 检测文件编码

clip.exe

把标准输出输出到剪贴板

cp:

复制一个文件或者文件夹.

  • 赋值多个文件

    cp /lib64/{a.so,b.so,c.so} /lib/

  • 不会删除原有的文件

  • -i: 如果遇到重复的文件,就进行询问

  • -n: 如果遇到重复的文件,就不复制

  • -r: 把文件夹内部的所有文件都复制出来。会覆盖掉重名文件

  • -u: 把文件夹内部的所有文件都复制出来,保留新的那个文件

  • -v: 显示复制的过程

curl

* post请求: `curl -d 'name=value' <url>`
* 发送文件: `curl -F 'data=@path/to/local/file' <url>`

dd:

复制文件

  • 测试磁盘速度
dd if=/dev/zero of=tempfile conv=fdatasync bs=384k count=1k; 
$ dd if=tempfile of=/dev/null bs=1M count=1024  # 测试读取速度
  • dig
    用drill
  • diff:
    -c:  把不同之处以及前3行和后3行显示出来。
    -r(recursively) 把子目录区别也比较出来
    -i :忽略大小写
    -w :忽略空格和tab
    diff3: 比较3个文件的不同。
        diff3 MY-FILE COMMON-FILE YOUR-FILE。把两边的都和中间的文件比较
    diff -Nur originalfile newfile > patchfile:把旧文件和新的文件进行比较,生成文件的差,一次作为升级包
    patch -p1 < patchfile:把升级包应用于文件夹
    patch originalfile patchfile:把升级包应用于单个文件
  • drill
dril @dnsserver 

du

du -h -d 1 | sort -h  # 输出文件夹大小并按照尺寸排序
du -sh * | sort -h
du -h -d 1 | sort -h

export

export 某变量名=值
export -n <删除某变量名>
export PATH=$PATH:<追加PATH>
  • fdisk: 对磁盘进行分区

    • fdisk -l: 查看电脑上有多少硬盘
  • find

    • find . -path "*/migrations/*.py" 查找文件
    • find ./ -type f -name "*.py" | xargs grep "verify_ssl"
    • find -name '*.py' -not -path './EVN/*
    • find . -iregex '.*.\(py\|html\)'
  • grep grep string <file>: 从file中找到文字

  • iconv: 转化文件编码 iconv -f GBK -t utf-8//IGNORE originfile -o target

  • less <filename>: 打开文件(一点点看),用于查看大文件

  • lshw -c disk: "显示硬盘信息"

flock

flock path/to/lock.lock --nonblock --command "command"

ldd

查看某个可执行文件需要的动态链接库

ls

  • -a 显示所有文件(包括 . 开头的文件)
  • -A --almo

排序方式

  • -S 按照文件大小排列
  • -t 按照时间顺序排列
  • -r 逆序排列

mount

  • 挂载内存硬盘
  • 自动挂载
/etc/fstab
UUID=B2A0348DA03459D5 /run/media/wangx/samsung ntfs umask=0077,gid=1001,uid=1000 0 0
UUID=222E77452E771151 /run/media/wangx/E ntfs defaults,rw,user 0 0
  • 选项
rw 读写
errors={panic|continue|remount-ro}
umask=覆盖掉哪些权限(0077就是只保留用户权限)
gid uid 挂载给哪个用户

notify-send

* `notify-send 保护视力,休息一会`
  • rar
    • rar a -v1024k netease.rar netease: 把netease创建成多个压缩文件,最大1024k
  • rename
    • rename 's/group_public/group-public/g' * 把当前目录下所有文件的group_public变成group-public
    • rename 's/(\d+).png/banner-\1.png/g' * 替换目录下的所有banner
    • rename -v '20190415' '2019-04-15' *.json

pstree

pstree -p <user> # 查看所有进程
pstree -p wangx  # 查看某个用户的进程

read

读取输入, 赋予给某个变量

read PATH p
read PATH -p "输入你要处理的文件路劲: " p
echo $p

sed

  • echo '.\foo\bar.xml' | sed 's/\\/\//g' * 把复制的windows路径转化成linux路径, 注意务必是单引号
  • sed -i 's/pattern/replace/g' <filename> 把文件内满足pattern的替换成replace
  • sed -i 's/\r$//g' <filename> 删除文件的\r
  • sed -r 's/useless([0-2]{2,})replace/\1/' test.txt 替换某段字符并提取出里面的信息

seq

重复

seq 10  # 输入1到10
seq 10 | xargs -i command  # 执行一个代码10次
seq 10 | xargs -i echo "{}123"  # 执行一个代码10次
  • sort:
    • 按照文件尺寸来排序: sort -h
    • 直接按照一行的文字来排序: sort -n

su

su -s /bin/bash www-data # 使用www-data来执行bash命令

swap

fallocate -l 8G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap sw 0 0" >> /etc/fstab
echo "vm.swappiness=10" >> /etc/sysctl.conf

sysctl

设定系统参数, 配置在/etc/sysctl.conf

sysctl -a 查看所有的属性
sysctl -a | grep dirty
sysctl -p  # 更新系统配置
  • fs.inotify.max_user_watches 允许用户监听的最大文件数

tar

tar -zcvf github.tar.gz github
tar -c -f project.tar --exclude=".git*" project/
  • tcpdump 监控网络数据 tcpdump -l -i eth0 -w - src or dst port 3306 | strings
  • tee
  • tidy

Tidy is a console application which corrects and cleans up HTML and XML documents by fixing markup errors and upgrading legacy code to modern standards. Tidy is a product of the World Wide Web Consortium and the HTML Tidy Advocacy Community Group.

  • timedatectl timedatectl set-local-rtc 1: 关闭使用utc时间
  • tr
    • 参考网站
    • tr -d '{{input_characters}}' 删除文件内指定的字符串

umask

查看当前默认的权限(一般是0022, 但是覆盖掉group和other的写入权限)

$ umask
0022
$ umask 0027  # 我习惯关闭其他所有用户的权限
  • unrar unrar x file.part01.rar 解压文件,会自动把多个文件一起解压 unrar e netease.part01.rar <director> 解压文件到指定路径
  • unzip
    • unzip -O gbk filename.zip: 处理windows的zip文件
    • unzip -O gbk -l filename.zip: 只看看,不解压

wait

等待任务完成

python3 test_multi.py & python3 test_multi.py & wait

wc

  • 按照文件的行数来排序: ls | xargs wc -l | sort -nr

whereis

查看某个命令的地址

xargs

  • --max-args/-n: num 所有的参数每n个传入后续命令
$ seq 3 | xargs echo "no: {}"
no: {} 1 2 3

$ seq 3 | xargs -I {} echo "no: {}"
no: 1
no: 2
no: 3

$ seq -i 3 | xargs --max-args 2 echo "no: "
no: 1 2
no: 3

zentify

  • zenity --info --text '保护视力,休息一会'

zip 压缩文件

zip -r target.zip sourcedirectory/

./shellprogramming/zip.md

zlib-flate

解压内容

cat .git/objects/c2/dc76d6e9ecfa41381f20813575f92c538448f4  | zlib-flate -uncompress

regular expression

  • 在线学习
  • 在线测试
  • 规则:
    1. 基础 abc
    2. 数字 \d
    3. 通配符 .
    4. 任意选择 [abc] 匹配中间任何一个 [^abc] 反向匹配,不要出现abc任何一个
    5. [a-z] 匹配 a 到 z的小写字母
    6. 指定数量 \d{1,3}
    7. 至少有数字 \d+
    8. 可有可无一个 \d?
    9. \s 空白符(space)
    10. ^开头
    11. $结尾
    12. ()当作一个group ^(.*).pdf$ 所有的pdf文件的文件名
    13. | 代表或者 (cats|dogs)
    14. \w 数字或者字母
    15. \D \S \W 代表反过来
    16. (?!abc) 不能出现abc

About

No description, website, or topics provided.

Resources

Readme
Activity

Stars

1 star

Watchers

1 watching

Forks

3 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.