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

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
 
 
第1行: 第1行:
=arm=
 
用自己的树霉试一下 常用的软件能不能用先 有空再过半年buy a  arm apple laptop
 
  
https://www.pine64.org/pinebook-pro/
 
  
https://zhuanlan.zhihu.com/p/38719508
 
  
[https://post.smzdm.com/p/a5kqwmxx/ 外媒观点对撞,ARM 版 Mac 到底值不值得买?| PCWorld :不要再买 Mac 产品 ]
+
 
+
good
[https://linuxtoy.org/archives/lightweight-portable-desktop-with-pine64.html  Pine64 轻量级便携电脑 ]
+
http://akaedu.github.io/book/
 
 
=NOTE=
 
下载东西 or 传输东西  记得最后 md5 or sham 一下
 
 
 
闪屏问题 参考 xps 相关wiki
 
  
=xps=
 
主要目录挂在 data 所以作各种 ln
 
ln -s  data/evanhome/python/  python
 
  
=老旧计算机=
+
[https://zhuanlan.zhihu.com/p/90971489 C语言编程学习必备的一些网站,干货收藏!]
https://antixlinux.com/
 
=2020=
 
  
將硬盘模式由RAID 可以进入原来的win
+
[https://www.bilibili.com/video/BV17s411N78s/?spm_id_from=333.788.videocard.0 带你学C带你飞》]
改为ACHI 就进入其它第三方os
+
=如何学习C=
  
[https://www.dell.com/support/article/zh-cn/sln308010/ubuntu-win10 Ubuntu ®/WIN10双系统安装教程 ]
+
[https://blog.csdn.net/qwe6620692/article/details/88107248  学习C语言,如何看懂及掌握一个程序]
  
https://www.dell.com/support/article/zh-cn/sln301754/%E5%A6%82%E4%BD%95%E5%9C%A8-dell-pc-%E4%B8%8A%E5%AE%89%E8%A3%85-ubuntu-%E5%92%8C-windows-8-%E6%88%9610%E4%BD%9C%E4%B8%BA%E5%8F%8C%E5%BC%95%E5%AF%BC?lang=zh
+
=2021学习C APUE=
 +
http://www.apuebook.com/
  
<pre>
+
[https://www.zhihu.com/topic/19705459/hot UNIX环境高级编程(书籍)笔记什么都 有呀 ]
第一步在 win中分区中压缩出给unix的空间
 
[[Win10系统相关]]
 
现在要什么改bios为AHI  原来的是ran0 on 是不是得重启安装win 问一下售后 
 
更改xps13的硬盘模式
 
  
Dell xps13 的硬盘模式有三种:RAID(默认)模式; ACHI模式;以及以上两种的混合模式。RAID模式下我们是无法安装ubuntu的,于是在开机dell图标的时候猛按F2进入BIOS选项,將硬盘模式由RAID改为ACHI, 在更改时系统会提醒若更改可能会导致无法逆转的问题,其实没关系,确认更改。注意,更改了硬盘模式之后是无法在进入win10的,所以这时候可以在USB接口插好我们准备好的ubuntu安装盘了,在系统重启进入dell图标界面时,
+
[https://www.zhihu.com/question/19939011 《UNIX环境高级编程》这本书怎么看?怎么学习]
猛按F12(不用按fn)进入boot界面选用U盘启动,进入ubuntu安装界面然后正常安装就好。关于安装ubuntu时的分区,我参考了网上的教程,采用以下分区:
 
  
  
分区完成后,不要急着下一步,这里还要选择 安装启动引导器的设备
 
  
选择boot所在的分区 /dev/sda ?
+
==看法 ==
</pre>
+
第二章和第六章可以跳跳,回头看
  
xps 13  7390  安装双系统
+
7.中文版翻译有瑕疵,但是整体还是不错,不至于对阅读产生影响(信号量那章有细节问题,但是信号量那张和csapp第八章几乎重复)
  
 +
首先,不要抱着一口气把这本书学完的心态去看。      尝试根据自己的兴趣,选择一个规模适当的开源项目,去阅读它的源代码。(例如我选择的就是一个小型的http服务器--Mongoose)当在某一方面发现自己有很多问题时,很希望去弄清楚时,这时候就可以去翻开手中的APUE,带着问题去阅读。这时候学习的效率必然比盲目地去看书更高,而且遗忘率也会降低。但是,仅仅读完是不够的。      很多时候,你看书的时候,会感觉自己看懂了,但是没过多久,又会发现自己忘了。或者,有时候你根本没看懂,而只是囫囵吞枣地看过去。所以,看完后,最好的方法就是写博客。尝试按照自己的理解以及逻辑,去将你学到的知识系统地阐述出来。这样,就算你以后忘了,再去翻翻博文,也能很快就捡起来。
  
linuxqq 在debian 10上用 sh 安装是成功的  weixin用一下 docker那个 就不用虚拟机了
+
十个最值得阅读学习的C开源项目代码
  
 +
    Webbench
 +
    Tinyhttpd
 +
    cJSON
 +
    CMockery
 +
    Libev
 +
    Memcached
 +
    Lua
 +
    SQLite
 +
    UNIX v6
 +
    NETBSD
  
 +
建议先看 >> Unix/Linux编程实践教程
  
 +
https://book.douban.com/subject/1219329/
  
[https://blog.csdn.net/JJ951001/article/details/104565862 安装参考这个喽 ]
+
http://item.kongfz.com/book/32040616.html?push_type=2&min_price=57.00&utm_source=101004009001
一开始不要安装太多桌面 就先xfce作备用 然后再上awesome
 
  
默认安装,想要更多工具
+
https://detail.tmall.com/item.htm?spm=a1z10.1-b.w9858442-8055933095.4.fH3HiL&id=19729431809
  sudo apt-get -y install kali-linux-large
 
  
[https://blog.csdn.net/zouguo1211/article/details/81200628 安装过程 有grub2修复呢]
+
[https://github.com/woai3c/recommended-books 常用计算机书的下载]
  
 +
[https://blog.csdn.net/qwe6620692/article/details/88107248  学习C语言,如何看懂及掌握一个程序!]
  
[https://blog.csdn.net/weixin_41247970/article/details/104118700 kali 2020.1安装(图文超详细版)]
+
[https://blog.51cto.com/chinalx1/2143904 十个经典的C开源项目代码]
  
 +
[https://developer.51cto.com/art/201903/593703.htm 初学玩转C语言,这17个小项目收下不谢]
  
[https://blog.csdn.net/MiaodXindng/article/details/104397988 kali linux 2020.1安装注意事项]
+
https://zhuanlan.zhihu.com/p/83185476
  
=debian=
+
== tinyhttpd C 语言实现最简单的 HTTP 服务器 学习 ==
<pre>
 
UNetbootin
 
  
debian-.0.0-amd64-xfce-CD-1.iso 安装后
+
[https://www.shuzhiduo.com/A/ZOJPY9Ge5v/ tinyhttpd ------ C 语言实现最简单的 HTTP 服务器]
如果还有方块需要装字体:
 
  
apt-get install ttf-wqy-zenhei #我试过这个就行了
+
https://github.com/nengm/Tinyhttpd
$ reboot
 
$ apt-get install ttf-arphic-uming
 
  
 +
[https://blog.csdn.net/baiwfg2/article/details/45582723  tinyhttpd源码详解]
  
 +
[https://blog.csdn.net/konghhhhh/article/details/103752962  tinyhttp整理(一)]
  
# testing
+
[https://blog.csdn.net/weixin_30387663/article/details/99664160  tinyhttp源码阅读(注释)]
  
# http://mirrors.ustc.edu.cn/debian/dists/
+
[https://juejin.cn/post/6870760453619122183 Tinyhttp源码分析及知识点总结 ]
deb http://mirrors.ustc.edu.cn/debian testing main contrib non-free
 
# deb-src http://mirrors.ustc.edu.cn/debian testing main contrib non-free
 
deb http://mirrors.ustc.edu.cn/debian testing-updates main contrib non-free
 
# deb-src http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free
 
  
# deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free
+
[https://www.bilibili.com/video/BV1hy4y1C71M/?spm_id_from=333.788.videocard.1 b站 C/C++ tinyHttp服务器小项目及源码讲解1]
# deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free
 
  
#deb http://mirrors.aliyun.com/debian/ testing  main non-free contrib
+
[https://blog.csdn.net/wwxy1995/article/details/99362666 tinyhttpd深入解析与源码剖析]
##deb-src http://mirrors.aliyun.com/debian/ testing main non-free contrib
 
#deb http://mirrors.aliyun.com/debian-security testing/updates main
 
##deb-src http://mirrors.aliyun.com/debian-security testing/updates main
 
#deb http://mirrors.aliyun.com/debian/ testing-updates main non-free contrib
 
##deb-src http://mirrors.aliyun.com/debian/ testing-updates main non-free contrib
 
#deb http://mirrors.aliyun.com/debian-backports/ bullseye-backports main non-free contrib
 
##deb-src http://mirrors.aliyun.com/debian-backports/ testing-backports main non-free contrib
 
#
 
#deb https://mirrors.163.com/debian-backports/ buster-backports main contrib non-free
 
#deb-src https://mirrors.163.com/debian-backports/ buster-backports main contrib non-free
 
  
 +
[https://blog.csdn.net/qq_40677350/article/details/90201758  Tinyhttpd-master 源码学习笔记1]
  
sudo apt-get update
+
[https://blog.csdn.net/yzhang6_10/article/details/51534409 Tinyhttp源码分析]
  sudo apt-get upgrade
 
  sudo apt-get dist-upgrade
 
  
</pre>
+
[https://github.com/EZLippi/Tinyhttpd Tinyhttpd非官方镜像,Fork自sourceForge,仅供学习]
  
你正在运行 Debian稳定版 因为你更偏好选择 Debian 稳定版分支。它运行得很好,但是只有一个问题:与其他发行版相比,它的软件有一点过时了。这便是 backports 出现的原因。
 
  
Backports是从testing版本 (大部分)和 unstable版本(可能性极小,例如:安全更新等)重新编译的软件包,因此他们在稳定的debian发行版中不需要新的库就可以运行(无论如何,这是可能的)。推荐你挑选一个能够满足你需求的单个的backports软件源,不要使用所有可用的backports源。
 
  
[https://wiki.debian.org/zh_CN/Backports      zh_CNBackports ]
 
  
[https://www.debian.cn/archives/45 如何使用 Debian backports 更新源]
+
[https://www.jianshu.com/p/18cfd6019296 tinyhttp源码分析]
  
https://wiki.debian.org/HowToUpgradeKernel
+
我把一些核心代码和相应的注释贴在这里,如果你感兴趣全部,可以移步我的github。
 +
https://github.com/zhaozhengcoder/rebuild-the-wheel/tree/master/tinyhttpd
  
  
[https://zhuanlan.zhihu.com/p/76991840 安装Debian并开启远程桌面(通过Xorg)]
+
[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 代码完全讲解]
  
[https://www.linuxtechi.com/things-to-do-after-installing-debian-10/ Top 8 Things to do after Installing Debian 10 (Buster)]
+
==Mongoose-基于C的Web服务器代码学习 ==
  
=start=
+
[https://www.jianshu.com/p/745c03a8864a Mongoose-基于C的Web服务器 介绍和使用]
此文适合于 debian10初始化 20190730
 
  
  
Debian_stretch 也就是 debian 9 这也是kali2018
+
[https://blog.csdn.net/hnzwx888/article/details/84971205 Web服务器----mongoose]
== 最常用软件==
 
<pre> ;geany ;  catfish 文件查看;  现在用 rofi 这个不用了synapse (上次回车运行不了软件是 自己小小心 把运行配置设置为f2); zim ; ;
 
 
 
hardInfo  硬件查看
 
  
alias halt='/usr/bin/sudo /bin/sync && /usr/bin/sudo  /sbin/poweroff'
+
https://github.com/cesanta/mongoose
</pre>
 
  
== xps13 7390问题==
+
[https://www.cnblogs.com/skynet/archive/2010/07/24/1784110.html  Mongoose源码剖析:外篇之web服务器 ]
<pre>
 
过一阵就会自动闪屏
 
  
 +
[https://blog.csdn.net/lixiaogang_theanswer/article/details/102753370  Mongoose-6.14源码剖析之基础篇]
  
FN+向上 亮度
+
== 我的笔记 ==
 +
  apue.3e/include/apue.h
 +
=== chapter 1===
 +
[https://zhuanlan.zhihu.com/p/136700729 APUE读书笔记-01UNIX系统概述]
  
</pre>
+
这是原文学不过是 Second Edition  firefox 放大 就可以看  找一下 第三版本吧 Third Edition
 +
https://vaqeteart.gitee.io/file_bed/shared/books/APUE2/toc.html
  
==国内iso下载地址==
 
  
 +
=== ?===
  
kali 的国内官方镜像为东软信息学院 所以下载地址有两个
+
[https://www.jb51.net/article/55257.htm C语言实现的ls命令源码分享-apue]
  
http://mirrors.neusoft.edu.cn/kali-images/
+
[https://blog.nowcoder.net/n/9a48a7f697864e3bbdae2fe5bfcb0ef9 C 语言实现 Linux ls 命令]
  
公司这个下载比较快
+
=understanding_unix_programming =
  
http://mirrors.163.com/kali-images/
+
==chapter 2  who ==
 
 
https://mirrors.ustc.edu.cn/kali-images
 
 
 
https://www.turnkeylinux.org/
 
  
 
<pre>
 
<pre>
evan@evankali:~/iso$ sha256sum kali-linux-2017.2-amd64.iso
+
/* 再看一下书 非常 好的啦 
4556775bfb981ae64a3cb19aa0b73e8dcac6e4ba524f31c4bc14c9137b99725d  kali-linux-2017.2-amd64.iso
+
who命令的实现过程是先打开一个系统文件UTMP_FILE,创建对应的格式struct utmpfd变量,读取数据到这个结构体中,作相应格式输出即可
 
+
*/
time sudo dd if=xxxxx.iso of=/dev/sdc && sync # real 23m33.039s
+
#include<stdio.h>
或者用什么 img32  linux 下还可以用 etcher U盘镜像复制工具
+
#include<utmp.h>
 
+
#include<fcntl.h>
国内源 加在最前面
+
#include <time.h>
 +
#include<unistd.h>
 +
#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 );
  
deb https://mirrors.dgut.edu.cn/kali kali-rolling main non-free contrib
+
  printf(" ");
deb-src https://mirrors.dgut.edu.cn/kali kali-rolling main non-free contrib
 
  
sudo apt-get update
+
  printf(" ");
</pre>
 
  
===Create bootable USB drives===
+
}
https://rufus.ie/
 
  
sudoapt-getinstallusb-creator-gtk
+
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;
  
https://www.balena.io/etcher/
+
}
  
  
win下的hash tools hash my files  divhasher
 
  
[https://docs.fedoraproject.org/en-US/quick-docs/creating-and-using-a-live-installation-image/ creating-and-using-a-live-installation-image]
 
  
http://www.ubuntukylin.com/public/pdf/1910.pdf
 
  
==debian==
 
[https://cdimage.debian.org/cdimage/unofficial/non-free/ 附带专有固件的非官方镜像]也已更新,如果您发现Debian与某个硬件不兼容,这些非自由版本很有用。
 
<pre>
 
sudo apt-get install -y dnsutils#dig
 
</pre>
 
===debian elite 无线驱动  iwlwifi-7260-17.ucode===
 
<pre>
 
debian 10 elite 无线驱动  iwlwifi-7260-17.ucode
 
 
#wifi 添加源
 
deb http://mirrors.163.com/debian/ buster main contrib non-free
 
 
apt  install firmware-iwlwifi wireless-tools
 
</pre>
 
  
===常用包安装===
 
<pre>
 
sudo apt install net-tools
 
</pre>
 
  
==pre==
 
[[Parrot安装]]
 
<pre>
 
如果发现不是中文界面 settings -->Region &language  选择中国  再次登录就是中文了
 
  
允许root登录
 
#PermitRootLogin prohibit-password
 
PermitRootLogin yes  #/etc/init.d/ssh restart
 
  
新用户  debain 系统建议用adduser
 
adduser evan #这个是交互的
 
  
useradd  evan -m  -s /bin/bash  -g evan
 
  
#is debian
 
apt install sudo -y
 
 
echo 'evan ALL=(ALL) NOPASSWD:NOPASSWD:ALL' >/etc/sudoers.d/evan
 
  
回收站 .local/share/Trash/files/
 
</pre>
 
[[useradd与adduser的区别]]
 
  
==分区==
 
<pre>
 
kalilatop  /  27G  建议大一些好  我的现在是20G 昨晚更新时就空间不太够 清理了今天一个上午 ,昨天还搞到半夜
 
cd /var/cache/apt/archives && rm -rf *.deb
 
  
在公司电脑上 居然要安装成 /home不独立出来,不然会安装不成功 搞笑 第一天不行 第二天又可以 了 哈哈 #应该是硬盘没删除成功 我发现还有 原来的数据呀
 
</pre>
 
  
==theme==
 
<pre>
 
sudo apt install oxygen-icon-theme
 
  
lxappearance (0.6.1-1)
+
C 库函数 void *memset(void *str, int c, size_t n) 复制字符 c(一个无符号字符)到参数 str 所指向的字符串的前 n 个字符。
    LXDE GTK+ theme switcher
+
memset(str,'$',7);
  
 +
This is string.h library function
 +
$$$$$$$ string.h library function
 
</pre>
 
</pre>
https://github.com/paullinuxthemer/Mc-OS-themes
 
 
==输入法==
 
===fcitx===
 
 
fcitx can not use in  ff rednotebook etc apps  on debina 10 testing 更新完就可以了 
 
 
  
<pre> sudo apt-get install fcitx fcitx-table-wbpy ttf-wqy-microhei ttf-wqy-zenhei
+
参考 和书 chapter 2  这个最接近原书的了
  
 +
https://www.cnblogs.com/20145221GQ/p/6060420.html
  
#官方提示
+
[https://blog.csdn.net/u010307522/article/details/72862589  who命令实现]
设置 用户设置 /home/evan/.xinputrc 为 fcitx。
 
手动设置选择: fcitx
 
小企鹅输入法(Fcitx)
 
* 必需组件:fcitx
 
* 输入特定语言所需的组件:
 
  * 简体中文拼音:fcitx-sunpinyin 或 fcitx-googlepinyin 或 fcitx-pinyin
 
  * 简体中文五笔:fcitx-table-wubi 或 fcitx-table-wbpy
 
  * 繁体中文:fcitx-table-cangjie
 
  * 通用的输入法码表: fcitx-table* 套件
 
* 应用程序支持:
 
  * GNOME/GTK+:fcitx-frontend-gtk2 和 fcitx-frontend-gtk3
 
                  (强烈建议同时安装)
 
  * KDE/Qt4:fcitx-frontend-qt4
 
  
 +
[https://blog.csdn.net/qq_33850438/article/details/60762519  unix/linux who命令的实现]
  
 +
https://www.runoob.com/cprogramming/c-function-memset.html
 +
===别人实现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#
 
 
用户设置 已被 im-config 修改。
 
 
 
请重新启动 X 会话管理器以激活新的 用户设置。
 
如果使用旧配置的守护进程被 X 会话管理器重启,您可能需要使用 kill(1) 手工将其杀死。
 
请参考 im-config(8) 和 /usr/share/doc/im-config/README.Debian.gz
 
 
 
 
 
# skin
 
 
 
下载皮肤并解压缩到下面任一目录,如果没有可以新建目录:
 
 
 
/usr/share/fcitx/skin  ##全局设置
 
~/.config/fcitx/skin    #特定用户设置
 
 
 
 
 
debian  kali
 
 
 
ls /usr/share/fcitx/skin/
 
classic  dark  default  google  sogou
 
 
 
 
 
freebsd
 
 
 
.config/fcitx/skin/
 
Alpha google material sogou startos</pre>
 
 
 
皮肤下载  sogou 不错
 
http://mirrors.163.com/deepin/pool/main/f/fcitx-skins/
 
 
 
[https://wiki.archlinux.org/index.php/Fcitx_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)  arch fcitx]
 
 
 
[https://www.cnblogs.com/findumars/p/5364701.html  Linux下Qt4与qt5的程序使用输入法(ibus与fcitx)不冲突 ]
 
 
 
 
 
[https://plumz.me/archives/4180/ 解决 Ubuntu 16.04 下 Telegram Fcitx 不能加载的问题]
 
 
 
===ibus===
 
 
<pre>
 
<pre>
#sudo apt-get install ibus-gtk  ibus-table-wubi  ibus-wayland  ibus-pinyin ibus-sunpinyin
 
    #不好用 暂时不用 现在又用了 2020      ibus-setup
 
  
ibus-setup
+
#include <stdio.h>   
 
+
#include <utmp.h>
在$HOME/.bashrc中加入下面这段就好了
+
#include <fcntl.h> 
 
+
#include <unistd.h>
export GTK_IM_MODULE=ibus
+
#include <time.h> 
export XMODIFIERS=@im=ibus
+
#include <string.h>
export QT_IM_MODULE=ibus
+
 
 
+
#define SHOWHOST 
 
+
 
</pre>
+
void showtime(long timeval){ 
[https://blog.csdn.net/wu10188/article/details/86540464 Ubuntu 18.04 配置ibus中文拼音输入法(超简单)]
+
    char* cp;
 
+
    cp = ctime(&timeval);  
==openssh==
+
    cp[strlen(cp)-1] = '\0';
<pre>
+
    printf("%s",cp+4);  
apt-get install openssh-client openssh-server
+
}  
这个要先安装 不然自启动会不成功
+
    
 
+
void show_info(struct utmp* utbufp){ 
如何激活服务并在启动时启用或禁用服务(即系统启动时自动启动服务)
+
    if(utbufp->ut_type != USER_PROCESS){ 
# systemctl is-active ssh.service
+
        return ; 
systemctl enable ssh.service
+
    } 
# systemctl disable ssh.service
+
 
</pre>
+
    printf("%-8.8s",utbufp->ut_name); 
 
+
    printf(" "); 
[http://www.cnblogs.com/yinheyi/p/6266748.html debian系统下安装ssh服务超级详细]
+
    printf("%-8.8s",utbufp->ut_line);  
 
+
    printf(" ");  
== 更新系统==
+
    showtime(utbufp->ut_time);  
<pre>
+
    printf(" ")
#配置源 又可以改为国内源了 记得在去年是不可以的 20180222 2020
+
 
#eg
+
#ifdef SHOWHOST  
sed -i "s@tuna.[email protected]@g" sources.list
+
    if(utbufp->ut_host[0] != '\0'){ 
sed -i "s@http://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list
+
        printf("(%s)",utbufp->ut_host);  
sed -i "s@http://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list
+
    } 
 
+
#endif  
 
+
    printf("\n");  
 
+
}
 
 
deb https://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
 
deb-src https://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
 
 
 
#aliyun是最快的 配置上他的dns 2020 但是官方源才是软件最新的哦
 
deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
 
#deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
 
#deb http://mirrors.aliyun.com/kali-security kali-rolling/updates main contrib non-free
 
#deb-src http://mirrors.aliyun.com/kali-security kali-rolling/updates main contrib non-free
 
#
 
#office
 
#deb https://http.kali.org/kali kali-rolling main non-free contrib
 
#deb http://http.kali.org/kali kali-rolling main non-free contrib
 
 
 
kali 的国内官方镜像为东软信息学院
 
所以只要dns是国内 应该 会自动去东软信息学院mirrors的
 
 
 
apt-get update
 
 
 
#一般只更新自己要的软件就好了,不要全系统更新 容易挂 再说 很多软件更新也没用嘛
 
apt install xxxx # apt list --upgradable |less 查看软件
 
apt upgrade
 
apt-get dist-upgrade #跨版本更新 ; 发布版升级
 
 
 
apt update && apt full-upgrade #升级2018的官方 命令
 
  </pre>
 
===更新系统故障===
 
<pre> evan@kalipc:~/github/python/tutorial$ sudo apt update
 
获取:1 http://mirrors.aliyun.com/kali kali-rolling InRelease [30.5 kB]
 
  错误:1 http://mirrors.aliyun.com/kali kali-rolling InRelease  
 
   下列签名无效: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <[email protected]>
 
 
 
正在读取软件包列表... 完成         
 
W: GPG 错误:http://mirrors.aliyun.com/kali kali-rolling InRelease: 下列签名无效: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <[email protected]>
 
E: 仓库 “http://mirrors.aliyun.com/kali kali-rolling InRelease” 没有数字签名。
 
N: 无法安全地用该源进行更新,所以默认禁用该源。
 
#使用root 运行此命令
 
root@kalipc:~# wget -q -O - https://archive.kali.org/archive-key.asc | apt-key add
 
OK </pre>
 
[https://www.kali.org/news/kali-linux-2018-1-release/ Kali Linux 2018.1 Release]
 
 
 
==添加 home分区==
 
<pre>
 
cp  -a .bash_history              .chromium-bsu              .gnupg/                    .pki/                      .ssh/                      .xinputrc .bak
 
 
 
把所以 . 隐藏的文件 先 ls . 然后得出的 放到 .bak目录 最后再放出来  
 
 
 
 
 
算了 直接搞个/data分区了
 
  mkfs.ext4 /dev/nvme0n1p9
 
 
 
 
 
blkid /dev/nvme0n1p9
 
 
 
cat /etc/fstab
 
# /etc/fstab: static file system information.
 
#
 
# Use 'blkid' to print the universally unique identifier for a
 
# device; this may be used with UUID= as a more robust way to name devices
 
# that works even if disks are added and removed. See fstab(5).
 
#
 
# <file system> <mount point>  <type> <options>      <dump>  <pass>
 
# / was on /dev/nvme0n1p8 during installation
 
UUID=8239d727-9b16-4e03-bf2d-d05766db6a2e /              ext4    errors=remount-ro 0       1
 
# /boot/efi was on /dev/nvme0n1p1 during installation
 
UUID=0848-0943 /boot/efi      vfat    umask=0077      0      1
 
# swap was on /dev/nvme0n1p7 during installation
 
UUID=753c3bee-a5b7-4de4-b0bf-1d971622d47a none            swap    sw              0      0
 
# /home was on /dev/nvme0n1p9 during installation
 
UUID=a90d5fe4-482b-458a-bc8b-fd733fd963d2 /data              ext4    errors=remount-ro 0      1
 
  
 +
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; 
 +
  
 
</pre>
 
</pre>
 
+
===see also===
==添加新硬盘==
+
[https://blog.csdn.net/u010307522/article/details/72862589 who命令实现]
<pre>
 
UUID=d94216fb-5712-dc44-ad1e-98534d6e4bae /mydata          ext4    defaults        0      2
 
#后来成为home 要记得改为 /home
 
mkdir /home/evan/data
 
uuid 查看
 
blkid
 
blkid /dev/sdb1
 
 
 
#mydata 2T hdd 2018年 09月 25日 星期二 10:22:06 CST
 
#/dev/sdb1  /home/evan/data    ext4    defaults        0      0
 
UUID=7664f2b3-ee40-4861-aed4-c6fd223126ac /home/evan/data          ext4    defaults        0      2
 
 
 
fstab 改为 /dev/sdb1 就好了 而不是UUID  可能和XFCE mount有关系  后来用uuid已正常 重分区系统也是同一个板 同一个CPU 不能在别的板搞过来
 
 
 
此问题 后来确定为让 sata线位置
 
 
 
fdiskl -l Partition 1 does not start on physical sector boundary.
 
用命令行gpt 分区后 老提示空间不够 后来 用gparted 重新分区好了
 
 
 
 
 
2021
 
root@k8s-master:~# blkid /dev/sdb1
 
/dev/sdb1: UUID="7664f2b3-ee40-4861-aed4-c6fd223126ac" TYPE="ext4" PARTUUID="c7b67401-1c52-4394-a779-e473df6c2a94"
 
 
 
#/etc/fstab
 
UUID=7664f2b3-ee40-4861-aed4-c6fd223126ac /mydata              ext4    errors=remount-ro 0      1
 
  
  
</pre>
+
===cp===
 
 
== install Awesome ==
 
 
<pre>
 
<pre>
这个的问题是安装后 gdm 选择了 依然进入gnome3 在家里用 vbox 试过也是尴尬了呢
 
解决办法是 ,可以不用安装kde
 
  apt install lightdm  lxrandr
 
#apt-get install kde-plasma-desktop
 
其实是gdm3  识别不了awesome 而ssdm可以识别,那其实也可以试一下 是不是只安装其它dm就可以了
 
</pre>
 
[[Awesome]]
 
 
== install xmonad ==
 
曾经放弃 现在 又回来了,没声音也是在mate打开一下就有了呢
 
 
[[xmonad安装及入门配置]]
 
 
安装完好像进入不了呢  原因和楼上一样
 
[http://blog.linuxchina.net/?p=1880 xmonad 安装及入门配置]
 
  
==install lxde==
+
#include        <stdio.h>//标准输入输出
apt-get install lxde
+
#include        <stdlib.h>//C标准函数库
 +
#include        <unistd.h>//Unix类系统定义符号常量
 +
#include        <fcntl.h>//定义了很多宏和open,fcntl函数原型
  
 +
#define BUFFERSIZE      4096//定义存储器容量
 +
#define COPYMODE        0644//定义复制的长度
  
[https://www.cnblogs.com/bu-wu-zheng-ye/p/4760919.html 在Debian上用FVWM做自己的桌面]
+
void oops(char *, char *);
 +
/*注意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]);
  
==备份[[Clonezilla]] ==
+
/*检查cp的第二个参数,复制的目的地址,用create在目的地址创建新文件,out_fd为open返回的描述符
 
+
  如果返回-1,代表创建失败,提示错误 ; create 创建的位置就是av[2] 目标文件的位置是也
== install mate ==
+
  为什么是 av[2] 就是 cp 命令的 第二个参数 也就是 目标文件 ,本来不存在 所以要create
<pre>
+
*/
#在公司的电脑不用安装这个了
+
if(out_fd=creat(av[2],COPYMODE)== -1)
sudo apt-get update
+
    oops("Cannot creat",argv[2])
#This will install the base packages required for a minimal MATE desktop
+
}
sudo apt-get install mate-desktop-environment-core
+
/*copyfiles  cp指令的动作就是读取一个文件的内容到存储器,在新的地址创建空白文件,再从存储器将内容写入新文件。
 
+
  这里判断复制是否成功:
#This will install the complete MATE desktop
+
  如果能读取顺利,而读取的位数和写的位数不同,是写错误;
sudo apt-get install mate-desktop-environment
+
  如果读取失败,是读错误。
 
+
  why n_chars 是什么
#This will install the complete MATE desktop including a few extras
+
  内核从utmpfd所指定的文件中读取了 reclen字节的数据,存放到 current_record所指定的内存空间中
sudo apt-get install mate-desktop-environment-extras
+
  while ( read(utmpfd, &current_record, reclen) == reclen )
</pre>
 
http://wiki.mate-desktop.org/download
 
 
 
==xrandr Multi-monitor==
 
<pre>
 
图形界面的用 lxrandr  XRandR
 
  
#if hdmi on home
+
  write out_fd 文件描述符  buf 内存数据, n_chars 要写的字节数
  
#只开启外外接显示器并关闭本本自带显示器 省电
+
循环的把源文件写入目标文件
xrandr --output  HDMI-1  --mode 1920x1080 --output LVDS-1 --off
+
*/
 +
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)
  
xrandr --output HDMI-1 --same-as   LVDS-1 --mode 1366x768  --output HDMI-1 --mode 1920x1080
+
        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)
  
多显示器
+
        }
今天使用了xrandr命令,似乎可以检测到扩展屏,之后详细看了xrandr的用法,运用 addmode 和 output 命令 结果可以用的!!!
 
  
 
</pre>
 
</pre>
[http://blog.linuxchina.net/?p=1441 linux桌面(Dedian Ubuntu kali) 多显示器支持]
 
 
[https://www.dell.com/support/article/zh-cn/sln129825/%E5%A6%82%E4%BD%95%E8%AE%BE%E7%BD%AE%E5%A4%9A%E6%98%BE%E7%A4%BA%E5%99%A8?lang=zh 如何设置多显示器]
 
 
[http://blog.linuxchina.net/?p=285 xrandr — fvwm 双显示器]
 
 
https://www.dell.com/community/Laptops-General-Read-Only/XPS-13-2in1-How-Many-External-Monitors-on-One-USB-C/td-p/5104782
 
  
[https://simonhawketts.co.uk/2017/02/27/multiple-monitors-on-a-dell-xps-13/ multiple-monitors-on-a-dell-xps-13]
 
  
https://wiki.archlinux.org/index.php/Multihead
+
[https://www.cnblogs.com/cxy1616/p/6063463.html cp命令的编写最接受原书的了]
  
https://wiki.debian.org/DualMonitorDualServerOneInput
+
[https://blog.csdn.net/hejishan/article/details/2250995  Unix程序设计:实现cp命令]
  
==外观==
+
[https://blog.csdn.net/XSL1990/article/details/8250039 linux自己编写的 cp 命令像os的那个了 ]
lxappearance
 
lxqt 外观设置  qt风格用 qt5  other kali-light 不然 vlc 可能不好看
 
  
 +
http://bbs.chinaunix.net/thread-247946-1-1.html
  
[http://www.linuxdiyf.com/soft/33622.html 12 个最佳 GNOME(GTK)主题]
+
[https://blog.csdn.net/byxbai1989/article/details/17371197 linux cp命令源码]
  
==all4one==
+
=== ls===
<pre>sudo apt install  tree  anjuta  geany  zim  remmina vlc  -y  #synapse spyder
 
#sudo apt-get install fcitx fcitx-table-wbpy ttf-wqy-microhei ttf-wqy-zenhei
 
sudo apt-get install alarm-clock-applet
 
#eclipse  emacs  pycharm  chrome  自己独立安装 </pre>
 
  
==解决没有声音: ==
 
<pre>
 
  sudo apt install  pulseaudio
 
systemctl --user enable pulseaudio && systemctl --user start pulseaudio
 
  systemctl --user enable pulseaudio #打开声音控制就好了
 
打开打开声音控制 然后
 
语音控制--输入设备--输入插孔 记得好个小锁头要打开
 
  
还有 就是 输出设备为  模拟耳机 20181023
 
  
可能还有回放要 chrome
 
</pre>
 
  
== install applications==
+
[https://blog.csdn.net/zhangxb35/article/details/42222037?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-3.control&dist_request_id=1331645.10707.16183847242193639&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-3.control Linux下的 ls 命令的简单实现]
大不了在启动是 用 win+R 先启动kupfer
 
  
===launcher===
+
[https://www.cnblogs.com/ikaros-521/p/11254332.html 高仿linux下的ls -l命令——C语言实现]
====[[Awesome#rofi_on_awesome|rofi_on_awesome]]====
 
====synapse====
 
  
快捷键一般设置 为menu(win右边那个)  实在不行就设置 为  win +`    or  ctrl+1
 
  
====kupfer====
+
[http://www.doczj.com/doc/54bc4a27a5e9856a56126086.html 在linux下编写一个LS命令的小程序]
====gnome-do====
 
apt-get install gnome-do gnome-do-plugins.
 
  
===[[Linux 下的护眼软件]]===
+
[https://www.cnblogs.com/lularible/p/14386358.html  Linux系统编程【3.1】——编写ls命令 ]
  
 +
[https://blog.csdn.net/lularible/article/details/113776163  Linux系统编程【3.2】——ls命令优化版和ls -l实现]
  
=== 系统还原===
+
[https://blog.nowcoder.net/n/9a48a7f697864e3bbdae2fe5bfcb0ef9 C 语言实现 Linux ls 命令]
timeshift
 
https://github.com/teejee2008/timeshift
 
=== 视频播放===
 
==== vlc====
 
apt install vlc # 也有升级功能  继续播放功能升级为3.0.6 版本就可以了 有皮肤 在插件管理器里
 
  
==== smplaye====
+
====简单版本的参考 ====
<pre>echo 'deb http://download.opensuse.org/repositories/home:/smplayerdev/Debian_9.0/ /' > /etc/apt/sources.list.d/home:smplayerdev.list
+
https://github.com/fupengfei058/ls
apt-get update
 
sudo apt-get install smplaye# 好用 可提高音量到200% 看py 教程非常 爽 vlc都没这么好 也可手工下载包安装 </pre>
 
  
[http://wiki.ubuntu.org.cn/SMPlayer SMPlayer使用]
+
http://www.voidcn.com/article/p-bzocmlpx-bxd.html
  
[https://software.opensuse.org/download.html?project=home%3Asmplayerdev&package=smplayer smplayer安装教程]
+
https://blog.csdn.net/qingshui23/article/details/53931555
  
[http://wiki.ubuntu.org.cn/Qref/Apps#.E8.A7.86.E9.A2.91.E6.92.AD.E6.94.BE 软件参考]
+
https://blog.csdn.net/aonaigayiximasi/article/details/54019964
  
=== 办公软件 ===
+
=C IDE=
  
====xpad====
+
https://www.jetbrains.com/zh-cn/clion/
====abiword and gnumeric====
 
  
====libreoffice====
+
[[Eclipse]]
[http://blog.linuxchina.net/?p=132 libreoffice installation]
 
  
[https://zh-cn.libreoffice.org/download/fonts/ 适用于 LibreOffice 的中日韩字体]
+
[[Anjuta on linux]]
  
https://zh-cn.libreoffice.org/get-help/install-howto/linux/
+
https://atom.io/
  
==== wps====
+
=pre main =
http://community.wps.cn/download/
 
 
<pre>
 
<pre>
问题
+
  init main( int argc, char *argv[]);
依赖关系问题使得 wps-office 的配置工作不能继续:
+
argc 是命令行参数的数目 也包括自身 没有后台的参数 那么 argc=1
  wps-office 依赖于 libpng12-0;然而:
 
  未安装软件包 libpng12-0。
 
 
 
wget http://ftp.cn.debian.org/debian/pool/main/libp/libpng/libpng12-0_1.2.49-1+deb7u2_amd64.deb
 
sudo dpkg -i libpng12-0_1.2.49-1+deb7u2_amd64.deb
 
sudo dpkg -i wps-office_10.1.0.5672-a21_amd64.deb
 
</pre>
 
 
 
[https://itaken.github.io/post/2017/05/03/libpng12-0%E6%9C%AA%E5%AE%89%E8%A3%85%E9%94%99%E8%AF%AF.html libpng12-0未安装错误]
 
 
 
[http://community.wps.cn/wiki/No_necessary_symbol_fonts wps字体]
 
  
===Notes ===
+
argv 指向参数的各个指针所构成的数组, argv[0]表示命令本身,argv[1] 表示第一个参数
gnote
 
  
https://wiki.gnome.org/Design/Apps/Notes
+
argc 是argument count的缩写表示传入main函数中的参数个数,包括这个程序本身
  
=== CAD ===
+
argv 是 argument vector的缩写表示传入main函数中的参数列表,其中argv[0]表示这个程序的名字; *argv[] 其实是地址
==== freecad====
 
sudo add-apt-repository ppa:freecad-maintainers/freecad-stable
 
sudo apt update
 
  sudo apt install freecad
 
  
[https://www.sysgeek.cn/linux-cad-software/ 适用于Linux系统的5款最佳CAD软件汇总]
+
第二个参数,char*型的argv[],为字符串数组,用来存放指向的字符串参数的指针数组,每一个元素指向一个参数。各成员含义如下:
 +
        argv[0]指向程序运行的全路径名
 +
        argv[1]指向在DOS命令行中执行程序名后的第一个字符串
  
https://wiki.freecadweb.org/Install_on_Unix/zh-cn
+
char  *argv[]是一个字符数组,其大小是int  argc,主要用于命令行参数  argv[]  参数,数组里每个元素代表一个参数;
  
https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-stable
+
看代码的时候我最先不理解的就是main函数的定义:
  
https://github.com/FreeCAD/FreeCAD/releases/tag/0.18.4
+
int main(int argc, char *argv[]){}
  
 +
经查阅得知,argc是用来表示在命令行下输入命令时的参数个数,包括指令本身;argv[]是用来取得你输入的参数。针对具体指令分析如下(每一步解释由注释形式给出)。
  
[https://linuxtoy.org/archives/6-of-the-best-free-linux-cad-software.html 6 款高品质的免费 Linux CAD 应用程序]
+
由于main函数不能被其它函数调用, 因此不可能在程序内部取得实际值。那么,在何处把实参值赋予main函数的形参呢? 实际上,main函数的参数值是从操作系统命令行上获得的。当我们要运行一个可执行文件时,在DOS提示符下键入文件名,再输入实际参数即可把这些实参传送到main的形参中去。
  
=== email ===
+
ls1.c中的 就是这个了啦
====[[thunderbird]]====
+
DOS提示符下命令行的一般形式为: C:\>可执行文件名 参数 参数……; 但是应该特别注意的是,main 的两个形参和命令行中的参数在位置上不是一一对应的。因为,main的形参只有二个,而命令行中的参数个数原则上未加限制。argc参数表示了命令行中参数的个数(注意:文件名本身也算一个参数),argc的值是在输入命令行时由系统按实际参数的个数自动赋予的。例如有命令行为: C:\>E6 24 BASIC dbase FORTRAN由于文件名E6 24本身也算一个参数,所以共有4个参数,因此argc取得的值为4。argv参数是字符串指针数组,其各元素值为命令行中各字符串(参数均按字符串处理)的首地址。 指针数组的长度即为参数个数。数组元素初值由系统自动赋予。其表示如图6.8所示:
===GNURadio===
 
GNURadio 是免费的软件开发工具套件。它提供信号运行和处理模块,用它可以在易制作的低成本的射频(RF)硬件和通用微处理器上实现软件定义无线电。 这套套件广泛用于业余爱好者,学术机构和商业机构用来研究和构建无线通信系统。
 
https://www.gnuradio.org/
 
  
== emacs26 in Ubuntu 18.04==
+
main(int argc,char *argv){
<pre>
+
while(argc-->1)
sudo add-apt-repository ppa:kelleyk/emacs
+
printf("%s\n",*++argv);
sudo apt update
+
}
  
  sudo apt install emacs26
+
本例是显示命令行中输入的参数如果上例的可执行文件名为e24.exe,存放在A驱动器的盘内。
 +
因此输入的命令行为: C:\>a:e24 BASIC dBASE FORTRAN 
 +
则运行结果为:
 +
BASIC
 +
dBASE
 +
FORTRAN
 +
  该行共有4个参数,执行main时,argc的初值即为4。argv的4个元素分为4个字符串的首地址。执行while语句,每循环一次 argv值减1,当argv等于1时停止循环,共循环三次, 因此共可输出三个参数。在printf函数中,由于打印项*++argv是先加1再打印, 故第一次打印的是argv[1]所指的字符串BASIC。第二、 三次循环分别打印后二个字符串。而参数e24是文件名,不必输出。
  
root@myxps:/usr/share/applications# cat emacs25.desktop
+
另外一个例子
[Desktop Entry]
 
Version=1.0
 
Name=GNU Emacs 25 (GUI)
 
GenericName=Text Editor
 
Comment=GNU Emacs is an extensible, customizable text editor - and more
 
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
 
TryExec=/usr/bin/emacs25
 
Exec=/usr/bin/emacs25 %F
 
Icon=emacs25
 
Type=Application
 
Terminal=false
 
Categories=Utility;Development;TextEditor;
 
StartupWMClass=Emacs
 
Keywords=Text;Editor;
 
root@myxps:/usr/share/applications# cp  emacs25.desktop  emacs.desktop
 
root@myxps:/usr/share/applications# emacs  -nw  emacs.desktop
 
root@myxps:/usr/share/applications# cat emacs.desktop
 
[Desktop Entry]
 
Version=1.0
 
Name=GNU Emacs 26 (GUI)
 
GenericName=Text Editor
 
Comment=GNU Emacs is an extensible, customizable text editor - and more
 
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
 
TryExec=/usr/bin/emacs26
 
Exec=/usr/bin/emacs26 %F
 
Icon=emacs25
 
Type=Application
 
Terminal=false
 
Categories=Utility;Development;TextEditor;
 
StartupWMClass=Emacs
 
Keywords=Text;Editor;
 
  
  
 
</pre>
 
</pre>
http://ubuntuhandbook.org/index.php/2019/04/gnu-emacs-26-2-released-install-in-ubuntu-18-04/
+
[https://blog.csdn.net/zhaozhiyuan111/article/details/104050729 c语言中argc和argv[ <nowiki>]</nowiki>的作用及用法]
=== emacs25===
 
  apt install emacs -y
 
  
[[How to Compile Emacs on Linux]]
+
[https://blog.csdn.net/weixin_40539125/article/details/82585792 good和ls1.c差不多 C语言中 int main(int argc,char *argv[<nowiki>]</nowiki>)的两个参数详解]
  
[[Emacs入门]]
+
https://zhuanlan.zhihu.com/p/267822985
  
===文件管理===
+
https://blog.csdn.net/LYJ_viviani/article/details/51873961
apt install  pcmanfm-qt # thunar
 
  
<pre>
+
[https://www.bilibili.com/video/av246420003/ c语言之argc和argv]
#gedit 另外到 mousepad
 
cat /usr/share/applications/gedit.desktop
 
[Desktop Entry]
 
Name=gedit
 
Comment[zh_CN]=简易文本编辑器
 
GenericName=Text Editor
 
GenericName[zh_CN]=文本编辑器
 
GenericName[zh_TW]=文字編輯程式
 
Exec=mousepad %F
 
Icon=accessories-text-editor
 
Terminal=false
 
StartupNotify=true
 
Type=Application
 
Categories=Utility;TextEditor;GTK;
 
MimeType=text/plain;
 
  
</pre>
+
=基础=
  
=== 终端软件===
+
==计算机为什么要用二进制==
  apt install terminator #tilix # ssh tools  pacmanager
+
  Everything over Binary 模拟路转换成为数字电路
  
[[terminator基础]]
+
https://blog.csdn.net/weixin_44296862/article/details/95277924
  
===[[下载工具]]===
+
https://blog.csdn.net/c46550/article/details/90951557
  
 
+
[https://wenku.baidu.com/view/77074002e009581b6ad9eb2c.html 一位全加器]
=== music===
+
=== signed char 类型的范围为 -128~127===
==== deadbeef====
 
[http://deadbeef.sourceforge.net/download.html 建议用deadbeef直接下载deb包]
 
 
 
[http://deadbeef.sourceforge.net/plugins.html plugins]
 
====qmmp====
 
[https://www.howtoing.com/how-to-get-the-most-out-of-qmmp-1-0/ 如何充分利用Qmmp 1.0]
 
 
 
皮肤下载 然后 ctrl+p 选择你下载的 .wsz skinsfile
 
http://qmmp.ylsoftware.com/files/skins
 
 
 
[http://vinmusic.com/tool/qmmp/ ubuntu下的音频播放器: Qmmp]
 
 
 
==== quodlibet====
 
<pre># deb http://lazka.github.io/ql-debian/testing/ quodlibet-unstable/
 
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5A62D0CAB6264964
 
sudo apt-get update
 
sudo apt-get install quodlibet</pre>
 
 
 
====Audacity  ====
 
[[Audacity音频处理]]
 
Audacity 多轨跨平台的音频编辑软件
 
 
 
=== install rednotebook===
 
[https://github.com/collinss/sticky Sticky Notes便笺]
 
 
<pre>
 
<pre>
#太老版本,不建议用
+
  按八位来算:
#apt-get install rednotebook  
+
在计算机里面是用补码表示的,128的二进制码是:10000000,这个东西在计算里面并不是128,因为最高位是符号,它是个负数,那么负数的原码是多少呢,我们知道如果补码的符号位为“1”,表示是一个负数,求原码的操作可以是:符号位为1,其余各位取反,然后再整个数加1。
 
+
所以,10000000取反后就是11111111,把符号位去了就是01111111再加1就是10000000就是-128了。
  sudo apt-get install noblenote
+
其实你看-127是10000001,这个很好理解,-128加1不就是-127
 
+
[https://blog.csdn.net/zy986718042/article/details/71699079 浅谈char类型范围]
 
 
#2020 jul
 
wget -c https://github.com/jendrikseipp/rednotebook/archive/v2.19.tar.gz
 
 
 
sudo apt install python3-yaml
 
 
 
 
 
rednotebook$ sudo python3  setup.py  install
 
 
 
 
 
#or 问题 新版本的图片看不到了
 
wget -c https://github.com/jendrikseipp/rednotebook/archive/v2.19.tar.gz
 
#wget -c --no-check-certificate https://github.com/jendrikseipp/rednotebook/archive/v2.6.1.tar.gz
 
tar xvf v2.6.1.tar.gz
 
sudo mv rednotebook-2.6.1 /opt/rednotebook
 
vi  /usr/share/applications/rednotebook.desktop
 
 
 
[Desktop Entry]
 
Encoding=UTF-8
 
Name=rednotebook
 
GenericName=rednotebook
 
Comment[zh_CN]=日志本
 
Comment= journal
 
#Exec=/home/evan/software/rednotebook-2.2/run
 
#Icon=/home/evan/software/rednotebook-2.2/rednotebook.png
 
Exec=/opt/rednotebook/run
 
Icon=/opt/rednotebook/rednotebook.png
 
Terminal=false
 
X-MultipleArgs=false
 
StartupWMClass=Firefox
 
Type=Application
 
Categories=Utility;TextEditor;GTK;
 
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;
 
 
 
 
 
#sudo mv /usr/bin/rednotebook /usr/bin/rednotebook1.4
 
#sudo ln -s /home/evan/software/rednotebook-1.10.1/rednotebook/rednotebook  /usr/bin/rednotebook
 
 
 
 
 
家目录  /home/evan/.rednotebook
 
rsync  -avz  /home/evan/.rednotebook/  192.168.0.176:/home/evan/.rednotebook/
 
 
 
 
 
 
 
ModuleNotFoundError: No module named 'distutils.core'
 
 
 
sudo apt install python3-pip python3-yaml
 
 
 
 
 
 
 
  
 +
补码表示时,-0和+0补码相同都是0 000 0000,所义导致可以多表示一个负数,...这个负数是最小的那个..
 
</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]
  
[[Rednotebook]]
 
  
=== install bluefish===
+
[https://wenwen.sogou.com/z/q871193299.htm?ch=fromnewwenwen.pc char 其数值表示 范围的计算]
Bluefish is a powerful editor targeted towards programmers and webdevelopers, with many options to write websites, scripts and programming code.
 
  
sudo apt install bluefish -y
+
[https://www.bilibili.com/video/BV1Gt4y1D73z?from=search&seid=13506202580160943636 b站 C语言数据类型及数值范围]
  
 
+
===原码 补码 反码 ===
http://pkg.kali.org/pkg/bluefish
 
 
 
[http://bluefish.openoffice.nl/index.html 官网]
 
 
 
[https://bfwiki.tellefsen.net/index.php/Installing_Bluefish  Installing Bluefish]
 
 
 
=== install Sublime Text 3===
 
<pre>wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
 
sudo apt-get install apt-transport-https
 
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
 
sudo apt-get update &&  sudo apt-get install sublime-text
 
</pre>
 
[https://www.sublimetext.com/docs/3/linux_repositories.html#apt 官方参考]
 
 
 
===IM ===
 
https://signal.org/
 
 
<pre>
 
<pre>
#2020
+
1.原码
 +
最高位表示符号位。剩下的位数,是这个数的绝对值的二进制
  
sudo mv telegram-desktop  telegram-desktopbak
+
就比方说 一个完整的int型变量在内存中占的是4个字节,32位的编译器中 那么这时候他的二进制表示是00000000 00000000 00000000 00000000
  
 +
所以
  
sudo cp Telegram /usr/bin/
+
10的原码就是00000000 00000000 00000000 00001010
sudo cp Updater  /usr/bin/
 
  
sudo ln -s Telegram telegram-desktop
+
那么负数的原码就是例如
  
 +
-10的原码10000000 00000000 00000000 00001010
  
 +
符号位是第一位 0为正数 1为负数
  
解压后复制到  /opt/Telegram/Telegram
+
2.反码
/usr/bin$ sudo ln -s  /opt/Telegram/Telegram  telegram-desktop #要新的 用下载的吧
+
    正数的反码就是其原码.
apt install  telegram-desktop
 
</pre>
 
2.1.5 与fictx冲突  换回2.1.4 
 
https://telegram.org/
 
https://pkg.kali.org/pkg/telegram-desktop
 
  
==== wechat====
+
    负数的反码就是在其原码的基础之上 符号位不变,其他位取反.
https://gitee.com/lizhuohuan/docker-wechat
+
   
==== QQ====
+
3.补码
<pre>
 
ps  QQ 有些 平铺下退出  ,换个样式就可以了
 
  
 +
    正数的补码就是其原码.
  
root@k8s-master:~# bash -x  linuxqq_2.0.0-b1-1024_x86_64.sh
+
    负数的补码就是在其反码的基础之上+1
+ [[ root != \r\o\o\t ]]
+
   
+ lines=33
 
+ tarball_md5=f90cfea5999cf4eaafba0b8f0a2f80f8
 
+ tail -n+33 linuxqq_2.0.0-b1-1024_x86_64.sh
 
++ md5sum linuxqq.tar.gz
 
++ cut '-d ' -f1
 
+ md5=f90cfea5999cf4eaafba0b8f0a2f80f8
 
+ [[ f90cfea5999cf4eaafba0b8f0a2f80f8 != \f\9\0\c\f\e\a\5\9\9\9\c\f\4\e\a\a\f\b\a\0\b\8\f\0\a\2\f\8\0\f\8 ]]
 
+ export -f do_install
 
+ tar zxf linuxqq.tar.gz
 
+ find linuxqq/ -type f -exec bash -c 'do_install "{}"' ';'
 
installing /usr/share/applications/qq.desktop
 
installing /usr/share/tencent-qq/crashpad_handler
 
installing /usr/share/tencent-qq/qq
 
installing /usr/share/tencent-qq/res.db
 
installing /usr/share/tencent-qq/qq.png
 
installing /usr/share/tencent-qq/qq.bmp
 
+ rm -rf linuxqq linuxqq.tar.gz
 
+ exit 0
 
 
 
 
</pre>
 
</pre>
  
===浏览器 ===
+
[https://www.cnblogs.com/wangxiaoqi/p/6419676.html  C语言中的原码、反码和补码 ]
====chrome ====
 
方法一:在官网下载对应版本的deb后执行
 
  google-chrome-stable #平时升级
 
 
 
[http://wiki.linuxchina.net/index.php?title=Ubuntu%E5%88%A9%E7%94%A8shadowsocks%E5%92%8Cpolipo%E7%BB%88%E7%AB%AF%E7%BF%BB%E5%A2%99#shadowsocks.E5.92.8Cpolipo 全局翻墙安装插件]
 
 
 
 
 
Google Chrome有众多的出色的插件,说几个常用的
 
suspender:内存不够用,可以装个suspender插件,把其他暂时不看的tab中断掉
 
AdBlock:最受欢迎的Chrome扩展,拥有超过4000万用户!屏蔽整个互联网上的广告
 
The QR Code Extension:允许当前页面生成QR码,并使用网络摄像头扫描QR码。
 
Window Resizer:调节屏幕的分辨率,诸多时候用户开发
 
Vimium:vim的分身
 
Proxy SwitchyOmega:轻松快捷地管理和切换多个代理设置
 
Wechat:微信
 
马克飞象:使用印象笔记扩展程序一键保存精彩网页内容到印象笔记帐户
 
惠惠购物助手:【网易出品】在您网购浏览商品的同时,自动对比其他优质电商同款商品价格,并提供商品价格历史,帮您轻松抄底,聪明网购不吃亏
 
JSON-handle:顾名思义就是处理JSON数据的工具
 
  
[https://www.yuzhi100.com/article/debian-9-anzhuang-chrome 使用 Apt 软件源安装谷歌 Chrome ]
+
[https://www.cnblogs.com/burningc/p/10741253.html  C语言之原码、反码和补码 ]
[[ 通过shadowsocks翻墙 ]]
 
  
====[http://wiki.linuxchina.net/index.php?title=Firefox%E5%AE%89%E8%A3%85%E5%92%8C%E6%B1%89%E5%8C%96 firefox]====
+
[https://blog.csdn.net/liuyangsyouxiang/article/details/6050525 C语言——源码、反码、补码]
sudo apt install firefox-esr-l10n-zh-cn #如果用自带的esr版本
 
常用插件 Auto Tab Discard, Notifier for Gmail ,  Tab Suspender
 
[[firefox安装和汉化]]
 
  
[https://www.mozilla.org/zh-CN/firefox/central/ firefox新手上路]
+
[https://www.bilibili.com/video/BV1Wx411g7Jg/?spm_id_from=333.788.videocard.1 b站原码 反码 补码]
  
====chromium====
+
=gdb=
apt install chromium chromium-l10n
 
https://wiki.debian.org/Chromium
 
 
 
====falkon====
 
sudo apt-get install falkon
 
又一个轻量的web 浏览器 以前的 Qupzilla  apt 会提示你的
 
2017年8月10日,QupZilla开发者David Rosca在博客宣布QupZilla成为KDE项目。[5]Qupzilla 2.2发布之后项目将更名为“Falkon”。[6]KDE Falkon 3.0于2018年2月27日发布。
 
qupzilla conitnues development as falkon browser
 
 
 
====[[tor]]====
 
 
 
====gnome-web====
 
apt install  epiphany-browser
 
====midori====
 
这个暂时安装上不好用 以前可以 直接 apt
 
 
 
====palemoon====
 
 
<pre>
 
<pre>
对于 Debian 10,请运行以下命令:
 
Keep in mind that the owner of the key may distribute updates, packages and repositories that your system will trust (more information).
 
 
echo 'deb http://download.opensuse.org/repositories/home:/stevenpusser/Debian_10/ /' | sudo tee /etc/apt/sources.list.d/home:stevenpusser.list
 
curl -fsSL https://download.opensuse.org/repositories/home:stevenpusser/Debian_10/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home:stevenpusser.gpg > /dev/null
 
sudo apt update
 
sudo apt install palemoon
 
</pre>
 
 
https://linux.palemoon.org/help/installation/
 
 
===download tools===
 
sudo apt install uget -y
 
 
axel  还是最爽的  下载rapian就知了
 
 
===绘图工具dia ===
 
绘图工具dia(取代visio)
 
sudo apt install dia -y
 
  
===电子书calibre ===
 
  apt install calibre
 
  
===有道词典 ===
 
  
http://cidian.youdao.com/index-linux.html
+
start  st 开始执行程序,在main函数的第一条语句前面停下来
#在官网下载对应版本的deb后执行
+
step      s  下一条语句,如果该语句为函数调用,则进入函数执行其中的第一条语句
  sudo dpkg -i *.deb && sudo apt-get install -fy
+
  next    n  执行下一条语句,如果该语句为函数调用,不会进入函数内部执行(即不会一步步地调试函数内部语句)
  
===x11vnc===
 
  
x11vnc是一种 位图显示的 视窗系统 。它是在 Unix 和 类Unix 操作系统 ,以及 OpenVMS 上建立图形用户界面的标准工具包和协议。x11vnc服务端可以实现Windows远程Linux桌面系统。
 
sudo apt-get install x11vnc
 
  
===python===
 
sudo apt-get install ipython3
 
  
  
[https://www.cnblogs.com/xuanhun/p/5481907.html kali linux Python开发环境初始化]
 
====python IDE ====
 
sudo apt-get install spyder3
 
  
https://docs.spyder-ide.org/installation.html#
 
  
===ops tools===
 
sudo apt install lrzsz #sz命令发送文件到本地: # sz filename
 
===develop tools ===
 
apt install gdb
 
  
===catfish===
 
sudo apt-get install catfish #catfish简称文件搜索神器
 
  
===django===
+
使用例子  结合他看C代码 爽到不行了
<pre>
+
184
pip install Django==1.8.18
+
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  执行下一条语句,如果该语句为函数调用,不会进入函数内部执行(即不会一步步地调试函数内部语句)
  
#on ~/.bashrc
 
alias django-admin='/home/evan/.local/lib/python2.7/site-packages/django/bin/django-admin.py'
 
 
</pre>
 
</pre>
  
===electronic-wechat===
+
=c=
 
 
electronic-wechat是一个基于nodeJS开发的Linux系统微信。
 
 
<pre>
 
<pre>
git clone https://github.com/geeeeeeeeek/electronic-wechat.git
 
cd electronic-wechat
 
npm install && npm start  #bash: npm: 未找到命令
 
  
bash: npm: 未找到命令
+
/*                                                                                                                                                                                         
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
+
20答案是 Tuesday  因为列数定了是10                                                                                                                                                           
sudo apt-get install -y nodejs
+
21days[2] === days[2][10]                                                                                                                                                                   
 +
22                                                                                                                                                                                           
 +
23解说                                                                                                                                                                                       
 +
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 ==
===截图===
+
=== 石头剪刀布===
 
 
==== flameshot ====
 
sudo apt install flameshot
 
https://flameshot.js.org/#/getting-start
 
 
 
[https://zhuanlan.zhihu.com/p/48250522 Flameshot:一个简洁但功能丰富的截图工具]
 
==== Shutter ====
 
gnome-screenshot
 
apt install shutter
 
sudo apt install deepin-screenshot -y
 
 
 
 
 
====ShareX(win)====
 
 
 
====deepin scrot 作废====
 
 
<pre>
 
<pre>
sudo apt install deepin-screenshot -y
+
#include <stdio.h>
 +
#include <stdlib.h>
 +
#include <time.h>
  
 +
int main(void)
 +
{
 +
char gesture[3][10] = { "scissor", "stone", "cloth" };
 +
int man, computer, result, ret;
  
wget -c http://packages.linuxdeepin.com/deepin/pool/main/d/deepin-scrot/deepin-scrot_2.0-0deepin_all.deb
+
srand(time(NULL));
sudo dpkg -i deepin-scrot_2.0-0deepin_all.deb
+
while (1) {
sudo apt-get install -f
+
computer = rand() % 3;
#使用
+
  printf("\nInput your gesture (0-scissor 1-stone 2-cloth):\n");
deepin-scrot
+
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;
https://github.com/lovesnow/pystorm
+
if (result > 0)
在这 里选择另存为  default/start_cursor.png
+
printf("You win!\n");
 +
else if (result == 0)
 +
printf("Draw!\n");
 +
else
 +
printf("You lose!\n");
 +
}
 +
return 0;
 +
}
  
  
screenshot
+
/*
 +
0、1、2三个整数分别是剪刀石头布在程序中的内部表示,用户也要求输入0、1或2,然后和计算机随机生成的0、1或2比胜负。这个程序的主体是一个死循环,需要按Ctrl-C退出程序。以往我们写的程序都只有打印输出,在这个程序中我们第一次碰到处理用户输入的情况。在这里只是简单解释一下,以后再细讲。scanf("%d", &man)这个调用的功能是等待用户输入一个整数并回车,这个整数会被scanf函数保存在man这个整型变量里。如果用户输入合法(输入的确实是整数而不是字符串),则scanf函数返回1,表示成功读入一个数据。但即使用户输入的是整数,我们还需要进一步检查是不是在0~2的范围内,写程序时对用户输入要格外小心,用户有可能输入任何数据,他才不管游戏规则是什么。
  
vi /usr/share/applications/scrot.desktop
+
和printf类似,scanf也可以用%c、%f、%s等转换说明。如果在传给scanf的第一个参数中用%d、%f或%c表示读入一个整数、浮点数或字符,则第二个参数的形式应该是&运算符加一个相应类型的变量名,表示读进来的数存到这个变量中;如果在第一个参数中用%s读入一个字符串,则第二个参数应该是数组名,数组名前面不加&,因为数组类型做右值时自动转换成指针类型,而scanf后面这个参数要的就是指针类型,在第 10 章 gdb有scanf读入字符串的例子。&运算符的作用也是得到一个指针类型,这个运算符以后再详细解释。
[Desktop Entry]
 
Name=scrot
 
Name[zh_CN]=抓图
 
Comment=Save images of your desktop or individual windows
 
Comment[zh_CN]=保存您桌面还是单个窗口的图像
 
Exec=/usr/bin/deepin-scrot
 
Terminal=false
 
Type=Application
 
Icon=/home/evan/screenshot/start_cursor.png
 
StartupNotify=true
 
Categories=GTK;Utility;
 
Keywords=MATE;screenshot;snapshot;desktop;window;image;
 
OnlyShowIn=MATE;
 
X-MATE-Bugzilla-Bugzilla=MATE
 
X-MATE-Bugzilla-Product=mate-utils
 
X-MATE-Bugzilla-Component=screenshot
 
X-MATE-Bugzilla-OtherBinaries=mate-panel-screenshot
 
  
https://wiki.debian.org/ScreenShots
+
留给读者的思考问题是:(man - computer + 4) % 3 - 1这个神奇的表达式是如何比较出0、1、2这三个数字在“剪刀石头布”意义上的大小的
 +
*/
  
/usr/share/applications# find ./ -name "*scree*"
 
 
</pre>
 
</pre>
[https://www.deepin.org/2012/03/02/deepin-scrot-2-0-video-and-install-in-ubuntu/ 深度截图工具(DEEPIN-SCROT]
 
  
===XMind===
+
[https://wenku.baidu.com/view/55e520da5022aaea998f0f5e.html 石头剪刀布_C语言]
XMind是一款实用的思维导图软件,简单易用、美观、功能强大,拥有高效的可视化思维模式,具备可扩展、跨平台。但是对于稳定性和性能还是欠佳,在ubuntu上使用占用很大的CPU资源。
 
  
#在官网下载对应版本的deb后执行
+
https://blog.csdn.net/guoqingchun/article/details/8104197
sudo dpkg -i *.deb && sudo apt-get install -fy
 
  
===远程桌面软件===
 
====Remmina====
 
<pre>
 
Remmina是一个用远程桌面软件,提供了RDP、VNC、XDMCP、SSH等远程连接协议的支持。 家里有时连不上是原来的网线接口不太好,重插一下就好了 
 
sudo apt-get install remmina
 
 
usage
 
 
高级-- 画质 --  最好
 
 
基本--色深--真色32位
 
 
</pre>
 
 
====rdesktop====
 
有时,有个备份的软件很重要 上次Remmina老是自动全屏,每次连接win后老是要断开 烦死了,于是找了一下 发现这货 记录一下
 
我的常用使用命令
 
rdesktop  -g 1280x960 192.168.30.54
 
 
[https://magiclen.org/rdesktop/ 在Linux上使用rdesktop]
 
 
[https://wiki.archlinux.org/index.php/rdesktop arch rdesktop]
 
 
====freerdp====
 
freerdp.com
 
  apt install freerdp-x11 freerdp2-x11
 
http://manpages.ubuntu.com/manpages/xenial/man1/xfreerdp.1.html
 
 
https://www.jianshu.com/p/f6fcf5b56fe3
 
 
===数据库连接 ===
 
====[[Dbeaver安装]]====
 
 
 
===思维导图===
 
[[freeplane]]
 
===IDE===
 
====eclipse====
 
 
https://www.eclipse.org/downloads/eclipse-packages/
 
 
[https://www.linuxidc.com/Linux/2018-12/155943.htm Ubuntu 18.04下JDK与Eclipse安装配置]
 
<pre>
 
 
 
 
cat /usr/share/applications/eclipse.desktop
 
[Desktop Entry]
 
Name=eclipse
 
Name[zh_CN]=eclipse IDE
 
GenericName=Integrated Development Environment
 
GenericName[zh_CN]=集成开发环境
 
Comment=Develop software in an integrated development environment
 
Comment[zh_CN]=在集成开发环境中开发软件
 
Encoding=UTF-8
 
Exec=/home/evan/apps/eclipse/eclipse
 
Icon=/home/evan/apps/eclipse/icon.xpm
 
Terminal=false
 
X-MultipleArgs=false
 
StartupWMClass=Firefox
 
Type=Application
 
Categories=GNOME;GTK;Development;IDE;
 
StartupNotify=true
 
</pre>
 
 
===Meld===
 
Meld是针对开发者的视觉差异和合并工具。MELD帮助您比较文件、目录和版本控制的项目。它提供了两个和三个比较的文件和目录,并支持许多流行的版本控制系统。既可以查看差异有可以同步!
 
sudo apt-get install meld
 
 
===spyder ===
 
 
Python的开源IDE
 
可在MIT许可下免费使用
 
Spyder python的一些基本特性是多语言编辑器,交互式控制台,文档查看器,变量浏览器,在文件中查找,文件浏览器等
 
虽然Spyder是一个独立的IDE,支持包括Windows,Linux,MacOS,MacOS X等多个平台,但它也可以作为一个PyQt扩展库嵌入到PyQt应用程序
 
sudo apt-get install spyder
 
https://pythonhosted.org/spyder/index.html
 
 
链接:https://github.com/spyder-ide/spyder
 
 
https://pythonhosted.org/spyder/installation.html 
 
 
问题就是在awesome环境中fcitx 不能打中文
 
  
=== albert===
+
===Linux下C语言获取目录中的文件列表 ===
wget -c http://repo.adminlounge.org/pool/dists/jessie/main/a/albert/albert_0.12_amd64.deb
 
sudo dpkg -i albert_0.12_amd64.deb  && sudo apt-get install -fy
 
 
 
https://albertlauncher.github.io/docs/installing/
 
官方安装命令好像不成功呢 所以 我直接拿出deb包了
 
 
 
===install eric6===
 
 
<pre>
 
<pre>
eric6 支持 py2 and py3
+
/*
  sudo apt install eric -y
+
  * dir.c
 
+
*
安裝插件
+
Linux下C语言获取目录中的文件列表  https://www.cnblogs.com/dgwblog/p/12158373.html
插件--> 插件儲存庫 --> 然後都是下載 安装 下一步什么 的就行了
+
http://c.biancheng.net/cpp/html/1548.html  怎样使用C语言列出某个目录下的文件?
 
+
*  Created on: 2020年11月2日
问题就是导致fcitx 不能打中文
+
*      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;
 +
}
  
Debugging with the Eric IDE
 
I would sum up how to debug with the Eric IDE too:
 
  
F5 (start debugging; untick “Don’t stop at first line” or set a breakpoint)
+
/* 结果
F10 (stop)
+
*
F7 (next, step in subroutines)
+
d_name:.
F8 (next, step over subroutines)
+
d_name:..
F9 (return, step out of subroutine)
+
d_name:1.py
F6 (continue, go, run)
+
d_name:22.py
Shift+F6 (continue till cursor)
 
conditional breakpoints are supported (set a breakpoint, right click on it, edit)
 
I find Eric’s debugger is much faster than Winpdb.0
 
  
 +
*/
  
trouble shooting
 
  
下列软件包有未满足的依赖关系:
 
libkf5coreaddons5 : 破坏: libkf5globalaccel-bin (< 5.37) 但是 5.28.0-1 正要被安装
 
libkf5crash5 : 破坏: libkf5globalaccel-bin (< 5.37) 但是 5.28.0-1 正要被安装
 
E: 错误,pkgProblemResolver::Resolve 发生故障,这可能是有软件包被要求保持现状的缘故。
 
 
 
如果用新立得 就是提示
 
无法应用变更! 请先修复损毁的软件包
 
 
结果这样就好了
 
sudo apt-get install -f
 
sudo dpkg --configure -a
 
 
sudo apt-get dist-upgrade
 
 
 
 
#这个小心点
 
sudo apt-get autoremove
 
 
</pre>
 
</pre>
  
http://eric-ide.python-projects.org/
+
=排序与查找=
 
+
==插入排序 ==
http://pydev.sourceforge.net/
 
 
 
[http://www.freehackers.org/IDE_for_python_and_django_development_on_linux IDE for python and django development on linux]
 
 
 
[http://blog.mattwoodward.com/2012/08/manually-installing-django-plugin-for.html Manually Installing the Django Plugin for Eric]
 
 
 
===Figlet===
 
一句话:Figlet是一个将字符串在终端生成一个logo的终端工具。
 
sudo apt-get install figlet
 
figlet mylove
 
===bleachbit ===
 
sudo apt install bleachbit
 
sudo  bleachbit #有中文界面
 
[https://www.howtoing.com/ccleaner-alternatives-for-ubuntu 用于Ubuntu的6款最佳CCleaner替代品]
 
===chmsee ===
 
 
 
chmsee
 
 
 
===打印机===
 
====惠普(HP_LaserJet_Professional_M1216nfh_MFP)HP打印机驱动安装====
 
===== apt我使用的办法 =====
 
 
<pre>
 
<pre>
1、打开深度终端,输入:sudo apt-get update && sudo apt-get install hplip hplip-gui hplip-plugin
+
#include <stdio.h>
libcups2 libcups2-dev cups-bsd cups-client libcupsimage2 libcupsimage2-dev libdbus-1-dev
+
#define LEN 5
</pre>
+
int a[LEN] = { 10, 5, 2, 4, 7 };
2、接着终端输入:hp-setup, 按照提示一路下一步 https://developers.hp.com/hp-linux-imaging-and-printing/install/manual/hp_setup
+
void insertion_sort(void)
 
+
{
 
+
int i, j, key;
https://wiki.deepin.org/index.php?title=%E6%89%93%E5%8D%B0%E6%9C%BA
+
for (j = 1; j < LEN; ++j) {
 
+
printf("%d, %d, %d, %d, %d\n",
===== 官方下载=====
+
      a[0], a[1], a[2], a[3], a[4]);
https://developers.hp.com/hp-linux-imaging-and-printing/gethplip
+
key = a[j]; //key 标记为未排序的第一个元素
 
+
i = j - 1;
https://developers.hp.com/hp-linux-imaging-and-printing/install
+
                // key 与已排序元素从大到小比较,寻找key应插入的元素 a[i+1]一般就是key 起初的值
 
+
////采用顺序查找方式找到插入的位置,在查找的同时,将数组中的元素进行后移操作,给插入元素腾出空间 ?
 
 
https://developers.hp.com/hp-linux-imaging-and-printing/install/install/index
 
 
 
===== 故障处理=====
 
Searching... (bus=net, timeout=5, ttl=4, search=(None) desc=0, method=slp)
 
error: No PPD found for model laserjet_professional_m1216nfh_mfp using old algorithm.
 
error: No appropriate print PPD file found for model hp_laserjet_professional_m1216nfh_mfp
 
 
 
HP_LaserJet_Professional_M1216nfh_MFP
 
 
 
Would you like to specify the path to the correct PPD file to use (y=yes, n=no*, q=quit) ? y
 
 
 
解决办法 启动cups
 
 
 
sudo /etc/init.d/cups start
 
 
 
===虚拟机软件===
 
http://pkg.kali.org/pkg/virtualbox
 
<pre>
 
myos is  kali 2020.2
 
 
 
 
 
sudo apt --fix-broken install
 
  416  sudo apt install linux-headers-5.4.0-kali4-amd64
 
  sudo apt install libsdl-ttf2.0-0
 
 
 
 
 
去掉vbox官方的源 
 
然后  sudo apt install virtualbox  就是最新的6.1的  原来自己的源里有哦  
 
 
 
用二进制包有错 和官方源有问题的 不用理了
 
 
 
 
 
 
 
#国内mirrors
 
https://mirrors.tuna.tsinghua.edu.cn/virtualbox/
 
 
 
 
 
https://mirrors.tuna.tsinghua.edu.cn/virtualbox/6.1.4/virtualbox-6.1_6.1.4-136177~Debian~buster_amd64.deb
 
 
 
 
 
sudo apt install virtualbox
 
 
 
https://download.virtualbox.org/virtualbox/6.0.10/virtualbox-6.0_6.0.10-132072~Ubuntu~bionic_amd64.deb
 
 
 
 
 
myos is kali 2017.3
 
Debian 9 ("Stretch")  i386 |  AMD64
 
wget -c http://download.virtualbox.org/virtualbox/5.2.2/virtualbox-5.2_5.2.2-119230~Debian~stretch_amd64.deb
 
 
 
apt install  linux-headers-amd64 linux-headers-4.13.0-kali1-amd64
 
sudo /sbin/vboxconfig
 
 
 
 
 
 
 
if  ubuntu18.04
 
去清华大学 mirros 下载 6.1  有问题就  sudo apt --fix-broken install
 
  
 +
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>
  
http://pkg.kali.org/pkg/virtualbox
 
 
[https://mirrors.tuna.tsinghua.edu.cn/help/virtualbox/ VirtualBox 镜像使用帮助]
 
 
===keepass2===
 
sudo apt install keepass2
 
===翻墙===
 
[[Chrome通过shadowsocks翻墙]]
 
 
[[Ubuntu利用shadowsocks和polipo终端翻墙]]
 
<pre>
 
sslocal -s linuxsa.org  -p 443  -k "lai22" -l 7070 -t 600 -m aes-256-cfb #on new kali 加 /etc/rc.local
 
  
#!/bin/bash
+
===算法的时间复杂度分析===
source /etc/profile #一定要加 不然可能sslocal都说找不到
+
  则总的执行时间粗略估计是(n-1)*(c1+c2+c5+m*(c3+c4))。 #怎么来的呢 线性函数 不记得了 要补一下
ps -ef | grep sslocal | grep -v grep
 
if [ $? -ne 0 ]
 
then
 
/usr/bin/python /usr/local/bin/sslocal -s linuxsa.org  -p 443 -k "lai2240" -l 7070 -t 600 -m aes-256-cfb #on new kali
 
else
 
#echo "has run "
 
:
 
fi
 
  
 +
[https://blog.csdn.net/qq_25775935/article/details/88724130 插入排序算法及C语言实现]
  
  
 +
==11.4 归并排序==
 +
递归实现 归并排序
  
  
  
  
 +
===see also===
  
#!/bin/bash
 
# */1  * * * * /home/evan/tunnel  &  #加定时任务不好 还不如用加配置的高级些呢
 
#CPID=$$  #$$ 是脚本运行的当前进程ID号
 
#RUN="`ps -ef | grep "$0" | grep -v "grep" | grep -v "$CPID" | wc -l`"  #$0 是脚本本身的名字
 
RUN="`ps -ef | grep  -v "grep" | grep 7070 | wc -l`"
 
[ "$RUN" -gt 0 ] && exit
 
#[ "$RUN" -gt 1 ] && exit
 
#sleep 1
 
  
# freebsd 
+
还有下一节 ?
#ssh  -i /home/evan/.ssh/evankey -p 22  -q  -D 7070 [email protected]
 
  
#ssh -2  -N  -f    -p 22  -D 7070 [email protected].220.125
+
[https://www.bilibili.com/video/av73101599?from=search&seid=6748303640916868853 4-5 通过归并排序算法深入理解递归]
#ssh  -i /home/evan/.ssh/evankey -p 22  -q  -D 7070 [email protected] &
 
#ssh -2 -N -f -L 7070:localhost:22  [email protected]
 
  
#4 linux
 
# sudo killall sshd
 
ssh -i /home/evan/.ssh/id_rsa -p 22 -qtfnN -D 7070 [email protected]
 
sleep 3
 
#[ "$RUN" -gq 0 ] && exit
 
#[ "$RUN" -gt 1 ] && exit
 
</pre>
 
  
===lua===
+
非递归
<pre>
+
https://blog.csdn.net/zjy900507/article/details/80530336
sudo apt install  lua5.1
 
  
evan@kalipc:~/test$ lua
+
=chapter 12 栈与队列=
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
+
==堆栈==
 +
http://docs.linuxtone.org/ebooks/C&CPP/c/ch12s02.html
 +
==3. 深度优先搜索 ==
 +
未看
 +
http://akaedu.github.io/book/ch12s03.html
  
</pre>
 
=== DM===
 
==== GDM====
 
gdm3
 
==== LightDM====
 
为什么不能列出已有用户呢 我改了 居然不能login
 
  
====SDDM====
+
=第 13 章 计算机中数的表示=
apt install sddm
+
==1. 为什么计算机用二进制计数==
=== redis-cli===
 
sudo  apt install  redis-tools
 
  
===vokoscreen录屏===
+
=第 14 章 计算机中数的表示=
sudo apt-get install vokoscreen
 
  
===Kazam录屏===
+
[http://c.biancheng.net/cpp/html/437.html c语言基本数据类型short、int、long、char、float、double]
  
apt install kazam #昨天好像是安装不成功呀
+
[https://www.cnblogs.com/luofay/p/6070613.html  C语言的基本数据类型 ]
http://pkg.kali.org/pkg/kazam
 
  
https://linsir.org/post/How_to_install_Kazam_on_kali_linux
 
  
[https://blog.csdn.net/luoxulinger/article/details/82261542 好用轻巧的录屏软件——Kazam]
+
[https://www.php.cn/csharp-article-443107.html c语言char是什么意思]
 
+
== 二进制制转十进制==
 
 
 
 
[http://www.mintos.org/skill/vokoscreen-capture.html Vokoscreen:优秀的屏幕录制软件]
 
 
 
 
 
 
 
[https://www.tecmint.com/best-linux-screen-recorders-for-desktop-screen-recording/ 8 Best Screen Recorders for Desktop Screen Recording in Linux]
 
 
 
https://www.tecmint.com/best-linux-screen-recorders-for-desktop-screen-recording/
 
 
 
https://itsfoss.com/best-linux-screen-recorders/
 
 
 
===vpn ===
 
<pre>
 
apt-get install network-manager-openvpn-gnome
 
apt-get install network-manager-pptp
 
apt-get install network-manager-pptp-gnome
 
apt-get install network-manager-strongswan
 
apt-get install network-manager-vpnc
 
apt-get install network-manager-vpnc-gnome
 
/etc/init.d/network-manager restart
 
</pre>
 
[http://xiao106347.blog.163.com/blog/static/21599207820133110048751?suggestedreading ubuntu vpn]
 
 
 
===vnc===
 
<pre>
 
sudo apt install vnc4server
 
vncserver
 
 
 
Use xtigervncviewer -SecurityTypes VncAuth -passwd /root/.vnc/passwd :1 to connect to the VNC server.
 
</pre>
 
 
<pre>
 
<pre>
0x03 安装VNC,远程桌面你的kali
+
在 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 ,这个问题甚至有的工作几年的程序员都模棱两可,因为没有深入思考过,只知道书上这么写。于是,我不得不深入思考一下这个被许多人忽视的问题。
  
还是先用ssh连接到kali,然后
+
对于无符号整数,很简单,全部位都表示数值,比如 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 。
  
##apt-get install tightvncserver
 
  
安装完之后,开启vnc连接
+
但是对于有符号整数,二进制的最高位表示正负,不表示数值,最高位为 0 时表示正数,为 1 时表示负数,这样一来,能表示数值的就剩下( n-1 )位了,
 +
比如 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 啊,下面就剖析一下这个惊人的奇葩。 加上反码 看到这里
  
##tightvncserver
 
  
会提示你输入远程时要验证的密码,输入你的密码(系统会提示你需要一定复杂度
+
再普及一下计算机内部整数存储形式,大家都知道计算机内部是以二进制来存贮数值的,无符号整数会用全部为来存储,有符号的整数,最高位当做符号位 ,其余为表示数值。
 
</pre>
 
</pre>
参考  http://www.52pi.net/archives/908
 
  
 +
=第 17 章=
 +
==3. 设备==
 +
http://akaedu.github.io/book/ch17s03.html
  
 +
=4. MMU=
 +
按照离CPU由近到远的顺序依次是CPU寄存器、Cache、内存、硬盘,越靠近CPU的存储器容量越小但访问速度越快
 +
http://akaedu.github.io/book/ch17s04.html
  
[https://blog.csdn.net/mooncarp/article/details/53038952 KALI中如何启用VNC]
+
=Memory Hierarchy=
 +
http://akaedu.github.io/book/ch17s05.html
  
[https://blog.csdn.net/qq_34661227/article/details/51260966 kali linux 2.0 实现vnc远程桌面连接]
+
=附录 A. 字符编码=
 +
20191112
 +
字符编码的高位 左边是也
  
[http://www.linuxzone.net/sysadmin/554.html Kali Linux开启VNC远程桌面登录]
+
=如何学习c=
  
===IRC===
+
== mongoose 开源http库==
hexchat 可惜输入框有点小 暂时不太会用
+
有空学习这个作为C的入门例子
  
quassel
+
Mongoose是一个用C编写的网络库。它为客户端和服务器模式实现TCP,UDP,HTTP,WebSocket,CoAP,MQTT的事件驱动的非阻塞API。
 +
[https://www.cnblogs.com/gardenofhu/p/6961343.html  mongoose 开源http库 ]
  
[http://blog.linuxchina.net/?p=1082 IRC 在Pidgin 中的设置]
+
[https://www.cnblogs.com/lifan3a/articles/7478295.html Mongoose 利用实现HTTP服务 ]
===IM===
+
=funciton=
[http://linux265.com/soft/3341.html 微信 for Linux]
+
==strcmp ==
 
 
https://github.com/geeeeeeeeek/electronic-wechat/blob/master/README_zh.md#%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8
 
 
 
===编程===
 
 
 
====[[Svn基础]]====
 
  sudo apt install subversion kdesvn
 
 
 
===思维导图===
 
FreeMind
 
Freeplane
 
 
 
[https://linux265.com/news/3925.html 为Linux用户推荐几种免费思维导图软件]
 
 
 
===打印机===
 
运行 “开始” -  ”控制中心 “ - “打印” - "服务器“ 设置共享打印机;然后另外一台 StartOS 机器,在连接打印机中选择”网络打印机“,选择”互联网打印协议(IPP)“,在 URI  输入条中输入共享打印机的地址,格式为 ipp://hostname:631/printers/<打印机的名称>,例如:  ipp://192.168.0.1:631/printers/DeskJet-D2300,再根据提示操作即可
 
 
 
===linux debian下安装中国农历===
 
[https://blog.csdn.net/rainysia/article/details/54847445 linux debian下安装中国农历]
 
 
 
==静态IP==
 
 
<pre>
 
<pre>
sudo cat /etc/NetworkManager/system-connections/Wired\ connection\ 1
+
C/C++函数,比较两个字符串
[connection]
 
id=Wired connection 1
 
uuid=b2931303-64fc-45e7-88f1-31e160ead5cc
 
type=ethernet
 
permissions=
 
timestamp=1558878910
 
  
[ethernet]
+
strcmp函数是string compare(字符串比较)的缩写,用于比较两个字符串并根据比较结果返回整数
mac-address-blacklist=
 
  
[ipv4]
+
设这两个字符串为str1,str2,
address1=192.168.88.4/24,192.168.88.1
 
dns=223.6.6.6;
 
dns-search=
 
method=manual
 
  
[ipv6]
+
若str1==str2,则返回零;
addr-gen-mode=eui64
 
dns-search=
 
ip6-privacy=2
 
method=ignore
 
  
</pre>
+
若str1<str2,则返回负数;
== 清理工作==
 
[https://www.linuxdashen.com/debianubuntu%e6%b8%85%e7%90%86%e7%a1%ac%e7%9b%98%e7%a9%ba%e9%97%b4%e7%9a%848%e4%b8%aa%e6%8a%80%e5%b7%a7 Debian/Ubuntu清理硬盘空间的8个技巧]
 
<pre>apt clean #释放空间 /var/cache/apt/archives/ 里面会有大量下载的软件包
 
  
 
+
若str1>str2,则返回正数。
cd /
 
du  -sh  * --exclude=home #查看除了home目录,哪个目录是最大的
 
 
 
du -s * | sort -nr|head # 排序
 
 
 
思路 在最大的里面删除 或者直接看到哪些没用的,直接删除 例如share/doc
 
 
 
 
 
root@latop:/usr# du -s * | sort -nr|head
 
8290868 lib
 
5811564 share
 
1070492 bin
 
173016 local
 
158300 src
 
149140 include
 
58604 sbin
 
9188 lib32
 
76 libexec
 
root@latop:/usr# du -sh lib
 
8.0G lib
 
root@latop:/usr# du -sh  share/
 
5.6G share/
 
 
 
 
 
 
 
 
 
sudo apt purge libreoffice?
 
使用'sudo apt autoremove'来卸载它(它们)。
 
 
</pre>
 
</pre>
 +
[https://baike.baidu.com/item/strcmp/5495571 strcmp]
  
=== 瘦身===
+
https://baike.so.com/doc/61175-64376.html
 +
==C library function - remove()==
 
<pre>
 
<pre>
apt remove rhythmbox  atril  pluma  uxterm xterm
+
/*
 
+
  * remvoe.c
apt autoremove gir1.2-pluma-1.0 gir1.2-rb-3.0 libgpod-common libgpod4 libpeas-1.0-python2loader \
+
  *
  librhythmbox-core10 libsgutils2-2 pluma-common rhythmbox-data
+
  * Created on: 2020年11月30日
 
+
  *      Author: evan
 
+
  */
#/usr/share/doc: 系统说明文件存放目录
+
#include <stdio.h>
evan@latop:~$ sudo mv /usr/share/doc/* bakdock/
+
#include<string.h>
 
 
</pre>
 
 
 
== remove different Desktop==
 
  sudo apt-get remove kde* plasma* plasma-desktop* plasma-desktop
 
  sudo apt-get remove kde-plasma-desktop kde-plasma-netbook kde-standard
 
[https://forums.kali.org/showthread.php?17716-How-to-install-remove-different-Desktop-Window-Manager-in-Kali-Linux-1-x How to install/remove different Desktop]
 
 
 
==apt 源目录==
 
  http://mirrors.aliyun.com/kali/pool/main/c/catfish/catfish_1.4.4-1_all.deb
 
 
 
== xfce==
 
[http://wiki.ubuntu.org.cn/Xfce%E9%9D%A2%E6%9D%BF%E6%93%8D%E4%BD%9C%E6%89%8B%E5%86%8C#.E5.90.AF.E5.8A.A8.E5.99.A8 Xfce面板操作手册]
 
[http://wiki.ubuntu.org.cn/Xfce4.2%E6%93%8D%E4%BD%9C%E6%89%8B%E5%86%8C  Xfce4.2操作手册]
 
 
 
[https://wiki.archlinux.org/index.php/Xfce_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87) Xfce (arch)]
 
 
 
[http://wiki.ubuntu.org.cn/Xfce4.2%E7%94%A8%E6%88%B7%E6%8C%87%E5%8D%97 Xfce4.2用户指南]
 
  
[https://wiki.gentoo.org/wiki/Xfce/Guide/zh-cn#Desktop_applications Xfce/指南(gentoo)]
+
int main() {
 +
int ret;
 +
FILE *fp;
 +
char filename[] = "file.txt";  // 这个是什么意思  定义一个 数组 ? 是的 
  
[https://wiki.xfce.org/start?id=zh-cn/start xfce ​百科]
+
fp = fopen(filename,"w");
  
== move files==
+
fprintf(fp,"%s", "THis is tutor \n");
<pre>
+
fprintf(fp,"%s", "ln2 THis is tutor");
0.on debianpc
+
fclose(fp);
  
*/5 * * * *  rsync -avz  xk/  data/xkbak/
+
//ret = remove(filename);
*/40 * * * *  rsync -avz  ssh/  data/xkbak/ssh/
+
/*
 +
cat file.txt
 +
THis is tutor*/
  
 +
if(ret == 0) {
 +
printf("file deleted successfully");
 +
}else {
 +
printf("Error: unable to delte the file");
 +
}
 +
return(0);
  
1. 先把latop的东西 rsync 到 mydata  #
+
}
cd /mydata
 
rsync -avz --progress  192.168.11.28:/home/evan/*  .
 
  
2.再把pc 有关的cp 到mydata
 
#on pc run  command
 
rsync  -avz --progress  ~/dkm/*  192.168.11.28:/home/evan/dkm/
 
  
#不然是变成 下面的一个子目录了
 
#cp dir1  dir2
 
#cp dir1/ dir2/ #变成子目录
 
rsync -avz --progress  .config/awesome/*  192.168.11.28:/home/evan/awesome
 
rsync  -avz --progress  book/*  192.168.11.28:/home/evan/book/
 
 
 
#这个要先清理一下先
 
#rsync 到 此目录
 
rsync -avz --progress /home/evan/rom/* 192.168.11.28:/home/evan/rom/
 
#同上
 
rsync -avz --progress /home/evan/rom/ 192.168.11.28:/home/evan/rom
 
不会成为子目录哦
 
rsync -avz --progress /home/evan/rom/ 192.168.11.28:/home/evan/rom/
 
 
</pre>
 
</pre>
  
== troubleshooting==
+
== C语言perror函数的作用 ==
=== watchdog===
 
 
<pre>
 
<pre>
现在看起来是那个外带的无线网上问题 还是感觉 kali 相比debian有点卡
+
 不可以掉了这个头文件,perror是包含在这个文件里的//编辑本段perror表头文件完善版定义函数
 +
  void perror(const char *s); perror ("open_port");
 +
函数说明
 +
  perror ( )用 来 将 上 一 个 函 数 发 生 错 误 的 原 因 输 出 到 标 准 设备 (stderr) 。参数 s 所指的字符串会先打印出,后面再加上错误原因字符串。此错误原因依照全局变量errno 的值来决定要输出的字符串。   在库函数中有个errno变量,每个errno值对应着以字符串表示的错误类型。当你调用"某些"函数出错时,该函数已经重新设置了errno的值。perror函数只是将你输入的一些信息和现在的errno所对应的错误一起输出。
  
Message from syslogd@kali at Oct 13 12:47:30 ...
+
void perror(const char *str)
kernel:[ 2897.771142] watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [netstat:3680]
 
  
Message from syslogd@kali at Oct 13 12:47:58 ...
+
参数
kernel:[ 2925.770120] watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [netstat:3680]</pre>
 
  
Firmware
+
    str -- 这是 C 字符串,包含了一个自定义消息,将显示在原本的错误消息之前
https://wiki.debian.org/Firmware
 
  
[https://ubuntuforums.org/showthread.php?t=2205211 kernel BUG: soft lockup - CPU stuck for 23s!]
+
#include <stdio.h>   
 
+
int main(void)   
=== 小心 更新系统===
+
{   
2018年 09月 23日 星期日 18:37:21 CST
+
FILE *fp ;   
这个主板 CPU 太新 一开始安装不上,搞了N久,后来 拿回家在家里的老主板上安装成功,然后拿到新主机机器上 一开始好好的 ,可惜我突然又想更新 于是又挂了呀
+
fp = fopen( "/root/noexitfile", "r+" );   
===乱码 kali light===
+
if ( NULL == fp )  ?
<pre> apt install  ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy  # reboot ok
+
{   
 
+
perror("/root/noexitfile");   //下面有这个输出
安装kali-linux-full,包含各种工具:
+
}   
$ sudo apt-get install kali-linux-full
+
return 0;   
 
+
}
安装GNOME 3桌面环境:
 
$ sudo apt-get install kali-desktop-gnome
 
  
 +
运行结果
 +
[root@localhost io]# gcc perror.c   
 +
[root@localhost io]# ./a.out   
 +
/root/noexitfile: No such file or directory
  
 
</pre>
 
</pre>
  
[https://blog.csdn.net/Blog_inG/article/details/78981684 安装kali-light版本后使用中文出现乱码签名无效]
 
  
=== realtek===
 
http://mirrors.ustc.edu.cn/debian/pool/non-free/f/firmware-nonfree/firmware-realtek_20161130-3_all.deb
 
  
===apt lock===
+
[https://blog.csdn.net/ypist/article/details/7886209  linux下 C语言perror函数的作用]
<pre>
 
root@kali:~# apt-get install openssh-client
 
E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
 
E: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?
 
root@kali:~# apt \\^C
 
root@kali:~# apt install openssh-client
 
E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
 
E: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?
 
root@kali:~# apt update
 
命中:1 http://mirrors.neusoft.edu.cn/kali kali-rolling InRelease
 
正在读取软件包列表... 完成 
 
正在分析软件包的依赖关系树     
 
正在读取状态信息... 完成     
 
  
root@kali:~# ps -ef | grep apt
+
https://www.cnblogs.com/yujianfei/p/8973867.html
_apt      1400  667  0 15:36 ?        00:00:00 /usr/lib/apt/methods/http
 
_apt      1401  667 11 15:36 ?        00:00:13 /usr/lib/apt/methods/http
 
  
root@kali:~# ps -ef | grep dpkg
+
https://www.runoob.com/cprogramming/c-function-perror.html
root      1525  1380  0 15:38 pts/1    00:00:00 grep dpkg
 
root@kali:~# kill -9  1400  1401
 
</pre>
 
=== err===
 
dpkg-deb: 错误: <解压缩> subprocess returned error exit status 2
 
dpkg: 处理归档 /var/cache/apt/archives/libwebkit2gtk-4.0-37_2.22.0-2_amd64.deb (--unpack)时出错:
 
无法为 './usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.33.1' 拷贝解压的文件至 '/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.33.1.dpkg-new': 未预期的文件结束或流结束
 
正准备解包 .../libjavascriptcoregtk-4.0-18_2.22.0-2_amd64.deb  ...
 
正在将 libjavascriptcoregtk-4.0-18:amd64 (2.22.0-2) 解包到 (2.20.3-1) 上 ...
 
dpkg-deb (子进程):解压缩归档成员:lzma 错误:压缩数据已损坏
 
dpkg-deb: 错误: <解压缩> subprocess returned error exit status 2
 
dpkg: 处理归档 /var/cache/apt/archives/libjavascriptcoregtk-4.0-18_2.22.0-2_amd64.deb (--unpack)时出错:
 
无法为 './usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.0.so.18.11.1' 拷贝解压的文件至 '/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.0.so.18.11.1.dpkg-new': 未预期的文件结束或流结束
 
在处理时有错误发生:
 
/var/cache/apt/archives/libwebkit2gtk-4.0-37_2.22.0-2_amd64.deb
 
/var/cache/apt/archives/libjavascriptcoregtk-4.0-18_2.22.0-2_amd64.deb
 
  
E: Sub-process /usr/bin/dpkg returned an error code (1)
 
  
=== 华硕开机自动进入bios ===
+
==c语言实现rm命令 or 删除==
 
<pre>
 
<pre>
#在新PC 安装了 kali,记得要删除整个硬盘,我使用了默认的分区,不然grub安装不成功, 加个数据硬盘后居然老是直接到BIOS
+
头文件:#include <stdio.h>
1.首先恢复一下bios默认值,避免其他参数变动影响
 
 
 
2..Security-->Secure Boot Management按回车进入设置菜单;将Secure Boot 改为Disabled
 
 
 
3.选择Boot进入启动设置,将Fast Boot设为disabled ,将Launch CSM设为Enabled;
 
 
 
4.F10保存设置。重启进系统不再进bios
 
 
 
#这个办法 ?
 
首先进入bios
 
 
 
Security->Secure Boot Control->Disabled
 
F10保存,继续进入bios
 
 
 
Boot->Launch CSM->Enabled
 
F10保存,成功进入系统
 
  
最后发现,如果在磁盘分区时候没选择全放在一起(即第一项推荐新手)而是选择了下面的2项就会导致安装操作系统失败
+
remove()函数用于删除指定的文件,其原型如下:
 +
    int remove(char * filename);
  
解决方案:我原本空闲出20G给kali,现在改为45G,安装时就不会失败了,详情见kali 安装步骤 安装失败 kali install fail 已解决,究其原因"/ 根目录" 要分10G以上(否则安装失败,x32和x64位的系统在两台电脑上面共尝试安装了10次左右没有成功,后来成功后总结出已知原因两点1,须选图形化安装2,手工分区,而且根目录足够大,此版本解压出来/根目录就7GB以上了
+
【参数】filename为要删除的文件名,可以为一目录。如果参数filename 为一文件,则调用unlink()处理;若参数filename 为一目录,则调用rmdir()来处理。
 
 
</pre>
 
http://linuxbsdos.com/2016/11/05/dual-boot-kali-linux-rolling-2016-2-windows-10-on-a-pc-with-uefi-firmware/
 
  
===  pc err ===
+
【返回值】成功则返回0,失败则返回-1,错误原因存于errno。
==== mate err ====
 
<pre>
 
您希望继续执行吗? [Y/n] y
 
dpkg-deb (子进程):解压缩归档成员:lzma 错误:压缩数据已损坏
 
dpkg-deb: 错误: <解压缩> subprocess returned error exit status 2
 
dpkg-deb (子进程):无法从 /var/cache/apt/archives/libgtk-3-0_3.24.1-2_amd64.deb 中拷贝归档成员到解码管道中:写入失败 (断开的管道)
 
读取变更记录(changelogs)... 完成
 
(正在读取数据库 ... 系统当前共安装有 436105 个文件和目录。)
 
正准备解包 .../libgtk-3-0_3.24.1-2_amd64.deb  ...
 
正在将 libgtk-3-0:amd64 (3.24.1-2) 解包到 (3.22.30-2) 上 ...
 
dpkg-deb (子进程):解压缩归档成员:lzma 错误:压缩数据已损坏
 
dpkg-deb: 错误: <解压缩> subprocess returned error exit status 2
 
dpkg: 处理归档 /var/cache/apt/archives/libgtk-3-0_3.24.1-2_amd64.deb (--unpack)时出错:
 
无法为 './usr/lib/x86_64-linux-gnu/libgtk-3.so.0.2400.1' 拷贝解压的文件至 '/usr/lib/x86_64-linux-gnu/libgtk-3.so.0.2400.1.dpkg-new': 未预期的文件结束或流结束
 
正准备解包 .../mate-icon-theme_1.20.1-1_all.deb  ...
 
正在解包 mate-icon-theme (1.20.1-1) ...
 
dpkg-deb (子进程):解压缩归档成员:lzma 错误:压缩数据已损坏
 
dpkg-deb: 错误: <解压缩> subprocess returned error exit status 2
 
dpkg: 处理归档 /var/cache/apt/archives/mate-icon-theme_1.20.1-1_all.deb (--unpack)时出错:
 
无法为 './usr/share/icons/mate/256x256/devices/video-display.png' 拷贝解压的文件至 '/usr/share/icons/mate/256x256/devices/video-display.png.dpkg-new': 未预期的文件结束或流结束
 
在处理时有错误发生:
 
/var/cache/apt/archives/libgtk-3-0_3.24.1-2_amd64.deb
 
/var/cache/apt/archives/mate-icon-theme_1.20.1-1_all.deb
 
 
</pre>
 
</pre>
  
=====办法  1 如何解决这个问题  看能不能这个=====
+
[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()函数:删除文件或目录]
 
 
[http://forum.ubuntu.org.cn/viewtopic.php?f=86&t=485625&p=3197587 使用apt安装软件时,提示dpkg-deb: /lib/x86_64-linux-gnu/liblzma.so.5]
 
 
 
[https://blog.csdn.net/longma666666/article/details/81701802 dpkg-deb (子进程):解压缩归档成员:lzma 错误:压缩数据已损坏]
 
 
 
=====办法2  重装 安装有gnome 就可以 全局ss 并安装chrome plus=====
 
 
 
=ops=
 
==[[中文man手册]]==
 
 
 
=常用软件列表=
 
Lubuntu 20.04
 
    Ark – 归档文件管理器
 
    Bluedevil – 蓝牙连接管理
 
    Discover 软件中心 – 包管理系统
 
    FeatherPad – 文本编辑器
 
    FireFox – 浏览器
 
    K3b – CD/DVD 刻录器
 
    Kcalc – 计算器
 
    KDE 分区管理器 – 分区管理工具
 
    LibreOffice – 办公套件(Qt 界面版本)
 
    LXimage-Qt – 图片查看器及截图制作
 
    Muon – 包管理器
 
    Noblenote – 笔记工具
 
    PCManFM-Qt – 文件管理器
 
    Qlipper – 剪贴板管理工具
 
    qPDFview – PDF 阅读器
 
    PulseAudio – 音频控制器
 
    Qtransmission – BT 下载工具(Qt 界面版本)
 
    Quassel – IRC 客户端
 
    ScreenGrab – 截屏制作工具
 
    Skanlite – 扫描工具
 
    启动盘创建工具 – USB 启动盘制作工具
 
    Trojita – 邮件客户端
 
    VLC – 媒体播放器
 
    MPV 视频播放器
 
 
 
 
 
[https://linux.cn/article-10099-1.html 75 个最常用的 Linux 应用程序]
 
 
 
 
 
[https://zhuanlan.zhihu.com/p/36649383 那个程序员的Linux常用软件清单]
 
 
 
[https://www.v2ex.com/t/575901 大家有什么推荐的日常 Linux 软件]
 
 
 
=备用=
 
[https://i.linuxtoy.org/docs/guide/ch31.html 完美工作站 Archlinux]
 
== ==
 
 
 
=Debian(kali)usb无线网卡=
 
 
 
 
 
公司的PC 无线网卡为RTL8192EE
 
 
 
安装过程报错
 
regulatory.db
 
 
 
如果没有你需要的,请自己在官网找,软件包地址在这:
 
https://packages.debian.org/search?searchon=names&keywords=Realtek
 
 
 
我下载了整个 deb包
 
https://packages.debian.org/stretch/firmware-realtek
 
 
 
 
 
[http://www.kali.org.cn/thread-31104-1-1.html Kali安装时:rtl_nic/rtl8411-1.fw固件缺失 以及无法确定发布代号的解决办法]
 
==see aslo==
 
 
 
https://www.linuxquestions.org/questions/linux-kernel-70/kernel-platform-regulatory-0-direct-firmware-load-for-regulatory-db-failed-with-error-2-a-4175622954/
 
 
 
https://github.com/robertfoss/wireless-regdb/blob/master/regulatory.db
 
 
 
 
 
TP-LINK 722N 不支持linux ,千万别买, 在kali上面无法识别,今天我买了一个,到货了,试了各种方法都没用,打算退货
 
 
 
TP-LINK TL-WN726N免驱版 外置天线USB无线网卡
 
 
 
http://www.aircrack-ng.org/doku.php?id=compatibility_drivers
 
 
 
[http://www.secist.com/archives/3916.html 2017年最适用于WIFI HACK的无线网卡推荐]
 
 
 
[https://blog.csdn.net/chenyiyue/article/details/52516395 Kali 安装无线网卡驱动]
 
 
 
=参考资料=
 
[https://my.oschina.net/u/260165/blog/4683598 ArchLinux 2020 安装总结]
 
 
 
[http://linux265.com/news/3352.html Linux系统装机必备应用top10]
 
 
 
[https://zhuanlan.zhihu.com/p/41058223 Linux上有哪些高效的工具软件?]
 
 
 
[https://hacpai.com/article/1552717494529 高效 manjaro i3]
 
 
 
[https://linux265.com/news/3887.html 安装完 Debian 10 后必做的10件事]
 
 
 
[http://wiki.ubuntu.com.cn/Qref/Apps ubuntu wiki apps]
 
[http://www.jianshu.com/p/ac6e13290698 程序员的Linux常用软件清单]
 
 
 
[http://blog.linuxchina.net/?p=1674 kali初始化myblog]
 
 
 
[https://linux.cn/article-11178-1.html Debian 10(Buster)安装后要做的前 8 件事 ]
 
  
[http://blog.linuxchina.net/?p=12 debian初始化 -testing]
+
[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()函数删除文件或目录]
  
[https://blog.csdn.net/w0ryitang/article/details/80138867 Kali Linux 配置和优化(安全牛学习笔记)]
+
[https://blog.csdn.net/qq_38074673/article/details/98047329  c语言实现rm命令,删除指定文件或目录]
  
[https://zhuanlan.zhihu.com/c_141709450  kali日常]
+
==C语言access()函数:判断是否具有存取文件的权限==
[http://blog.csdn.net/u012539899/article/details/38350279  无法应用变更! 请先修复损毁的软件包]
 
  
  
[http://www.cnblogs.com/leisurely/p/4033557.html kali初始化]
+
[http://c.biancheng.net/cpp/html/303.html C语言access()函数:判断是否具有存取文件的权限]
  
[http://qiuye.iteye.com/blog/461394 Ubuntu 中软件的安装、卸载以及查看的方法总结]
+
[https://blog.csdn.net/eager7/article/details/8131169  C语言中access函数]
  
[https://pythonadventures.wordpress.com/2011/03/15/install-the-eric-python-ide/ Install the Eric Python IDE]
+
[https://www.runoob.com/cprogramming/c-arrays.html C 数组]
  
  
[https://weibo.com/ttarticle/p/show?id=2309404087493942188550&infeed=1 10个最佳 Python 集成开发环境(IDE)]
+
=进阶=
 +
==十个经典的C开源项目代码==
 +
[https://blog.51cto.com/chinalx1/2143904 十个经典的C开源项目代码]
  
[http://note.qidong.name/2017/07/remmina-rampage/  Remmina的一次暴走]
 
  
[https://www.cnblogs.com/sqlsec/p/diykali.html 开启你的kali linux DIY之旅]
+
=2021=
  
  
[https://blog.csdn.net/oZuiJiaoWeiYang/article/details/44804787 Linux下给力截图工具归纳]
+
[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语言目录操作]
  
[http://www.linuxdiyf.com/linux/32561.html Ubuntu安装腾讯TIM]
+
[http://www.freecplus.net C语言技术网]
  
[http://linux265.com/news/3546.html Debian Xfce 安装后的常用配置教程]
+
[https://www.cnblogs.com/qigaohua/p/5838263.html       博客园  C语言中关于对目录的操作 ]
  
[https://www.cnblogs.com/seniusen/p/9295583.html Remmina Ubuntu 和 Windows 之间进行远程访问和文件互传]
+
=书=
 +
[https://www.codetd.com/article/2162329 《Linux环境C程序设计(第2版)徐诚》pdf 附下载链接]
  
 +
http://www.txtepub.com/105693.html
  
[https://www.moonsec.com/archives/762 vbox host  kali 2020.1版本安装及中文汉化]
+
=see also=
 +
[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语言简要语法指南]
  
[https://zhuanlan.zhihu.com/p/37314255 Ubuntu 18.04 LTS 安装、美化]
+
https://wiki.ubuntu.com.cn/Compiling_C
  
 +
[https://wiki.ubuntu.com.cn/Gcchowto Gcc-howto]
  
[https://www.cnblogs.com/M4K0/p/11409647.html  Kali-Linux-美化与优化 ]
+
=c++=
  
[https://www.tecmint.com/hardinfo-check-hardware-information-in-linux/ HardInfo – Check Hardware Information in Linux]
+
[https://zh.wikipedia.org/wiki/C%2B%2B c++ zh.wikipedia.org]
  
 [[category:linux]]  [[category:desktop]]  [[category:kali]]
+
https://isocpp.org/
 +
[[category:c]]

2021年4月15日 (四) 07:49的版本



good http://akaedu.github.io/book/


C语言编程学习必备的一些网站,干货收藏!

带你学C带你飞》

如何学习C

学习C语言,如何看懂及掌握一个程序

2021学习C APUE

http://www.apuebook.com/

UNIX环境高级编程(书籍)笔记什么都 有呀

《UNIX环境高级编程》这本书怎么看?怎么学习


看法

第二章和第六章可以跳跳,回头看

7.中文版翻译有瑕疵,但是整体还是不错,不至于对阅读产生影响(信号量那章有细节问题,但是信号量那张和csapp第八章几乎重复)

首先,不要抱着一口气把这本书学完的心态去看。 尝试根据自己的兴趣,选择一个规模适当的开源项目,去阅读它的源代码。(例如我选择的就是一个小型的http服务器--Mongoose)当在某一方面发现自己有很多问题时,很希望去弄清楚时,这时候就可以去翻开手中的APUE,带着问题去阅读。这时候学习的效率必然比盲目地去看书更高,而且遗忘率也会降低。但是,仅仅读完是不够的。 很多时候,你看书的时候,会感觉自己看懂了,但是没过多久,又会发现自己忘了。或者,有时候你根本没看懂,而只是囫囵吞枣地看过去。所以,看完后,最好的方法就是写博客。尝试按照自己的理解以及逻辑,去将你学到的知识系统地阐述出来。这样,就算你以后忘了,再去翻翻博文,也能很快就捡起来。

十个最值得阅读学习的C开源项目代码

   Webbench
   Tinyhttpd
   cJSON
   CMockery
   Libev
   Memcached
   Lua
   SQLite
   UNIX v6
   NETBSD

建议先看 >> Unix/Linux编程实践教程

https://book.douban.com/subject/1219329/

http://item.kongfz.com/book/32040616.html?push_type=2&min_price=57.00&utm_source=101004009001

https://detail.tmall.com/item.htm?spm=a1z10.1-b.w9858442-8055933095.4.fH3HiL&id=19729431809

常用计算机书的下载

学习C语言,如何看懂及掌握一个程序!

十个经典的C开源项目代码

初学玩转C语言,这17个小项目收下不谢

https://zhuanlan.zhihu.com/p/83185476

tinyhttpd C 语言实现最简单的 HTTP 服务器 学习

tinyhttpd ------ C 语言实现最简单的 HTTP 服务器

https://github.com/nengm/Tinyhttpd

tinyhttpd源码详解

tinyhttp整理(一)

tinyhttp源码阅读(注释)

Tinyhttp源码分析及知识点总结

b站 C/C++ tinyHttp服务器小项目及源码讲解1

tinyhttpd深入解析与源码剖析

Tinyhttpd-master 源码学习笔记1

Tinyhttp源码分析

Tinyhttpd非官方镜像,Fork自sourceForge,仅供学习



tinyhttp源码分析

我把一些核心代码和相应的注释贴在这里,如果你感兴趣全部,可以移步我的github。 https://github.com/zhaozhengcoder/rebuild-the-wheel/tree/master/tinyhttpd


Tinyhttp 代码完全讲解

Mongoose-基于C的Web服务器代码学习

Mongoose-基于C的Web服务器 介绍和使用


Web服务器----mongoose

https://github.com/cesanta/mongoose

Mongoose源码剖析:外篇之web服务器

Mongoose-6.14源码剖析之基础篇

我的笔记

apue.3e/include/apue.h

chapter 1

APUE读书笔记-01UNIX系统概述

这是原文学不过是 Second Edition firefox 放大 就可以看 找一下 第三版本吧 Third Edition https://vaqeteart.gitee.io/file_bed/shared/books/APUE2/toc.html


?

C语言实现的ls命令源码分享-apue

C 语言实现 Linux ls 命令

understanding_unix_programming

chapter 2 who

/* 再看一下书 非常 好的啦  
who命令的实现过程是先打开一个系统文件UTMP_FILE,创建对应的格式struct utmpfd变量,读取数据到这个结构体中,作相应格式输出即可
*/
#include<stdio.h>
#include<utmp.h>
#include<fcntl.h>
#include <time.h>
#include<unistd.h>
#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(" ");

  printf(" ");

}

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;

}
















C 库函数 void *memset(void *str, int c, size_t n) 复制字符 c(一个无符号字符)到参数 str 所指向的字符串的前 n 个字符。
memset(str,'$',7);

This is string.h library function
$$$$$$$ string.h library function

参考 和书 chapter 2 这个最接近原书的了

https://www.cnblogs.com/20145221GQ/p/6060420.html

who命令实现

unix/linux who命令的实现

https://www.runoob.com/cprogramming/c-function-memset.html

别人实现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#


#include <stdio.h>  
#include <utmp.h>
#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(){  
    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;  
}  

see also

who命令实现


cp


#include        <stdio.h>//标准输入输出
#include        <stdlib.h>//C标准函数库
#include        <unistd.h>//Unix类系统定义符号常量
#include        <fcntl.h>//定义了很多宏和open,fcntl函数原型

#define BUFFERSIZE      4096//定义存储器容量
#define COPYMODE        0644//定义复制的长度

void oops(char *, char *);
/*注意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 要写的字节数

循环的把源文件写入目标文件
*/
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)

        }


cp命令的编写最接受原书的了

Unix程序设计:实现cp命令

linux自己编写的 cp 命令像os的那个了

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

linux cp命令源码

ls

Linux下的 ls 命令的简单实现

高仿linux下的ls -l命令——C语言实现


在linux下编写一个LS命令的小程序

Linux系统编程【3.1】——编写ls命令

Linux系统编程【3.2】——ls命令优化版和ls -l实现

C 语言实现 Linux ls 命令

简单版本的参考

https://github.com/fupengfei058/ls

http://www.voidcn.com/article/p-bzocmlpx-bxd.html

https://blog.csdn.net/qingshui23/article/details/53931555

https://blog.csdn.net/aonaigayiximasi/article/details/54019964

C IDE

https://www.jetbrains.com/zh-cn/clion/

Eclipse

Anjuta on linux

https://atom.io/

pre main

 init main( int argc, char *argv[]);
argc 是命令行参数的数目 也包括自身 没有后台的参数 那么 argc=1

argv 指向参数的各个指针所构成的数组, argv[0]表示命令本身,argv[1] 表示第一个参数

argc 是argument count的缩写表示传入main函数中的参数个数,包括这个程序本身

argv 是 argument vector的缩写表示传入main函数中的参数列表,其中argv[0]表示这个程序的名字; *argv[] 其实是地址 

第二个参数,char*型的argv[],为字符串数组,用来存放指向的字符串参数的指针数组,每一个元素指向一个参数。各成员含义如下:
        argv[0]指向程序运行的全路径名
        argv[1]指向在DOS命令行中执行程序名后的第一个字符串 

char   *argv[]是一个字符数组,其大小是int   argc,主要用于命令行参数   argv[]   参数,数组里每个元素代表一个参数;

看代码的时候我最先不理解的就是main函数的定义:

int main(int argc, char *argv[]){}

经查阅得知,argc是用来表示在命令行下输入命令时的参数个数,包括指令本身;argv[]是用来取得你输入的参数。针对具体指令分析如下(每一步解释由注释形式给出)。

由于main函数不能被其它函数调用, 因此不可能在程序内部取得实际值。那么,在何处把实参值赋予main函数的形参呢? 实际上,main函数的参数值是从操作系统命令行上获得的。当我们要运行一个可执行文件时,在DOS提示符下键入文件名,再输入实际参数即可把这些实参传送到main的形参中去。

ls1.c中的 就是这个了啦 
DOS提示符下命令行的一般形式为: C:\>可执行文件名 参数 参数……; 但是应该特别注意的是,main 的两个形参和命令行中的参数在位置上不是一一对应的。因为,main的形参只有二个,而命令行中的参数个数原则上未加限制。argc参数表示了命令行中参数的个数(注意:文件名本身也算一个参数),argc的值是在输入命令行时由系统按实际参数的个数自动赋予的。例如有命令行为: C:\>E6 24 BASIC dbase FORTRAN由于文件名E6 24本身也算一个参数,所以共有4个参数,因此argc取得的值为4。argv参数是字符串指针数组,其各元素值为命令行中各字符串(参数均按字符串处理)的首地址。 指针数组的长度即为参数个数。数组元素初值由系统自动赋予。其表示如图6.8所示:

main(int argc,char *argv){
while(argc-->1)
printf("%s\n",*++argv);
}

本例是显示命令行中输入的参数如果上例的可执行文件名为e24.exe,存放在A驱动器的盘内。
因此输入的命令行为: C:\>a:e24 BASIC dBASE FORTRAN  
则运行结果为:
BASIC
dBASE
FORTRAN
  该行共有4个参数,执行main时,argc的初值即为4。argv的4个元素分为4个字符串的首地址。执行while语句,每循环一次 argv值减1,当argv等于1时停止循环,共循环三次, 因此共可输出三个参数。在printf函数中,由于打印项*++argv是先加1再打印, 故第一次打印的是argv[1]所指的字符串BASIC。第二、 三次循环分别打印后二个字符串。而参数e24是文件名,不必输出。

另外一个例子


c语言中argc和argv[ ]的作用及用法

good和ls1.c差不多 C语言中 int main(int argc,char *argv[])的两个参数详解

https://zhuanlan.zhihu.com/p/267822985

https://blog.csdn.net/LYJ_viviani/article/details/51873961

c语言之argc和argv

基础

计算机为什么要用二进制

Everything over Binary 模拟路转换成为数字电路

https://blog.csdn.net/weixin_44296862/article/details/95277924

https://blog.csdn.net/c46550/article/details/90951557

一位全加器

signed char 类型的范围为 -128~127

 按八位来算:
在计算机里面是用补码表示的,128的二进制码是:10000000,这个东西在计算里面并不是128,因为最高位是符号,它是个负数,那么负数的原码是多少呢,我们知道如果补码的符号位为“1”,表示是一个负数,求原码的操作可以是:符号位为1,其余各位取反,然后再整个数加1。 
所以,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,所义导致可以多表示一个负数,...这个负数是最小的那个..

浅析为什么char类型的范围是 —128~+127


char 其数值表示 范围的计算

b站 C语言数据类型及数值范围

原码 补码 反码

1.原码
最高位表示符号位。剩下的位数,是这个数的绝对值的二进制

就比方说 一个完整的int型变量在内存中占的是4个字节,32位的编译器中 那么这时候他的二进制表示是00000000 00000000 00000000 00000000

所以

10的原码就是00000000 00000000 00000000 00001010

那么负数的原码就是例如

-10的原码10000000 00000000 00000000 00001010

 符号位是第一位 0为正数 1为负数

2.反码
    正数的反码就是其原码.

    负数的反码就是在其原码的基础之上 符号位不变,其他位取反.
    
3.补码

    正数的补码就是其原码.

    负数的补码就是在其反码的基础之上+1
    

C语言中的原码、反码和补码

C语言之原码、反码和补码

C语言——源码、反码、补码

b站原码 反码 补码

gdb




start   st 开始执行程序,在main函数的第一条语句前面停下来
step       s   下一条语句,如果该语句为函数调用,则进入函数执行其中的第一条语句
 next    n  执行下一条语句,如果该语句为函数调用,不会进入函数内部执行(即不会一步步地调试函数内部语句)









使用例子  结合他看C代码 爽到不行了 
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  执行下一条语句,如果该语句为函数调用,不会进入函数内部执行(即不会一步步地调试函数内部语句)

c


/*                                                                                                                                                                                          
20答案是 Tuesday  因为列数定了是10                                                                                                                                                            
21days[2] === days[2][10]                                                                                                                                                                     
22                                                                                                                                                                                            
23解说                                                                                                                                                                                        
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                 

eg

石头剪刀布

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void)
{
	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;
		if (result > 0)
			printf("You win!\n");
		else if (result == 0)
			printf("Draw!\n");
		else
			printf("You lose!\n");
	}
	return 0;
}


/*
0、1、2三个整数分别是剪刀石头布在程序中的内部表示,用户也要求输入0、1或2,然后和计算机随机生成的0、1或2比胜负。这个程序的主体是一个死循环,需要按Ctrl-C退出程序。以往我们写的程序都只有打印输出,在这个程序中我们第一次碰到处理用户输入的情况。在这里只是简单解释一下,以后再细讲。scanf("%d", &man)这个调用的功能是等待用户输入一个整数并回车,这个整数会被scanf函数保存在man这个整型变量里。如果用户输入合法(输入的确实是整数而不是字符串),则scanf函数返回1,表示成功读入一个数据。但即使用户输入的是整数,我们还需要进一步检查是不是在0~2的范围内,写程序时对用户输入要格外小心,用户有可能输入任何数据,他才不管游戏规则是什么。

和printf类似,scanf也可以用%c、%f、%s等转换说明。如果在传给scanf的第一个参数中用%d、%f或%c表示读入一个整数、浮点数或字符,则第二个参数的形式应该是&运算符加一个相应类型的变量名,表示读进来的数存到这个变量中;如果在第一个参数中用%s读入一个字符串,则第二个参数应该是数组名,数组名前面不加&,因为数组类型做右值时自动转换成指针类型,而scanf后面这个参数要的就是指针类型,在第 10 章 gdb有scanf读入字符串的例子。&运算符的作用也是得到一个指针类型,这个运算符以后再详细解释。

留给读者的思考问题是:(man - computer + 4) % 3 - 1这个神奇的表达式是如何比较出0、1、2这三个数字在“剪刀石头布”意义上的大小的
*/

石头剪刀布_C语言

https://blog.csdn.net/guoqingchun/article/details/8104197


Linux下C语言获取目录中的文件列表

/*
 * dir.c
 *
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;
}


/* 结果
 *
d_name:.
d_name:..
d_name:1.py
d_name:22.py

*/


排序与查找

插入排序

#include <stdio.h>
#define LEN 5
int a[LEN] = { 10, 5, 2, 4, 7 };
void insertion_sort(void)
{
	int i, j, key;
	for (j = 1; j < LEN; ++j) {
		printf("%d, %d, %d, %d, %d\n",
		       a[0], a[1], a[2], a[3], a[4]);
		key = a[j];  //key 标记为未排序的第一个元素
		i = j - 1;
                // key  与已排序元素从大到小比较,寻找key应插入的元素 a[i+1]一般就是key 起初的值
////采用顺序查找方式找到插入的位置,在查找的同时,将数组中的元素进行后移操作,给插入元素腾出空间 ?

		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 */ 


算法的时间复杂度分析

则总的执行时间粗略估计是(n-1)*(c1+c2+c5+m*(c3+c4))。 #怎么来的呢  线性函数  不记得了 要补一下

插入排序算法及C语言实现


11.4 归并排序

递归实现 归并排序



see also

还有下一节 ?

4-5 通过归并排序算法深入理解递归


非递归 https://blog.csdn.net/zjy900507/article/details/80530336

chapter 12 栈与队列

堆栈

http://docs.linuxtone.org/ebooks/C&CPP/c/ch12s02.html

3. 深度优先搜索

未看 http://akaedu.github.io/book/ch12s03.html


第 13 章 计算机中数的表示

1. 为什么计算机用二进制计数

第 14 章 计算机中数的表示

c语言基本数据类型short、int、long、char、float、double

C语言的基本数据类型


c语言char是什么意思

二进制制转十进制

 在 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 ,这个问题甚至有的工作几年的程序员都模棱两可,因为没有深入思考过,只知道书上这么写。于是,我不得不深入思考一下这个被许多人忽视的问题。

对于无符号整数,很简单,全部位都表示数值,比如 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 。


但是对于有符号整数,二进制的最高位表示正负,不表示数值,最高位为 0 时表示正数,为 1 时表示负数,这样一来,能表示数值的就剩下( n-1 )位了,
比如 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 啊,下面就剖析一下这个惊人的奇葩。 加上反码 看到这里 


再普及一下计算机内部整数存储形式,大家都知道计算机内部是以二进制来存贮数值的,无符号整数会用全部为来存储,有符号的整数,最高位当做符号位 ,其余为表示数值。

第 17 章

3. 设备

http://akaedu.github.io/book/ch17s03.html

4. MMU

按照离CPU由近到远的顺序依次是CPU寄存器、Cache、内存、硬盘,越靠近CPU的存储器容量越小但访问速度越快

http://akaedu.github.io/book/ch17s04.html

Memory Hierarchy

http://akaedu.github.io/book/ch17s05.html

附录 A. 字符编码

20191112

字符编码的高位 左边是也

如何学习c

mongoose 开源http库

有空学习这个作为C的入门例子

Mongoose是一个用C编写的网络库。它为客户端和服务器模式实现TCP,UDP,HTTP,WebSocket,CoAP,MQTT的事件驱动的非阻塞API。 mongoose 开源http库

Mongoose 利用实现HTTP服务

funciton

strcmp

C/C++函数,比较两个字符串

strcmp函数是string compare(字符串比较)的缩写,用于比较两个字符串并根据比较结果返回整数

设这两个字符串为str1,str2,

若str1==str2,则返回零;

若str1<str2,则返回负数;

若str1>str2,则返回正数。

strcmp

https://baike.so.com/doc/61175-64376.html

C library function - remove()

/*
 * remvoe.c
 *
 *  Created on: 2020年11月30日
 *      Author: evan
 */
#include <stdio.h>
#include<string.h>

int main() {
	int ret;
	FILE *fp;
	char filename[] = "file.txt";  // 这个是什么意思  定义一个 数组 ? 是的  

	fp = fopen(filename,"w");

	fprintf(fp,"%s", "THis is tutor \n");
	fprintf(fp,"%s", "ln2 THis is tutor");
	fclose(fp);

	//ret = remove(filename);
/*
	 cat file.txt
	THis is tutor*/

	if(ret == 0) {
		printf("file deleted successfully");
	}else {
		printf("Error: unable to delte the file");
	}
	return(0);

}


C语言perror函数的作用

 不可以掉了这个头文件,perror是包含在这个文件里的//编辑本段perror表头文件完善版定义函数
  void perror(const char *s); perror ("open_port");
函数说明
  perror ( )用 来 将 上 一 个 函 数 发 生 错 误 的 原 因 输 出 到 标 准 设备 (stderr) 。参数 s 所指的字符串会先打印出,后面再加上错误原因字符串。此错误原因依照全局变量errno 的值来决定要输出的字符串。   在库函数中有个errno变量,每个errno值对应着以字符串表示的错误类型。当你调用"某些"函数出错时,该函数已经重新设置了errno的值。perror函数只是将你输入的一些信息和现在的errno所对应的错误一起输出。

void perror(const char *str)

参数

    str -- 这是 C 字符串,包含了一个自定义消息,将显示在原本的错误消息之前

#include <stdio.h>   
int main(void)   
{   
	FILE *fp ;   
	fp = fopen( "/root/noexitfile", "r+" );   
	if ( NULL == fp )  ?
	{   
		perror("/root/noexitfile");   //下面有这个输出
	}   
	return 0;   
}

运行结果
[root@localhost io]# gcc perror.c   
[root@localhost io]# ./a.out   
/root/noexitfile: No such file or directory


linux下 C语言perror函数的作用

https://www.cnblogs.com/yujianfei/p/8973867.html

https://www.runoob.com/cprogramming/c-function-perror.html


c语言实现rm命令 or 删除

头文件:#include <stdio.h>

remove()函数用于删除指定的文件,其原型如下:
    int remove(char * filename);

【参数】filename为要删除的文件名,可以为一目录。如果参数filename 为一文件,则调用unlink()处理;若参数filename 为一目录,则调用rmdir()来处理。

【返回值】成功则返回0,失败则返回-1,错误原因存于errno。

C语言remove()函数:删除文件或目录

linux下实现rm()函数删除文件或目录

c语言实现rm命令,删除指定文件或目录

C语言access()函数:判断是否具有存取文件的权限

C语言access()函数:判断是否具有存取文件的权限

C语言中access函数

C 数组


进阶

十个经典的C开源项目代码

十个经典的C开源项目代码


2021

C语言目录操作

C语言技术网

博客园 C语言中关于对目录的操作

《Linux环境C程序设计(第2版)徐诚》pdf 附下载链接

http://www.txtepub.com/105693.html

see also

C语言简要语法指南

https://wiki.ubuntu.com.cn/Compiling_C

Gcc-howto

c++

c++ zh.wikipedia.org

https://isocpp.org/