GaGa's Blog

One GaGa, One World !

Joplin 是一个开源的笔记管理和待办事项应用,专注于跨平台同步和数据隐私。它支持 Markdown 格式,允许用户创建富文本笔记,包含图片、附件和表格。Joplin 提供桌面(Windows、macOS、Linux)、移动端(iOS、Android)和命令行版本,笔记可通过云服务(如 Dropbox、OneDrive、WebDAV 或 Joplin Cloud)在设备间同步。


官网:https://joplinapp.org/

joplin-desktop

Read more »

情景

shell脚本的执行效率虽高,但当任务量巨大时仍然需要较长的时间,尤其是需要执行一大批的命令时。因为默认情况下,shell脚本中的命令是串行执行的。如果这些命令相互之间是独立的,则可以使用“并发”的方式执行这些命令,这样可以更好地利用系统资源,提升运行效率,缩短脚本执行的时间。如果命令相互之间存在交互,则情况就复杂了,那么不建议使用shell脚本来完成多线程的实现。

为了方便阐述,使用一段测试代码。在这段代码中,通过seq命令输出1到10,使用for…in语句产生一个执行10次的循环。每一次循环都执行sleep 1,并echo出当前循环对应的数字。

注意:
真实的使用场景下,循环次数不一定等于10,或高或低,具体取决于实际的需求。
真实的使用场景下,循环体内执行的语句往往比较耗费系统资源,或比较耗时等。
请根据真实场景的各种情况理解本文想要表达的内容。

Read more »

登录shell类型

  • 登录shell读取系统配置文件

    • /etc/profile —/etc/profile.d/*.sh — ~/.bashrc ~.bash_profile – /etc/bashrc
  • 非登录shell读取系统配置文件

    • ~/.bashrc — /etc/bashrc — /etc/profile.d/*.sh

登录式shell怎么区别?

  • 正常通过终端登录

    • su -l username
    • su - username
  • 非登录shell

    • su usrname
    • 图形化打开窗口
    • 自己执行的shell脚本
Read more »

r8168 是一个Linux内核模块,用于驱动Realtek RTL8168/8111系列以太网网卡

Read more »

journal log

1.craete dir
mkdir -p /var/log/journal
mkdir -p /etc/systemd/journald.conf.d

2.add journal config
cat /etc/systemd/journald.conf.d/99-storage.conf <<EOF
[Journal]
Storage=persistent
Compress=yes
SyncIntervalSec=5m

SystemMaxUse=1G
SystemMaxFileSize=200M
MaxRetentionSec=2week
ForwardToSyslog=no
EOF

3.restart systemd-journald
systemctl restart systemd-journald

history命令的用法及参数

history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
参数:
   n :数字,要列出最近的若干命令列表
  -c :将目前的shell中的所有history内容全部消除
  -a :将目前新增的history指令新增入histfiles中,若没有加 histfiles ,则预设写入 ~/.bash_history
  -r :将 histfiles 的内容读到目前这个 shell 的 history 记忆中
  -w :将目前的 history 记忆内容写入 histfiles

重复执历史特定指令

[root@keystone ~]# history 10 # 列出最后10条执行的命令
[root@keystone ~]# !988 # 执行第988条指令
[root@keystone ~]# !! # 执行最后一条指令
[root@keystone ~]# history -c # 清除所有的指令记录
Read more »
0%