
linux
mct123
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
使用top命令获取cpu使用率
使用top -n1命令获取cpu使用率不变问题转载 2023-03-20 14:13:09 · 2486 阅读 · 0 评论 -
linux cpu使用率计算
转自linux 进程的cpu计算,linux环境下cpu利用率的计算_美自的博客-优快云博客,已经收藏但怕丢失所以直接复制过来目前linux统计cpu利用率时,所用到的信息,大多数是从 /proc/stat中获得,其中信息大致如下:[work@builder ~]$ cat /proc/statcpu 432661 13295 86656 422145968 171474 233 5346cpu0 123075 2462 23494 105543694 16586 0 4615cp转载 2022-04-14 17:23:08 · 3562 阅读 · 0 评论 -
远程同步文件 rsync 免密码登录
rsync与scp的区别主要是rsync可以设置已经存在的文件不需要再次同步。例如:rsync -avzu --progress -rsh=ssh mission@10.1.1.156:/home/mission/StationPisPlayer/data/resource .把156上的文件夹拷贝到本地机器在同步文件时要手动输入密码。如何设置免密码呢?1.在本地机上执行ssh-keygen -t rsa直接回车会生成id_rsa id_rsa.pub两个文件,id_rsa...原创 2021-09-08 17:34:07 · 2323 阅读 · 1 评论 -
RTNETLINK answers: File exists
sudo ip addr flush dev ens33原创 2021-06-22 16:17:15 · 395 阅读 · 0 评论 -
cryptopp交叉编译
编译linuxt版本直接make交叉编译版本,我的编译器是arm-hisiv400-linux-g++修改GNUmakefile-cross在开头部分修改CXX = arm-hisiv400-linux-gnueabi-g++开始编译make -f GNUmakefile-cross报错要加-mfloat-abi=softfp -mfpu=neon参数修改CXXFLAGS ?= -DNDEBUG -g2 -O3 -fPIC -pipe -mfloat-abi=softfp原创 2021-03-16 19:11:52 · 770 阅读 · 0 评论 -
代码编译所有条件都正常,但链接时程序失败
代码在虚拟机中编译,正常都可以成功,突然有一次就编译不过,后发现是虚拟机空间满了,删除点东西即可原创 2021-03-04 11:05:20 · 758 阅读 · 1 评论 -
如何让linux脚本只运行一次
update_time.sh:#!/bin/bashexport SUDO_ASKPASS=/home/mission/update_time/printpwdHOME_DIR=/home/mission/update_time LOG_FILE="${HOME_DIR}/update_date.log"cd $HOME_DIRn=`ps -ef|grep "update_time.sh"|grep -v grep|wc -l`if [ $n -gt 2 ]; thenexit 0fi.原创 2020-11-06 11:35:10 · 1752 阅读 · 0 评论 -
Qt 程序运行报错 “could not load find or load the Qt platform plugin xcb”
export QT_PLUGIN_PATH=/home/rolay64/Qt5.5.1/5.5/gcc_64/plugins我是设置下环境变量即可原创 2020-10-30 13:06:59 · 515 阅读 · 0 评论 -
定时任务 脚本只启一次调用程序
/etc/crontab* * * * * root /bin/bash /home/mission/TestTool/start.sh#表示每分钟调用一次脚本start.sh#!/bin/bashcd /home/mission/TestToolpidof TestToolif [ $? -ne 0 ]; then./TestTool ats.txt 10.1.1.124 8130 &fi#进程没有启动就启动一次...原创 2020-10-30 13:00:40 · 410 阅读 · 0 评论 -
system返回256
http://blog.chinaunix.net/uid-24774106-id-3048281.html?page=3遇到system调用脚本,结果返回了256的情况,那么如何判断脚本是否正常成功调用,即取到脚本的真正返回值system是个综合的操作,分解开来看就是相当于执行了1 fork 生成一个子进程。2 在子进程执行 execl("/bin/sh","sh","-c转载 2017-01-13 15:18:33 · 19762 阅读 · 1 评论 -
禁止ubuntu系统弹出报错界面
永远禁用掉Apport这一特性,可以远离在每次重启时出现错误提示的纷扰。编辑apport文件 /etc/default/apport,sudonano /etc/default/apport找到 enabled=1 这一行,并改变到0(zero)enabled=0保存,退出。然后,就可以停止apport服务了。sudo stop apport原创 2016-10-19 16:40:17 · 2218 阅读 · 1 评论 -
ubuntu开机启动特定程序
ubuntu开机启动特定程序原创 2016-08-12 17:09:50 · 2769 阅读 · 0 评论 -
arm上nfs挂载共享
mount -t nfs -o nolock,nfsvers=3,vers=3 192.168.1.151:/home/mit/cd6_c /home/tmp原创 2018-06-15 00:35:17 · 739 阅读 · 0 评论 -
ubuntu定时任务启动图形程序
crontab -e22 18 * * * export DISPLAY=:0&&/home/mct/PisPlayer_V2.0_train_branch/build/StationPisPlayer注意红色部分原创 2016-08-12 16:39:16 · 985 阅读 · 2 评论 -
linux程序只运行一个实例
法1.使用文件的排他锁,排他锁(Exclusive Locks,简称X锁),又称为写锁、独占锁,是一种基本的锁类型。若事务T对数据对象A加上X锁,则只允许T读取和修改A,其他任何事务都不能再对A加任何类型的锁,直到T释放A上的锁。这就保证了其他事务在T释放A上的锁之前不能再读取和修改A。int flock(int fd, int operation);其中,参数 fd 表示文件描述符;原创 2017-01-13 11:38:16 · 5080 阅读 · 0 评论 -
UBUNTU16.04 和 12.04 安装samba 共享目录到windos上
转自https://www.linuxidc.com/Linux/2017-07/145445.htm1 sudo apt-get install samba2 sudo apt-get install smbclient3 修改samba配置文件/etc/samba/smb.conf在文件末尾加上如下[share] (相当于在home目录项增加了一个新用户)[share]comment = ...转载 2018-05-26 15:07:56 · 481 阅读 · 0 评论 -
linux与windows的route命令
linuxifconfig eth0 192.168.45.101ifconfig eth0 uproute //显示路由信息route add -net 192.168.45.0 gw 192.168.45.254 eth0 //指定网关 及哪个网口route add -net 192.168.62.0 netmask 255.255.255.0 gw 192.168.45.254 et...原创 2018-05-24 11:32:59 · 1361 阅读 · 0 评论 -
qt程序运行时的路径问题
程序运行时的路径是该程序在被调用时的目录假如系统刚启动时,是在/目录处,这时系统启动脚本/etc/rc.local调用/home/root/qt_broadcast_client/qt_broadcast_client程序则目录就是/目录,qt_broadcast_client在调用system("./run.sh")时,run.sh的预期目录是/home/root/qt_broadcast_cl...原创 2018-06-05 19:36:35 · 2027 阅读 · 0 评论 -
linux格式化文件系统为ext4
https://www.cnblogs.com/micmouse521/p/8064568.html mkfs.ext4 -T largefile4 -n /dev/sdc1转载 2018-12-10 10:49:20 · 9930 阅读 · 0 评论 -
linux里所有关于时间的函数整理
东西都是从网上收集整理的原创 2014-07-30 09:35:16 · 1021 阅读 · 0 评论 -
ubuntu ntp 时间同步
1.在不装ntp时,ntpdate 命令是可以用的,且能与ntp服务器同步时间root@wilson-software:~# date -s "18:22"Tue Jul 5 18:22:00 CST 2016root@wilson-software:~# ntpdate -d 202.108.6.95 5 Jul 18:22:12 ntpdate[4439]: ntpdate 4.2原创 2016-07-05 21:55:45 · 6572 阅读 · 0 评论 -
linux变量 set env export的区别
http://blog.chinaunix.net/uid-21312393-id-3611574.htmlset,env和export这三个命令都可以用来显示shell变量,区别[root@localhost root]# a=test[root@localhost root]# echo $atest[root@localhost root]# set |grep aa转载 2016-07-26 21:49:54 · 652 阅读 · 0 评论 -
系统调用open()为什么有O_APPEND,O_CREAT选项
要将内容写到文件的尾端原创 2014-08-06 16:03:36 · 5116 阅读 · 0 评论 -
AUPE第三章文件I/O笔记
fcntl在设置文件状态和标志时,要注意先原创 2014-08-07 10:47:21 · 590 阅读 · 0 评论 -
linux上lseek的理解
每个打开文件都有一个与其相关联原创 2014-08-06 09:43:03 · 1921 阅读 · 0 评论 -
linux上c,c++ 的io函数原型
#includeint open(const char*name ,int flag,mode_t mode);int create(const char*name原创 2014-08-06 11:20:17 · 671 阅读 · 0 评论 -
线程之间利用信号量协调对共享资源访问的c++代码实现
首先要了解线程之间的信号量的系统函数原创 2014-07-04 15:20:06 · 808 阅读 · 0 评论 -
进程间使用信号量协调对共享资源访问c++代码实现
#include #include #include #include#include#includestatic int semid;//union semun要自己定义一下,否则gcc编译会报错union semun{ int val; struct semid_ds *buf; unsigned short *arry;};bo转载 2014-07-04 12:55:28 · 924 阅读 · 0 评论 -
百度上的共享内存使用例子程序
例1:#include #include #include #include #include #include #define SIZE 1024int main()//子进程写一句话,父进程读{ int shmid ; char *shmaddr ; struct shmid_ds buf ; int flag = 0 ; int pid转载 2014-07-03 09:37:16 · 801 阅读 · 0 评论 -
信号量集知识整理
使用的头文件#include #include #include int semget(key_t key, int nsems, int semflg);取得已经存在的信号量或者创建一个新的信号量key:所创建或打开信号量集的键值。和共享内存使用相同,一般也是要用ftok函数去产生key为IPC_PRIVATE时,则创建一个信号量key为其他值时,如果标识中包含I原创 2014-07-03 17:09:40 · 2005 阅读 · 1 评论 -
重定向在不同shell下是有区别的
试验AUPE里fcntl函数获取文件状态原创 2014-08-07 09:51:02 · 2427 阅读 · 0 评论 -
linux用户和组
创建用户useradd -d /home/mct -g users -s /bin/csh -m mct原创 2014-09-05 10:15:15 · 406 阅读 · 0 评论 -
查看ubuntu版本
1.cat /proc/version 查看2.使用命令:uname -a 查看3.使用命令:lsb_release -a 查看转载 2016-07-26 21:05:42 · 347 阅读 · 0 评论 -
ubuntu 环境变量设置
1.vi /etc/environment #设置的是所有用户的环境变量2.在用户目录下的.bashrc中修改,export PATH=XXXX:$PATH #设置的是单个用户的环境变量转载 2016-07-26 20:41:39 · 409 阅读 · 0 评论 -
APUE第7章 UNIX进程环境 笔记
1.五种方式使进程终止正常:return原创 2014-08-14 16:52:45 · 667 阅读 · 0 评论 -
APUE第5章标准I/O库 笔记
1.系统调用是以文件描述符进行I/O原创 2014-08-12 15:16:10 · 701 阅读 · 0 评论 -
APUE第6章 系统数据文件和信息 笔记
1.getpwuid函数是通过用户的uid查找用户的passwd数据。如果出错时,它们都返回一个空指针并设置errno的值,用户可以根据perror函数查看出错的信息。原创 2014-08-14 15:41:34 · 493 阅读 · 0 评论 -
c,c++读写文件的使用整理
c风格的#include#define LEGNTH 1024int main(int argc,char *argv[]){ FILE *in,*out; in = fopen(argv[1],"r") char buf[LEGNTH+1] = {0}; if(NULL == in) { printf("fopen for read error\n");原创 2014-08-01 17:42:57 · 869 阅读 · 0 评论 -
APUE第4章 文件和目录笔记
1.#include#includeint stat(const char *pathname,struct stat *buf);//根据文件名取得文件的信息int fstat(int fd,struct stat *buf);//根据文件描述符取得文件信息int lstat(const char *pathname,struct stat *buf);//类似stat,但当文件原创 2014-08-08 17:30:23 · 665 阅读 · 0 评论 -
共享内存知识点整理
ipcs用于输出消息队列,信号量,共享内存的使用信息ipcs -m只输出共享内存------ Shared Memory Segments --------key shmid owner perms bytes nattch status 0x0103c005 49446938 dmslcclcj 644原创 2014-07-02 17:34:52 · 1247 阅读 · 0 评论