页面“C基础”与“Freebsd桌面初始化”之间的差异

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
 
 
第1行: 第1行:
 +
=用户需知=
 +
Absolute BSD
  
 +
因此对于FreeBSD用户,需要根据情况选择使用不同的版本。对于正式使用,应该选择stable版本,而对于进行学习、研究、开发FreeBSD,可以考虑使用current版本。
  
 +
如何升级 current版本呢
  
   
+
[https://zhuanlan.zhihu.com/p/49203814 FreeBSD入门概论]
good  
+
 
http://akaedu.github.io/book/
+
[https://www.v2ex.com/t/460137 freebsd 有这么强悍呢?能做什么呢?]
 +
 
 +
[https://www.freebsd.org/releases/12.2R/installation.html FreeBSD 12.2-RELEASE Installation Instructions]
 +
 
 +
[https://mirrors.163.com/freebsd/snapshots/ISO-IMAGES/13.0/ freebsd13 download]
 +
<pre>
 +
Tip:
 +
#xps上写入U盘
 +
sudo dd if=FreeBSD-12.2-RELEASE-amd64-memstick.img of=/dev/sda bs=1M conv=sync
 +
 
 +
https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/13.0/FreeBSD-13.0-RELEASE-amd64-memstick.img
 +
 
 +
https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.2/FreeBSD-12.2-RELEASE-amd64-memstick.img
 +
 
 +
注意    wget -c https://mirrors.aliyun.com/freebsd/releases/ISO-IMAGES/12.2/FreeBSD-12.2-RELEASE-amd64-memstick.img.xz && xz -d  FreeBSD-12.2-RELEASE-amd64-memstick.img.xz
 +
这次 sha512sum FreeBSD-12.2-RELEASE-amd64-memstick.img 才是对的 一开始下载的 img文件校验不对 注意国内的下载
 +
 
 +
 
 +
https://mirrors.aliyun.com/freebsd/releases/ISO-IMAGES/12.2/
 +
#写入U盘
 +
dd if=/path/to/downloaded.iso of=/dev/rdiskN bs=1m
 +
 
 +
 
 +
 
 +
Invite evan into other groups? wheel
 +
 
 +
FreeBSD12
 +
 
 +
如果是有兴趣,要有进步的 直接上freebsd 
 +
 
 +
[https://www.v2ex.com/t/460137 freebsd 有这么强悍呢?能做什么呢]
 +
 
 +
今天在家成功安装了freebsd12  并连上wifi  freebsd11连不上
 +
 
 +
现在双硬盘也是成功的 1t 作为了home  昨天的安装好了 再mount硬盘居然是不行的,一开机就死了了,不过现在是GPT加bios 兼容模式
 +
gnome3 to leav  xfce is good for use
 +
 
 +
桌面用户如何? 家里不用理 带个 freebsd latop 上班就行了
 +
 
 +
 
 +
这几天更新firefox 70 失败 用port 居然有很多软件消失了 ,例如 fcitx-qt5  liboffice
 +
 
 +
</pre>
 +
  Note: Users who prefer to install FreeBSD using a graphical installer may be interested in FuryBSD, GhostBSD or MidnightBSD.
 +
 
 +
整个项目全挂了  202011.1
 +
如果你读过我的TrueOS 评论并且有兴趣尝试使用桌面 BSD 或已经使用 TrueOS,请不要担心(这对于生活来说也是一个很好的建议)。TrueOS 的所有桌面元素都将剥离到 Project Trident。目前,Project Trident 网站的细节不多。他们仿佛还在进行剥离的幕后工作。
 +
如果你目前拥有 TrueOS,则无需担心迁移。TrueOS 团队表示,“对于那些希望迁移到其他基于 FreeBSD 的发行版,如 Project Trident 或 GhostBSD 的人而言将会有迁移方式。
 +
[https://zhuanlan.zhihu.com/p/39736459 TrueOS不再想要成为“桌面 BSD”了]
 +
 
 +
 
 +
TW的文档是新式,天朝的太老了
 +
https://www.freebsd.org/doc/zh_TW.UTF-8/books/handbook/index.html
 +
 
 +
[https://forums.internetfreedom.org/index.php?topic=29988.0  FuryBSD 12.1 简体中文(汉化)桌面,启用 ipfw 防火墙,简体中文输入法设置方法,]
 +
 
 +
=双系统=
 +
[https://www.youtube.com/watch?v=oGPvt3pQfaw Install FreeBSD 10 in UEFI Mode (Dual Boot Windows 8/8.1/10)]
 +
 
 +
https://wiki.archlinux.org/index.php/REFInd_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
 +
=freebsd12 on elitebook 问题 后来解决了2020=
 +
U盘子 delete-> f9->USB -
 +
1. 中文输入法老是调不出来  无论是fcitx  ibus scim
 +
 
 +
2. lxqt 界面 会假死,虽然在远程还可以ssh
 +
 
 +
=laptop=
 +
 
 +
https://wiki.freebsd.org/Laptops
 +
 
 +
=furybsd停止了啦=
 +
 
 +
login gropu is evan          wheel
 +
 
 +
 
 +
home is  /usr/home/evan
 +
 
 +
=nomadbsd=
 +
https://nomadbsd.org/download.html
 +
 
 +
<pre>
 +
 
 +
Linux
 +
 
 +
# lzma -d nomadbsd-x.y.z.img.lzma
 +
# dd bs=1M if=nomadbsd-x.y.z.img of=/dev/sdX conv=fsync
 +
 
 +
or
 +
 
 +
# xzcat nomadbsd-x.y.z.img.lzma | dd of=/dev/sdX bs=1M
 +
 
 +
FreeBSD
 +
 
 +
# lzma -d nomadbsd-x.y.z.img.lzma
 +
# dd if=nomadbsd-x.y.z.img of=/dev/daX bs=1m
 +
 
 +
or
 +
 
 +
# xzcat nomadbsd-x.y.z.img.lzma | dd of=/dev/daX bs=1m
 +
 
 +
 
 +
Installing Linux® packages
 +
 
 +
Before you can install Linux® packages it is necessary to enable Linux® binary compatibility. Let's say you want to install linux-sublime you can proceed as follows:
 +
 
 +
# kldload linux
 +
# sysrc linux_enable=YES
 +
# pkg install linux-sublime
 +
 
 +
</pre>
 +
https://rufus.ie/
 +
 
 +
https://www.freebsd.org/doc/handbook/linuxemu-lbc-install.html
 +
 
 +
=pre-configure=
 +
<pre>
 +
Pkg源地址更换为USTC:
 +
 
 +
官方源配置是 /etc/pkg/FreeBSD.conf ,请先检查该文件内容。注意其中的 url 参数配置了官方仓库的地址,我们需要把它替换为镜像站的地址。 该配置文件是 FreeBSD 基本系统的一部分,会随着 freebsd-update 更新,请不要直接修改,而是创建 /usr/local/etc/pkg/repos/FreeBSD.conf 覆盖配置,文件内容如下:
 +
 
 +
FreeBSD: {
 +
url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",
 +
}
 +
如果要使用滚动更新的 latest 仓库,把 url 配置最后的 quarterly 换成 latest 即可。 修改配置后,运行 pkg update -f 更新索引。
 +
 
 +
</pre>
 +
=更新=
 +
<pre>
 +
更新。FreeBSD和Linux中更新的不同之处在于,内核和软件包是分开更新的,
 +
内核使用 freebsd-update 更新,
 +
而软件包使用 pkg upgrade 更新。
 +
 
 +
常用命令。
 +
        安装软件:sudo pkg install xxx
 +
        安装本地包:sudo pkg add ./xxx
 +
        列出安装的包:sudo pkg info
 +
        列出设备:sudo pciconf -l
 +
        列出内核模块:sudo kldstat
 +
</pre>
 +
 
 +
=configure start=
 +
==0基本系统已安装 没有gui==
 +
 
 +
 
 +
[[安装freebsd]]
 +
 
 +
[http://blog.linuxchina.net/?p=1047 freebsd 添加用户]
 +
 
 +
===字体 ===
 +
<pre>cd /usr/ports/x11-fonts/wqy
 +
make install clean
 +
#没有字体 显示中文时为乱码
 +
 
 +
编辑/usr/local/etc/fonts/conf.d/85-wqy.conf这个文件,找到下面这两行( 现在不是这二行了 应该在第99、100行):
 +
 
 +
查找  compare="less_eq"  freebsd12 有5个
 +
 
 +
<test name="size" compare="less_eq"><int>16</int></test>
 +
<edit name="antialias" mode="assign"><bool>false</bool></edit>
 +
把less_eq后面的int值从16改成8即可。这两行的意思是对于所有小于16号的字体都禁用抗锯齿(match居然写的target=”font”,匹配了所有字体),一个最简单的workaround就是把禁用抗锯齿的字号改小一点,8号是个不错的值,因为太小的字用抗锯齿反而会模糊。
 +
 
 +
这样字体就美美的 </pre>
 +
 
 +
https://www.librehat.com/solve-freebsd-dragonflybsd-font-antialiasing-settings-invalid-issues/
 +
https://www.freebsdchina.org/forum/viewtopic.php?p=291166&sid=3b2dad0b46fafdb9a54757d673fef516
 +
 
 +
===xorg GUI 开始 ===
 +
<pre>
 +
yes |pkg install xorg
 +
 
 +
 
 +
pkg install xf86-video-intel​​​​​​​
 +
 
 +
pkg  install xrandr
 +
 
 +
/etc/rc.conf
 +
hald_enable="YES"
 +
dbus_enable="YES"
 +
 
 +
 
 +
pkg install gdm  #  gnome3-lite #gnome3 有点显卡闪屏
 +
</pre>
 +
[https://freebsdfoundation.org/freebsd-project/resources/installing-a-desktop-environment-on-freebsd/ Installing a Desktop Environment on FreeBSD]
 +
 
 +
===slim===
 +
<pre>
 +
pkg install -y slim-themes slim
 +
/usr/local/etc/slim.conf
 +
#sessiondir  /usr/local/share/xsessions
 +
# ...
 +
current_theme fbsd
  
 +
ls  /usr/local/share/slim/themes/
 +
archlinux-simple    fbsd                gentoo-simple      mindlock            scotland-road
 +
capernoited        fingerprint        gnewsense          parallel-dimensions subway
 +
debian-moreblue    flat                lake                rainbow            wave
 +
default            flower2            lunar              rear-window        zenwalk
  
[https://zhuanlan.zhihu.com/p/90971489 C语言编程学习必备的一些网站,干货收藏!]
 
  
[https://www.bilibili.com/video/BV17s411N78s/?spm_id_from=333.788.videocard.0 带你学C带你飞》]
 
=如何学习C=
 
  
[https://blog.csdn.net/qwe6620692/article/details/88107248  学习C语言,如何看懂及掌握一个程序]
+
</pre>
 +
====usage====
 +
<pre>单用户环境
 +
要将SLiM配置为加载某个特定的环境,只需编辑~/.xinitrc 如下:
  
=2021学习C APUE=
+
#!/bin/sh
http://www.apuebook.com/
 
  
[https://www.zhihu.com/topic/19705459/hot UNIX环境高级编程(书籍)笔记什么都 有呀 ]
+
#
 +
# ~/.xinitrc
 +
#
 +
# Executed by startx (run your window manager from here)
 +
#
  
[https://www.zhihu.com/question/19939011 《UNIX环境高级编程》这本书怎么看?怎么学习]
+
exec [session-command]
 +
将[session-command]替换为适当的会话命令。例如:
  
 +
exec awesome
 +
exec dwm
 +
exec startfluxbox
 +
exec fvwm2
 +
exec gnome-session
 +
exec openbox-session
 +
exec startkde
 +
exec startlxde
 +
exec startxfce4
 +
exec enlightenment_start
 +
</pre>
  
 +
https://wiki.archlinux.org/index.php/SLiM_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
  
==看法  ==
+
https://www.c0ffee.net/blog/freebsd-on-a-laptop/#slim
第二章和第六章可以跳跳,回头看
 
  
7.中文版翻译有瑕疵,但是整体还是不错,不至于对阅读产生影响(信号量那章有细节问题,但是信号量那张和csapp第八章几乎重复)
+
===xfce ===
 +
<pre>
  
首先,不要抱着一口气把这本书学完的心态去看。      尝试根据自己的兴趣,选择一个规模适当的开源项目,去阅读它的源代码。(例如我选择的就是一个小型的http服务器--Mongoose)当在某一方面发现自己有很多问题时,很希望去弄清楚时,这时候就可以去翻开手中的APUE,带着问题去阅读。这时候学习的效率必然比盲目地去看书更高,而且遗忘率也会降低。但是,仅仅读完是不够的。      很多时候,你看书的时候,会感觉自己看懂了,但是没过多久,又会发现自己忘了。或者,有时候你根本没看懂,而只是囫囵吞枣地看过去。所以,看完后,最好的方法就是写博客。尝试按照自己的理解以及逻辑,去将你学到的知识系统地阐述出来。这样,就算你以后忘了,再去翻翻博文,也能很快就捡起来。
+
pkg install xfce
  
十个最值得阅读学习的C开源项目代码
+
cat .xinitrc
 +
. /usr/local/etc/xdg/xfce4/xinitrc
 +
#ck-launch-session /usr/local/bin/startlxqt
 +
#exec awesome
 +
export LC_ALL=zh_CN.UTF-8
 +
export LANGUAGE=zh_CN.UTF-8.UTF-8
 +
export LANG=zh_CN.UTF-8.UTF-8
 +
#fcitx &
  
    Webbench
+
cat /etc/rc.conf
    Tinyhttpd
+
hostname="bsdelite.linuxsa.org"
    cJSON
+
#wlans_iwm0="wlan0"
    CMockery
+
#ifconfig_wlan0="WPA DHCP"
    Libev
+
sshd_enable="YES"
    Memcached
+
dbus_enable="YES"
    Lua
+
hald_enable="YES"
    SQLite
+
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
    UNIX v6
+
dumpdev="AUTO"
    NETBSD
+
ifconfig_em0="DHCP"
 +
slim_enable="yes"
 +
defaultrouter="192.168.10.1"
  
建议先看 >> Unix/Linux编程实践教程
+
fcitx wubi  在xfce 是成功的
 +
</pre>
  
https://book.douban.com/subject/1219329/
+
===lxqt ===
 +
<pre>
 +
pkg install lxqt    # sudo pkg delete lxqt # 输入法不好用 老调不出来  放弃
 +
</pre>
 +
https://wiki.freebsd.org/LXQt
  
http://item.kongfz.com/book/32040616.html?push_type=2&min_price=57.00&utm_source=101004009001
+
===awesome===
 +
<pre>
 +
pkg install awesome
 +
# cp /usr/local/etc/xdg/awesome/rc.lua .config/awesome/ #这个不要,我们后面会操作的 在配置里面
 +
echo "exec awesome" >> .xinitrc
 +
chmod +x ~/.xinitrc
 +
</pre>
  
https://detail.tmall.com/item.htm?spm=a1z10.1-b.w9858442-8055933095.4.fH3HiL&id=19729431809
+
===gnome===
 +
<pre>
 +
pkg install gnome3  vlc
 +
pkg install gnome-desktop gdm xorg gnome3
  
[https://github.com/woai3c/recommended-books 常用计算机书的下载]
+
have gdm can not add this  我一开始加了这个没用
 +
#echo 'exec gnome-session'  >> ~/.xinitrc
  
[https://blog.csdn.net/qwe6620692/article/details/88107248  学习C语言,如何看懂及掌握一个程序!]
 
  
[https://blog.51cto.com/chinalx1/2143904 十个经典的C开源项目代码]
+
root@bsd-latop:~ # cat  /etc/rc.conf
 +
hostname="bsd-latop"
  
[https://developer.51cto.com/art/201903/593703.htm 初学玩转C语言,这17个小项目收下不谢]
+
##wifi
 +
wlans_iwm0="wlan0"
 +
ifconfig_wlan0="WPA DHCP"
  
https://zhuanlan.zhihu.com/p/83185476
+
# evan
 +
gnome_enable="YES"
 +
moused_enable="YES"
 +
dbus_enable="YES"
 +
hald_enable="YES"
 +
gdm_enable="YES"
  
== tinyhttpd C 语言实现最简单的 HTTP 服务器 学习 ==
+
sshd_enable="YES"
 +
dbus_enable="YES"
 +
hald_enable="YES"
  
[https://www.shuzhiduo.com/A/ZOJPY9Ge5v/ tinyhttpd ------ C 语言实现最简单的 HTTP 服务器]
+
sendmail_enable="NONE"
 +
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
 +
#dumpdev="AUTO"
 +
ifconfig_em0="DHCP"
 +
#slim_enable="yes"
 +
defaultrouter="192.168.10.1"
  
https://github.com/nengm/Tinyhttpd
+
#vboxnet_enable="YES"
 +
#v2ray_enable="YES"
 +
#v2ray_enable="NO"
  
[https://blog.csdn.net/baiwfg2/article/details/45582723  tinyhttpd源码详解]
 
  
[https://blog.csdn.net/konghhhhh/article/details/103752962  tinyhttp整理(一)]
 
  
[https://blog.csdn.net/weixin_30387663/article/details/99664160  tinyhttp源码阅读(注释)]
+
cat .xinitrc
 +
#!/bin/bash
 +
#success if u run xmonad  must open it
 +
#/home/evan/.xmonad/autostart.sh
  
[https://juejin.cn/post/6870760453619122183 Tinyhttp源码分析及知识点总结 ]
+
#xautolock -time 10 -locker "i3lock  -b  -i '/home/evan/wallpaper/2020-02-04_14-46.png'" &
 +
xautolock -time 30 -locker "i3lock  -b  -i '/home/evan/wallpaper/sj.png'" &
 +
sudo /usr/local/bin/networkmgr &
 +
#networkmgr &
  
[https://www.bilibili.com/video/BV1hy4y1C71M/?spm_id_from=333.788.videocard.1 b站 C/C++ tinyHttp服务器小项目及源码讲解1]
+
export LC_ALL=zh_CN.UTF-8
 +
export LANGUAGE=zh_CN.UTF-8.UTF-8
 +
export LANG=zh_CN.UTF-8.UTF-8
 +
#export XMODIFIERS=@im=fcitx
 +
#if [ -x /usr/local/bin/fcitx  ]; then
 +
# /usr/local/bin/fcitx &
 +
#fi
 +
#if [ -x /usr/local/bin/synapse  ]; then
 +
#    /usr/local/bin/synapse &
 +
#fi
 +
#
 +
#run desktop
 +
#exec  /usr/local/bin/xmonad
  
[https://blog.csdn.net/wwxy1995/article/details/99362666  tinyhttpd深入解析与源码剖析]
+
#exec awesome
  
[https://blog.csdn.net/qq_40677350/article/details/90201758  Tinyhttpd-master 源码学习笔记1]
+
#. /usr/local/etc/xdg/xfce4/xinitrc
  
[https://blog.csdn.net/yzhang6_10/article/details/51534409  Tinyhttp源码分析]
+
#exec /usr/local/bin/i3
  
[https://github.com/EZLippi/Tinyhttpd Tinyhttpd非官方镜像,Fork自sourceForge,仅供学习]
+
#ck-launch-session /usr/local/bin/startlxqt
 +
exec gnome-session
  
 +
#export LC_ALL=zh_CN.UTF-8
 +
#export LANGUAGE=zh_CN.UTF-8.UTF-8
 +
#export LANG=zh_CN.UTF-8.UTF-8
 +
#export XMODIFIERS=@im=fcitx
 +
#if [ -x /usr/local/bin/fcitx  ]; then
 +
# /usr/local/bin/fcitx &
 +
#fi
 +
#if [ -x /usr/local/bin/synapse  ]; then
 +
#    /usr/local/bin/synapse &
 +
#fi
  
  
 +
</pre>
 +
https://www.osradar.com/how-to-install-gnome-or-plasma5-kde-on-freebsd-12/
  
[https://www.jianshu.com/p/18cfd6019296 tinyhttp源码分析]
+
===电池条 xbattbar ===
 +
===时间设置===
 +
<pre>
 +
先用bsdconfig-->network -->  不行再date
  
我把一些核心代码和相应的注释贴在这里,如果你感兴趣全部,可以移步我的github。
+
date 201908122145
https://github.com/zhaozhengcoder/rebuild-the-wheel/tree/master/tinyhttpd
+
2019年 8月12日 星期一 21时45分00秒 CST
  
 +
</pre>
  
[https://www.google.com/search?q=Tinyhttp+%E4%BB%A3%E7%A0%81%E5%AE%8C%E5%85%A8%E8%AE%B2%E8%A7%A3&newwindow=1&safe=active&sxsrf=ALeKk00sI_LE3rix9st768kTRNvSLADqfQ%3A1616990574286&source=hp&ei=blFhYIrjDoTcswW95aqACg&iflsig=AINFCbYAAAAAYGFffrh-H2QmmZeV5OlApkx5kRBpdYOT&oq=Tinyhttp+%E4%BB%A3%E7%A0%81%E5%AE%8C%E5%85%A8%E8%AE%B2%E8%A7%A3&gs_lcp=Cgdnd3Mtd2l6EANQ0QhY0Qhg2gpoAHAAeACAAQCIAQCSAQCYAQCgAQKgAQGqAQdnd3Mtd2l6&sclient=gws-wiz&ved=0ahUKEwiK0qGmz9TvAhUE7qwKHb2yCqAQ4dUDCAY&uact=5 Tinyhttp 代码完全讲解]
+
===xrand===
 +
<pre>
 +
#at  elitebook
 +
xrandr --output DP2 --same-as  eDP1  --mode 1366x768  --output DP2 --mode 1920x1080
  
==Mongoose-基于C的Web服务器代码学习 ==
+
#I3只有这个有效果  上面那个 是完全 只有一半 感觉没有了另外一半  哈哈
 +
xrandr --output DP2      --mode 1920x1080    --output eDP1 --off
  
[https://www.jianshu.com/p/745c03a8864a Mongoose-基于C的Web服务器 介绍和使用]
 
  
  
[https://blog.csdn.net/hnzwx888/article/details/84971205  Web服务器----mongoose]
 
  
https://github.com/cesanta/mongoose
+
#at 神舟
 +
#xrandr --output HDMI-1 --same-as  LVDS-1  --mode 1366x768  --output HDMI-1 --mode 1920x1080
  
[https://www.cnblogs.com/skynet/archive/2010/07/24/1784110.html Mongoose源码剖析:外篇之web服务器 ]
+
##kali
 +
#on home
 +
# if vga on home  24 1920*1080
 +
#xrandr --output VGA-1 --same-as  LVDS-1 --mode 1366x768  --output VGA-1 --mode 1920x1080
  
[https://blog.csdn.net/lixiaogang_theanswer/article/details/102753370 Mongoose-6.14源码剖析之基础篇]
+
#if hdmi on home
 +
#xrandr --output HDMI-1 --same-as  LVDS-1  --mode 1366x768  --output HDMI-1 --mode 1920x1080
 +
#只开启外外接显示器
 +
xrandr --output HDMI-1  --mode 1920x1080 --output LVDS-1 --off
  
== 我的笔记 ==
+
#HDMI-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 527mm x 296mm
apue.3e/include/apue.h
 
=== chapter 1===
 
[https://zhuanlan.zhihu.com/p/136700729 APUE读书笔记-01UNIX系统概述]
 
  
这是原文学不过是 Second Edition firefox 放大 就可以看 找一下 第三版本吧 Third Edition
+
#xrandr --output HDMI-1 --same-as  --mode 1366x768 --output HDMI-1 --mode 1920x1080+0+0
https://vaqeteart.gitee.io/file_bed/shared/books/APUE2/toc.html
+
# on work
 +
#xrandr --output VGA1  --same-as LVDS1 --mode  1920x1080  --output LVDS1 --mode 1366x768
  
=understanding_unix_programming =
 
  
==chapter 2  who ==
+
</pre>
  
 +
===wifi===
 
<pre>
 
<pre>
/* 再看一下书 非常 好的啦 
+
 
who命令的实现过程是先打开一个系统文件UTMP_FILE,创建对应的格式struct utmpfd变量,读取数据到这个结构体中,作相应格式输出即可
+
首先 安装freebsd12 时,就选择wifi连接网络,不要插网线
*/
+
 
#include<stdio.h>
+
Add an entry for this network to /etc/wpa_supplicant.conf. If the file does not exist, create it.  
#include<utmp.h>
+
 
#include<fcntl.h>
+
network={
#include <time.h>
+
ssid="myssid"
#include<unistd.h>
+
psk="mypsk"
#define SHOWHOST
 
void showtime(long);
 
void showtime(long timeval){
 
    char *cp;
 
    cp = ctime(&timeval);
 
    //cp[strlen(cp)-1]='\0';
 
    printf("%s",cp+4 ); //wed jun 21:40:09  +4是因为*cp所指的一串字符前4个字符表示为“星期”,可以忽略此信息
 
 
}
 
}
// 指向结构体 utmp 的指针 utbufp
 
void show_info(struct utmp *utbufp)
 
{
 
    printf("%-8.8s",utbufp->ut_name) ;
 
    printf(" ");
 
  printf("%-8.8s",utbufp->ut_line);
 
  printf("");
 
  printf("% 10ld",utbufp->ut_time );
 
  
  printf(" ");
+
Add entries to /etc/rc.conf to configure the network on startup:
 +
 
 +
wlans_ath0="wlan0"
 +
ifconfig_wlan0="WPA SYNCDHCP"
 +
 
 +
 
 +
Restart the computer, or restart the network service to connect to the network:
 +
 
 +
# service netif restar
 +
 
 +
 
 +
#in me
 +
 
 +
 
 +
##wifi
 +
wlans_iwm0="wlan0"
 +
ifconfig_wlan0="WPA DHCP"
 +
 
 +
 
 +
</pre>
 +
https://www.freebsd.org/doc/handbook/network-wireless.html
 +
 
 +
===显示器 之亮度 及双显示器 ===
 +
<pre>
 +
 
 +
freebsd 上有个 亮度设置  rofi search  rd 就可以出来
 +
#我的
 +
root@bsd-latop:~ # sudo kldload acpi_video; sudo sysctl hw.acpi.video.crt0.brightness=30
 +
hw.acpi.video.crt0.brightness: 80 -> 30
 +
 
 +
查看
 +
sysctl hw.acpi.video
 +
 
 +
hw.acpi.video.out2.active: 1
 +
hw.acpi.video.out1.active: 1
 +
hw.acpi.video.out0.active: 1
 +
hw.acpi.video.ext2.active: 1
 +
hw.acpi.video.ext1.active: 1
 +
hw.acpi.video.ext0.active: 1
 +
hw.acpi.video.lcd0.active: 1
 +
hw.acpi.video.crt0.levels: 80 50 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 69 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
 +
hw.acpi.video.crt0.economy: 50
 +
hw.acpi.video.crt0.fullpower: 80
 +
hw.acpi.video.crt0.brightness: 80
 +
hw.acpi.video.crt0.active: 1
 +
 
 +
 
 +
别人的例子
 +
kldload acpi_video; sysctl hw.acpi.video.lcd0.brightness=30 试试
 +
 
 +
 
 +
</pre>
 +
 
 +
[http://www.bsdart.org/freebsd-%e4%b8%8b%e5%8f%8c%e6%98%be%e7%a4%ba%e5%99%a8%e7%9a%84%e8%ae%be%e7%bd%ae/ FreeBSD 下双显示器的设置]
  
  printf(" ");
+
===pkg 源更新和系统更新===
 +
<pre>
 +
mkdir -p /usr/local/etc/pkg/repos/
  
 +
sudo pkg install security/ca_root_nss
 +
vi /usr/local/etc/pkg/repos/FreeBSD.conf
 +
FreeBSD: {
 +
  url: "pkg+https://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",
 +
#url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",
 
}
 
}
  
int main()
 
{
 
  struct utmp current_record;
 
  int  utmpfd;
 
  int reclen = sizeof(current_record);
 
  
  if (( utmpfd = open (UTMP_FILE, O_RDONLY)) == -1) {
 
  perror(UTMP_FILE);
 
  return 1;
 
  }
 
  while ( read(utmpfd, &current_record, reclen) == reclen )
 
  show_info(&current_record);
 
  close(utmpfd);
 
  return 0;
 
  
}
 
  
 +
#repository update
 +
pkg update -f
 +
pkg update
 +
 +
#系统更新
 +
pkg upgrade
 +
 +
</pre>
 +
 +
[https://www.freebsd.org/releases/12.1R/installation.html FreeBSD 12.1-RELEASE Installation Instructions]
 +
https://mirrors.ustc.edu.cn/help/freebsd-pkg.html
 +
 +
https://www.freebsd.org/doc/handbook/pkgng-intro.html
 +
 +
===更新单个软件===
 +
<pre>
 +
 +
这里以firefox为例子
 +
 +
pkg install firefox #就可以直接升级了
 +
 +
Installed packages to be UPGRADED:
 +
firefox: 68.0.1_1,1 -> 69.0.2,1
 +
telegram: 1.4.1.g20161227_5 -> 1.4.1.g20161227_6
 +
protobuf: 3.7.1,1 -> 3.9.2,1
 +
libevent: 2.1.10 -> 2.1.11
 +
libqtxdg: 3.3.0 -> 3.3.0_1
 +
 +
Installed packages to be REINSTALLED:
 +
mysql57-server-5.7.27 (direct dependency changed: perl5)
 +
 +
Number of packages to be upgraded: 5
 +
Number of packages to be reinstalled: 1
 +
 +
The operation will free 1 MiB.
 +
64 MiB to be downloaded.
 +
 +
</pre>
 +
 +
===ports 加速===
 +
<pre>
 +
sudo pkg install axel
 +
 +
vi /etc/make.conf
 +
#加入以下内容
 +
FETCH_CMD=axel
 +
FETCH_BEFORE_ARGS= -n 10 -a
 +
FETCH_AFTER_ARGS=
 +
DISABLE_SIZE=yes
 +
MASTER_SITE_OVERRIDE?=\
 +
http://ports.hshh.org/${DIST_SUBDIR}/\
 +
http://ports.cn.freebsd.org/${DIST_SUBDIR}/\
 +
#ftp://ftp.freeBSDchina.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/
 +
MASTER_SITE_OVERRIDE?=http://mirrors.ustc.edu.cn/freebsd-ports/distfiles/${DIST_SUBDIR}/
 +
MASTER_SITE_OVERRIDE?=${MASTER_SITE_BACKUP}
 +
#MASTER_SITE_OVERRIDE?=http://mirrors.ustc.edu.cn/freebsd-ports/distfiles/${DIST_SUBDIR}/
 +
 +
vi /etc/portsnap.conf
 +
 +
 +
SERVERNAME=portsnap.freebsd.org
  
 +
修改成:
  
 +
SERVERNAME=portsnap.hshh.org
  
 +
这个是他的更新服务器。另外还有几个国内比较快的portsnap服务器:
  
 +
portsnap.hshh.org
  
 +
portsnap2.hshh.org
  
 +
portsnap3.hshh.org (网通)
  
 +
portsnap4.hshh.org
 +
</pre>
  
 +
===更新ports===
 +
<pre>
  
 +
在 /etc/make.conf 中添加以下内容(如果文件不存在,则新建之):
  
 +
MASTER_SITE_OVERRIDE?=http://mirrors.ustc.edu.cn/freebsd-ports/distfiles/${DIST_SUBDIR}/
  
  
  
 +
cat  /etc/portsnap.conf  | grep cn
 +
SERVERNAME=portsnap.cn.FreeBSD.org
  
 +
fetch 获取数据
 +
extract 释放全部ports
 +
update 更新ports
 +
第一次使用可以portsnap fetch extract
  
C 库函数 void *memset(void *str, int c, size_t n) 复制字符 c(一个无符号字符)到参数 str 所指向的字符串的前 n 个字符。
+
以后使用可以 portsnap fetch update
memset(str,'$',7);
+
portsnap extract; portsnap update
  
This is string.h library function
+
现在的亚洲pkg mirrors
$$$$$$$ string.h library function
+
pkg0.twn.freebsd.org
 
</pre>
 
</pre>
  
参考 和书 chapter 2 这个最接近原书的了
+
http://mirrors.ustc.edu.cn/help/freebsd-ports.html
 +
 
 +
[https://blog.csdn.net/joyous/article/details/81990019 FreeBSD 11.1 发行版在线升级到 FreeBSD 11.2 发行版]
 +
 
 +
[https://blog.csdn.net/lanzh_syf/article/details/86599445 FreeBSD 12 国内源提速 pkg 和 ports 做个笔记]
 +
 
 +
[https://www.cnblogs.com/apexchu/p/4131821.html Freebsd 下如何最有效率的安装软件]
 +
 
 +
[http://blog.linuxchina.net/?p=1039 freebsd 安装ports以及加速]
  
https://www.cnblogs.com/20145221GQ/p/6060420.html
+
[https://blog.csdn.net/pengsixiang/article/details/4224141 使用国内镜像给FreeBSD的Ports安装加速]
  
[https://blog.csdn.net/u010307522/article/details/72862589  who命令实现]
+
[https://blog.csdn.net/pengsixiang/article/details/7458136 FreeBSD Fetch和Tar的妙用]
  
[https://blog.csdn.net/qq_33850438/article/details/60762519  unix/linux who命令的实现]
 
  
https://www.runoob.com/cprogramming/c-function-memset.html
+
[https://www.zhihu.com/question/264793642 怎么看待FreeBSD官方对镜像站的封闭管理]
===别人实现1===
 
https://www.cnblogs.com/20145221GQ/p/6060420.html
 
  
https://gitee.com/20145221/linux-besti-is-2016-2017-1-20145221/blob/master/src/week09/who.c?dir=0&filepath=src%2Fweek09%2Fwho.c&oid=6ca54191e2a046c9de2e42cfc5eb895ff665b429&sha=6cd302d6cb4f0d36f667754e972ce63963483044#
+
=20190808 new add=
 
<pre>
 
<pre>
 +
root@freebsd:/home/evan # cat /etc/fstab
 +
# Custom /etc/fstab for FreeBSD VM images
 +
/dev/gpt/rootfs  /      ufs    rw      1      1
 +
/dev/gpt/swapfs  none    swap    sw      0      0
 +
 +
 +
% echo 'ck-launch-session /usr/local/bin/startlxqt' > ~/.xinitrc
 +
 +
pkg install xorg
 +
 +
 +
安装:
 +
pkg install xorg
 +
//在/etc/rc.conf文件内添加如下内容:
 +
 +
 +
cat  /etc/rc.conf
 +
hostname="freebsd"
 +
moused_enable="YES"
 +
moused_nodefault_enable="YES"
 +
dbus_enable="YES"
 +
hald_enable="YES"
 +
ifconfig_DEFAULT="DHCP inet6 accept_rtadv"
 +
sshd_enable="YES"
 +
slim_enable="yes"
 +
#lightdm_enable="YES"
 +
 +
 +
pkg install xrandr  remmina synapse
 +
 +
pkg  install awesome 
 +
 +
pkg install telegram # or pidgim </pre>
 +
https://forums.freebsd.org/threads/running-telegram-gui.51494/
 +
 +
添加 新硬盘  这个会出错  只有在安装时就两个硬盘 并分区就没事
 +
 +
 +
Aug 9 2019
 +
 +
[https://blog.csdn.net/tg2003/article/details/80569955 FreeBSD本地化]
 +
 +
 +
[http://blog.linuxchina.net/?p=1039 freebsd 安装ports以及加速]
 +
 +
[https://blog.csdn.net/pengsixiang/article/details/4224141 使用国内镜像给FreeBSD的Ports安装加速]
 +
 +
[https://blog.csdn.net/pengsixiang/article/details/7458136 FreeBSD Fetch和Tar的妙用]
 +
 +
 +
[https://www.zhihu.com/question/264793642 怎么看待FreeBSD官方对镜像站的封闭管理]
 +
 +
 +
[https://blog.csdn.net/lanzh_syf/article/details/86635083 freebsd12 安装gnome3图形界面]
 +
 +
 +
 +
docker on freebsd
 +
https://wiki.freebsd.org/Docker
 +
 +
jails
 +
 +
 +
---------------------
 +
 +
原文链接:https://blog.csdn.net/MoeDisk/article/details/87028238
 +
 +
 +
==1 安装 gui 相关==
 +
=== 安装===
 +
<pre>#不用 portnaps 直接pkg
 +
#昨晚这个默认居然是没有cn的 我去 搞半天 ,还是改一下比较好滴
 +
vi /etc/portsnap.conf
 +
SERVERNAME=portsnap.cn.FreeBSD.org
 +
 +
#不安装gnome3 就没有gdm,但是没办法单独安装gdm 
 +
pkg install  xorg mate  slim  #没了 xf86-video-fbdev ?
 +
 +
#[Install CINNAMON Desktop Environment]
 +
pkg install cinnamon
 +
#20170331
 +
#Lightdm is in the ports tree.
 +
pkg install x11/lightdm
 +
 +
For lightdm to function, it requires one of the available greeters to be
 +
installed, which are available in the ports tree at x11/lightdm-*greeter*
  
#include <stdio.h> 
+
# 记得要添加这个DM Add the following lines to /etc/rc.conf to enable the LightDM:
#include <utmp.h>
+
lightdm_enable="YES"
#include <fcntl.h> 
 
#include <unistd.h> 
 
#include <time.h> 
 
#include <string.h>
 
 
 
#define SHOWHOST 
 
 
 
void showtime(long timeval){ 
 
    char* cp; 
 
    cp = ctime(&timeval); 
 
    cp[strlen(cp)-1] = '\0';
 
    printf("%s",cp+4); 
 
 
 
 
void show_info(struct utmp* utbufp){ 
 
    if(utbufp->ut_type != USER_PROCESS){ 
 
        return ; 
 
    } 
 
 
 
    printf("%-8.8s",utbufp->ut_name); 
 
    printf(" "); 
 
    printf("%-8.8s",utbufp->ut_line); 
 
    printf(" "); 
 
    showtime(utbufp->ut_time); 
 
    printf(" "); 
 
 
 
#ifdef SHOWHOST 
 
    if(utbufp->ut_host[0] != '\0'){ 
 
        printf("(%s)",utbufp->ut_host); 
 
    } 
 
#endif 
 
    printf("\n"); 
 
}
 
  
int main(){ 
+
# pkg install terminology</pre>
    struct utmp current_record; 
 
    int utmpfd; 
 
    int reclen = sizeof(current_record); 
 
 
 
    if((utmpfd = open(UTMP_FILE,O_RDONLY)) == -1){ 
 
        perror(UTMP_FILE); 
 
 
 
        return 1; 
 
    } 
 
 
 
    while( read(utmpfd,&current_record,reclen) == reclen ){ 
 
        show_info(&current_record); 
 
    } 
 
 
 
    close(utmpfd); 
 
 
 
    return 0; 
 
 
  
 +
===配置 和开机自启动===
 +
<pre>vi /etc/fstab
 +
proc /proc procfs rw 0 0
 +
sysrc  'hald_enable=YES'  'dbus_enable=YES' 'slim_enable=YES'    #'gdm_enable=YES'
 
</pre>
 
</pre>
===see also===
+
 
[https://blog.csdn.net/u010307522/article/details/72862589  who命令实现]
+
=== 中文化===
 +
<pre>
 +
 
 +
只有中文化后 才能调用fcitx 五笔哦 不然没中文输入
 +
2019
 +
 
 +
编辑用户的环境文件:
 +
#vi ~/.cshrc      //增加如下内容
 +
setenv LANG        zh_CN.UTF-8   
 +
setenv LC_CTYPE    zh_CN.UTF-8
 +
setenv LC_ALL      zh_CN.UTF-8
 +
//添加完后退出当前会话,重新进入。
 +
#locale    //显示当前用户环境
 +
LANG=zh_CN.UTF-8
 +
LC_CTYPE="zh_CN.UTF-8"
 +
LC_COLLATE="zh_CN.UTF-8"
 +
LC_TIME="zh_CN.UTF-8"
 +
LC_NUMERIC="zh_CN.UTF-8"
 +
LC_MONETARY="zh_CN.UTF-8"
 +
LC_MESSAGES="zh_CN.UTF-8"
 +
LC_ALL=zh_CN.UTF-8
  
  
===cp===
+
用户级:
 +
修改用户根目录文件.login_conf: 这个好像加了无效 201908
 +
me:\
 +
        :lang=zh_CN.UTF-8:\
 +
        :setenv=LC_ALL=zh_CN.UTF-8:\
 +
        :setenv=LC_CTYPE=zh_CN.UTF-8:\
 +
        :setenv=LC_COLLATE=zh_CN.UTF-8:\
 +
        :setenv=LC_TIME=zh_CN.UTF-8:\
 +
        :setenv=LC_NUMERIC=zh_CN.UTF-8:\
 +
        :setenv=LC_MONETARY=zh_CN.UTF-8:\
 +
        :setenv=LC_MESSAGES=zh_CN.UTF-8:\
 +
        :charset=UTF-8:\
 +
        :xmodifiers="@im=SCIM": #这里我假设你使用SCIM
 +
在英文界面下运行中文输入法:
 +
 
 +
startx 开启 gnome 或 gdm 开始登录gnome
 +
 
 +
我在 ~/.xinitrc中加入了:
 +
 
 +
 
 +
cat .xinitrc
 +
#ck-launch-session /usr/local/bin/startlxqt
 +
exec awesome
 +
export LC_ALL=zh_CN.UTF-8
 +
export LANGUAGE=zh_CN.UTF-8.UTF-8
 +
export LANG=zh_CN.UTF-8.UTF-8
 +
fcitx &
 +
 
 +
2019
 +
 
 +
export LC_CTYPE=“zh_CN.UTF-8” export XMODIFIERS=@im=SCIM export GTK_IM_MODULE=xim export QT_IM_DODULE=xim export XIM_PROGRAM=“scim -d” scim -d
 +
 
 +
 
 +
 
 +
#汉化  第一次失败了 第二再重装一下又好了 2017
 +
$ vi  .xinitrc
 +
export LC_ALL=zh_CN.UTF-8
 +
export LANGUAGE=zh_CN.UTF-8.UTF-8
 +
export LANG=zh_CN.UTF-8.UTF-8
 +
#exec mate-session 不用这个 mate 默认没有gdm了 如果用slim 还是要用这个</pre>
 +
 
 +
http://blog.chinaunix.net/uid-20377663-id-114464.html
 +
 
 +
https://zhidao.baidu.com/question/2203007741278957948.html
 +
 
 +
https://www.cnblogs.com/misstaste/p/5177011.html
 +
 
 +
 
 +
 
 +
https://www.cnblogs.com/sinx/p/10585930.html
 +
 
 +
=== update ports===
 
<pre>
 
<pre>
  
#include        <stdio.h>//标准输入输出
 
#include        <stdlib.h>//C标准函数库
 
#include        <unistd.h>//Unix类系统定义符号常量
 
#include        <fcntl.h>//定义了很多宏和open,fcntl函数原型
 
  
#define BUFFERSIZE      4096//定义存储器容量
+
SERVERNAME=portsnap.hshh.org
#define COPYMODE        0644//定义复制的长度
+
 
  
void oops(char *, char *);
+
http://mirrors.ustc.edu.cn/help/freebsd-ports.html
/*注意main函数的两个参数:
 
  argc记录了用户在运行程序的命令行中输入的参数的个数。
 
  arg[]指向的数组中至少有一个字符指针,即arg[0].它通常指向程序中的可执行文件的文件名。 */
 
main(int ac,char *av[])
 
{
 
    int in_fd, out_fd,n_chars;    //三个描述符值 in_fd为open返回的描述符 ,create out_fd为open返回的描述符  n_chars  读取的数据 function 见上个who  read的
 
    char buf[BUFFERSIZE]; //存储器位置
 
/*cp的参数有两个,分别是要复制的文件,和目的目录,这样一共应该是有三个操作数
 
  所以要先检查argc的值是否为三,如果不是,返回标准错误*/
 
        if(ac !=3) {
 
            fprintf(stderr, "usage:%s source destination\n",* av);
 
            exit(1);
 
        }
 
        /* open files 检查cp的第一个参数,要复制的文件,用open打开,in_fd为open返回的描述符 如果返回-1,代表打开失败,提示错误
 
          why CP 第一个参数是 av[1],  av[0] 是程序中的可执行的文件名也就是自己
 
        */
 
        if ((in_fd=open(av[1],O_RDONLY)) == -1)
 
            oops("Cannot open",av[1]);
 
  
/*检查cp的第二个参数,复制的目的地址,用create在目的地址创建新文件,out_fd为open返回的描述符
 
  如果返回-1,代表创建失败,提示错误 ; create 创建的位置就是av[2] 目标文件的位置是也
 
  为什么是 av[2]  就是 cp 命令的 第二个参数 也就是 目标文件 ,本来不存在 所以要create
 
*/
 
if(out_fd=creat(av[2],COPYMODE)== -1)
 
    oops("Cannot creat",argv[2])
 
}
 
/*copyfiles  cp指令的动作就是读取一个文件的内容到存储器,在新的地址创建空白文件,再从存储器将内容写入新文件。
 
  这里判断复制是否成功:
 
  如果能读取顺利,而读取的位数和写的位数不同,是写错误;
 
  如果读取失败,是读错误。
 
  why n_chars 是什么
 
  内核从utmpfd所指定的文件中读取了 reclen字节的数据,存放到 current_record所指定的内存空间中
 
  while ( read(utmpfd, &current_record, reclen) == reclen )
 
  
  write out_fd 文件描述符  buf 内存数据, n_chars 要写的字节数
 
  
循环的把源文件写入目标文件
+
https://www.cnblogs.com/yibinboy/articles/6136704.html
*/
 
while ((n_chars= read(int __fd,buf,BUFFERSIZE))>0) {
 
    if(write(out_fd,buf,n_chars) != n_chars)
 
        oops("Write error to ", av[2]);
 
    if (n_chars== -1)
 
  
        oops("Read error from ",argv[1]);
 
/*这里执行的是关闭文件的动作,in_fd open的 和out_fd create的两个文件描述符
 
  所指向的文件只要有一个关闭错误,就提示关闭错误。*/
 
    if (close(in_fd) == -1 || close(out_fd)== -1)
 
        oops("Error closing files","");
 
}
 
  
/*不太明白为什么是指针了这里 evan  这个是用来输出错误信息的函数*/
 
void oops(char *s1, char *s2)
 
{
 
    fprintf(stderr, "Error:%s", s1);
 
    perror(s2); // 用来将上一个函数发生错误的原因输出到标准设备(stderr)
 
    exit(1)
 
  
        }
 
  
 +
pkg install firefox
 
</pre>
 
</pre>
 +
http://mirrors.ustc.edu.cn/help/freebsd-ports.html
  
 +
https://www.cnblogs.com/yibinboy/articles/6136704.html
  
[https://www.cnblogs.com/cxy1616/p/6063463.html cp命令的编写最接受原书的了]
+
https://blog.csdn.net/lanzh_syf/article/details/86599445
  
[https://blog.csdn.net/hejishan/article/details/2250995  Unix程序设计:实现cp命令]
+
===输入法===
 +
==== install ====
 +
<pre>
 +
# fcitx wubi  在xfce 是成功的
 +
##记得 一定要加上chinese/ 不然是pkg 不到东西的  #fcitx-qt5 qt支持 不然在telegarm不能打字
 +
pkg install chinese/fcitx  chinese/fcitx-configtool chinese/fcitx-table-extra  chinese/fcitx-ui-light fcitx-qt5
  
[https://blog.csdn.net/XSL1990/article/details/8250039 linux自己编写的 cp 命令像os的那个了 ]
 
  
http://bbs.chinaunix.net/thread-247946-1-1.html
+
#skin
 +
/usr/local/share/fcitx/skin/dark
  
[https://blog.csdn.net/byxbai1989/article/details/17371197  linux cp命令源码]
+
我放在 .config/fcitx/skin  可以看到 但是用不了  无法加载皮肤36,回到默认皮肤 应试是皮肤不对
 +
 +
</pre>
 +
下載後放在 .config/fcitx/skin  下創建一個對應的目錄就行了
  
=C IDE=
 
  
https://www.jetbrains.com/zh-cn/clion/
+
[https://github.com/hosxy/fcitx-skin 基于sogou拼音皮肤修改的fcitx皮肤]
  
[[Eclipse]]
+
[https://bbs.deepin.org/forum.php?mod=viewthread&tid=168146 两款简洁的fcitx皮肤 ]
  
[[Anjuta on linux]]
+
[https://forum.suse.org.cn/t/fcitx-artwork-fcitx/731 Fcitx 输入法皮肤制作全教程]
  
https://atom.io/
+
[https://blog.csdn.net/Luo_Jin/article/details/102842437 Fcitx使用搜狗词库与皮肤]
  
=pre main =
+
==== configure ====
 
<pre>
 
<pre>
init main( int argc, char *argv[]);
 
argc 是命令行参数的数目 也包括自身 没有后台的参数 那么 argc=1
 
  
argv 指向参数的各个指针所构成的数组, argv[0]表示命令本身,argv[1] 表示第一个参数
+
Note:
 +
默认输入状态 非激活 不然 老是默认中文 影响 commmond
 +
 
 +
fcitx-diagnose  #查看相关的模块 非常不错的命令
 +
 
 +
vi .cshrc
 +
 
 +
#Note just for csh
 +
setenv LANG        zh_CN.UTF-8
 +
setenv LC_CTYPE    zh_CN.UTF-8
 +
setenv LC_ALL      zh_CN.UTF-8
 +
 
 +
# evan 4 fcitx
 +
setenv  XMODIFIERS @im=fcitx
 +
setenv  GTK_IM_MODULE fcitx
 +
setenv  QT_IM_MODULE fcitx
 +
setenv  XIM=fcitx
 +
 
 +
 
 +
下面这些只是提示而已
 +
 
 +
③如果使用的Shell是bash或sh:
 +
cat .cshrc
 +
 
 +
export XMODIFIERS='@im=fcitx'
 +
export GTK_IM_MODULE=fcitx
 +
export QT_IM_MODULE=fcitx
 +
 
 +
我暂时是这个哦
 +
④如果使用的Shell是csh或tcsh :
 +
setenv  XMODIFIERS @im=fcitx
 +
setenv  GTK_IM_MODULE fcitx
 +
setenv  QT_IM_MODULE fcitx
 +
⑤开机启动设置
 +
系统-->首选项-->启动应用程序
 +
添加fcitx
  
argc 是argument count的缩写表示传入main函数中的参数个数,包括这个程序本身
 
  
argv 是 argument vector的缩写表示传入main函数中的参数列表,其中argv[0]表示这个程序的名字
 
  
char  *argv[]是一个字符数组,其大小是int  argc,主要用于命令行参数  argv[]  参数,数组里每个元素代表一个参数;
 
  
看代码的时候我最先不理解的就是main函数的定义:
+
evan@home:~ % cat .xinitrc
 +
export LC_ALL=zh_CN.UTF-8
 +
export LANGUAGE=zh_CN.UTF-8.UTF-8
 +
export LANG=zh_CN.UTF-8.UTF-8
 +
export XMODIFIERS='@im=fcitx'
 +
export GTK_IM_MODULE=fcitx
 +
export GTK3_IM_MODULE=fcitx
 +
 
 +
mkdir -p ~/.config/autostart/
 +
cp /usr/local/share/applications/fcitx.desktop    ~/.config/autostart/
 +
 
 +
 
 +
pkg  prompt
 +
Message from zh-fcitx-4.2.9.6_2:
 +
 
 +
************************************************************************
 +
 
 +
Remember to set the environment variable XMODIFIERS:
 +
 
 +
        csh/tcsh:      setenv XMODIFIERS @im=fcitx
 +
        sh/bash:        export XMODIFIERS='@im=fcitx'
 +
 
 +
For GTK+ programs, you may want to set:
 +
 
 +
        csh/tcsh:      setenv GTK_IM_MODULE fcitx
 +
                        setenv GTK3_IM_MODULE fcitx
 +
        sh/bash:        export GTK_IM_MODULE=fcitx
 +
                        export GTK3_IM_MODULE=fcitx
 +
 
 +
For Qt4 programs, we recommend you to use
 +
 
 +
        qtconfig-qt4: /usr/ports/misc/qt4-qtconfig
 +
 
 +
instead of to manually set QT4_IM_MODULE.
 +
 
 +
To start fcitx with your desktop, just
 +
 
 +
        cp /usr/local/share/applications/fcitx.desktop \
 +
            ~/.config/autostart/
 +
 
 +
************************************************************************
 +
Message from zh-fcitx-ui-light-0.1.3_2:
 +
 
 +
************************************************************************
 +
 
 +
Replace your `fcitx` command with
 +
        fcitx -u fcitx-light-ui
 +
to start Fcitx with this lightweight UI.
 +
 
 +
**************************************************************
  
int main(int argc, char *argv[]){}
 
  
经查阅得知,argc是用来表示在命令行下输入命令时的参数个数,包括指令本身;argv[]是用来取得你输入的参数。针对具体指令分析如下(每一步解释由注释形式给出)。
 
 
</pre>
 
</pre>
[https://blog.csdn.net/zhaozhiyuan111/article/details/104050729  c语言中argc和argv[ <nowiki>]</nowiki>的作用及用法]
 
  
https://zhuanlan.zhihu.com/p/267822985
 
  
=基础=
+
[[https://ultra-technology.org/freebsd/chinese-japanese-korean-input-freebsd/ Writing Chinese, Japanese, Korean in FreeBSD with fcitx]]
 +
 
 +
=== ops and develop  ===
 +
<pre>pkg install git  rsync sudo vim bash  terminal anjuta vsftp  xfce4-terminal gcc
 +
echo 'evan ALL=(ALL) NOPASSWD:NOPASSWD:ALL' >/usr/local/etc/sudoers.d/evan
 +
 
 +
pkg install  python
 +
https://docs.python.org/2.7/using/unix.html
 +
https://docs.python.org/3.3/using/unix.html
 +
 
 +
# python  ide
 +
pkg install python  intellij-pycharm
 +
ln -s /usr/local/bin/python2  /usr/bin/python
 +
 
 +
 
 +
pkg install editors/emacs
 +
https://www.freebsd.org/doc/en/books/developers-handbook/emacs.html
 +
 
 +
pkg install terminator
 +
 
 +
#dig
 +
pkg  install  dns/bind-tools
 +
 
 +
sudo pkg install py36-pip
 +
sudo pip install ipython
 +
 
 +
evan@bsd-latop:~/lx/zabbix/api_zbx % sudo pkg search urllib3
 +
py27-urllib3-1.22,1            HTTP library with thread-safe connection pooling, file post, and more
 +
py36-urllib3-1.22,1            HTTP library with thread-safe connection pooling, file post, and more
 +
 
 +
 
 +
</pre>
 +
 
 +
====更改freebsd shell为bash vi 为vim ====
 +
==== install ====
 +
<pre>pkg install bash vim
 +
root@home:~ # where  vi
 +
/usr/bin/vi
 +
 
 +
mv /usr/bin/vi /usr/bin/bakvi && ln -s /usr/local/bin/vim  /usr/bin/vi</pre>
 +
 
 +
====设置bash====
 +
<pre>
 +
tcsh (发音为/tiːˈsiːʃɛl/ tee-SEE-shel, /ˈtiːʃɛl/ TEE-shel, 是一个向下兼容c shell的Unix shell。它本质上是为c shell增加命令补完,命令编辑等其他功能。 当前作为FreeBSD和其延伸发行版的默认shell。
 +
 
 +
 
 +
evan# whereis bash
 +
bash: /usr/local/bin/bash
 +
 
 +
#sudo mv /bin/sh /bin/bak_sh
 +
 
 +
##做了下面这个ln 以后我们把平时在linux下跑的 shell 脚本拿到freebsd跑,也绝大部分没问题了
 +
ln -s /usr/local/bin/bash /bin/bash
 +
#ln -s /usr/local/bin/bash /bin/sh
 +
 
 +
 
 +
evan# chsh -s /usr/local/bin/bash
 +
chsh: user information updated
 +
注销重启后 如下 搞定
 +
[root@evan ~]# echo $SHELL
 +
/usr/local/bin/bash
 +
 
 +
sudo chsh -s /bin/tcsh
 +
 
 +
 
 +
#这两个干啥
 +
tcsh -s /bin/bash
 +
tcsh -s /usr/local/bin/bash
 +
 
 +
 
 +
chsh命令:
 +
 
 +
chsh 这个命令现在一般被用来替换,usermod -s 命令即更改用户登录的shell。其常用的只有两个参数 -l 和 -s
 +
 
 +
chsh -l 起到的作用是列出当前系统的所有shell
 +
 
 +
 
 +
 
 +
 
 +
#anjuta log
 +
===========================================================================
 +
Note that some standard Python modules are provided as separate ports
 +
as they require additional dependencies. They are available as:
  
==计算机为什么要用二进制==
+
py35-gdbm      databases/py35-gdbm
Everything over Binary 模拟路转换成为数字电路
+
py35-sqlite3    databases/py35-sqlite3
 +
py35-tkinter    x11-toolkits/py35-tkinter
 +
===========================================================================
 +
</pre>
  
https://blog.csdn.net/weixin_44296862/article/details/95277924
+
====7zip====
 +
<pre>
 +
archivers/p7zip
  
https://blog.csdn.net/c46550/article/details/90951557
+
1. 解压缩文件
 +
# 7z x 解压缩文件
 +
注意的是如果类似libpcap-0.7.1.tar.gz,一次性7z x libpcap-0.7.1.tar.gz后,7z会解压出文件libpcap-0.7.1.tar这一层,这个时候再一次7z x libpcap-0.7.1.tar就可以啦。
 +
2.压缩文件的参数是a
 +
# 7z a filename.7z 要压缩的文件或者目录
 +
3.其他
 +
# 7z e,e这个参数很有意思,也是解压,但和x参数不同 有的就解不了 如 tar , gz
 +
4.更多的使用7z -h看说明! 另外,apt安装p7aip后还有个命令7za,不知道和7z有什么区别
 +
</pre>
  
[https://wenku.baidu.com/view/77074002e009581b6ad9eb2c.html 一位全加器]
+
=applications=
=== signed char 类型的范围为 -128~127===
+
==终端==
 
<pre>
 
<pre>
按八位来算:
+
sudo pkg install tilda
在计算机里面是用补码表示的,128的二进制码是:10000000,这个东西在计算里面并不是128,因为最高位是符号,它是个负数,那么负数的原码是多少呢,我们知道如果补码的符号位为“1”,表示是一个负数,求原码的操作可以是:符号位为1,其余各位取反,然后再整个数加1。
+
</pre>
所以,10000000取反后就是11111111,把符号位去了就是01111111再加1就是10000000就是-128了。
+
 
其实你看-127是10000001,这个很好理解,-128加1不就是-127
 
[https://blog.csdn.net/zy986718042/article/details/71699079 浅谈char类型范围]
 
  
补码表示时,-0和+0补码相同都是0 000 0000,所义导致可以多表示一个负数,...这个负数是最小的那个..
+
==health[[Linux 下的护眼软件]]==
 +
<pre>
 +
sudo pkg install  redshift redshift-gtk
 
</pre>
 
</pre>
[https://blog.csdn.net/czg13548930186/article/details/52602279?ops_request_misc=&request_id=&biz_id=102&utm_term=%25E6%25B5%2585%25E6%259E%2590%25E4%25B8%25BA%25E4%25BB%2580%25E4%25B9%2588char%25E7%25B1%25BB%25E5%259E%258B%25E7%259A%2584%25E8%258C%2583%25E5%259B%25B4%25E6%2598%25AF%2520%25E2%2580%2594128~%2520127&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-1-52602279.pc_search_result_no_baidu_js  浅析为什么char类型的范围是 —128~+127]
 
  
  
[https://wenwen.sogou.com/z/q871193299.htm?ch=fromnewwenwen.pc char 其数值表示 范围的计算]
+
https://forums.freebsd.org/threads/compiling-redshift-color-temperature-app.17693/
 +
 
 +
==rednotebook==
 +
<pre>
 +
 
 +
下载 src  https://rednotebook.sourceforge.io/downloads.html
 +
 
 +
 
 +
sudo ln -s /usr/local/bin/bash /bin/bash
 +
 
 +
sudo pkg install devel/py-yaml
 +
#sudo pkg install py36-yaml # 这个是老的名
 +
 
 +
sudo python3.6 setup.py install
 +
 
 +
如何添加快捷方式  上次是在源码里面找到办法的
 +
 
 +
暂时这样
 +
 
 +
sudo mv /usr/local/bin/rednotebook /usr/local/bin/bakrednotebook
 +
 
 +
~/tmp/rednotebook-2.15 % sudo cp ./rednotebook/rednotebook /usr/local/bin/rednotebook
 +
 
 +
 
 +
 
 +
ERROR PyYAML not found. Please install it (python3-yaml).
 +
sudo pkg install devel/py-yaml
 +
</pre>
 +
https://www.freshports.org/devel/py-yaml/
  
[https://www.bilibili.com/video/BV1Gt4y1D73z?from=search&seid=13506202580160943636 b站 C语言数据类型及数值范围]
+
http://bbs.chinaunix.net/thread-3568241-1-1.html
  
===原码 补码 反码 ===
+
==ss==
 
<pre>
 
<pre>
1.原码
+
ss
最高位表示符号位。剩下的位数,是这个数的绝对值的二进制
+
pkg install shadowsocks-libev
 +
# or cd /usr/ports/net/shadowsocks-libev/ && make install clean
  
就比方说 一个完整的int型变量在内存中占的是4个字节,32位的编译器中 那么这时候他的二进制表示是00000000 00000000 00000000 00000000
 
  
所以
+
</pre>
 +
[http://wiki.linuxchina.net/index.php?title=Chrome%E9%80%9A%E8%BF%87shadowsocks%E7%BF%BB%E5%A2%99#linux.28debian_pc.29_or_freebsd12 Chrome通过shadowsocks翻墙]
  
10的原码就是00000000 00000000 00000000 00001010
+
==Document Viewers==
 +
  sudo pkg install  Okular    epdfview  #Okular好用 #mupdf 只有命令行界面  # atril 好用 但是是安装上整个mate桌面
 +
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/desktop-viewers.html
  
那么负数的原码就是例如
+
==IM==
  
-10的原码10000000 00000000 00000000 00001010
+
===telegram===
 +
  sudo pkg install telegram-desktop # 其它都不对 sudo pkg install telegram  #/usr/ports/net-im/telegram && make install clean
 +
  在界面顶部的搜索框中输入@zh_CN
  
符号位是第一位 0为正数 1为负数
+
===IRC===
 +
  sudo pkg install hexchat konversation
  
2.反码
+
== 影音==
    正数的反码就是其原码.
+
<pre>pkg install -y  celluloid  vlc audacious  audacious-skins  multimedia/audacious-plugins archivers/unzip  mplayer smplayer  gnome-mplayer    qmmp </pre>
 +
===audacious-skins===
 +
https://pakeklinux.wordpress.com/2010/11/17/the-best-audacious-skin-that-i-know/
  
    负数的反码就是在其原码的基础之上 符号位不变,其他位取反.
+
https://www.gnome-look.org/p/1115066
   
 
3.补码
 
  
    正数的补码就是其原码.
+
sudo cp -a ~/tmp/Audacious\ grey\ theme/Audacious\ grey\ theme/*  /usr/share/audacious/Skins/grep/
  
    负数的补码就是在其反码的基础之上+1
+
==ftp ==
   
+
<pre>service 自带了ftp
 +
FreeBSD includes FTP server software, ftpd, in the base system.
 +
https://www.freebsd.org/doc/en/books/handbook/network-ftp.html
 +
#ftp client
 +
pkg install filezilla
 
</pre>
 
</pre>
  
[https://www.cnblogs.com/wangxiaoqi/p/6419676.html  C语言中的原码、反码和补码 ]
+
==Browsers==
 +
<pre>pkg install netsurf  midori falkon  chromium  firefox-esr#  firefox # firefox这个在配置那里就可以选择 add 中文
 +
 
 +
falkon
 +
ld-elf.so.1: /usr/local/lib/qt5/libQt5Core.so.5: version Qt_5.13 required by /usr/local/bin/falkon not found
 +
 
 +
#今天 更新到firefox 70 然后起不来了 Segmentation fault (core dumped)
 +
 
 +
 
 +
fetch https://download.cdn.mozilla.net/pub/firefox/releases/70.0/source/firefox-70.0.source.tar.xz
 +
 
 +
:/usr/ports/www/firefox # make install clean
 +
 
 +
 
 +
https://www.freebsd.org/doc/handbook/desktop-browsers.html
 +
 
 +
## log
 +
Message from chromium-56.0.2924.87_1:
 +
For correct operation, shared memory support has to be enabled
 +
in Chromium by performing the following command as root :
 +
 
 +
sysctl kern.ipc.shm_allow_removed=1
 +
 
 +
To preserve this setting across reboots, append the following
 +
to /etc/sysctl.conf :
 +
 
 +
kern.ipc.shm_allow_removed=1
 +
 
 +
 
 +
安装flashplayer插件
 +
 
 +
安装 nspluginwrapper  this is  only for firefox ?
 +
cd /usr/ports/www/nspluginwrapper   
 +
make   
 +
make install
 +
安装 linux-c6-flashplugin11
 +
cd /usr/ports/www/linux-c6-flashplugin11 
 +
make  
 +
make install
 +
执行nspluginwrapper -v -a -i
 +
若报错Kernel too old, 执行命令sysctl compat.linux.osrelease=2.6.18
 +
修改/etc/sysctl.conf, 增加compat.linux.osrelease=2.6.18
 +
修改/etc/fstab
 +
linproc /usr/compat/linux/proc linprocfs rw 0 0
 +
 
 +
 
 +
 
 +
#这个是 也是手册上的哦
 +
cd /usr/ports/www/linux-flashplayer
 +
make install clean
 +
 
 +
 
 +
备注
 +
 
 +
安装步骤参考FreeBSD Handbook
 +
安装nspluginwrapper会安装linux_base-c6
 +
注意安装的版本</pre>
 +
 
 +
 
 +
=== firefox ===
 +
<pre>
 +
% sudo  pkg search firefox
 +
firefox-73.0.1,1              Web browser based on the browser portion of Mozilla
 +
firefox-esr-68.5.0_1,1        Web browser based on the browser portion of Mozilla
 +
 
 +
要把 .mozilla/ 目录先删除  再 重装 firefox-esr 就可以同步回插件等等所有东西回来了
 +
sudo pkg install  firefox # firefox-esr
 +
要更新整个系统,不然 firefox 更新不成功的
 +
 
 +
 
 +
字体设置 记得这个不要勾上
 +
允许页面选择自己的字体代替您的上述选择(A
 +
 
 +
 
 +
</pre>
  
[https://www.cnblogs.com/burningc/p/10741253.html  C语言之原码、反码和补码 ]
 
  
[https://blog.csdn.net/liuyangsyouxiang/article/details/6050525  C语言——源码、反码、补码]
+
https://www.freebsd.org/doc/en/books/handbook/desktop-browsers.html
  
[https://www.bilibili.com/video/BV1Wx411g7Jg/?spm_id_from=333.788.videocard.1 b站原码 反码 补码]
+
[https://daemon-notes.com/articles/desktop/firefox Firefox/Flash on FreeBSD]
  
=gdb=
+
==remmina==
 
<pre>
 
<pre>
 +
pkg install remmina
 +
#默认没有rdp 等协议
 +
To install the port: cd /usr/ports/net/remmina-plugins/ && make install clean
 +
To add the package: pkg install remmina-plugins
 +
</pre>
 +
https://forums.freebsd.org/threads/rdp-or-vnc-for-access-to-remote-windows-machine.53651/
 +
 +
https://www.freshports.org/net/remmina-plugins/
 +
==网络管理工具==
 +
<pre> networkmgr
 +
 +
.xinitrc 里面启动 图标好难看
  
 +
essage from networkmgr-3.1:
  
 +
--
 +
Any bug reports or request of new feature should be addressed at:
 +
    https://github.com/GhostBSD/networkmgr/issues
  
start  st 开始执行程序,在main函数的第一条语句前面停下来
+
Make sure that the /usr/local/etc/doas.conf have someting simular like this:
step      s  下一条语句,如果该语句为函数调用,则进入函数执行其中的第一条语句
 
next    n  执行下一条语句,如果该语句为函数调用,不会进入函数内部执行(即不会一步步地调试函数内部语句)
 
  
 +
    permit nopass keepenv root
 +
    permit :wheel
 +
    permit nopass keepenv :wheel cmd netcardmgr
 +
    permit nopass keepenv :wheel cmd ifconfig
 +
    permit nopass keepenv :wheel cmd service
  
 +
When rebooting it should automaticaly start is the desktop support xdg and make
 +
sure that the user using NetworkMgr is in the wheel group.
  
 +
</pre>
 +
https://vermaden.wordpress.com/2018/03/24/freebsd-network-management-with-network-sh-script/
  
 +
==启动器==
 +
synapse
 +
rofi
 +
gmrun # 配置文件  cat  /etc/gmrunrc
  
 +
https://wiki.archlinux.org/index.php/Rofi
  
 +
https://www.cnblogs.com/siyingcheng/p/11706215.html
 +
https://hacpai.com/article/1552717494529
  
 +
https://itgoyo.github.io/2019/01/28/%E8%87%AA%E5%B7%B1%E6%8A%98%E8%85%BE%E4%B8%AARofi%E9%85%8D%E7%BD%AE/
  
 +
https://github.com/davatorium/rofi/wiki/themes
  
使用例子  结合他看C代码 爽到不行了
+
https://wiki.archlinux.org/index.php/Gmrun
184
 
185gcc -g 11.2.c -o 11.2
 
186gdb 11.2
 
187
 
188(gdb) start
 
189(gdb) s  #一直用step命令(简写为s)进入函数中 ,n命令呢
 
190
 
191
 
192step s  下一条语句,如果该语句为函数调用,则进入函数执行其中的第一条语句
 
193next n  执行下一条语句,如果该语句为函数调用,不会进入函数内部执行(即不会一步步地调试函数内部语句)
 
  
 +
==文件管理器==
 +
<pre>
 +
pcmanfm
 
</pre>
 
</pre>
  
=c=
+
==edit==
 
<pre>
 
<pre>
 +
pkg install  gedit geany  gnote  gnome-calculator#算机器  #madedit
 +
</pre>
 +
 +
==USB 镜像写入器 ==
 +
Etcher 是一个由 http://resin.io 开发的 USB 镜像写入器。它是一个跨平台的应用,可以帮助你将 ZIP、ISO、IMG 格式的镜像文件写入到 USB 存储中
 +
 +
==svn==
 +
pkg install subversion && pkg install kdesvn  # or esvn
 +
 +
[[Svn基础]]
 +
 +
[https://blog.csdn.net/xujianhua815926/article/details/468811 在FreeBSD上安装SVN(Subversion)]
  
/*                                                                                                                                                                                         
+
==office==
20答案是 Tuesday  因为列数定了是10                                                                                                                                                           
+
=== libreoffice===
21days[2] === days[2][10]                                                                                                                                                                   
+
<pre>  Gnumeric 电子表格
22                                                                                                                                                                                           
+
sudo pkg install libreoffice
23解说                                                                                                                                                                                       
+
pushd  /usr/ports/chinese/libreoffice-zh_CN  && sudo make  install clean
24days[2][0]=T                                                                                                                                                                               
 
25days[2][1]=u                                                                                                                                                                               
 
26days[2][2]=e                                                                                                                                                                               
 
27days[2][3]=s                                                                                                                                                                               
 
28days[2][4]=d                                                                                                                                                                               
 
29days[2][5]=a                                                                                                                                                                               
 
30days[2][6]=y                                                                                                                                                                               
 
31days[2][7]=                                                                                                                                                                               
 
32days[2][8]=                                                                                                                                                                               
 
33days[2][9]=                                                                                                                                                                               
 
34                                                                                                                                                                                           
 
35               
 
 
</pre>
 
</pre>
==eg ==
+
[https://www.libreofficechina.org/ LibreOffice 中文社区]
=== 石头剪刀布===
+
 
 +
==虚拟化 ==
 +
<pre>#FreeBSD as a Host with VirtualBox
 +
sudo pkg install emulators/virtualbox-ose
 +
 
 +
 
 +
sudo pkg install virtualbox-ose-additions #不然没办法在freebsd12 上安装debian10.04 依然失败
 +
#普通用户启动
 +
sudo pw groupmod vboxusers -m evan
 +
 
 +
sudo sysrc vboxnet_enable
 +
 
 +
#现在是这样启动的
 +
sudo virtualbox
 +
</pre>
 +
 
 +
===err===
 +
win10  debian10 安装错误  installation step  failed
 +
 
 +
===note===
 +
 
 
<pre>
 
<pre>
#include <stdio.h>
+
=============================================================================
#include <stdlib.h>
+
 
#include <time.h>
+
VirtualBox was installed.
 +
 
 +
You need to load the vboxdrv kernel module via /boot/loader.conf:
 +
 
 +
vboxdrv_load="YES"
 +
 
 +
You also have to add all users to your vboxusers group in order to use vbox.
 +
 
 +
% pw groupmod vboxusers -m jerry
 +
 
 +
Reboot the machine to load the needed kernel modules.
 +
 
 +
 
 +
Bridging Support:
 +
=================
 +
 
 +
For bridged networking please add the following line to your /etc/rc.conf:
 +
 
 +
vboxnet_enable="YES"
 +
 
 +
 
 +
USB Support:
 +
============
 +
 
 +
For USB support your user needs to be in the operator group and needs read
 +
 
 +
and write permissions to the USB device.
 +
 
 +
% pw groupmod operator -m jerry
 +
 
 +
Add the following to /etc/devfs.rules (create if it doesn't exist):
 +
 
 +
[system=10]
 +
add path 'usb/*' mode 0660 group operator
 +
 
 +
To load these new rule add the following to /etc/rc.conf:
 +
 
 +
devfs_system_ruleset="system"
 +
 
 +
Then restart devfs to load the new rules:
  
int main(void)
+
% /etc/rc.d/devfs restart
{
 
char gesture[3][10] = { "scissor", "stone", "cloth" };
 
int man, computer, result, ret;
 
  
srand(time(NULL));
 
while (1) {
 
computer = rand() % 3;
 
  printf("\nInput your gesture (0-scissor 1-stone 2-cloth):\n");
 
ret = scanf("%d", &man);
 
  if (ret != 1 || man < 0 || man > 2) {
 
printf("Invalid input! Please input 0, 1 or 2.\n");
 
continue;
 
}
 
printf("Your gesture: %s\tComputer's gesture: %s\n",
 
gesture[man], gesture[computer]);
 
  
result = (man - computer + 4) % 3 - 1;
+
Troubleshooting:
if (result > 0)
+
================
printf("You win!\n");
 
else if (result == 0)
 
printf("Draw!\n");
 
else
 
printf("You lose!\n");
 
}
 
return 0;
 
}
 
  
 +
Running VirtualBox as non-root user may fail with a fatal error
 +
NS_ERROR_FACTORY_NOT_REGISTERED. In this case delete /tmp/.vbox-*-ipc file.
 +
If you experience "Network: write Failed: Cannot allocate memory" errors
 +
try to increase net.graph.maxdata in /boot/loader.conf
  
/*
+
If you are using AIO, then increase these limits (PR#168298):
0、1、2三个整数分别是剪刀石头布在程序中的内部表示,用户也要求输入0、1或2,然后和计算机随机生成的0、1或2比胜负。这个程序的主体是一个死循环,需要按Ctrl-C退出程序。以往我们写的程序都只有打印输出,在这个程序中我们第一次碰到处理用户输入的情况。在这里只是简单解释一下,以后再细讲。scanf("%d", &man)这个调用的功能是等待用户输入一个整数并回车,这个整数会被scanf函数保存在man这个整型变量里。如果用户输入合法(输入的确实是整数而不是字符串),则scanf函数返回1,表示成功读入一个数据。但即使用户输入的是整数,我们还需要进一步检查是不是在0~2的范围内,写程序时对用户输入要格外小心,用户有可能输入任何数据,他才不管游戏规则是什么。
+
vfs.aio.max_buf_aio=8192
 +
vfs.aio.max_aio_queue_per_proc=65536
 +
vfs.aio.max_aio_per_proc=8192
 +
vfs.aio.max_aio_queue=65536
 +
To check if AIO is used use: kldstat -v | grep aio
  
和printf类似,scanf也可以用%c、%f、%s等转换说明。如果在传给scanf的第一个参数中用%d、%f或%c表示读入一个整数、浮点数或字符,则第二个参数的形式应该是&运算符加一个相应类型的变量名,表示读进来的数存到这个变量中;如果在第一个参数中用%s读入一个字符串,则第二个参数应该是数组名,数组名前面不加&,因为数组类型做右值时自动转换成指针类型,而scanf后面这个参数要的就是指针类型,在第 10 章 gdb有scanf读入字符串的例子。&运算符的作用也是得到一个指针类型,这个运算符以后再详细解释。
+
Check wiki page for known issues and troubleshooting:
 +
http://wiki.freebsd.org/VirtualBox
  
留给读者的思考问题是:(man - computer + 4) % 3 - 1这个神奇的表达式是如何比较出0、1、2这三个数字在“剪刀石头布”意义上的大小的
+
Please report any problems to emulation@. Thanks!
*/
 
  
 
</pre>
 
</pre>
  
[https://wenku.baidu.com/view/55e520da5022aaea998f0f5e.html 石头剪刀布_C语言]
+
https://www.freebsd.org/doc/handbook/virtualization-host-virtualbox.html
  
https://blog.csdn.net/guoqingchun/article/details/8104197
+
https://wiki.freebsd.org/VirtualBox
  
 +
[https://blog.csdn.net/flymyd/article/details/76399861 FREENAS虚拟机Jails配置全攻略(多篇集合)]
  
===Linux下C语言获取目录中的文件列表 ===
+
== 连接win客户端==
 +
=== rdesktop===
 
<pre>
 
<pre>
/*
+
pkg -y install rdesktop
  * dir.c
+
pkg -y install tsclient
*
 
Linux下C语言获取目录中的文件列表  https://www.cnblogs.com/dgwblog/p/12158373.html
 
http://c.biancheng.net/cpp/html/1548.html  怎样使用C语言列出某个目录下的文件?
 
*  Created on: 2020年11月2日
 
  *      Author: evan
 
*/
 
#include <sys/types.h>
 
#include <dirent.h>
 
#include <unistd.h>
 
#include <stdio.h>
 
int main(){
 
DIR *dir;
 
struct  dirent *ptr;
 
dir = opendir("/home/evan/t1/");
 
while((ptr = readdir(dir)) != NULL)
 
printf("d_name:%s\n",ptr->d_name);
 
closedir(dir);
 
return 0;
 
}
 
  
 +
rdesktop是基于命令行的工具,tsclient只是一个图形化的界面,依赖于rdesktop
 +
</pre>
  
/* 结果
+
=== remmmina===
*
+
==[[远程桌面工具]]==
d_name:.
 
d_name:..
 
d_name:1.py
 
d_name:22.py
 
  
*/
+
== CAD ==
 +
  sudo pkg install freecad #0.18
 +
== email==
 +
===thunderbird===
 +
<pre>
 +
201912 现在 打开会100cpu
 +
composition—> language —Download more  就可以下载中文了
  
 +
Advanced  language  选择chinese
  
 +
代理配置
 +
高级 —网络 —连接
 
</pre>
 
</pre>
 +
[https://jingyan.baidu.com/article/cdddd41cac326353cb00e129.html Thunderbird设置IRC聊天]
 +
 +
[[Thunderbird]]
  
=排序与查找=
+
==server ==
==插入排序 ==
+
===redis===
 
<pre>
 
<pre>
#include <stdio.h>
+
#redis 3.x compli
#define LEN 5
+
gmaek -j2 && sudo gmake  install
int a[LEN] = { 10, 5, 2, 4, 7 };
+
 
void insertion_sort(void)
+
/usr/local/bin/redis-server
{
+
 
int i, j, key;
+
#自启动
for (j = 1; j < LEN; ++j) {
+
cat  /etc/rc.local
printf("%d, %d, %d, %d, %d\n",
+
/usr/local/bin/redis-server > /dev/null 
      a[0], a[1], a[2], a[3], a[4]);
+
 
key = a[j];  //key 标记为未排序的第一个元素
+
#这个不行 Ambiguous output redirect
i = j - 1;
+
/usr/local/bin/redis-server > /dev/null  2 > &1
                // key  与已排序元素从大到小比较,寻找key应插入的元素 a[i+1]一般就是key 起初的值
+
 
////采用顺序查找方式找到插入的位置,在查找的同时,将数组中的元素进行后移操作,给插入元素腾出空间 ?
+
or
 +
/usr/local/etc/rc.d下面放你的脚本
 +
 
 +
 
 +
 
 +
 
 +
cd /usr/ports/databases/redis
 +
make
 +
/usr/local/etc/rc.d/redis start
 +
/usr/local/bin/redis-cli
 +
 
 +
 
  
while (i >= 0 && a[i] > key) {
 
a[i+1] = a[i];
 
--i; //跳出while
 
}
 
a[i+1] = key; ////插入到正确位置
 
}
 
printf("%d, %d, %d, %d, %d\n",
 
      a[0], a[1], a[2], a[3], a[4]);
 
}
 
int main(void)
 
{
 
insertion_sort();
 
return 0;
 
}
 
/* 就是key 一直和前面排好的比,找到正确的位置
 
10, 5, 2, 4, 7
 
5, 10, 2, 4, 7
 
2, 5, 10, 4, 7
 
2, 4, 5, 10, 7
 
2, 4, 5, 7, 10 */
 
 
</pre>
 
</pre>
 +
[https://www.cnblogs.com/1q84/archive/2011/12/18/2291840.html FreeBSD下安装redis以及redis_py]
 +
 +
====docker====
 +
https://wiki.freebsd.org/Docker
 +
 +
https://www.oschina.net/p/docker-freebsd
 +
 +
=== 参考===
 +
https://www.c0ffee.net/blog/freebsd-on-a-laptop/
  
 +
[https://feng.si/posts/2019/06/freebsd-and-risc-v-the-future-of-open-source-iot-ecosystem/ FreeBSD 与 RISC-V: 开源物联网生态系统的未来]
  
===算法的时间复杂度分析===
+
https://wiki.freebsdchina.org/software/a/awesome
则总的执行时间粗略估计是(n-1)*(c1+c2+c5+m*(c3+c4))。 #怎么来的呢  线性函数  不记得了 要补一下
 
  
[https://blog.csdn.net/qq_25775935/article/details/88724130 插入排序算法及C语言实现]
+
[https://wiki.freebsdchina.org/doc/d/freebsd_desktop 使用FreeBSD作为桌面操作系统]
  
  
==11.4 归并排序==
+
[http://bbs.chinaunix.net/thread-1780047-1-1.html FreeBSD 桌面系统常用软件清单]
递归实现 归并排序
 
  
 +
[https://blog.csdn.net/u011152627/article/details/77744795 FreeBSD 配置经验]
  
 +
[https://wiki.freebsdchina.org/doc/x/freebsd_desktop_xfce FreeBSD桌面-Xfce4]
  
 +
[https://wiki.freebsdchina.org/doc/p/freebsd_desktop_kde FreeBSD 7 Xorg7.3 KDE3.5 桌面系统安装及美化]
  
===see also===
+
[https://huataihuang.gitbooks.io/cloud-atlas/os/freebsd/ gitbooks.io freebsd]
  
 +
[https://www.freebsd.org/doc/en/books/developers-handbook/index.html FreeBSD Developers' Handbook]
  
还有下一节 ?
+
[https://www.freebsd.org/doc/en/books/developers-handbook/emacs.html ecmacs]
  
[https://www.bilibili.com/video/av73101599?from=search&seid=6748303640916868853 4-5 通过归并排序算法深入理解递归]
+
[http://blog.163.com/sujoe_2006/blog/static/3353151201211431245305/ Freebsd 9.0+LXDE桌面安装]
  
  
非递归
 
https://blog.csdn.net/zjy900507/article/details/80530336
 
  
=chapter 12 栈与队列=
+
[https://www.cnblogs.com/yibinboy/articles/1818638.html FreeBSD笔记常用命令]
==堆栈==
 
http://docs.linuxtone.org/ebooks/C&CPP/c/ch12s02.html
 
==3. 深度优先搜索 ==
 
未看
 
http://akaedu.github.io/book/ch12s03.html
 
  
 +
[http://www.2daygeek.com/install-xfce-mate-kde-gnome-cinnamon-desktop-environment-on-freebsd/ Choose the best Desktop for FreeBSD]
  
=第 13 章 计算机中数的表示=
+
https://cooltrainer.org/a-freebsd-desktop-howto/
==1. 为什么计算机用二进制计数==
 
  
=第 14 章 计算机中数的表示=
 
  
[http://c.biancheng.net/cpp/html/437.html c语言基本数据类型short、int、long、char、float、double]
+
[https://www.linuxprobe.com/remmina-linux.html 如何使用Remmina从 Linux 上连接到远程桌面]
  
[https://www.cnblogs.com/luofay/p/6070613.html  C语言的基本数据类型 ]
 
  
 +
[https://www.freebsdchina.org/forum/viewtopic.php?t=62967 配置FreeBSD 10.0(amd64)fvwm桌面]
  
[https://www.php.cn/csharp-article-443107.html c语言char是什么意思]
+
[https://blog.csdn.net/xport/article/details/500161 安装远程桌面,VNC Server on FreeBSD + VNC Viewer on Windows ]
== 二进制制转十进制==
+
 
 +
== 截图==
 +
===flameshot===
 +
<pre>pkg install flameshot
 +
 
 +
#conf
 +
vi ~/.cshrc
 +
alias flameshot  flameshot  gui
 +
 
 +
source ~/.cshrc
 +
</pre>
 +
[https://linux265.com/soft/3848.html Flameshot - 截图工具]
 +
 
 +
==下载==
 +
[[下载工具]]
 +
uget
 +
 
 +
==图形==
 +
  gimp screenfetch
 +
 
 +
==development ide==
 +
 
 +
[[Eclipse]]
 +
 
 +
  sudo pkg install devel/liteide
 +
 
 +
==mysql==
 
<pre>
 
<pre>
在 C 语言中, signed char 类型的范围为 -128~127,每本教科书上也这么写,但是没有哪一本书上(包括老师)也不会给你为什么是 -128~127,这个问题貌似看起来也很简单容易, 以至于不用去思考为什么,不是有一个整型范围的公式吗:  -2^(n-1)~2^(n-1)-1 (n为整型的内存占用位数),所以 int 类型 32 位那么就是 -(2^31) ~ 2^31-1 即 -2147483648~2147483647,但是为什么最小负数绝对值总比最大正数多 1 ,这个问题甚至有的工作几年的程序员都模棱两可,因为没有深入思考过,只知道书上这么写。于是,我不得不深入思考一下这个被许多人忽视的问题。
+
Message from mysql57-server-5.7.27:
 +
*****************************************************************************
 +
 
 +
Remember to run mysql_upgrade the first time you start the MySQL server
 +
after an upgrade from an earlier version.
 +
 
 +
Initial password for first time use of MySQL is saved in $HOME/.mysql_secret
 +
ie. when you want to use "mysql -u root -p" first you should see password
 +
in /root/.mysql_secret
 +
 
 +
MySQL57 has a default %%ETCDIR%%/my.cnf,
 +
remember to replace it wit your own
 +
or set `mysql_optfile="$YOUR_CNF_FILE` in rc.conf.
 +
 
 +
*****************************************************************************
 +
Message from akonadi-19.04.2_1:
 +
 
 +
===============================================================================
 +
 
 +
KDE Applications versions of Akonadi, KMail, and Kontact use large
 +
messages on the local machine. The default size on FreeBSD is too
 +
small, which causes local connection problems, and Akonadi-based
 +
applications will be flaky (e.g. mailboxes do not display, messages
 +
cannot be found). Increasing the buffer size is recommended:
  
对于无符号整数,很简单,全部位都表示数值,比如 char 型,8位,用二进制表示为 0000 0000 ~ 1111 1111,1111 1111 最大即为十进制255,所以 unsigned char 的范围为 0~ 255,在这里普及一下 2 进制转十进制的方法, 二进制每一位的数值乘以它的位权(2^(n-1),n为自右向左的位),再相加,可得到十进制数,比如 :1111 1111 = 1*2^7 + 1*2^6 + 1*2^5 + 1*2^4 + 1*2^3 + 1*2^2 + 1*2^1 + 1*2^0 = 255 。
+
sysctl net.local.stream.recvspace=65536
 +
sysctl net.local.stream.sendspace=65536
  
 +
===============================================================================
  
但是对于有符号整数,二进制的最高位表示正负,不表示数值,最高位为 0 时表示正数,为 1 时表示负数,这样一来,能表示数值的就剩下( n-1 )位了,
+
</pre>
比如 char a = -1;  那么二进制表示就为 1 0000001,1 表示为 0 0000001,所以 signed char 型除去符号位剩下的 7 位最大为 1111 111 = 127,再把符号加上,0 1111111 = 127,1 1111111 = -127,范围应该为 -127~127 ,同理 int 类型也一样,但是问题出来了,教科书上是 -128~127 啊,下面就剖析一下这个惊人的奇葩。 加上反码 看到这里
 
  
 +
==视频编辑==
 +
[https://www.linuxdashen.com/kdenlive%ef%bc%8d-linux%e7%b3%bb%e7%bb%9f%e4%b8%8a%e6%9c%80%e5%bc%ba%e8%a7%86%e9%a2%91%e7%bc%96%e8%be%91%e5%99%a8%ef%bc%8c%e6%b2%a1%e6%9c%89%e4%b9%8b%e4%b8%80%ef%bc%81 Kdenlive- Linux系统上最强视频编辑器]
 +
==有用的==
 +
<pre>
 +
启用、安装linxu内核。
 +
#kldload linux
 +
#ee /etc/rc.conf
 +
linux_enable=”YES”
 +
#cd /usr/ports/www/linux_base-f10 && make install clean
 +
先安装linux的flash10插件
 +
cd /usr/ports/www/linux-f10-flashplugin10
 +
make install clean (这一步会把libflashplayer.so安装在/usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so)
 +
再安装nspluginwrapper
 +
cd /usr/ports/www/nspluginwrapper
 +
make install clean
 +
兼容转换
 +
nspluginwrapper -v -i /usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so(这一步会在/usr/local/lib/browser_plugins/ 下生成能在freebsd下使用的npwrapper.libflashplayer.so文件 )
 +
最后把插件链接到chromium插件目录下
 +
ln -s /usr/local/lib/browser_plugins/npwrapper.libflashplayer.so /usr/local/share/chromium/plugins/
 +
与此同时firefox也可以进行视频播放了,如果还不可以,可以到网上去看看其他教程.
  
再普及一下计算机内部整数存储形式,大家都知道计算机内部是以二进制来存贮数值的,无符号整数会用全部为来存储,有符号的整数,最高位当做符号位 ,其余为表示数值。
 
 
</pre>
 
</pre>
  
=第 17 章=
+
==old输入法==
==3. 设备==
 
http://akaedu.github.io/book/ch17s03.html
 
  
=4. MMU=
+
[https://www.xuebuyuan.com/1982862.html FreeBSD 下安装输入法]
按照离CPU由近到远的顺序依次是CPU寄存器、Cache、内存、硬盘,越靠近CPU的存储器容量越小但访问速度越快
 
http://akaedu.github.io/book/ch17s04.html
 
  
=Memory Hierarchy=
+
[https://blog.csdn.net/cheviko/article/details/17628425 FreeBSD安装汉字输入法:SCIM]
http://akaedu.github.io/book/ch17s05.html
 
  
=附录 A. 字符编码=
+
[https://www.freebsdchina.org/forum/viewtopic.php?p=177278 如何配置scim(或skim)]
20191112
 
  字符编码的高位 左边是也
 
  
=如何学习c=
+
[https://wiki.archlinux.org/index.php/IBus_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87) IBus (简体中文)]
  
== mongoose 开源http库==
 
有空学习这个作为C的入门例子
 
  
Mongoose是一个用C编写的网络库。它为客户端和服务器模式实现TCP,UDP,HTTP,WebSocket,CoAP,MQTT的事件驱动的非阻塞API。
+
[https://www.freshports.org/chinese/ibus-table-chinese/ ibus-table-chinese Chinese input tables for IBus]
[https://www.cnblogs.com/gardenofhu/p/6961343.html  mongoose 开源http库 ]
 
  
[https://www.cnblogs.com/lifan3a/articles/7478295.html  Mongoose 利用实现HTTP服务 ]
+
==== other====
=funciton=
 
==strcmp  ==
 
 
<pre>
 
<pre>
C/C++函数,比较两个字符串
 
  
strcmp函数是string compare(字符串比较)的缩写,用于比较两个字符串并根据比较结果返回整数
 
  
设这两个字符串为str1,str2,
 
  
若str1==str2,则返回零;
+
sed -i '' -e 's/memorylocked=128M/memorylocked=256M/' /etc/login.conf
 +
# cap_mkdb /etc/login.conf
 +
 
 +
 
 +
 
 +
Remember to set the environment variable XMODIFIERS:
 +
 
 +
csh/tcsh: setenv XMODIFIERS @im=fcitx
 +
sh/bash: export XMODIFIERS='@im=fcitx'
 +
 
 +
For GTK+ programs, you may want to set:
 +
 
 +
csh/tcsh: setenv GTK_IM_MODULE fcitx
 +
setenv GTK3_IM_MODULE fcitx
 +
sh/bash: export GTK_IM_MODULE=fcitx
 +
export GTK3_IM_MODULE=fcitx
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
For Qt4 programs, we recommend you to use
 +
 
 +
qtconfig-qt4: /usr/ports/misc/qt4-qtconfig
 +
 
 +
instead of to manually set QT4_IM_MODULE.
 +
 
 +
To start fcitx with your desktop, just
 +
 
 +
cp /usr/local/share/applications/fcitx.desktop \
 +
    ~/.config/autostart/
 +
 
 +
************************************************************************
 +
Message from zh-fcitx-ui-light-0.1.3_2:
 +
 
 +
************************************************************************
 +
 
 +
Replace your `fcitx` command with
 +
fcitx -u fcitx-light-ui
 +
to start Fcitx with this lightweight UI.
 +
 
 +
</pre>
 +
<pre>0.
 +
#添加到管理员组
 +
pw groupmod wheel -m evan
 +
 
 +
#enable ssh
 +
sysrc 'sshd_enable=YES'
 +
 
 +
 
 +
cat  /etc/rc.conf
 +
zfs_enable="YES"
 +
hostname="digitalocean"
 +
ifconfig_vtnet0="dhcp"
 +
sshd_enable="YES"
 +
nginx_enable="YES"
 +
php_fpm_enable="YES"
 +
mysql_enable="YES"
 +
redis_enable="YES"
 +
shadowsocks_libev_enable="YES"
 +
 
 +
 
 +
 
 +
# set time
 +
ntpdate cn.pool.ntp.org
 +
 
 +
#添加新硬盘到 home 给evan 使用
 +
 
  
若str1<str2,则返回负数;
 
  
若str1>str2,则返回正数。
 
 
</pre>
 
</pre>
[https://baike.baidu.com/item/strcmp/5495571 strcmp]
 
  
https://baike.so.com/doc/61175-64376.html
 
==C library function - remove()==
 
 
<pre>
 
<pre>
/*
+
fstab
* remvoe.c
+
evan@homebsd:~/kalibak % cat /etc/fstab
*
+
# Device Mountpoint FStype Options Dump Pass#
*  Created on: 2020年11月30日
+
/dev/ada0p1 none swap sw 0 0
*      Author: evan
+
/dev/ada0p3 / ufs rw 1 1
*/
+
/dev/ada0p4 /home ufs rw 2 2
#include <stdio.h>
+
proc /proc procfs rw 0 0
#include<string.h>
+
 
 +
 
 +
Display manager
 +
https://wiki.archlinux.org/index.php/Display_manager_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
 +
 
 +
FreeBSD从入门到放弃
 +
https://linxiaohui.gitbooks.io/notes-on-freebsd/content/
 +
 
 +
 
 +
 
 +
Tencent QQ (简体中文)
 +
https://wiki.archlinux.org/index.php/Tencent_QQ_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)#.E5.9F.BA.E4.BA.8E_WebQQ
 +
 
 +
 
 +
Installing a Desktop Environment on FreeBSD
 +
https://www.freebsdfoundation.org/freebsd/how-to-guides/installing-a-desktop-environment-on-freebsd/#!
 +
 
 +
 
 +
How to Install FreeBSD 10.2 with Mate Desktop
 +
http://linoxide.com/linux-how-to/install-freebsd-10-2-mate-desktop/
 +
 
 +
 
 +
https://wiki.lxde.org/en/FreeBSD
 +
 
 +
Installing Mate desktop on FreeBSD 11
 +
http://www.vpierre.it/installing-mate-desktop-on-freebsd-11/
 +
 
 +
fetch 获取数据
 +
extract 释放全部ports
 +
update 更新ports
 +
第一次使用可以 portsnap fetch extract
 +
以后使用可以 portsnap fetch update
 +
portsnap  extract;  portsnap update
 +
 
 +
如果写在cron可以用 portsnap cron update
 +
 
 +
FreeBSD 简明用户指南
 +
install gnome3  kde4 xfce etc
 +
https://www.freebsd.org/doc/handbook/x11-wm.html
  
int main() {
+
Browsers
int ret;
+
https://www.freebsd.org/doc/handbook/desktop-browsers.html
FILE *fp;
+
pkg install firefox
char filename[] = "file.txt";  // 这个是什么意思  定义一个 数组 ? 是的 
+
pkg install swfdec-plugin
  
fp = fopen(filename,"w");
 
  
fprintf(fp,"%s", "THis is tutor \n");
+
MP3 Audio
fprintf(fp,"%s", "ln2 THis is tutor");
+
https://www.freebsd.org/doc/handbook/sound-mp3.html
fclose(fp);
 
  
//ret = remove(filename);
+
https://bsdelf.github.io/posts/freebsd-brief-user-guide
/*
 
cat file.txt
 
THis is tutor*/
 
  
if(ret == 0) {
+
https://huataihuang.gitbooks.io/cloud-atlas/content/os/freebsd/packages_and_ports.html
printf("file deleted successfully");
 
}else {
 
printf("Error: unable to delte the file");
 
}
 
return(0);
 
  
}
+
https://antumdeluge.wordpress.com/2014/07/19/how-to-install-freebsd/
 +
 
 +
FreeBSD简单汉化终结篇[基于core font的汉化]
 +
http://bbs.watchstor.com/thread-274706-1-1.html
 +
 
 +
**********************
 +
 
 +
 
 +
安装Firefox的多国语言包
 +
#pkg install firefox35-i18n
 +
 
 +
你太善良》是香港歌手张智霖,
 +
张惠妹 放开你的头脑
 +
 
 +
 
 +
就两个文件 另外一个freebsd10 4 desktop
 +
 
 +
program/kindlereader
 +
 
 +
 
 +
Official Mirrors
 +
https://www.freebsd.org/doc/handbook/eresources-web.html
 +
 +
SERVERNAME=portsnap.FreeBSD.org
 +
SERVERNAME=portsnap.cn.FreeBSD.org
 +
 
 +
portsnap fetch extract
 +
 
 +
 
 +
 
 +
桌面相关的官方文档
 +
https://www.freebsd.org/doc/handbook/x11-wm.html
 +
 
 +
echo 'exec enlightenment_start'  >> ~/.xinitrc
 +
 
 +
##xfce  这个也是成功了 字体好看  不过是英文的呢喃 加上汉化的就行了
 +
pkg install xfce
 +
 +
#昨天今天就是少了这一步 看来要多提高英文水平哦
 +
Unlike GNOME or KDE, Xfce does not provide its own login manager. In order to start Xfce from the command line by typing startx, first add its entry to ~/.xinitrc:
 +
 
 +
% echo "exec /usr/local/bin/startxfce4 --with-ck-launch" > ~/.xinitrc
 +
 +
 
 +
##gnome3
 +
 
 +
pkg install gnome3  vlc
 +
 
 +
have gdm can not add this
 +
#echo 'exec gnome-session'  >> ~/.xinitrc
 +
 
 +
 
 +
http://blog.linuxchina.net/?p=993
 +
 
 +
https://www.freebsd.org/doc/handbook/x11-wm.html
 +
https://antumdeluge.wordpress.com/2014/07/19/how-to-install-freebsd/
 +
 
 +
https://forums.freebsd.org/threads/57329/
 +
 
 +
Installing Mate desktop on FreeBSD 11
 +
http://www.vpierre.it/installing-mate-desktop-on-freebsd-11/</pre>
 +
 
 +
=ops=
 +
在bsd上直接叫 md5  linux上是md5sum
 +
https://www.freebsd.org/cgi/man.cgi?query=md5&apropos=0&sektion=0&manpath=FreeBSD+11.1-RELEASE&arch=default&format=html
 +
 
 +
==firewall==
 +
<pre>
 +
    防火墙。Linux中使用iptables来做防火墙,不过那个太复杂了,我一般使用 ufw。 FreeBSD中可以使用 ipfw 来管理防火墙,它的用法和ufw差不多:
 +
 
 +
$ ipfw add allow tcp from any to me 22 in via $ext_if
 +
</pre>
  
 +
=优化=
 +
<pre>
  
 +
sendmail_enable="NONE"
 
</pre>
 
</pre>
  
== C语言perror函数的作用 ==
+
==old ==        
 
<pre>
 
<pre>
 不可以掉了这个头文件,perror是包含在这个文件里的//编辑本段perror表头文件完善版定义函数
 
  void perror(const char *s); perror ("open_port");
 
函数说明
 
  perror ( )用 来 将 上 一 个 函 数 发 生 错 误 的 原 因 输 出 到 标 准 设备 (stderr) 。参数 s 所指的字符串会先打印出,后面再加上错误原因字符串。此错误原因依照全局变量errno 的值来决定要输出的字符串。   在库函数中有个errno变量,每个errno值对应着以字符串表示的错误类型。当你调用"某些"函数出错时,该函数已经重新设置了errno的值。perror函数只是将你输入的一些信息和现在的errno所对应的错误一起输出。
 
  
void perror(const char *str)
+
###fvwm
 +
FreeBSD汉化+FVWM
 +
http://zqscm.qiniucdn.com/data/20090728100241/index.html
 +
 
 +
1 中文环境
 +
  pkg_add -r zh-auto-ch-l10n
 +
  这个命令好像作了不少事情,我忘记是否下载了wenquanyi字体,没有的话,再手动来一遍
 +
 pkg_add -r wqy
 +
  下边的不知道是不是必须的
 +
  在设置好xorg.conf中fontpath的前题下,执行
 +
  fc-cache -fv,让系统加入wqy字体
 +
  输入法如果没下载的话,可以
 +
 pkg_add -r fcitx,我是用五笔的
 +
 然后,配置中文的locale
  
参数
 
  
    str -- 这是 C 字符串,包含了一个自定义消息,将显示在原本的错误消息之前
+
  在~/.chsrc里,增加
 +
 setenv LANG zh_CN.eucCN
 +
  setenv LC_CTYPE zh_CN.eucCN
 +
setenv LC_ALL zh_CN.eucCN
 +
  上边是中文local,lc_all好像不是必须要设置的
 +
 下边设置输入法
 +
  setenv XMODIFIERS @im=fcitx
  
#include <stdio.h>   
+
2 fvwm,这个东西小快,够用了
int main(void)   
+
  pkg_add -r fvwm
{   
 
FILE *fp ;   
 
fp = fopen( "/root/noexitfile", "r+" );   
 
if ( NULL == fp )  ?
 
{   
 
perror("/root/noexitfile");   //下面有这个输出
 
}   
 
return 0;   
 
}
 
  
运行结果
+
3 使用fvwm作为桌面
[root@localhost io]# gcc perror.c   
+
  在~下,找一下有没有.xinitrc文件,没有就搞一个出来
[root@localhost io]# ./a.out   
+
  内容是
/root/noexitfile: No such file or directory
+
  exec fvwm
 +
  如果要输入法也一并启动则为
 +
  fcitx&
 +
    exec fvwm
  
 
</pre>
 
</pre>
 +
 +
=Troubleshooting=
 +
<pre>
 +
 +
随便更新了一下firefox 70 现在总算可以了 以后少更新点
 +
 +
 +
terminator 启动不了
 +
Traceback (most recent call last):
 +
  File "/usr/local/bin/terminator", line 83, in <module>
 +
    from terminatorlib import ipc
 +
  File "/usr/local/lib/python2.7/site-packages/terminatorlib/ipc.py", line 31, in <module>
 +
    class DBusService(Borg, dbus.service.Object):
 +
  File "/usr/local/lib/python2.7/site-packages/terminatorlib/ipc.py", line 62, in DBusService
 +
    @dbus.service.method(BUS_NAME, in_signature='a{ss}')
 +
  File "/usr/local/lib/python2.7/site-packages/dbus/decorators.py", line 155, in method
 +
    validate_interface_name(dbus_interface)
 +
ValueError: Invalid interface or error name 'net.tenshu.Terminator2-0x3bc8d9c28d7f7322': contains invalid character '-'   
 +
 +
terminator  -u  这样启动就行了
 +
 +
 +
telegram 等等有关qt的都用不了  firefox70 也好了
 +
Cannot mix incompatible Qt library (version ) with this library (version )
 +
 +
pkg install qt5-core
 +
 +
pkg update -f
 +
pkg update
 +
pkg upgrade
 +
  
  
  
[https://blog.csdn.net/ypist/article/details/7886209  linux下 C语言perror函数的作用]
+
telegram-desktop
 +
ld-elf.so.1: /usr/local/lib/qt5/libQt5Core.so.5: version Qt_5.13 required by /usr/local/bin/telegram-desktop not found
 +
root@bsd-latop:~ # pkg install qt5
 +
root@bsd-latop:~ # telegram-desktop
 +
ld-elf.so.1: /usr/local/lib/qt5/libQt5Core.so.5: version Qt_5.13 required by /usr/local/bin/telegram-desktop not found
 +
root@bsd-latop:~ # file /usr/local/lib/qt5/libQt5Core.so.5
 +
/usr/local/lib/qt5/libQt5Core.so.5: symbolic link to libQt5Core.so.5.12.2
  
https://www.cnblogs.com/yujianfei/p/8973867.html
 
  
https://www.runoob.com/cprogramming/c-function-perror.html
 
  
  
==c语言实现rm命令 or 删除==
 
<pre>
 
头文件:#include <stdio.h>
 
  
remove()函数用于删除指定的文件,其原型如下:
+
pkg: cached package *:size mismatch, cannot continue
    int remove(char * filename);
+
 
 +
pkg update -f
 +
 
 +
 
 +
 
 +
 
  
【参数】filename为要删除的文件名,可以为一目录。如果参数filename 为一文件,则调用unlink()处理;若参数filename 为一目录,则调用rmdir()来处理。
 
  
【返回值】成功则返回0,失败则返回-1,错误原因存于errno。
 
 
</pre>
 
</pre>
  
[https://blog.csdn.net/teleger/article/details/80537229?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.pc_relevant_is_cache&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.pc_relevant_is_cache  C语言remove()函数:删除文件或目录]
+
https://unix.stackexchange.com/questions/384396/terminator-fails-to-start-in-i686-dbus-issue-in-python
 +
 
 +
=zfs  nas=
 +
 
 +
ZFS 依赖可靠的内存,装在个人机器上直接用ufs. ZFS不适合
  
[https://blog.csdn.net/piaoliangjinjin/article/details/80707139?utm_medium=distribute.pc_relevant.none-task-blog-title-7&spm=1001.2101.3001.4242  linux下实现rm()函数删除文件或目录]
+
从12.0开始,FreeNAS将改名为TrueNAS Core。
  
[https://blog.csdn.net/qq_38074673/article/details/98047329  c语言实现rm命令,删除指定文件或目录]
+
同时,zfs创建以后,zpool里面直接创建块设备用zfs create 就可以解决了,那么在/dev/zvol/xxx路径上就会产生一个块设备,其实会关联到一个/dev/zd16类似这样的名称的设备上,但是前者不会盘符漂移,后者会,因此使用的时候多注意一点。还有就是zfs做配额管理这些也非常方便,可以看看oracle的介绍吧。
  
==C语言access()函数:判断是否具有存取文件的权限==
+
https://www.freebsd.org/doc/zh_CN/books/handbook/filesystems-zfs.html
  
 +
[https://zhuanlan.zhihu.com/p/62933164 打造家用NAS之六(2019年版)ZFS介绍]
  
[http://c.biancheng.net/cpp/html/303.html C语言access()函数:判断是否具有存取文件的权限]
+
[https://www.cnblogs.com/pipci/p/10180366.html 初学者指南:ZFS 是什么,为什么要使用 ZFS]
  
[https://blog.csdn.net/eager7/article/details/8131169  C语言中access函数]
+
=see also=
 +
www.midnightbsd.org
  
[https://www.runoob.com/cprogramming/c-arrays.html C 数组]
+
[http://www.chinafreebsd.cn/article/59da60970cb81 FreeBSD系统配置 chinafreebsd]
  
 +
[https://linuxtoy.org/pages/download.html  Linux 相关资料]
  
=进阶=
+
[https://www.lulinux.com/archives/5557 Linux桌面常用软件列表 (2019]
==十个经典的C开源项目代码==
 
[https://blog.51cto.com/chinalx1/2143904 十个经典的C开源项目代码]
 
  
 +
                   
 +
[https://www.cnblogs.com/dcb3688/p/4607976.html linux下几个常用软件]
 +
[https://www.cnblogs.com/arxive/p/6057603.html 100款开源软件]
  
=2021=
+
[https://linux.cn/article-8050-1.html 24 款必备的 Linux 桌面应用(2016 版)]
  
 +
http://www.chinafreebsd.cn/article/59da3fa39561e
  
[https://www.cnblogs.com/wucongzhou/p/12498740.html#%E4%B8%80%E3%80%81%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E5%B7%A5%E4%BD%9C%E7%9B%AE%E5%BD%95 C语言目录操作]
+
[https://blog.csdn.net/xiao_wanpeng/article/category/1134819 csdn freebsd blog]
  
[http://www.freecplus.net C语言技术网]
+
[http://bbs.chinaunix.net/thread-3769209-1-1.html [FreeBSD<nowiki>]</nowiki> 选择 FreeBSD 六个理由]
  
[https://www.cnblogs.com/qigaohua/p/5838263.html      博客园  C语言中关于对目录的操作 ]
+
[https://zhuanlan.zhihu.com/p/87544910 给Linux用户的FreeBSD快速指南]
  
=书=
+
[https://blog.csdn.net/striker/article/details/5270856  Freebsd下常用软件介绍]
[https://www.codetd.com/article/2162329 《Linux环境C程序设计(第2版)徐诚》pdf 附下载链接]
 
  
http://www.txtepub.com/105693.html
+
[http://www.bsdart.org/freebsd-%e4%b8%8b%e5%8f%8c%e6%98%be%e7%a4%ba%e5%99%a8%e7%9a%84%e8%ae%be%e7%bd%ae/  FreeBSD 下双显示器的设置]
  
=see also=
+
freenas Mount ext4 partition
[https://wiki.ubuntu.com.cn/C%E8%AF%AD%E8%A8%80%E7%AE%80%E8%A6%81%E8%AF%AD%E6%B3%95%E6%8C%87%E5%8D%97 C语言简要语法指南]
+
http://blog.linuxchina.net/?p=1782
 +
 
 +
linux: mount UFS filesystem
 +
http://blog.linuxchina.net/?p=1776
 +
 
 +
Linux® 用户的 FreeBSD 快速入门向导
 +
https://www.freebsd.org/doc/zh_CN/articles/linux-users/index.html
 +
 
 +
 
 +
https://freebsdchina.org/forum/topic_63558.html
 +
 
 +
https://www.enlightenment.org/distros/freebsd-start
 +
 
 +
https://www.freebsd.org/doc/zh_CN.UTF-8/books/handbook/updating-upgrading-portsnap.html
  
https://wiki.ubuntu.com.cn/Compiling_C
+
https://www.trueos.org/handbook/preinstall.html
  
[https://wiki.ubuntu.com.cn/Gcchowto Gcc-howto]
+
[https://www.cnblogs.com/linux-xsj/p/7089069.html Linux下远程桌面连接windows]
  
=c++=
+
[https://blog.csdn.net/weixin_30814319/article/details/97236112#sec-20 fvwm 下相关软件]
  
[https://zh.wikipedia.org/wiki/C%2B%2B c++ zh.wikipedia.org]
+
[https://zhuanlan.zhihu.com/p/87544910 给Linux用户的FreeBSD快速指南]
  
https://isocpp.org/
+
 [[category:freebsd]]
[[category:c]]
 

2021年4月14日 (三) 03:14的版本

目录

用户需知

Absolute BSD

因此对于FreeBSD用户,需要根据情况选择使用不同的版本。对于正式使用,应该选择stable版本,而对于进行学习、研究、开发FreeBSD,可以考虑使用current版本。

如何升级 current版本呢

FreeBSD入门概论

freebsd 有这么强悍呢?能做什么呢?

FreeBSD 12.2-RELEASE Installation Instructions

freebsd13 download

Tip:
#xps上写入U盘
sudo dd if=FreeBSD-12.2-RELEASE-amd64-memstick.img of=/dev/sda bs=1M conv=sync

https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/13.0/FreeBSD-13.0-RELEASE-amd64-memstick.img

https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.2/FreeBSD-12.2-RELEASE-amd64-memstick.img

注意    wget -c https://mirrors.aliyun.com/freebsd/releases/ISO-IMAGES/12.2/FreeBSD-12.2-RELEASE-amd64-memstick.img.xz && xz -d   FreeBSD-12.2-RELEASE-amd64-memstick.img.xz
这次 sha512sum FreeBSD-12.2-RELEASE-amd64-memstick.img 才是对的 一开始下载的 img文件校验不对 注意国内的下载 


https://mirrors.aliyun.com/freebsd/releases/ISO-IMAGES/12.2/
#写入U盘
 dd if=/path/to/downloaded.iso of=/dev/rdiskN bs=1m



Invite evan into other groups?  wheel

 FreeBSD12

 如果是有兴趣,要有进步的 直接上freebsd  

[https://www.v2ex.com/t/460137 freebsd 有这么强悍呢?能做什么呢]

今天在家成功安装了freebsd12  并连上wifi  freebsd11连不上

现在双硬盘也是成功的 1t 作为了home  昨天的安装好了 再mount硬盘居然是不行的,一开机就死了了,不过现在是GPT加bios 兼容模式
gnome3 to leav  xfce is good for use

桌面用户如何? 家里不用理 带个 freebsd latop 上班就行了 


这几天更新firefox 70 失败 用port 居然有很多软件消失了 ,例如 fcitx-qt5  liboffice

 Note: Users who prefer to install FreeBSD using a graphical installer may be interested in FuryBSD, GhostBSD or MidnightBSD.

整个项目全挂了 202011.1 如果你读过我的TrueOS 评论并且有兴趣尝试使用桌面 BSD 或已经使用 TrueOS,请不要担心(这对于生活来说也是一个很好的建议)。TrueOS 的所有桌面元素都将剥离到 Project Trident。目前,Project Trident 网站的细节不多。他们仿佛还在进行剥离的幕后工作。 如果你目前拥有 TrueOS,则无需担心迁移。TrueOS 团队表示,“对于那些希望迁移到其他基于 FreeBSD 的发行版,如 Project Trident 或 GhostBSD 的人而言将会有迁移方式。 TrueOS不再想要成为“桌面 BSD”了


TW的文档是新式,天朝的太老了 https://www.freebsd.org/doc/zh_TW.UTF-8/books/handbook/index.html

FuryBSD 12.1 简体中文(汉化)桌面,启用 ipfw 防火墙,简体中文输入法设置方法,

双系统

Install FreeBSD 10 in UEFI Mode (Dual Boot Windows 8/8.1/10)

https://wiki.archlinux.org/index.php/REFInd_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

freebsd12 on elitebook 问题 后来解决了2020

U盘子 delete-> f9->USB -

1. 中文输入法老是调不出来 无论是fcitx ibus scim

2. lxqt 界面 会假死,虽然在远程还可以ssh

laptop

https://wiki.freebsd.org/Laptops

furybsd停止了啦

login gropu is evan          wheel


home is  /usr/home/evan

nomadbsd

https://nomadbsd.org/download.html

Linux

# lzma -d nomadbsd-x.y.z.img.lzma
# dd bs=1M if=nomadbsd-x.y.z.img of=/dev/sdX conv=fsync

or

# xzcat nomadbsd-x.y.z.img.lzma | dd of=/dev/sdX bs=1M

FreeBSD

# lzma -d nomadbsd-x.y.z.img.lzma
# dd if=nomadbsd-x.y.z.img of=/dev/daX bs=1m

or

# xzcat nomadbsd-x.y.z.img.lzma | dd of=/dev/daX bs=1m


Installing Linux® packages

Before you can install Linux® packages it is necessary to enable Linux® binary compatibility. Let's say you want to install linux-sublime you can proceed as follows:

# kldload linux
# sysrc linux_enable=YES
# pkg install linux-sublime

https://rufus.ie/

https://www.freebsd.org/doc/handbook/linuxemu-lbc-install.html

pre-configure

Pkg源地址更换为USTC:

官方源配置是 /etc/pkg/FreeBSD.conf ,请先检查该文件内容。注意其中的 url 参数配置了官方仓库的地址,我们需要把它替换为镜像站的地址。 该配置文件是 FreeBSD 基本系统的一部分,会随着 freebsd-update 更新,请不要直接修改,而是创建 /usr/local/etc/pkg/repos/FreeBSD.conf 覆盖配置,文件内容如下:

FreeBSD: {
url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",
}
如果要使用滚动更新的 latest 仓库,把 url 配置最后的 quarterly 换成 latest 即可。 修改配置后,运行 pkg update -f 更新索引。

更新

更新。FreeBSD和Linux中更新的不同之处在于,内核和软件包是分开更新的,
内核使用 freebsd-update 更新,
而软件包使用 pkg upgrade 更新。

常用命令。
        安装软件:sudo pkg install xxx
        安装本地包:sudo pkg add ./xxx
        列出安装的包:sudo pkg info
        列出设备:sudo pciconf -l
        列出内核模块:sudo kldstat

configure start

0基本系统已安装 没有gui

安装freebsd

freebsd 添加用户

字体

cd /usr/ports/x11-fonts/wqy
make install clean
#没有字体 显示中文时为乱码

编辑/usr/local/etc/fonts/conf.d/85-wqy.conf这个文件,找到下面这两行( 现在不是这二行了 应该在第99、100行):

查找  compare="less_eq"  freebsd12 有5个

<test name="size" compare="less_eq"><int>16</int></test>
<edit name="antialias" mode="assign"><bool>false</bool></edit>
把less_eq后面的int值从16改成8即可。这两行的意思是对于所有小于16号的字体都禁用抗锯齿(match居然写的target=”font”,匹配了所有字体),一个最简单的workaround就是把禁用抗锯齿的字号改小一点,8号是个不错的值,因为太小的字用抗锯齿反而会模糊。

这样字体就美美的 

https://www.librehat.com/solve-freebsd-dragonflybsd-font-antialiasing-settings-invalid-issues/ https://www.freebsdchina.org/forum/viewtopic.php?p=291166&sid=3b2dad0b46fafdb9a54757d673fef516

xorg GUI 开始

yes |pkg install xorg


pkg install xf86-video-intel​​​​​​​

pkg  install xrandr

/etc/rc.conf
hald_enable="YES"
dbus_enable="YES"


pkg install gdm   #  gnome3-lite #gnome3 有点显卡闪屏

Installing a Desktop Environment on FreeBSD

slim

pkg install -y slim-themes slim
/usr/local/etc/slim.conf
#sessiondir   /usr/local/share/xsessions
# ...
current_theme fbsd

ls  /usr/local/share/slim/themes/
archlinux-simple    fbsd                gentoo-simple       mindlock            scotland-road
capernoited         fingerprint         gnewsense           parallel-dimensions subway
debian-moreblue     flat                lake                rainbow             wave
default             flower2             lunar               rear-window         zenwalk



usage

单用户环境
要将SLiM配置为加载某个特定的环境,只需编辑~/.xinitrc 如下:

#!/bin/sh

#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
#

exec [session-command]
将[session-command]替换为适当的会话命令。例如:

exec awesome
exec dwm
exec startfluxbox
exec fvwm2
exec gnome-session
exec openbox-session
exec startkde
exec startlxde
exec startxfce4
exec enlightenment_start

https://wiki.archlinux.org/index.php/SLiM_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

https://www.c0ffee.net/blog/freebsd-on-a-laptop/#slim

xfce


pkg install xfce 

 cat .xinitrc
. /usr/local/etc/xdg/xfce4/xinitrc
#ck-launch-session /usr/local/bin/startlxqt
#exec awesome
export LC_ALL=zh_CN.UTF-8
export LANGUAGE=zh_CN.UTF-8.UTF-8
export LANG=zh_CN.UTF-8.UTF-8
#fcitx &

 cat /etc/rc.conf
hostname="bsdelite.linuxsa.org"
#wlans_iwm0="wlan0"
#ifconfig_wlan0="WPA DHCP"
sshd_enable="YES"
dbus_enable="YES"
hald_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
ifconfig_em0="DHCP"
slim_enable="yes"
defaultrouter="192.168.10.1"

fcitx wubi  在xfce 是成功的

lxqt

pkg install lxqt    # sudo pkg delete lxqt # 输入法不好用 老调不出来  放弃

https://wiki.freebsd.org/LXQt

awesome

pkg install awesome
# cp /usr/local/etc/xdg/awesome/rc.lua .config/awesome/ #这个不要,我们后面会操作的 在配置里面
echo "exec awesome" >> .xinitrc
chmod +x ~/.xinitrc

gnome

pkg install gnome3  vlc 
pkg install gnome-desktop gdm xorg gnome3

have gdm can not add this  我一开始加了这个没用 
#echo 'exec gnome-session'  >> ~/.xinitrc


root@bsd-latop:~ # cat  /etc/rc.conf
hostname="bsd-latop"

##wifi 
wlans_iwm0="wlan0"
ifconfig_wlan0="WPA DHCP"

# evan 
gnome_enable="YES"
moused_enable="YES"
dbus_enable="YES"
hald_enable="YES"
gdm_enable="YES"

sshd_enable="YES"
dbus_enable="YES"
hald_enable="YES"

sendmail_enable="NONE"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
#dumpdev="AUTO"
ifconfig_em0="DHCP"
#slim_enable="yes"
defaultrouter="192.168.10.1"

#vboxnet_enable="YES"
#v2ray_enable="YES"
#v2ray_enable="NO"



 cat .xinitrc
#!/bin/bash
#success if u run xmonad  must open it 
#/home/evan/.xmonad/autostart.sh

#xautolock -time 10 -locker "i3lock  -b  -i '/home/evan/wallpaper/2020-02-04_14-46.png'" &
xautolock -time 30 -locker "i3lock  -b  -i '/home/evan/wallpaper/sj.png'" &
sudo  /usr/local/bin/networkmgr &
#networkmgr &

export LC_ALL=zh_CN.UTF-8
export LANGUAGE=zh_CN.UTF-8.UTF-8
export LANG=zh_CN.UTF-8.UTF-8
#export XMODIFIERS=@im=fcitx
#if [ -x /usr/local/bin/fcitx   ]; then
#	/usr/local/bin/fcitx &
#fi
#if [ -x /usr/local/bin/synapse  ]; then
#    /usr/local/bin/synapse &
#fi
#
#run desktop
#exec  /usr/local/bin/xmonad

#exec awesome

#. /usr/local/etc/xdg/xfce4/xinitrc

#exec /usr/local/bin/i3

#ck-launch-session /usr/local/bin/startlxqt
exec gnome-session

#export LC_ALL=zh_CN.UTF-8
#export LANGUAGE=zh_CN.UTF-8.UTF-8
#export LANG=zh_CN.UTF-8.UTF-8
#export XMODIFIERS=@im=fcitx
#if [ -x /usr/local/bin/fcitx   ]; then
#	/usr/local/bin/fcitx &
#fi
#if [ -x /usr/local/bin/synapse  ]; then
#    /usr/local/bin/synapse &
#fi


https://www.osradar.com/how-to-install-gnome-or-plasma5-kde-on-freebsd-12/

电池条 xbattbar

时间设置

先用bsdconfig-->network -->  不行再date 

date 201908122145
2019年 8月12日 星期一 21时45分00秒 CST

xrand

#at  elitebook
 xrandr --output DP2 --same-as   eDP1  --mode 1366x768  --output DP2 --mode 1920x1080

#I3只有这个有效果  上面那个 是完全 只有一半 感觉没有了另外一半  哈哈 
xrandr --output DP2      --mode 1920x1080    --output eDP1 --off




#at 神舟
#xrandr --output HDMI-1 --same-as   LVDS-1  --mode 1366x768  --output HDMI-1 --mode 1920x1080

##kali 
#on home
# if vga on home   24 1920*1080
#xrandr --output VGA-1 --same-as   LVDS-1  --mode 1366x768  --output VGA-1 --mode 1920x1080

#if hdmi on home
#xrandr --output HDMI-1 --same-as   LVDS-1  --mode 1366x768  --output HDMI-1 --mode 1920x1080
#只开启外外接显示器
xrandr --output  HDMI-1  --mode 1920x1080 --output LVDS-1 --off

#HDMI-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 527mm x 296mm

#xrandr --output HDMI-1  --same-as   --mode 1366x768  --output HDMI-1 --mode 1920x1080+0+0 
# on work
#xrandr --output VGA1  --same-as LVDS1 --mode  1920x1080  --output LVDS1 --mode 1366x768


wifi


首先 安装freebsd12 时,就选择wifi连接网络,不要插网线 

Add an entry for this network to /etc/wpa_supplicant.conf. If the file does not exist, create it. 

network={
	ssid="myssid"
	psk="mypsk"
}

Add entries to /etc/rc.conf to configure the network on startup:

wlans_ath0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"


Restart the computer, or restart the network service to connect to the network:

# service netif restar


#in me 


##wifi 
wlans_iwm0="wlan0"
ifconfig_wlan0="WPA DHCP"


https://www.freebsd.org/doc/handbook/network-wireless.html

显示器 之亮度 及双显示器


freebsd 上有个 亮度设置   rofi search  rd 就可以出来 
#我的
root@bsd-latop:~ # sudo kldload acpi_video; sudo sysctl hw.acpi.video.crt0.brightness=30
hw.acpi.video.crt0.brightness: 80 -> 30

查看
 sysctl hw.acpi.video

hw.acpi.video.out2.active: 1
hw.acpi.video.out1.active: 1
hw.acpi.video.out0.active: 1
hw.acpi.video.ext2.active: 1
hw.acpi.video.ext1.active: 1
hw.acpi.video.ext0.active: 1
hw.acpi.video.lcd0.active: 1
hw.acpi.video.crt0.levels: 80 50 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 69 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
hw.acpi.video.crt0.economy: 50
hw.acpi.video.crt0.fullpower: 80
hw.acpi.video.crt0.brightness: 80
hw.acpi.video.crt0.active: 1


别人的例子
kldload acpi_video; sysctl hw.acpi.video.lcd0.brightness=30 试试


FreeBSD 下双显示器的设置

pkg 源更新和系统更新

mkdir -p /usr/local/etc/pkg/repos/

sudo pkg install security/ca_root_nss
vi /usr/local/etc/pkg/repos/FreeBSD.conf
FreeBSD: {
  url: "pkg+https://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",
 #url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",
}




#repository update
pkg update -f
pkg update

#系统更新 
pkg upgrade 

FreeBSD 12.1-RELEASE Installation Instructions https://mirrors.ustc.edu.cn/help/freebsd-pkg.html

https://www.freebsd.org/doc/handbook/pkgng-intro.html

更新单个软件


这里以firefox为例子 

pkg install firefox #就可以直接升级了 

Installed packages to be UPGRADED:
	firefox: 68.0.1_1,1 -> 69.0.2,1
	telegram: 1.4.1.g20161227_5 -> 1.4.1.g20161227_6
	protobuf: 3.7.1,1 -> 3.9.2,1
	libevent: 2.1.10 -> 2.1.11
	libqtxdg: 3.3.0 -> 3.3.0_1

Installed packages to be REINSTALLED:
	mysql57-server-5.7.27 (direct dependency changed: perl5)

Number of packages to be upgraded: 5
Number of packages to be reinstalled: 1

The operation will free 1 MiB.
64 MiB to be downloaded.

ports 加速

sudo pkg install axel

vi /etc/make.conf
#加入以下内容
FETCH_CMD=axel
FETCH_BEFORE_ARGS= -n 10 -a
FETCH_AFTER_ARGS=
DISABLE_SIZE=yes
MASTER_SITE_OVERRIDE?=\
http://ports.hshh.org/${DIST_SUBDIR}/\
http://ports.cn.freebsd.org/${DIST_SUBDIR}/\
#ftp://ftp.freeBSDchina.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/
MASTER_SITE_OVERRIDE?=http://mirrors.ustc.edu.cn/freebsd-ports/distfiles/${DIST_SUBDIR}/
MASTER_SITE_OVERRIDE?=${MASTER_SITE_BACKUP}
#MASTER_SITE_OVERRIDE?=http://mirrors.ustc.edu.cn/freebsd-ports/distfiles/${DIST_SUBDIR}/

vi /etc/portsnap.conf
把

SERVERNAME=portsnap.freebsd.org

修改成:

SERVERNAME=portsnap.hshh.org

这个是他的更新服务器。另外还有几个国内比较快的portsnap服务器:

portsnap.hshh.org

portsnap2.hshh.org

portsnap3.hshh.org (网通)

portsnap4.hshh.org

更新ports


在 /etc/make.conf 中添加以下内容(如果文件不存在,则新建之):

MASTER_SITE_OVERRIDE?=http://mirrors.ustc.edu.cn/freebsd-ports/distfiles/${DIST_SUBDIR}/



cat  /etc/portsnap.conf  | grep cn
SERVERNAME=portsnap.cn.FreeBSD.org

fetch 获取数据
extract 释放全部ports
update 更新ports
第一次使用可以portsnap fetch extract

以后使用可以 portsnap fetch update
portsnap extract; portsnap update

现在的亚洲pkg mirrors
pkg0.twn.freebsd.org

http://mirrors.ustc.edu.cn/help/freebsd-ports.html

FreeBSD 11.1 发行版在线升级到 FreeBSD 11.2 发行版

FreeBSD 12 国内源提速 pkg 和 ports 做个笔记

Freebsd 下如何最有效率的安装软件

freebsd 安装ports以及加速

使用国内镜像给FreeBSD的Ports安装加速

FreeBSD Fetch和Tar的妙用


怎么看待FreeBSD官方对镜像站的封闭管理

20190808 new add

root@freebsd:/home/evan # cat /etc/fstab
# Custom /etc/fstab for FreeBSD VM images
/dev/gpt/rootfs   /       ufs     rw      1       1
/dev/gpt/swapfs  none    swap    sw      0       0


% echo 'ck-launch-session /usr/local/bin/startlxqt' > ~/.xinitrc

pkg install xorg 


安装:
pkg install xorg
//在/etc/rc.conf文件内添加如下内容:


 cat  /etc/rc.conf
hostname="freebsd"
moused_enable="YES"
moused_nodefault_enable="YES"
dbus_enable="YES"
hald_enable="YES"
ifconfig_DEFAULT="DHCP inet6 accept_rtadv"
sshd_enable="YES"
slim_enable="yes"
#lightdm_enable="YES"


pkg install xrandr   remmina synapse

pkg  install awesome  

pkg install telegram # or pidgim 

https://forums.freebsd.org/threads/running-telegram-gui.51494/

添加 新硬盘 这个会出错 只有在安装时就两个硬盘 并分区就没事


Aug 9 2019

FreeBSD本地化


freebsd 安装ports以及加速

使用国内镜像给FreeBSD的Ports安装加速

FreeBSD Fetch和Tar的妙用


怎么看待FreeBSD官方对镜像站的封闭管理


freebsd12 安装gnome3图形界面


docker on freebsd https://wiki.freebsd.org/Docker

jails



原文链接:https://blog.csdn.net/MoeDisk/article/details/87028238


1 安装 gui 相关

安装

#不用 portnaps 直接pkg 
#昨晚这个默认居然是没有cn的 我去 搞半天 ,还是改一下比较好滴 
vi /etc/portsnap.conf
SERVERNAME=portsnap.cn.FreeBSD.org

#不安装gnome3 就没有gdm,但是没办法单独安装gdm   
pkg install  xorg mate  slim   #没了 xf86-video-fbdev ?

#[Install CINNAMON Desktop Environment]
 pkg install cinnamon
#20170331
#Lightdm is in the ports tree. 
pkg install x11/lightdm

For lightdm to function, it requires one of the available greeters to be
installed, which are available in the ports tree at x11/lightdm-*greeter*

# 记得要添加这个DM Add the following lines to /etc/rc.conf to enable the LightDM:
lightdm_enable="YES"

# pkg install terminology

配置 和开机自启动

vi /etc/fstab
proc /proc procfs rw 0 0
sysrc  'hald_enable=YES'  'dbus_enable=YES' 'slim_enable=YES'     #'gdm_enable=YES' 

中文化

 

只有中文化后 才能调用fcitx 五笔哦 不然没中文输入
2019

编辑用户的环境文件:
#vi ~/.cshrc      //增加如下内容
setenv LANG         zh_CN.UTF-8     
setenv LC_CTYPE     zh_CN.UTF-8 
setenv LC_ALL       zh_CN.UTF-8
//添加完后退出当前会话,重新进入。
#locale    //显示当前用户环境
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_ALL=zh_CN.UTF-8


用户级:
修改用户根目录文件.login_conf: 这个好像加了无效 201908
me:\
        :lang=zh_CN.UTF-8:\
        :setenv=LC_ALL=zh_CN.UTF-8:\
        :setenv=LC_CTYPE=zh_CN.UTF-8:\
        :setenv=LC_COLLATE=zh_CN.UTF-8:\
        :setenv=LC_TIME=zh_CN.UTF-8:\
        :setenv=LC_NUMERIC=zh_CN.UTF-8:\
        :setenv=LC_MONETARY=zh_CN.UTF-8:\
        :setenv=LC_MESSAGES=zh_CN.UTF-8:\
        :charset=UTF-8:\
        :xmodifiers="@im=SCIM": #这里我假设你使用SCIM
在英文界面下运行中文输入法:

startx 开启 gnome 或 gdm 开始登录gnome

我在 ~/.xinitrc中加入了:


cat .xinitrc 
#ck-launch-session /usr/local/bin/startlxqt
exec awesome
export LC_ALL=zh_CN.UTF-8
export LANGUAGE=zh_CN.UTF-8.UTF-8
export LANG=zh_CN.UTF-8.UTF-8
fcitx &

2019

export LC_CTYPE=“zh_CN.UTF-8” export XMODIFIERS=@im=SCIM export GTK_IM_MODULE=xim export QT_IM_DODULE=xim export XIM_PROGRAM=“scim -d” scim -d



#汉化  第一次失败了 第二再重装一下又好了 2017
$ vi  .xinitrc 
export LC_ALL=zh_CN.UTF-8
export LANGUAGE=zh_CN.UTF-8.UTF-8
export LANG=zh_CN.UTF-8.UTF-8
#exec mate-session 不用这个 mate 默认没有gdm了 如果用slim 还是要用这个

http://blog.chinaunix.net/uid-20377663-id-114464.html

https://zhidao.baidu.com/question/2203007741278957948.html

https://www.cnblogs.com/misstaste/p/5177011.html


https://www.cnblogs.com/sinx/p/10585930.html

update ports



SERVERNAME=portsnap.hshh.org


http://mirrors.ustc.edu.cn/help/freebsd-ports.html



https://www.cnblogs.com/yibinboy/articles/6136704.html




pkg install firefox 

http://mirrors.ustc.edu.cn/help/freebsd-ports.html

https://www.cnblogs.com/yibinboy/articles/6136704.html

https://blog.csdn.net/lanzh_syf/article/details/86599445

输入法

install

# fcitx wubi  在xfce 是成功的
##记得 一定要加上chinese/ 不然是pkg 不到东西的  #fcitx-qt5 qt支持 不然在telegarm不能打字 
pkg install chinese/fcitx  chinese/fcitx-configtool chinese/fcitx-table-extra  chinese/fcitx-ui-light fcitx-qt5


#skin 
/usr/local/share/fcitx/skin/dark

我放在 .config/fcitx/skin  可以看到 但是用不了  无法加载皮肤36,回到默认皮肤 应试是皮肤不对 
 

下載後放在 .config/fcitx/skin 下創建一個對應的目錄就行了


基于sogou拼音皮肤修改的fcitx皮肤

两款简洁的fcitx皮肤

Fcitx 输入法皮肤制作全教程

Fcitx使用搜狗词库与皮肤

configure


Note:
默认输入状态 非激活 不然 老是默认中文 影响 commmond

fcitx-diagnose  #查看相关的模块 非常不错的命令

vi .cshrc

#Note just for csh
setenv LANG         zh_CN.UTF-8
setenv LC_CTYPE     zh_CN.UTF-8
setenv LC_ALL       zh_CN.UTF-8

# evan 4 fcitx 
setenv  XMODIFIERS @im=fcitx
setenv  GTK_IM_MODULE fcitx
setenv  QT_IM_MODULE fcitx
setenv  XIM=fcitx


下面这些只是提示而已 

③如果使用的Shell是bash或sh:
cat .cshrc

export XMODIFIERS='@im=fcitx'
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx

我暂时是这个哦 
④如果使用的Shell是csh或tcsh :
setenv  XMODIFIERS @im=fcitx
setenv  GTK_IM_MODULE fcitx
setenv  QT_IM_MODULE fcitx
⑤开机启动设置
系统-->首选项-->启动应用程序
添加fcitx




evan@home:~ % cat .xinitrc 
export LC_ALL=zh_CN.UTF-8
export LANGUAGE=zh_CN.UTF-8.UTF-8
export LANG=zh_CN.UTF-8.UTF-8
export XMODIFIERS='@im=fcitx'	
export GTK_IM_MODULE=fcitx
export GTK3_IM_MODULE=fcitx

mkdir -p ~/.config/autostart/
cp /usr/local/share/applications/fcitx.desktop     ~/.config/autostart/


pkg  prompt 
Message from zh-fcitx-4.2.9.6_2:

************************************************************************

Remember to set the environment variable XMODIFIERS:

        csh/tcsh:       setenv XMODIFIERS @im=fcitx
        sh/bash:        export XMODIFIERS='@im=fcitx'

For GTK+ programs, you may want to set:

        csh/tcsh:       setenv GTK_IM_MODULE fcitx
                        setenv GTK3_IM_MODULE fcitx
        sh/bash:        export GTK_IM_MODULE=fcitx
                        export GTK3_IM_MODULE=fcitx

For Qt4 programs, we recommend you to use

        qtconfig-qt4: /usr/ports/misc/qt4-qtconfig

instead of to manually set QT4_IM_MODULE.

To start fcitx with your desktop, just

        cp /usr/local/share/applications/fcitx.desktop \
            ~/.config/autostart/

************************************************************************
Message from zh-fcitx-ui-light-0.1.3_2:

************************************************************************

Replace your `fcitx` command with
        fcitx -u fcitx-light-ui
to start Fcitx with this lightweight UI.

**************************************************************



[Writing Chinese, Japanese, Korean in FreeBSD with fcitx]

ops and develop

pkg install git  rsync sudo vim bash   terminal anjuta vsftp  xfce4-terminal gcc
echo 'evan ALL=(ALL) NOPASSWD:NOPASSWD:ALL' >/usr/local/etc/sudoers.d/evan

pkg install  python
https://docs.python.org/2.7/using/unix.html
https://docs.python.org/3.3/using/unix.html

# python  ide 
 pkg install python  intellij-pycharm
ln -s /usr/local/bin/python2  /usr/bin/python


pkg install editors/emacs
https://www.freebsd.org/doc/en/books/developers-handbook/emacs.html

pkg install terminator

#dig 
 pkg  install  dns/bind-tools

sudo pkg install py36-pip
sudo pip install ipython

evan@bsd-latop:~/lx/zabbix/api_zbx % sudo pkg search urllib3
py27-urllib3-1.22,1            HTTP library with thread-safe connection pooling, file post, and more
py36-urllib3-1.22,1            HTTP library with thread-safe connection pooling, file post, and more


更改freebsd shell为bash vi 为vim

install

pkg install bash vim 
root@home:~ # where  vi
/usr/bin/vi

mv /usr/bin/vi /usr/bin/bakvi && ln -s /usr/local/bin/vim  /usr/bin/vi

设置bash

tcsh (发音为/tiːˈsiːʃɛl/ tee-SEE-shel, /ˈtiːʃɛl/ TEE-shel, 是一个向下兼容c shell的Unix shell。它本质上是为c shell增加命令补完,命令编辑等其他功能。 当前作为FreeBSD和其延伸发行版的默认shell。


evan# whereis bash
bash: /usr/local/bin/bash 

#sudo mv /bin/sh /bin/bak_sh

##做了下面这个ln 以后我们把平时在linux下跑的 shell 脚本拿到freebsd跑,也绝大部分没问题了
ln -s /usr/local/bin/bash /bin/bash
#ln -s /usr/local/bin/bash /bin/sh


evan# chsh -s /usr/local/bin/bash
chsh: user information updated
注销重启后 如下 搞定
[root@evan ~]# echo $SHELL
/usr/local/bin/bash

sudo chsh -s /bin/tcsh


#这两个干啥
tcsh -s /bin/bash
tcsh -s /usr/local/bin/bash


chsh命令:

chsh 这个命令现在一般被用来替换,usermod -s 命令即更改用户登录的shell。其常用的只有两个参数 -l 和 -s 

chsh -l 起到的作用是列出当前系统的所有shell




#anjuta log
===========================================================================
Note that some standard Python modules are provided as separate ports
as they require additional dependencies. They are available as:

py35-gdbm       databases/py35-gdbm
py35-sqlite3    databases/py35-sqlite3
py35-tkinter    x11-toolkits/py35-tkinter
===========================================================================

7zip

 archivers/p7zip

1. 解压缩文件
# 7z x 解压缩文件
注意的是如果类似libpcap-0.7.1.tar.gz,一次性7z x libpcap-0.7.1.tar.gz后,7z会解压出文件libpcap-0.7.1.tar这一层,这个时候再一次7z x libpcap-0.7.1.tar就可以啦。
2.压缩文件的参数是a
# 7z a filename.7z 要压缩的文件或者目录
3.其他
# 7z e,e这个参数很有意思,也是解压,但和x参数不同 有的就解不了 如 tar , gz
4.更多的使用7z -h看说明! 另外,apt安装p7aip后还有个命令7za,不知道和7z有什么区别

applications

终端

sudo pkg install tilda


healthLinux 下的护眼软件

sudo pkg install  redshift redshift-gtk


https://forums.freebsd.org/threads/compiling-redshift-color-temperature-app.17693/

rednotebook


下载 src  https://rednotebook.sourceforge.io/downloads.html


sudo ln -s /usr/local/bin/bash /bin/bash

sudo pkg install devel/py-yaml
#sudo pkg install py36-yaml # 这个是老的名 

sudo python3.6 setup.py install

如何添加快捷方式  上次是在源码里面找到办法的

暂时这样 

sudo mv /usr/local/bin/rednotebook /usr/local/bin/bakrednotebook

~/tmp/rednotebook-2.15 % sudo cp ./rednotebook/rednotebook /usr/local/bin/rednotebook



ERROR PyYAML not found. Please install it (python3-yaml).
sudo pkg install devel/py-yaml

https://www.freshports.org/devel/py-yaml/

http://bbs.chinaunix.net/thread-3568241-1-1.html

ss

ss
 pkg install shadowsocks-libev
 # or cd /usr/ports/net/shadowsocks-libev/ && make install clean


Chrome通过shadowsocks翻墙

Document Viewers

 sudo pkg install   Okular    epdfview   #Okular好用 #mupdf 只有命令行界面  # atril 好用 但是是安装上整个mate桌面

https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/desktop-viewers.html

IM

telegram

 sudo pkg install telegram-desktop # 其它都不对 sudo pkg install telegram  #/usr/ports/net-im/telegram && make install clean
 在界面顶部的搜索框中输入@zh_CN

IRC

  sudo pkg install hexchat konversation

影音

pkg install -y   celluloid  vlc audacious   audacious-skins   multimedia/audacious-plugins archivers/unzip  mplayer smplayer  gnome-mplayer    qmmp 

audacious-skins

https://pakeklinux.wordpress.com/2010/11/17/the-best-audacious-skin-that-i-know/

https://www.gnome-look.org/p/1115066

sudo cp -a ~/tmp/Audacious\ grey\ theme/Audacious\ grey\ theme/*  /usr/share/audacious/Skins/grep/

ftp

service 自带了ftp 
FreeBSD includes FTP server software, ftpd, in the base system.
https://www.freebsd.org/doc/en/books/handbook/network-ftp.html
#ftp client 
pkg install filezilla

Browsers

pkg install netsurf  midori falkon  chromium  firefox-esr#  firefox # firefox这个在配置那里就可以选择 add 中文 

falkon
ld-elf.so.1: /usr/local/lib/qt5/libQt5Core.so.5: version Qt_5.13 required by /usr/local/bin/falkon not found

#今天 更新到firefox 70 然后起不来了 Segmentation fault (core dumped)


fetch https://download.cdn.mozilla.net/pub/firefox/releases/70.0/source/firefox-70.0.source.tar.xz

 :/usr/ports/www/firefox # make install clean


https://www.freebsd.org/doc/handbook/desktop-browsers.html

## log 
Message from chromium-56.0.2924.87_1:
For correct operation, shared memory support has to be enabled
in Chromium by performing the following command as root :

sysctl kern.ipc.shm_allow_removed=1

To preserve this setting across reboots, append the following
to /etc/sysctl.conf :

kern.ipc.shm_allow_removed=1


安装flashplayer插件

安装 nspluginwrapper  this is  only for firefox ?
cd /usr/ports/www/nspluginwrapper    
make    
make install
安装 linux-c6-flashplugin11
cd /usr/ports/www/linux-c6-flashplugin11   
make  
make install
执行nspluginwrapper -v -a -i
若报错Kernel too old, 执行命令sysctl compat.linux.osrelease=2.6.18
修改/etc/sysctl.conf, 增加compat.linux.osrelease=2.6.18
修改/etc/fstab
linproc /usr/compat/linux/proc linprocfs rw 0 0



#这个是 也是手册上的哦 
cd /usr/ports/www/linux-flashplayer
make install clean 


备注

安装步骤参考FreeBSD Handbook
安装nspluginwrapper会安装linux_base-c6
注意安装的版本


firefox

% sudo  pkg search firefox
firefox-73.0.1,1               Web browser based on the browser portion of Mozilla
firefox-esr-68.5.0_1,1         Web browser based on the browser portion of Mozilla

要把 .mozilla/ 目录先删除  再 重装 firefox-esr 就可以同步回插件等等所有东西回来了 
sudo pkg install   firefox # firefox-esr 
要更新整个系统,不然 firefox 更新不成功的 


字体设置 记得这个不要勾上
允许页面选择自己的字体代替您的上述选择(A



https://www.freebsd.org/doc/en/books/handbook/desktop-browsers.html

Firefox/Flash on FreeBSD

remmina

pkg install remmina
#默认没有rdp 等协议
To install the port: cd /usr/ports/net/remmina-plugins/ && make install clean
To add the package: pkg install remmina-plugins

https://forums.freebsd.org/threads/rdp-or-vnc-for-access-to-remote-windows-machine.53651/

https://www.freshports.org/net/remmina-plugins/

网络管理工具

 networkmgr

.xinitrc 里面启动 图标好难看

essage from networkmgr-3.1:

--
Any bug reports or request of new feature should be addressed at:
    https://github.com/GhostBSD/networkmgr/issues

Make sure that the /usr/local/etc/doas.conf have someting simular like this:

    permit nopass keepenv root
    permit :wheel 
    permit nopass keepenv :wheel cmd netcardmgr
    permit nopass keepenv :wheel cmd ifconfig
    permit nopass keepenv :wheel cmd service

When rebooting it should automaticaly start is the desktop support xdg and make
sure that the user using NetworkMgr is in the wheel group.

https://vermaden.wordpress.com/2018/03/24/freebsd-network-management-with-network-sh-script/

启动器

synapse
rofi
gmrun # 配置文件  cat  /etc/gmrunrc

https://wiki.archlinux.org/index.php/Rofi

https://www.cnblogs.com/siyingcheng/p/11706215.html https://hacpai.com/article/1552717494529

https://itgoyo.github.io/2019/01/28/%E8%87%AA%E5%B7%B1%E6%8A%98%E8%85%BE%E4%B8%AARofi%E9%85%8D%E7%BD%AE/

https://github.com/davatorium/rofi/wiki/themes

https://wiki.archlinux.org/index.php/Gmrun

文件管理器

pcmanfm

edit

pkg install  gedit geany  gnote   gnome-calculator#算机器  #madedit

USB 镜像写入器

Etcher 是一个由 http://resin.io 开发的 USB 镜像写入器。它是一个跨平台的应用,可以帮助你将 ZIP、ISO、IMG 格式的镜像文件写入到 USB 存储中

svn

pkg install subversion && pkg install kdesvn  # or esvn

Svn基础

在FreeBSD上安装SVN(Subversion)

office

libreoffice

  Gnumeric 电子表格
sudo pkg install libreoffice
pushd  /usr/ports/chinese/libreoffice-zh_CN  && sudo make  install clean

LibreOffice 中文社区

虚拟化

#FreeBSD as a Host with VirtualBox
sudo pkg install emulators/virtualbox-ose 


sudo pkg install virtualbox-ose-additions #不然没办法在freebsd12 上安装debian10.04 依然失败
#普通用户启动
sudo pw groupmod vboxusers -m evan

sudo sysrc vboxnet_enable

#现在是这样启动的
sudo virtualbox
 

err

win10 debian10 安装错误 installation step failed

note

=============================================================================

VirtualBox was installed.

You need to load the vboxdrv kernel module via /boot/loader.conf:

vboxdrv_load="YES"

You also have to add all users to your vboxusers group in order to use vbox.

% pw groupmod vboxusers -m jerry

Reboot the machine to load the needed kernel modules.


Bridging Support:
=================

For bridged networking please add the following line to your /etc/rc.conf:

vboxnet_enable="YES"


USB Support:
============

For USB support your user needs to be in the operator group and needs read

and write permissions to the USB device.

% pw groupmod operator -m jerry

Add the following to /etc/devfs.rules (create if it doesn't exist):

[system=10]
add path 'usb/*' mode 0660 group operator

To load these new rule add the following to /etc/rc.conf:

devfs_system_ruleset="system"

Then restart devfs to load the new rules:

% /etc/rc.d/devfs restart


Troubleshooting:
================

Running VirtualBox as non-root user may fail with a fatal error
NS_ERROR_FACTORY_NOT_REGISTERED. In this case delete /tmp/.vbox-*-ipc file.
If you experience "Network: write Failed: Cannot allocate memory" errors
try to increase net.graph.maxdata in /boot/loader.conf

If you are using AIO, then increase these limits (PR#168298):
vfs.aio.max_buf_aio=8192
vfs.aio.max_aio_queue_per_proc=65536
vfs.aio.max_aio_per_proc=8192
vfs.aio.max_aio_queue=65536
To check if AIO is used use: kldstat -v | grep aio

Check wiki page for known issues and troubleshooting:
http://wiki.freebsd.org/VirtualBox

Please report any problems to emulation@. Thanks!

https://www.freebsd.org/doc/handbook/virtualization-host-virtualbox.html

https://wiki.freebsd.org/VirtualBox

FREENAS虚拟机Jails配置全攻略(多篇集合)

连接win客户端

rdesktop

pkg  -y install rdesktop
pkg  -y install tsclient

rdesktop是基于命令行的工具,tsclient只是一个图形化的界面,依赖于rdesktop

remmmina

远程桌面工具

CAD

 sudo pkg install freecad #0.18

email

thunderbird

201912 现在 打开会100cpu
composition—> language —Download more  就可以下载中文了

Advanced  language  选择chinese

代理配置 
高级 —网络 —连接 

Thunderbird设置IRC聊天

Thunderbird

server

redis

#redis 3.x compli
gmaek -j2 && sudo gmake  install

/usr/local/bin/redis-server

#自启动
cat  /etc/rc.local
/usr/local/bin/redis-server > /dev/null  

#这个不行 Ambiguous output redirect
/usr/local/bin/redis-server > /dev/null   2 > &1

or
/usr/local/etc/rc.d下面放你的脚本 




cd /usr/ports/databases/redis
make
/usr/local/etc/rc.d/redis start
/usr/local/bin/redis-cli



FreeBSD下安装redis以及redis_py

docker

https://wiki.freebsd.org/Docker

https://www.oschina.net/p/docker-freebsd

参考

https://www.c0ffee.net/blog/freebsd-on-a-laptop/

FreeBSD 与 RISC-V: 开源物联网生态系统的未来

https://wiki.freebsdchina.org/software/a/awesome

使用FreeBSD作为桌面操作系统


FreeBSD 桌面系统常用软件清单

FreeBSD 配置经验

FreeBSD桌面-Xfce4

FreeBSD 7 Xorg7.3 KDE3.5 桌面系统安装及美化

gitbooks.io freebsd

FreeBSD Developers' Handbook

ecmacs

Freebsd 9.0+LXDE桌面安装


FreeBSD笔记常用命令

Choose the best Desktop for FreeBSD

https://cooltrainer.org/a-freebsd-desktop-howto/


如何使用Remmina从 Linux 上连接到远程桌面


配置FreeBSD 10.0(amd64)fvwm桌面

安装远程桌面,VNC Server on FreeBSD + VNC Viewer on Windows

截图

flameshot

pkg install flameshot

#conf 
vi ~/.cshrc
alias flameshot  flameshot  gui

source ~/.cshrc

Flameshot - 截图工具

下载

下载工具

uget

图形

 gimp screenfetch

development ide

Eclipse

 sudo pkg install devel/liteide

mysql

Message from mysql57-server-5.7.27:
*****************************************************************************

Remember to run mysql_upgrade the first time you start the MySQL server
after an upgrade from an earlier version.

Initial password for first time use of MySQL is saved in $HOME/.mysql_secret
ie. when you want to use "mysql -u root -p" first you should see password
in /root/.mysql_secret

MySQL57 has a default %%ETCDIR%%/my.cnf,
remember to replace it wit your own
or set `mysql_optfile="$YOUR_CNF_FILE` in rc.conf.

*****************************************************************************
Message from akonadi-19.04.2_1:

===============================================================================

KDE Applications versions of Akonadi, KMail, and Kontact use large
messages on the local machine. The default size on FreeBSD is too
small, which causes local connection problems, and Akonadi-based
applications will be flaky (e.g. mailboxes do not display, messages
cannot be found). Increasing the buffer size is recommended:

	sysctl net.local.stream.recvspace=65536
	sysctl net.local.stream.sendspace=65536

===============================================================================

视频编辑

Kdenlive- Linux系统上最强视频编辑器

有用的

启用、安装linxu内核。
#kldload linux
#ee /etc/rc.conf
linux_enable=”YES”
#cd /usr/ports/www/linux_base-f10 && make install clean
先安装linux的flash10插件
cd /usr/ports/www/linux-f10-flashplugin10
make install clean (这一步会把libflashplayer.so安装在/usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so)
再安装nspluginwrapper
cd /usr/ports/www/nspluginwrapper
make install clean
兼容转换
nspluginwrapper -v -i /usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so(这一步会在/usr/local/lib/browser_plugins/ 下生成能在freebsd下使用的npwrapper.libflashplayer.so文件 )
最后把插件链接到chromium插件目录下
ln -s /usr/local/lib/browser_plugins/npwrapper.libflashplayer.so /usr/local/share/chromium/plugins/
与此同时firefox也可以进行视频播放了,如果还不可以,可以到网上去看看其他教程.

old输入法

FreeBSD 下安装输入法

FreeBSD安装汉字输入法:SCIM

如何配置scim(或skim)

IBus (简体中文)


ibus-table-chinese Chinese input tables for IBus

other




 sed -i '' -e 's/memorylocked=128M/memorylocked=256M/' /etc/login.conf
# cap_mkdb /etc/login.conf



Remember to set the environment variable XMODIFIERS:

	csh/tcsh:	setenv XMODIFIERS @im=fcitx
	sh/bash:	export XMODIFIERS='@im=fcitx'

For GTK+ programs, you may want to set:

	csh/tcsh:	setenv GTK_IM_MODULE fcitx
			setenv GTK3_IM_MODULE fcitx
	sh/bash:	export GTK_IM_MODULE=fcitx
			export GTK3_IM_MODULE=fcitx






For Qt4 programs, we recommend you to use

	qtconfig-qt4: /usr/ports/misc/qt4-qtconfig

instead of to manually set QT4_IM_MODULE.

To start fcitx with your desktop, just

	cp /usr/local/share/applications/fcitx.desktop \
	    ~/.config/autostart/

************************************************************************
Message from zh-fcitx-ui-light-0.1.3_2:

************************************************************************

Replace your `fcitx` command with
	fcitx -u fcitx-light-ui
to start Fcitx with this lightweight UI.

0.
#添加到管理员组
pw groupmod wheel -m evan 

#enable ssh
 sysrc 'sshd_enable=YES'


 cat  /etc/rc.conf
zfs_enable="YES"
hostname="digitalocean"
ifconfig_vtnet0="dhcp"
sshd_enable="YES"
nginx_enable="YES"
php_fpm_enable="YES"
mysql_enable="YES"
redis_enable="YES"
shadowsocks_libev_enable="YES"



# set time
 ntpdate cn.pool.ntp.org

#添加新硬盘到 home 给evan 使用



fstab 
evan@homebsd:~/kalibak % cat /etc/fstab 
# Device	Mountpoint	FStype	Options	Dump	Pass#
/dev/ada0p1	none		swap	sw	0	0
/dev/ada0p3	/		ufs	rw	1	1
/dev/ada0p4	/home		ufs	rw	2	2
proc /proc procfs rw 0 0


Display manager
https://wiki.archlinux.org/index.php/Display_manager_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

FreeBSD从入门到放弃
https://linxiaohui.gitbooks.io/notes-on-freebsd/content/



Tencent QQ (简体中文)
https://wiki.archlinux.org/index.php/Tencent_QQ_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)#.E5.9F.BA.E4.BA.8E_WebQQ


Installing a Desktop Environment on FreeBSD
https://www.freebsdfoundation.org/freebsd/how-to-guides/installing-a-desktop-environment-on-freebsd/#!


How to Install FreeBSD 10.2 with Mate Desktop
http://linoxide.com/linux-how-to/install-freebsd-10-2-mate-desktop/


https://wiki.lxde.org/en/FreeBSD

Installing Mate desktop on FreeBSD 11
http://www.vpierre.it/installing-mate-desktop-on-freebsd-11/

fetch 获取数据
extract 释放全部ports
update 更新ports
第一次使用可以 portsnap fetch extract
以后使用可以 portsnap fetch update
portsnap   extract;  portsnap update

如果写在cron可以用 portsnap cron update

FreeBSD 简明用户指南
install gnome3  kde4 xfce etc 
https://www.freebsd.org/doc/handbook/x11-wm.html

Browsers
https://www.freebsd.org/doc/handbook/desktop-browsers.html
pkg install firefox 
pkg install swfdec-plugin


MP3 Audio
https://www.freebsd.org/doc/handbook/sound-mp3.html

https://bsdelf.github.io/posts/freebsd-brief-user-guide

https://huataihuang.gitbooks.io/cloud-atlas/content/os/freebsd/packages_and_ports.html

https://antumdeluge.wordpress.com/2014/07/19/how-to-install-freebsd/

FreeBSD简单汉化终结篇[基于core font的汉化]
http://bbs.watchstor.com/thread-274706-1-1.html

**********************


安装Firefox的多国语言包
#pkg install firefox35-i18n

你太善良》是香港歌手张智霖,
张惠妹 放开你的头脑


就两个文件 另外一个freebsd10 4 desktop 

program/kindlereader 


 Official Mirrors
https://www.freebsd.org/doc/handbook/eresources-web.html
 
SERVERNAME=portsnap.FreeBSD.org
SERVERNAME=portsnap.cn.FreeBSD.org

portsnap fetch extract



桌面相关的官方文档 
https://www.freebsd.org/doc/handbook/x11-wm.html

echo 'exec enlightenment_start'  >> ~/.xinitrc

##xfce  这个也是成功了 字体好看  不过是英文的呢喃 加上汉化的就行了 
 pkg install xfce
 
#昨天今天就是少了这一步 看来要多提高英文水平哦 
Unlike GNOME or KDE, Xfce does not provide its own login manager. In order to start Xfce from the command line by typing startx, first add its entry to ~/.xinitrc:

% echo "exec /usr/local/bin/startxfce4 --with-ck-launch" > ~/.xinitrc 
 

##gnome3 

pkg install gnome3  vlc 

have gdm can not add this 
#echo 'exec gnome-session'  >> ~/.xinitrc


http://blog.linuxchina.net/?p=993

https://www.freebsd.org/doc/handbook/x11-wm.html
https://antumdeluge.wordpress.com/2014/07/19/how-to-install-freebsd/

https://forums.freebsd.org/threads/57329/

Installing Mate desktop on FreeBSD 11
http://www.vpierre.it/installing-mate-desktop-on-freebsd-11/

ops

在bsd上直接叫 md5  linux上是md5sum 

https://www.freebsd.org/cgi/man.cgi?query=md5&apropos=0&sektion=0&manpath=FreeBSD+11.1-RELEASE&arch=default&format=html

firewall

    防火墙。Linux中使用iptables来做防火墙,不过那个太复杂了,我一般使用 ufw。 FreeBSD中可以使用 ipfw 来管理防火墙,它的用法和ufw差不多:

$ ipfw add allow tcp from any to me 22 in via $ext_if

优化


sendmail_enable="NONE"

old


###fvwm 
FreeBSD汉化+FVWM
http://zqscm.qiniucdn.com/data/20090728100241/index.html

1 中文环境
  pkg_add -r zh-auto-ch-l10n
  这个命令好像作了不少事情,我忘记是否下载了wenquanyi字体,没有的话,再手动来一遍
 pkg_add -r wqy
  下边的不知道是不是必须的
  在设置好xorg.conf中fontpath的前题下,执行
   fc-cache -fv,让系统加入wqy字体
  输入法如果没下载的话,可以
 pkg_add -r fcitx,我是用五笔的
 然后,配置中文的locale


  在~/.chsrc里,增加
 setenv LANG zh_CN.eucCN
  setenv LC_CTYPE zh_CN.eucCN
 setenv LC_ALL zh_CN.eucCN
  上边是中文local,lc_all好像不是必须要设置的
 下边设置输入法
  setenv XMODIFIERS @im=fcitx

2 fvwm,这个东西小快,够用了
  pkg_add -r fvwm

3 使用fvwm作为桌面
  在~下,找一下有没有.xinitrc文件,没有就搞一个出来
  内容是
  exec fvwm
  如果要输入法也一并启动则为
  fcitx&
    exec fvwm

Troubleshooting


随便更新了一下firefox 70 现在总算可以了 以后少更新点


terminator 启动不了 
Traceback (most recent call last):
  File "/usr/local/bin/terminator", line 83, in <module>
    from terminatorlib import ipc
  File "/usr/local/lib/python2.7/site-packages/terminatorlib/ipc.py", line 31, in <module>
    class DBusService(Borg, dbus.service.Object):
  File "/usr/local/lib/python2.7/site-packages/terminatorlib/ipc.py", line 62, in DBusService
    @dbus.service.method(BUS_NAME, in_signature='a{ss}')
  File "/usr/local/lib/python2.7/site-packages/dbus/decorators.py", line 155, in method
    validate_interface_name(dbus_interface)
ValueError: Invalid interface or error name 'net.tenshu.Terminator2-0x3bc8d9c28d7f7322': contains invalid character '-'    

terminator  -u  这样启动就行了 


telegram 等等有关qt的都用不了   firefox70 也好了
Cannot mix incompatible Qt library (version ) with this library (version )

pkg install qt5-core

pkg update -f
pkg update
pkg upgrade 




 telegram-desktop 
ld-elf.so.1: /usr/local/lib/qt5/libQt5Core.so.5: version Qt_5.13 required by /usr/local/bin/telegram-desktop not found
root@bsd-latop:~ # pkg install qt5
root@bsd-latop:~ # telegram-desktop 
ld-elf.so.1: /usr/local/lib/qt5/libQt5Core.so.5: version Qt_5.13 required by /usr/local/bin/telegram-desktop not found
root@bsd-latop:~ # file /usr/local/lib/qt5/libQt5Core.so.5
/usr/local/lib/qt5/libQt5Core.so.5: symbolic link to libQt5Core.so.5.12.2





pkg: cached package *:size mismatch, cannot continue

pkg update -f






https://unix.stackexchange.com/questions/384396/terminator-fails-to-start-in-i686-dbus-issue-in-python

zfs nas

ZFS 依赖可靠的内存,装在个人机器上直接用ufs. ZFS不适合

从12.0开始,FreeNAS将改名为TrueNAS Core。

同时,zfs创建以后,zpool里面直接创建块设备用zfs create 就可以解决了,那么在/dev/zvol/xxx路径上就会产生一个块设备,其实会关联到一个/dev/zd16类似这样的名称的设备上,但是前者不会盘符漂移,后者会,因此使用的时候多注意一点。还有就是zfs做配额管理这些也非常方便,可以看看oracle的介绍吧。

https://www.freebsd.org/doc/zh_CN/books/handbook/filesystems-zfs.html

打造家用NAS之六(2019年版)ZFS介绍

初学者指南:ZFS 是什么,为什么要使用 ZFS

see also

www.midnightbsd.org

FreeBSD系统配置 chinafreebsd

Linux 相关资料

Linux桌面常用软件列表 (2019


linux下几个常用软件 100款开源软件

24 款必备的 Linux 桌面应用(2016 版)

http://www.chinafreebsd.cn/article/59da3fa39561e

csdn freebsd blog

[FreeBSD] 选择 FreeBSD 六个理由

给Linux用户的FreeBSD快速指南

Freebsd下常用软件介绍

FreeBSD 下双显示器的设置

freenas Mount ext4 partition http://blog.linuxchina.net/?p=1782

linux: mount UFS filesystem http://blog.linuxchina.net/?p=1776

Linux® 用户的 FreeBSD 快速入门向导 https://www.freebsd.org/doc/zh_CN/articles/linux-users/index.html


https://freebsdchina.org/forum/topic_63558.html

https://www.enlightenment.org/distros/freebsd-start

https://www.freebsd.org/doc/zh_CN.UTF-8/books/handbook/updating-upgrading-portsnap.html

https://www.trueos.org/handbook/preinstall.html

Linux下远程桌面连接windows

fvwm 下相关软件

给Linux用户的FreeBSD快速指南