Arch Linux 天坑
docker 用户组问题
sudo groupadd docker #添加docker用户组
#sudo gpasswd -a $XXX docker #检测当前用户是否已经在docker用户组中,其中XXX为用户名。
sudo gpasswd -a $USER docker #将当前用户添加至docker用户组
newgrp docker #更新docker用户组
忍无可忍 装了个输入法
xfce4安装了ibus,无法切换全拼
运行如下命令:
sudo dconf update # 初始化 ibus 的设置
ibus-daemon -rdx # 重启 ibus 的守护进程
然后再设置成全拼。
xfce4 中文环境中。ibus输入框不能跟随的问题
在/etc/profile的最后添加 xport XMODIFIERS=@im=ibus export GTK_IM_MODULE=ibus export QT_IM_MODULE=ibus ibus-daemon -d -xhttps://blog.csdn.net/weixin_44054539/article/details/91901190
https://blog.csdn.net/weixin_44054539/article/details/91901190
https://tieba.baidu.com/p/1818734163?red_tag=1785703275
http://www.xefan.com/archives/83634.html
1 安装必要的包
ifconfig,route在net-tools中,
nslookup,dig在dnsutils中,
ftp,telnet等在inetutils中,ip命令在iproute2中。
pacman -S net-tools dnsutils inetutils iproute2
升级chromium 后不能呼出 同法可解决问题
Archlinux让chromium支持 fcitx输入法
chromium中ctl加空格出不来fcitx, 需要安装fcitx-gtk3,因为chromium是基于gtk3的。 sudo pacman -S fcitx-gtk3解决yay
https://blog.csdn.net/qq_41175951/article/details/102767671
https://blog.nanpuyue.com/2019/052.html
在 Arch Linux 下为 Windows 编译 Rust 程序
yay -S mingw-w64-crt-bin mingw-w64-binutils-bin mingw-w64-winpthreads-bin mingw-w64-headers-bin mingw-w64-gcc-bin
这些都是 aur 上的包,因为我不想自己再编译一遍,就偷懒安装了 *-bin。
aurman
https://aur.archlinux.org/packages/aurman/
停更 新作yay https://github.com/Jguer/yay
mingw
aurman -S --noedit --solution_way --pgp_fetch mingw-w64-gcc
https://aur.archlinux.org/packages/mingw-w64-gcc/
https://wiki.archlinux.org/index.php/PKGBUILD
arch AUR INSTALL
https://linux.cn/article-12107-1.html
git clone [package URL]cd [package name]makepkg -si
git clone https://aur.archlinux.org/telegram-desktop-git.gitcd telegram-desktop-gitmakepkg -si
yay -S package_name-
gpg --recv-key 465022E743D71E39
-
pacman-key --recv-keys keyid
-
pacman-key --lsign-key
-
https://wiki.archlinux.org/index.php/Pacman/Package_signing
-
arch dns set
https://www.archlinux.org/packages/community/x86_64/dns-over-https/
https://wiki.archlinux.org/index.php/Domain_name_resolution_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
cmake cmakelists.txt -DBOOST_ROOT="/mingw64/include" -DBOOST_LIBRARYDIR="/mingw64/lib"
set(BOOST_ROOT /mingw64/include) # full path just to figure this out
message(STATUS "BOOST_ROOT= ${BOOST_ROOT}")
include_directories(${BOOST_ROOT})
# Find and link boost components.
FIND_PACKAGE(Boost)
IF (Boost_FOUND)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
ADD_DEFINITIONS( "-DHAS_BOOST" )
ENDIF()
target_link_libraries (${PROJECT_NAME} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
1. export -p 列出所有环境变量,查看boost库的环境变量$BOOST_ROOT是否为空。
如果为空,设置该变量。
export BOOST_ROOT=$BOOST_ROOT:/usr/include/boost
2.编写测试程序 例如boost-test.cpp
3.编译测试程序
g++ -I $BOOST_ROOT boost-test.cpp -o boost-test
4.运行程序
./boost-test
https://wiki.archlinux.org/index.php/Samba_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
samba gui客户端 smb4k 带扫描 可以扫windows
smbpasswd - a root 密码设置
[share]
path=/share
;下面是允许root 访问
valid users = root
public = yes
;only guest = yes
writable = yes
printable = no
启动 包括重启 主要用于配置修改或者第一次安装后 必须执行
systemctl restart smb.service
重启依然服务
systemctl enable smb.service
ssh root 登录设置
etc/ssh/sshd_config
找 PermitRootLogin
PermitRootLogin yes
时区设置
1.时区文件(名字:OStimezone.infile)Rule CGPTZDST 1970 1970 - Jan 1 0:0:0 0:0:0 -
Zone IMS/CGP 3:30:0 - CGP 1970 Jan 1 0:0:0
3:30:0 CGPTZDST CGP 2037 Dec 31 23:59:59
3:30:0 - CGP
Link IMS/CGP CGP
2.编译
zic OStimezone.infile
3.设置:
ln -sf /usr/share/zoneinfo/IMS/CGP /etc/localtime
4.查看
zdump -v /usr/share/zoneinfo/IMS/CGP
/usr/share/zoneinfo/IMS/MEDIAX Fri Dec 13 20:45:52 1901 UTC = Sat Dec 14 00:15:52 1901 MEDIAX isdst=0
/usr/share/zoneinfo/IMS/MEDIAX Sat Dec 14 20:45:52 1901 UTC = Sun Dec 15 00:15:52 1901 MEDIAX isdst=0
/usr/share/zoneinfo/IMS/MEDIAX Wed Dec 31 20:29:59 1969 UTC = Wed Dec 31 23:59:59 1969 MEDIAX isdst=0
/usr/share/zoneinfo/IMS/MEDIAX Wed Dec 31 20:30:00 1969 UTC = Thu Jan 1 04:30:00 1970 MEDIAX isdst=0
/usr/share/zoneinfo/IMS/MEDIAX Mon Jan 18 03:14:07 2038 UTC = Mon Jan 18 11:14:07 2038 MEDIAX isdst=0
/usr/share/zoneinfo/IMS/MEDIAX Tue Jan 19 03:14:07 2038 UTC = Tue Jan 19 11:14:07 2038 MEDIAX isdst=0
1、基本概念
UTC:(Universal Time/Temps Cordonné 世界标准时间)
CMT: (Greenwich Mean Time)格林尼治时间,基本上等于UTC 时间
CET:(Central European Time) 欧洲中部时间, 冬季时间为UTC+1, 夏季时间为UTC+2
CST: 可同时代表4个时区
1、 Central Standard Time (USA) UT-6:00
2、 Central Standard Time (Australia) UT 9:30
3、 China Standard Time UT 8:00
4、 Cuba Standard Time UT-4:00
wqy-microhei
pacman -S community/fcitx sudo pacman -S community/fcitx sudo pacman -S community/fcitx-libpinyin sudo pacman -S community/fcitx-googlepinyin sudo pacman -S fcitx fcitx-configtool fcitx-googlepinyin fcitx-cloudpinyin fcitx-gtk2 fcitx-gtk3 sudo pacman -S sddm-kcm sudo pacman -S xfce4-goodies sudo pacman -S fcitx fcitx-googlepinyin fcitx-im fcitx-configtool kcm-fcitx .xprofile export LC_ALL="zh_CN.UTF-8" export XMODIFIERS=@im=fcitx export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx fcitx -d .xinitrc export LC_CTYPE="zh_CN.utf8" export XIM=fcitx export XIM_PROGRAM=fcitx export XMODIFIERS="@im=fcitx" export GTK_IM_MODULE=xim export QT_IM_MODULE=xim
# pacman -S syslinux # syslinux-install_update -iam
# nano /boot/syslinux/syslinux.cfg
https://www.jianshu.com/p/3d3da6b930a1
LS
1、直接使用通配符百。
ls la*
这是最方便的一种方法,*表示匹配任何长度的任意字符,通过这样的方式就可以查找到所有以ls开头的文件,如果我们想查找文件名中含有la的文件,只需输入“ls *la*”即可。
2、可以使用管道,将ls输出送入grep这个程序来实现。
ls -1 | grep "^la"
-1选项表度示将列出的所有文件排成一列,方便grep的匹配(grep按行匹配)。
扩展资料:
ls 指令是Linux下最常用的指令之一。
ls 命令将每个问由 Directory 参数指定的目录或者每个由 File 参数指定的名称写到标准输出,以及您所要求的答和标志一起的其它信息。
运用举例:
1、列出具体文件 #ls -al //这个最常用,可是往往又不彻底符合要求,
2、列出一切子目录的文件:#ls -R //上个指令仅仅列出了本目录下的一切目录和文件,可是目录下的文件不会循环的列出。版
3、分屏权显现:#ls -l|more //能在当时屏退出,很有用,但不能一页一页翻屏
#ls -l|less //能用pgup,pgdw 翻页,但不能在当时方位退出。
https://linux.cn/article-9170-1.html
https://www.jianshu.com/p/3d3da6b930a1
https://man.linuxde.net/nano
https://my.oschina.net/wuzsheng/blog/1622254
https://bbs.archlinuxcn.org/viewtopic.php?id=1037
https://blog.csdn.net/ytingone/article/details/82819429
https://www.cnblogs.com/onlybobby/p/7018788.html
https://www.cnblogs.com/bluestorm/p/5929172.html
https://www.linuxidc.com/Linux/2014-02/96100.htm
https://wiki.archlinux.org/index.php/syslinux#Configuration
https://www.cnblogs.com/wurui1994/p/6279501.html
RAR
pacman -S thunar-archive-plugin xarchiver zip unzip p7zip arj lzop cpio unrar相关函数 time,ctime,gmtime,localtime
//--------------------------------------------------------------------------------------------------------------------------------------------------------//
asctime(将时间和日期以字符串格式表示)
#include
定义函数
char * asctime(const struct tm * timeptr);
函数说明
asctime()将参数timeptr所指的tm结构中的信息转换成真实世界所使用的时间日期表示方法,然后将结果以字符串形态返回。此函数已经由时区转换成当地时间,字符串格式为:“Wed Jun 30 21:49:08 1993\n”
返回值
若再调用相关的时间日期函数,此字符串可能会被破坏。此函数与ctime不同处在于传入的参数是不同的结构。
附加说明
返回一字符串表示目前当地的时间日期。
范例
#include
main()
{
time_t timep;
time (&timep);
printf(“%s”,asctime(gmtime(&timep)));
}
执行
Sat Oct 28 02:10:06 2000
//--------------------------------------------------------------------------------------------------------------------------------------------------------//
ctime(将时间和日期以字符串格式表示)
表头文件
#include
定义函数
char *ctime(const time_t *timep);
函数说明
ctime()将参数timep所指的time_t结构中的信息转换成真实世界所使用的时间日期表示方法,然后将结果以字符串形态返回。此函数已经由时区转换成当地时间,字符串格式为“Wed Jun 30 21 :49 :08 1993\n”。若再调用相关的时间日期函数,此字符串可能会被破坏。
返回值
返回一字符串表示目前当地的时间日期。
范例
#include
main()
{
time_t timep;
time (&timep);
printf(“%s”,ctime(&timep));
}
执行
Sat Oct 28 10 : 12 : 05 2000
//--------------------------------------------------------------------------------------------------------------------------------------------------------//
gettimeofday(取得目前的时间)
表头文件
#include
#include
定义函数
int gettimeofday ( struct timeval * tv , struct timezone * tz )
函数说明
gettimeofday()会把目前的时间有tv所指的结构返回,当地时区的信息则放到tz所指的结构中。
timeval结构定义为:
struct timeval{
long tv_sec; /*秒*/
long tv_usec; /*微秒*/
};
timezone 结构定义为:
struct timezone{
int tz_minuteswest; /*和Greenwich 时间差了多少分钟*/
int tz_dsttime; /*日光节约时间的状态*/
};
上述两个结构都定义在/usr/include/sys/time.h。tz_dsttime 所代表的状态如下
DST_NONE /*不使用*/
DST_USA /*美国*/
DST_AUST /*澳洲*/
DST_WET /*西欧*/
DST_MET /*中欧*/
DST_EET /*东欧*/
DST_CAN /*加拿大*/
DST_GB /*大不列颠*/
DST_RUM /*罗马尼亚*/
DST_TUR /*土耳其*/
DST_AUSTALT /*澳洲(1986年以后)*/
返回值
成功则返回0,失败返回-1,错误代码存于errno。附加说明EFAULT指针tv和tz所指的内存空间超出存取权限。
范例
#include
#include
main(){
struct timeval tv;
struct timezone tz;
gettimeofday (&tv , &tz);
printf(“tv_sec; %d\n”, tv,.tv_sec) ;
printf(“tv_usec; %d\n”,tv.tv_usec);
printf(“tz_minuteswest; %d\n”, tz.tz_minuteswest);
printf(“tz_dsttime, %d\n”,tz.tz_dsttime);
}
执行
tv_sec: 974857339
tv_usec:136996
tz_minuteswest:-540
tz_dsttime:0
//--------------------------------------------------------------------------------------------------------------------------------------------------------//
gmtime(取得目前时间和日期)
表头文件
#include
定义函数
struct tm*gmtime(const time_t*timep);
函数说明
gmtime()将参数timep 所指的time_t 结构中的信息转换成真实世界所使用的时间日期表示方法,然后将结果由结构tm返回。
结构tm的定义为
struct tm
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};
int tm_sec 代表目前秒数,正常范围为0-59,但允许至61秒
int tm_min 代表目前分数,范围0-59
int tm_hour 从午夜算起的时数,范围为0-23
int tm_mday 目前月份的日数,范围01-31
int tm_mon 代表目前月份,从一月算起,范围从0-11
int tm_year 从1900 年算起至今的年数
int tm_wday 一星期的日数,从星期一算起,范围为0-6
int tm_yday 从今年1月1日算起至今的天数,范围为0-365
int tm_isdst 日光节约时间的旗标
此函数返回的时间日期未经时区转换,而是UTC时间。
返回值
返回结构tm代表目前UTC 时间
范例
#include
main(){
char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
time_t timep;
struct tm *p;
time(&timep);
p=gmtime(&timep);
printf(“%d%d%d”,(1900+p->tm_year), (1+p->tm_mon),p->tm_mday);
printf(“%s%d;%d;%d\n”, wday[p->tm_wday], p->tm_hour, p->tm_min, p->tm_sec);
}
执行
2000/10/28 Sat 8:15:38
//--------------------------------------------------------------------------------------------------------------------------------------------------------//
localtime(取得当地目前时间和日期)
表头文件
#include
定义函数
struct tm *localtime(const time_t * timep);
函数说明
localtime()将参数timep所指的time_t结构中的信息转换成真实世界所使用的时间日期表示方法,然后将结果由结构tm返回。结构tm的定义请参考gmtime()。此函数返回的时间日期已经转换成当地时区。
返回值
返回结构tm代表目前的当地时间。
范例
#include
main(){
char *wday[]={“Sun”,”Mon”,”Tue”,”Wed”,”Thu”,”Fri”,”Sat”};
time_t timep;
struct tm *p;
time(&timep);
p=localtime(&timep); /*取得当地时间*/
printf (“%d%d%d ”, (1900+p->tm_year),( l+p->tm_mon), p->tm_mday);
printf(“%s%d:%d:%d\n”, wday[p->tm_wday],p->tm_hour, p->tm_min, p->tm_sec);
}
执行
2000/10/28 Sat 11:12:22
//--------------------------------------------------------------------------------------------------------------------------------------------------------//
mktime(将时间结构数据转换成经过的秒数)
表头文件
#include
定义函数
time_t mktime(strcut tm * timeptr);
函数说明
mktime()用来将参数timeptr所指的tm结构数据转换成从公元1970年1月1日0时0分0 秒算起至今的UTC时间所经过的秒数。
返回值
返回经过的秒数。
范例
/* 用time()取得时间(秒数),利用localtime()
转换成struct tm 再利用mktine()将struct tm转换成原来的秒数*/
#include
main()
{
time_t timep;
strcut tm *p;
time(&timep);
printf(“time() : %d \n”,timep);
p=localtime(&timep);
timep = mktime(p);
printf(“time()->localtime()->mktime():%d\n”,timep);
}
执行
time():974943297
time()->localtime()->mktime():974943297
//--------------------------------------------------------------------------------------------------------------------------------------------------------//
settimeofday(设置目前时间)
表头文件
#include
#include
定义函数
int settimeofday ( const struct timeval *tv,const struct timezone *tz);
函数说明
settimeofday()会把目前时间设成由tv所指的结构信息,当地时区信息则设成tz所指的结构。详细的说明请参考gettimeofday()。注意,只有root权限才能使用此函数修改时间。
返回值
成功则返回0,失败返回-1,错误代码存于errno。
错误代码
EPERM 并非由root权限调用settimeofday(),权限不够。
EINVAL 时区或某个数据是不正确的,无法正确设置时间。
//--------------------------------------------------------------------------------------------------------------------------------------------------------//
time(取得目前的时间)
表头文件
#include
定义函数
time_t time(time_t *t);
函数说明
此函数会返回从公元1970年1月1日的UTC时间从0时0分0秒算起到现在所经过的秒数。如果t 并非空指针的话,此函数也会将返回值存到t指针所指的内存。
返回值
成功则返回秒数,失败则返回((time_t)-1)值,错误原因存于errno中。
范例
#include
mian()
{
int seconds= time((time_t*)NULL);
printf(“%d\n”,seconds);
}