brew install iproute2mac
来自:https://blog.csdn.net/u010164190/article/details/79474309

实用工具-》网络工具-》Traceroute
来自:https://blog.csdn.net/qq_38789531/article/details/82734646
密钥登陆能,发现SSH不行,提示:
$ssh -l xiangdong 10.244.25.**
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

到:
$ssh -l xiangdong 10.244.25.**
xiangdong@10.244.25.89's password:


实践OK办法,能密钥能密码:
cat  /etc/ssh/sshd_config|grep -E "PermitRootLogin|UsePAM|PasswordAuthentication"

UsePAM yes  #改成NO后出现需要密钥,还登陆不了。后修改为yes后重启oK service sshd restart
PermitRootLogin yes
PasswordAuthentication yes


root依然不行,修改UsePAM no,还是不行,后来加一个irdcops帐号且能 sudo ,也就用它去SSH就行了:
$ssh -l root 10.244.25.**
root@10.244.25.**'s password:
Permission denied, please try again.

==================================
首先:配置ssh服务器配置文件。

在root 用户下才能配置。

vi /etc/ssh/sshd_config

权限设为no:

#PermitRootLogin yes

#UsePAM yes

#PasswordAuthentication yes

如果前面有# 号,将#号去掉,之后将yes修改为no。

修改之后为:

PermitRootLogin no

UsePAM no

PasswordAuthentication no

权限设为yes:

RSAAuthentication yes

PubkeyAuthentication yes

(2)重启sshd服务

systemctl restart sshd.service

systemctl status sshd.service #查看ssh服务的状态

#systemctl start sshd.service  #开启ssh服务

#sytemctl enable sshd.service #ssh服务随开机启动,还有个disabled

#systemctl stop sshd.ervice #停止

正常情况下应该是Active:active(running)
摘自:https://www.cnblogs.com/xubing-613/p/6844564.html
Demon:
code ~/.bashrc

根据终端命令行使用 bash 还是 zsh 选择编辑环境变量的文件。

bash,写入 ~/.bash_profile

zsh, 写入 ~/.zshrc

阅读全文
以下四条命令搞定,谁用谁知道



来自:https://blog.csdn.net/weixin_40545512/article/details/82685927
背影:买了个Mac本,无法用.vbs脚本,输入个密码啥的更快一些。
xiangdongAutoEnterPasswd*.py


secureCRT支持运行.js和.vbs以及.py格式的脚本,无奈mac上识别前两个格式的脚本只能写一写python脚本,
举个简单的例子,利用脚本直接ssh连接一台机器,
在View菜单中勾选Button Bar让这个菜单在下方显示出来,
在下方的Default右方右键出现一个菜单点击New Button按钮,在显示框的Function一栏选择Run Script中间选择编写好的.py文件
.py文件的内容大致如下:


另外一个:


来自:https://blog.csdn.net/medivhq/article/details/52119572
好不容易买个Mac,最近一段时间在使用 git log 和 git diff 命令的时候一直有乱码出现,具体表现为在行首出现 ESC[33,而在行尾出现 ESC[m,如下所示:


解决
经过搜索之后了解到,出现该问题的原因是 git 使用的默认分页程序是 less,而默认的直接运行 less 的话,会无法正确解析转义字符。但是如果以 -r 命令来运行 less 的话,就可以解决了。故解决办法就是将 git 的默认分页程序改为 “less -r” 来运行,如下:
git config --global core.pager "less -r" 后:
好了,买个Mac花了十年,用它得花一年。

Git log 和Git diff显示正常:

方向来自:https://blog.yongli1992.com/2015/08/14/git-log-diff-esc-garbled/
装在台式机上,先在笔记本上用一个USB给Win上用软件UltraISO把extix-19.1-64bit-kde-kodi18-refracta-calamares-nvidia-1970mb-181228.iso给写入硬盘映像,开机启动BIOS设置从这个U盘启动,然后,再用一个U盘给把这个extix-19.1-64bit-kde-kodi18-refracta-calamares-nvidia-1970mb-181228.iso给拷贝进去,再插入到台式机上,这个ExTix会自动识别为/dev/sdc,用fdisk -l也能看到,于是把这台式机的那个磁盘/dev/sda给格式化:
mkfs.ext4 /dev/sda


cp extix-19.0-64bit-deepin-refracta-calamares-kodi18-1760mb-181208.iso /dev/sda

重启,设置BIOS从台式机磁盘启动,OK。但是空间没有500G和之前U盘一样大,怎么办?
https://blog.csdn.net/huanghai381/article/details/50033775


From:https://www.extix.se/?page_id=24

ExTiX - The Ultimate Linux System
Based on Debian/Ubuntu with Deepin/LXQt/KDE and kernel 4.20-rc4
Deepin:  https://sourceforge.net/projects/extix/files/
https://cytranet.dl.sourceforge.net/project/extix/extix-19.0-64bit-deepin-refracta-calamares-kodi18-1760mb-181208.iso
Linux嵌入式由于诸多的限制,调试方法有限,常常出现面对Bug束手无策的情况,现在介绍一种通过信号处理对Linux嵌入式应用程序进行调试的方法。

linux中一共有32种信号,在/usr/include/bits/signum.h 头文件中可以看到,具体如下:SIGHUP ;SIGINT ;SIGQUIT ;SIGILL ;SIGTRAP ;SIGABRT ;SIGIOT ;SIGBUS ;SIGFPE ;SIGKILL ;SIGUSR1 ;SIGSEGV ;SIGUSR2 ;SIGPIPE ;SIGALRM ;SIGTERM ;SIGSTKFLT ;SIGCLD ;SIGCHLD ;SIGCONT ;SIGSTOP ;SIGTSTP ;SIGTTIN ;SIGTTOU ;SIGURG ;SIGXCPU ;SIGXFSZ ;SIGVTALRM ;SIGPROF ;SIGWINCH ;SIGPOLL ;SIGIO ;SIGPWR ;SIGSYS ;SIGUNUSED
以上来自:https://blog.csdn.net/u010133805/article/details/53899667 ,他用的c++,改成c研究研究,如下:

看编号,用kill -l,SIGUSR1编号为10,如下所示:
#kill -l
1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL       5) SIGTRAP
6) SIGABRT      7) SIGBUS       8) SIGFPE       9) SIGKILL     10) SIGUSR1
11) SIGSEGV     12) SIGUSR2     13) SIGPIPE     14) SIGALRM     15) SIGTERM
16) SIGSTKFLT   17) SIGCHLD     18) SIGCONT     19) SIGSTOP     20) SIGTSTP
21) SIGTTIN     22) SIGTTOU     23) SIGURG      24) SIGXCPU     25) SIGXFSZ
26) SIGVTALRM   27) SIGPROF     28) SIGWINCH    29) SIGIO       30) SIGPWR
31) SIGSYS      34) SIGRTMIN    35) SIGRTMIN+1  36) SIGRTMIN+2  37) SIGRTMIN+3
38) SIGRTMIN+4  39) SIGRTMIN+5  40) SIGRTMIN+6  41) SIGRTMIN+7  42) SIGRTMIN+8
43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7
58) SIGRTMAX-6  59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2
63) SIGRTMAX-1  64) SIGRTMAX

其中SIGUSER1信号用户可以自己定义其处理行为,处理范例如下:

#make usr1
cc     usr1.c   -o usr1
./usr1

ps -ef|grep usr1

kill -s SIGUSR1 17331
sig_num=10
flag is true!
sig_num=10
flag is false
flag is false
macbook鼠标慢命令行设置:
defaults read -g com.apple.mouse.scaling
defaults write -g com.apple.mouse.scaling 10.0




MAC下截屏命令是Command+Shift+3,部分截屏命令是Command+Shift+4。
---------
按下Command+Shift+4并按下空格键。 交叉十字图标将变为小照相机图标。
你可以再次按下空格键转换为交叉十字图标。
移动光标到你希望进行截图的窗口上。
当照相机图标移过不同窗口上时,窗口将程高亮蓝色显示。 ...
点击所需窗口。 和其他截图方法一样,所选窗口的截图将默认保存在桌面上。


MAC下退出VIrtualBox全屏命令是Command+C,鼠标退出来的命令是command.




snip快捷键和钉钉的截图快捷键冲突,需要将钉钉的截图删除掉。
钉钉-》偏好设置-》快捷键里修改或者删掉。
我用的是微信的截图,不一定登录上,只要打开就能截图,微信-设置-快捷键如下:
Control+Command+a。AddTime:2023-05-14.

应用界面居中control+option+command+C


vim ~/.zshrc
# export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH=$HOME/.irdcops/shell/tools/location.jackxiang.com:$PATH
export PATH=$HOME/.irdcops/shell/tools/ippbcopy.jackxiang.com:$PATH

Mac终端被自己玩“坏”了,登陆默认是-bash-3.2$,一些命令无法使用,现在记录恢复初始化    [username(你的账户名)@主机名 ~] $   解决的办法。
工具/原料
Mac
终端
方法/步骤1
终端输入以下命令:

export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin

之后输入

cd ~/

3、先输入

touch .bash_profile

之后输入

open .bash_profile

打开文件之后,在文件的最后一行添加

export PS1='[\u@\h \w]\$'



之后按住保存该文件关闭

输入下列命令,刷新终端,ok~

source .bash_profile

补充:关于更改主机名和共享名

主机名

sudo scutil --set HostName rainbird-desk

共享名

sudo scutil --set ComputerName newName


来自:https://jingyan.baidu.com/article/c74d6000c277e80f6a595d8c.html



二)MAC 设置环境变量PATH 和 查看PATH
理论篇
Mac系统的环境变量,加载顺序为:
/etc/profile /etc/paths ~/.bash_profile ~/.bash_login ~/.profile ~/.bashrc

#中间用冒号隔开
export PATH=$PATH:<PATH 1>:<PATH 2>:<PATH 3>:------:<PATH N>

实践主要是:ckubectlcmd    ckubectlishow 两个快捷命令,如下:
$cat /Users/jackXiang/.bashrc |grep kube


$cat /Users/jackXiang/.bash_profile

参考自:https://www.jianshu.com/p/acb1f062a925
法一)直接PKG安装:
#pkg install git
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01    
Fetching packagesite.txz: 100%    6 MiB 118.7kB/s    00:57    
Processing entries: 100%
FreeBSD repository update completed. 32579 packages processed.
All repositories are up to date.
Updating database digests format: 100%
The following 15 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        git: 2.19.1
        p5-CGI: 4.40
        p5-HTML-Parser: 3.72
        p5-HTML-Tagset: 3.20_1
        perl5.24: 5.24.4
        p5-IO-Socket-SSL: 2.059

法二)Ports源码安装:

cd /usr/ports/devel/git
sudo make install clean BATCH="yes"

https://www.digitalocean.com/community/tutorials/how-to-install-git-on-freebsd-11-0






sudo pkg update
Updating FreeBSD repository catalogue...
pkg: Repository FreeBSD has a wrong packagesite, need to re-create database

Fetching meta.conf: 100%    163 B   0.2kB/s    00:01    
Fetching packagesite.pkg: 100%    7 MiB  73.4kB/s    01:41    
Processing entries:   0%
Newer FreeBSD version for package zziplib:
To ignore this error set IGNORE_OSVERSION=yes
- package: 1302001
- running kernel: 1300139
Ignore the mismatch and continue? [y/N]: pkg: repository FreeBSD contains packages for wrong OS version: FreeBSD:13:amd64
Processing entries: 100%
Unable to update repository FreeBSD
Error updating repositories!
========================================================

根据错误信息,您遇到了一个由于系统版本不匹配而导致的问题。您的系统内核版本是`1300139`,而存储库中的软件包适用于版本`1302001`。以下是解决此问题的步骤:

1. **确认系统版本:**
   使用以下命令确认您的系统版本:

    ```bash
    uname -a
    ```

   如果输出的版本与错误中提到的不匹配,您可能需要更新系统。

2. **更新系统:**
   如果系统版本不匹配,尝试更新系统以匹配存储库中的软件包版本。使用以下命令:

    ```bash
    freebsd-update fetch install
    ```

   这将尝试将您的系统更新到最新的稳定版本。

3. **更新软件包数据库:**
   更新软件包数据库,以确保它与新的系统版本兼容:

    ```bash
    sudo pkg update
    ```

   如果这仍然失败,您可能需要重新创建软件包数据库。

4. **重新创建软件包数据库:**
   执行以下命令来重新创建软件包数据库:

    ```bash
    sudo pkg bootstrap -f
    ```

   然后再次运行更新命令:

    ```bash
    sudo pkg update
    ```

   现在,您应该能够更新软件包并安装Git。

请注意,由于系统版本不匹配可能会导致其他依赖关系问题,如果遇到其他错误,请根据错误消息逐个解决。如果有其他问题或需要更多帮助,请告诉我。
问题: sh: zip: not found

Port安装:
cd /usr/ports/archivers/zip/ && make install clean

安装后位置: /usr/local/bin/zip
#systemctl stop slapd
Error getting authority: Error initializing authority: Could not connect: Connection refused (g-io-error-quark, 39)
解决这个问题:
第一步)主要是重装  polkit,然后重启。
#rpm -qa|grep polkit
polkit-0.112-14.el7.x86_64
polkit-pkla-compat-0.1-4.el7.x86_64
来自:https://blog.csdn.net/wuyezhiyu/article/details/82905661

弟二步)#systemctl start dbus.service
Error getting authority: Error initializing authority: Could not connect: Connection refused (g-io-error-quark, 39)

#ps -ef|grep dbus
root     31670     1  0 09:38 ?        00:00:00 [dbus-daemon] <defunct>

#systemctl list-unit-files|grep dbus.service        #查看systemd管理的所有单元
dbus.service                 static  
systemctl enable dubs.service        

access("/etc/systemd/system/dubs.service", F_OK) = -1 ENOENT (No such file or directory)
access("/run/systemd/system/dubs.service", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/lib/systemd/system/dubs.service", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/lib/systemd/system/dubs.service", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/rc.d/init.d/dubs", F_OK)   = -1 ENOENT (No such file or directory)
"static"  尚未被启用,并且单元文件的 "[Install]" 小节中没有可用于 enable 命令的选项
"disabled"  尚未被启用,但是单元文件的 "[Install]" 小节中存在可用于 enable 命令的选项
"enabled"  已经通过 /etc/systemd/system/ 目录下的 Alias= 别名、 .wants/ 或 .requires/ 软连接被永久启用

来自:https://mellowhost.com/billing/index.php?rp=/knowledgebase/71/Error-getting-authority-Error-initializing-authority-Could-not-connect-Connection-refused-g-io-error-quark-39.html


Error getting authority: Error initializing authority: Could not connect: Connection refused (g-io-error-quark, 39)
systemctl stop slapd
Error getting authority: Error initializing authority: Could not connect: Connection refused (g-io-error-quark, 39)

在使用centos7.4 安装服务的时候报错:

Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Timeout was reached (g-io-error-quark, 24)
解决方案:


ps -ef |grep polkit

再安装:
pyum reinstall polkit

再重启
reboot

就可以解决

来自:http://www.cnblogs.com/flyfish2012/p/9527810.html
背景:在Docker打包PHP时发现这个命令,于是查了一下。
strip命令用于脱掉文件的衣服, 文件会变小, 其中的符号信息会失去。 那这个strip有什么

用呢? 很有用的! 原来的a.out比较大, 可以执行。 在strip之后, 文件变小了, 也是可以执行, 这就节省了很多空间.

      其实, strip不仅仅可以针对可执行文件, 还能针对目标文件和动态库等. 在实际的开发中, 经常需要对动态库.so进行strip操作, 减少占地空间。 而在调试的时候(比如用addr2line), 就需要符号了。 因此, 通常的做法是: strip前的库用来调试, strip后的库用来实际发布, 他们两者有对应关系。 一旦发布的strip后的库出了问题, 就可以找对应的未strip的库来定位。

      例如某个动态库strip前是50M左右, strip后是20M左右, 可见, 脱脱衣服还是有明显好处的。

      我们在调试过程中, 经常涉及到上传库, 库太大时, 很耗费传输时间, 所以还是先用strip来处理一下比较好。
---------------------
/data/codesdev/testdemo/c/strip]
#tree -l
.
├── strip
└── strip.c

#cat strip.c
#include <stdio.h>  

void main()  
{  
    printf("strip\n");
}

#make strip
cc     strip.c   -o strip

#ls -l strip
-rwxr-xr-x 1 root root 8440 11月  1 17:26 strip

#/usr/bin/file strip
strip: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=ec884c4b45d605867f9319a6d5b3acaea1866798, not stripped

#nm strip
000000000060102c B __bss_start
000000000060102c b completed.6355
0000000000601028 D __data_start
0000000000601028 W data_start
0000000000400460 t deregister_tm_clones

#strip strip

#ls -l strip  #File Size变小
-rwxr-xr-x 1 root root 6296 11月  1 17:28 strip

#file strip
strip: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=ec884c4b45d605867f9319a6d5b3acaea1866798, stripped

#nm strip
nm: strip:无符号


来自:https://blog.csdn.net/qq_37858386/article/details/78559490
freebsd-update -r 11.2-RELEASE upgrade
/usr/sbin/freebsd-update install
中间有几次NTP的配置文件确认。
/usr/sbin/freebsd-update install
reboot


FreeBSD 11.2-RELEASE-p4 (GENERIC) #0: Thu Sep 27 08:16:24 UTC 2018
Welcome to jackxiang's Compute Service !

参考:https://blog.csdn.net/joyous/article/details/81990019


升级遇到的问题,出现openssl的动态链接库版本对不上。
最后一次构建FreeBSD镜像::
1)无法再次升级,原因是相关SSHD和Mysqld的动态链接libssl会有问题。

2)FreeBSD升级到11.3还会出sockstat -4l会报错。

3)即使到FreeBSD12.0后Mysql编译好的启动可能也有问题,由于旧的库可能还是涉及到libssl还是有问题。

最终,无法升级,做了一些域名应用快捷方面的优化以及完善了PHP扩展,得出这个版本是一个最后的ISO版本FreeBSD11.2。

pkg info -r security/openssl
openssl-1.0.2l,1:
        libarchive-3.3.1,1
        mysql80-client-8.0.0_3
        bind-tools-9.11.1P3
pkg auto remove
pkg upgrade -y
rm -rf /var/db/freebsd-update/files  #记得删掉。


一些其它命令:
> pkg-add -r openssh-portable
> cd /usr/ports / security / openssh&& make install clean


> portupgrade security / openssh-portable
> makeworld / buildworld过程的一部分
> freebsd-upgrade
1.CURL批量:

输出(注意那个双引号里加一个单引号引起来,输出单引号,还是那个双引号为匹配,里面单引号原样输出,这点得记住!):
/usr/bin/curl -I 'baidu.com'
/usr/bin/curl -I '360.cn'
/usr/bin/curl -I 'souhu.com'
/usr/bin/curl -I 'sina.com.cn'

for i in $(cat url.txt);do echo /usr/bin/curl -I "''$i'''";done;  #双引号里加一个单引号引起来,输出单引号,还是那个双引号为匹配
/usr/bin/curl -I ''baidu.com'''
/usr/bin/curl -I ''360.cn'''
/usr/bin/curl -I ''souhu.com'''
/usr/bin/curl -I ''sina.com.cn'''

Curl命令实战:

;done;    
curl: (6) Couldn't resolve host ''baidu.com''
curl: (6) Couldn't resolve host ''360.cn''
curl: (6) Couldn't resolve host ''souhu.com''
curl: (6) Couldn't resolve host ''sina.com.cn''

2.Nc批量:

nc -w 1 -z -v 10.71.182.175 80
nc -w 1 -z -v 192.168.111.43 80

for i in $(cat ip.txt);do  nc -w 1 -z -v $i 80;done;  
Connection to 10.71.182.175 80 port [tcp/http] succeeded!
Connection to 192.168.111.43 80 port [tcp/http] succeeded!
strings
ldd
autoconf
yum groupinstall "Development Tools"
分页: 8/40 第一页 上页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 下页 最后页 [ 显示模式: 摘要 | 列表 ]