Linux 系列笔记1 -- 杂记

在此仅为自己的使用做一个笔记,所以以下内容比较杂乱,设计到各方面的内容,跨度比较大。。。

安装zsh

sudo apt-get install zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
使程序在ssh连接中断退出后,仍在后台继续执行

使用 nohup 和 & 执行程序

nohup python test.py &
xshell 使用zsh home end 键 小键盘区无法使用解决办法

在终端执行以下代码

cat <<ENDOF >> ~/.zshrc
# Home
bindkey '\e[1~' beginning-of-line
# End
bindkey '\e[4~' end-of-line

# Keypad
# 0 . Enter
bindkey -s "^[Op" "0"
bindkey -s "^[Ol" "."
bindkey -s "^[OM" "^M"
# 1 2 3
bindkey -s "^[Oq" "1"
bindkey -s "^[Or" "2"
bindkey -s "^[Os" "3"
# 4 5 6
bindkey -s "^[Ot" "4"
bindkey -s "^[Ou" "5"
bindkey -s "^[Ov" "6"
# 7 8 9
bindkey -s "^[Ow" "7"
bindkey -s "^[Ox" "8"
bindkey -s "^[Oy" "9"
# + -  * /
bindkey -s "^[Ok" "+"
bindkey -s "^[Om" "-"
bindkey -s "^[Oj" "*"
bindkey -s "^[Oo" "/"
ENDOF

source ~/.zshrc

编译opencv C++代码

g++ revise_img.cpp -o revise_img `pkg-config --libs --cflags opencv` -ldl

git 切换TensorFlow版本为交叉编译版本

git checkout -b cross-compile  #交叉编译

在树莓派上使用bazel 交叉编译tensorflow

bazel build -c opt --copt="-mfpu=neon-vfpv4" --incompatible_load_argument_is_label=false --copt="-funsafe-math-optimizations" --copt="-ftree-vectorize" --copt="-fomit-frame-pointer" --local_resources 1024,1.0,1.0 --verbose_failures tensorflow/tools/pip_package:build_pip_package

查看并杀死僵尸进程

ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]'

没有root权限安装rpm包

rpm2cpio ctags-5.8-2.el6.x86_64.rpm |cpio -idvm

安装vim8.0

./configure --prefix=/home/u11266/.local/ \
--includedir=/usr/lib/perl5/CORE/ \
--enable-luainterp=yes  \
--enable-python3interp=yes \
--with-python3-config-dir=/home/u11266/.local/lib/python3.5/config-3.5m  --enable-rubyinterp=yes \
--enable-cscope \
--enable-multibyte \
--enable-hangulinput \
--enable-xim \
--enable-fontset -\
-with-modified-by=mznfirst --with-compiledby=mznfirst \
--with-lua-prefix=/home/u11266/.local
--libdir=/home/hekun/.local/lib/ \
--includedir=/home/hekun/.local/include/
./configure --prefix=/home/u11266/.local/ --with-python3-config-dir=/home/u11266/.local/lib/python3.6/config-3.6m-x86_64-linux-gnu --with-features=huge --enable-rubyinterp --enable-pythoninterp --enable-luainterp --with-lua-prefix=/home/u11266/.local/ --with-python-config-dir=/usr/lib64/python2.7/config

opencv3 python3.5

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D PYTHON3_EXECUTABLE=/usr/bin/python3 \
-D PYTHON_INCLUDE_DIR=/usr/include/python3.5 \
-D PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so \
-D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/local/lib/python3.5/dist-packages/numpy/core/include \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/home/mzn/Software/opencv-3.3.1/opencv_contrib-3.3.1/modules \
-D PYTHON_EXECUTABLE=/usr/lib/python3 \
-D BUILD_EXAMPLES=ON ..

编译安装Python3

使能共享库

./configure --enable-shared --enable-optimizations --prefix=/home/u11266/.local
make -j8
make install

配置fast-rcnn出现问题解决方法
将caffe中的文件复制到当前目录

cp /Deeplearning/caffe/include/caffe/util/cudnn.hpp include/caffe/util/cudnn.hpp 
cp /Deeplearning/caffe/src/caffe/layers/cudnn_conv_layer.c* .
cp /Deeplearning/caffe/src/caffe/layers/cudnn_deconv_layer.c* .
cp /Deeplearning/caffe/src/caffe/layers/cudnn_lcn_layer.c* .
cp /Deeplearning/caffe/src/caffe/layers/cudnn_lrn_layer.c* .
cp /Deeplearning/caffe/src/caffe/layers/cudnn_pooling_layer.c* .
cp /Deeplearning/caffe/src/caffe/layers/cudnn_relu_layer.c* .
cp /Deeplearning/caffe/src/caffe/layers/cudnn_sigmoid_layer.c* .
cp /Deeplearning/caffe/src/caffe/layers/cudnn_softmax_layer.c* .
cp /Deeplearning/caffe/src/caffe/layers/cudnn_tanh_layer.c* .
cp -r /Deeplearning/caffe/include/caffe/layers include/caffe

Linux分开设置目录权限和文件权限:
linux 服务器权限:经常要用到的命令:

find dir_path -type f -exec chmod 644 {} \;  //设置文件权限为644
find dir_path -type d -exec chmod 755 {} \;  //设置目录权限为755

TensorFlow使用中指定GPU

import os
os.environ['CUDA_VISIBLE_DEVICES']='2,3'  

增加swap交换空间

创建2G的swap文件

mkdir /swap 
cd /swap 
sudo dd if=/dev/zero of=swapfile bs=2048 count=2000000

把生成的文件转换成 Swap 文件

sudo mkswap -f swapfile

激活swap文件

sudo swapon swapfile 

卸载swap文件

sudo swapoff swapfile

如果需要一直保持这个 swap ,可以把它写入 /etc/fstab 文件。

/swap/swapfile /swap swap defaults 0 0
VNC连接远程桌面命令(自定义分辨率)
vnc4server -geometry 1920x1080 -depth 24
(默认分辨率为1024*768 depth为16 )
Linux下利用nginx流服务器推送摄像头实时采集视频 (转载)
ffmpeg -f video4linux2 -i /dev/video0 -f flv rtmp://192.168.1.200/live/livestream

其中, /dev/video0 是摄像头默认设备地址,192.168.1.200为服务器地址

成功推流后,在游览器或者手机上输入推流地址rtmp://192.168.1.200/live/livestream即可观看。

ubuntu 没有root权限安装软件
$ apt-get download package
$ dpkg -x package.deb dir

执行上述命令后在当前目录会出现usr目录,将usr中的文件全部copy到~/.local目录中

apt-get source package
cd package
./configure --prefix=$HOME
make
make install
树莓派系统还原
sudo gzip -dc /home/raspi.gz |sudo dd of=/dev/sdd 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值