Linux

分类下相关文章

Manual sections

例如:想要查看 c 中 sleep 这个函数的文档 $ man 3 sleep Section 列表 Section Description 1 General commands 2 System calls 3 Library functions, covering in particular the C standard library 4 Special files (usually devices, those found in /dev) and drivers 5 File formats and conventions 6 Games and scre ...

阅读全文...

K.I.S.S 原则

(./first_tool | ./second_tool) < input_file.txt > output_file.txt 加括号是为了保证 input_file.txt 的内容能够通过 stdin 传递给 first_tool,而不是 second_tool. Ask: Ah, I see. And do you deal with a lot of tools? Answer: Arn’t that life? It depends on the operating system. Unix-style systems use a lot of tools to ge ...

阅读全文...

使用 df 监控磁盘的使用

正常 df 的结果输出 df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 1.8T 7.2G 1.7T 1% / none 4.0K 0 4.0K 0% /sys/fs/cgroup udev 3.9G 4.0K 3.9G 1% /dev tmpfs 787M 1.1M 786M 1% /run none 5.0M 0 5.0M 0% /run/lock none ...

阅读全文...

解决 Ubuntu 下 ssh 服务器中文显示乱码

在 Ubuntu 16.10 下使用终端 ssh 登录远程服务器,然后使用服务器上的 VIM 打开代码文件,发现文件中的中文都是乱码。而使用 Mac 的自带终端进行同样的操作,看到的中文显示就是正常的。遂怀疑 Ubuntu 本地的配置有问题。 问题的原因是,本地的 locale 与服务器上的 locale 不匹配。参考链接里提供了四种解决方案,而我觉得 Stop forwarding locale from the client 这种解决方案最简单。 即,修改 Ubuntu 本地的 /etc/ssh/ssh_config 文件,注释掉 SendEnv LANG LC_* 这一行。然后重新 s ...

阅读全文...

php-fpm 自启动失败问题排查

在 vagrant ubuntu 14.04 环境中配置的 php-fpm 总是自启动失败,每次都需要 vagrant ssh 上去切换到 root 手动起来 sudo su - /etc/init.d/php-fpm start 非常不专业 排查思路 首先,确认 init.d 是否有统一的日志文件,从这里看 centos - Is there an init.d start log? - Unix & Linux Stack Exchange,并没有。 然后,确认一下,php-fpm 的日志文件是否记录了启动错误。从 /etc/init.d/php-fpm 启动脚步文件中 ph ...

阅读全文...

Ubuntu 16.10 & Unity 8 安装体验

今天 Ubuntu 16.10 正式发布了,早上来赶紧下载了安装镜像。然后使用 unetbootin 在现有的 Ubuntu 16.04 系统上制作了安装引导 U 盘。 安装过程很快,不到十分钟安装完毕。唯一的期待是 16.10 内置的 Unity 8 体验版,在登录界面,将默认桌面切换为 Unity 8 总体感觉,Unity 8 的界面很清爽。然而除此之外都是差评 没有几个应用 也不知道在哪里添加新应用 打开 terminal 还需要输入密码 内置浏览器下载搜狗拼音输入法,会无限死循环不断打开新 Tab,而且无法停止。重启之后仍然继续开新 tab ... 我还是老老实实地切换回了默认 ...

阅读全文...

mkcast 记录键盘输入并生成 GIF 录屏

一图胜千言 有时候做 demo,使用视频演示最直观不过了,但是视频文件太大,并且不方便将对应的按键显示到屏幕上。 mkcast 完美的解决了这个问题 生成 GIF 录屏 显示按键到屏幕上 下载 mkcast 并安装 git clone https://github.com/KeyboardFire/mkcast.git cd mkcast # 安装依赖 sudo apt-get install wmctrl byzanz -y sudo ./setup.sh 开始录屏,执行 mkcast Terminal 10 -o out.gif 参数说明 Terminal 是对应的终端 t ...

阅读全文...

计划任务

查看计划任务日志的方法 grep CRON /var/log/syslog 动态查看 tail -f /var/log/syslog | grep CRON 参考: Where is the cron / crontab log? ...

阅读全文...

Ubuntu

必备软件 oh-my-zsh mysql workbench (sudo apt-get install mysql-workbench) chrome DBeaver 设置默认浏览器 如果想把 Chrome 设置成为默认浏览器,打开 System settings -> Details -> Default Applications -> Web ...

阅读全文...

MySQL 崩溃导致 Discuz! Database Error (2002) notconnect 错误

中午发现周末搭建的 Disuz 论坛以及周五搭建的测试用 WordPress 均报错无法访问。 以 Discuz 为例,报错信息为: Discuz! Database Error (2002) notconnect 很明显,问题出在了 MySQL。重新刷新,错误依旧,说明不是连接池问题。 重启 MySQL 首要工作是把 MySQL 重新启动起来 $ sudo mysqld 150608 11:49:31 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and ...

阅读全文...

linux

People disagree with me. I just ignore them. -- Linus Torvalds (regarding the use of C++ for the Linux kernel.) File size change when copied with scp http://www.linuxforums.org/forum/newbie/188379-file-size-change-when-copied-scp.html md5sum is an excellent indication. Consider a 9K file. On a dis ...

阅读全文...