ubuntu常用指令

是皮皮攀呀,發表於2018-09-07

1.pwd:顯示當前路徑

2. rm -rf * :刪除當前資料夾內的所有內容

3.make -j3:4個CPU時,最快速度make

4.find / -name “ ×××” :全盤尋找×××

5.mv aa  bb:將aa更名為bb

6.cp 檔案  待移動位置:複製

複製資料夾:cp  -r  檔案  待移動位置

7.make clean 刪除之前make生成的一些檔案

8.catkin_init_workspace 初始化工作區

9. sudo apt-get check檢查是否有包有異常

10.  /home/david/MySoft/Eigen3/Eigen/src/Core/util/Macros.h 裡面可檢視當前eigen的使用版本

11.python --version  檢視當前python版本

12.切換python2和python3:

echo alias python=python2 >> ~/.bashrc

source ~/.bashrc  //指定為python2

echo alias python=python3 >> ~/.bashrc

source ~/.bashrc  //指定為python3

13.不同版本的OpenCV間相互切換

不同版本的OpenCV編譯好後,都會生成一個 OpenCVConfig.cmake,這個檔案中指定了對應庫函式和標頭檔案的位置。在本教程的情況下,OpenCV2對應的OpenCVConfig.cmake在/usr/local/opencv2/share/OpenCV,OpenCV3對應的OpenCVConfig.cmake在/usr/local/opencv3/share/OpenCV。因此,如果要使用那個版本的OpenCV只需要將對應版本OpenCVConfig.cmake的路徑寫入CMakeLists.txt即可。這就是說,當自己所寫的程式使用到OpenCV3時,在 FIND_PACKAGE( OpenCV REQUIRED ) 前,新增set(OpenCV_DIR “/usr/local/opencv3/share/OpenCV”) 這樣計算機就找到OpenCV3的對應標頭檔案和庫檔案了,如果使用OpenCV2,那麼新增set(OpenCV_DIR “/usr/local/opencv2/share/OpenCV”)在FIND_PACKAGE( OpenCV REQUIRED ) 前就好。比如下面是一個使用OpenCV3的例子。

CMAKE_MINIMUM_REQUIRED( VERSION 2.8)
PROJECT(useOpenCV)
set(OpenCV_DIR "/usr/local/opencv3/share/OpenCV") 
FIND_PACKAGE(OpenCV REQUIRED)
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
add_executable(useOpenCV useOpenCV.cpp)
TARGET_LINK_LIBRARIES(useOpenCV ${OpenCV_LIBRARIES})

14.pkg-config --modversion opencv :檢視opencv版本

15.E: 有未能滿足的依賴關係。請嘗試不指明軟體包的名字來執行“apt-get -f install”(也可以指定一個解決辦法)

直接在終端輸入sudo apt-get --fix-broken install即可解決問題。

16.第二次血的教訓:sudo apt-get autoremove libtiff5-dev 不能隨便用!!!

zp@zp:~/opencv-3.3.1/build$ sudo apt-get autoremove libtiff5-dev
[sudo] zp 的密碼: 
正在讀取軟體包列表... 完成
正在分析軟體包的依賴關係樹       
正在讀取狀態資訊... 完成       
下列軟體包將被【解除安裝】:
  fltk1.3-doc fluid gazebo7 gazebo7-common gazebo7-plugin-base google-mock
  hddtemp hdf5-helpers libaec-dev libapr1-dev libaprutil1-dev libarmadillo6
  libarpack2 libbulletcollision2.83.6 libbulletdynamics2.83.6
  libcollada-dom2.4-dp-dev libcollada-dom2.4-dp0 libconsole-bridge-dev
  libconsole-bridge0.2v5 libcurl4-openssl-dev libcv-dev libcvaux-dev
  libdap-dev libdap17v5 libdapclient6v5 libdapserver7v5 libepsilon1
  libfltk-cairo1.3 libfltk-forms1.3 libfltk-gl1.3 libfltk-images1.3 libfltk1.3
  libfltk1.3-dev libfreeimage-dev libfreeimage3 libfreexl1 libgazebo7
  libgazebo7-dev libgdal-dev libgdal1i libgeos-3.5.0 libgeos-c1v5 libgeos-dev
  libgif-dev libgl2ps-dev libgtkglext1 libgts-0.7-5 libgts-bin libgts-dev
  libhdf4-0-alt libhdf4-alt-dev libhdf5-cpp-11 libhdf5-dev libhdf5-mpi-dev
  libhdf5-openmpi-10 libhdf5-openmpi-dev libhighgui-dev libignition-math2
  libignition-math2-dev libilmbase-dev libinput-dev libjbig-dev libjsoncpp-dev
  libjxr0 libkmlbase1 libkmldom1 libkmlengine1 libldap2-dev
  liblinearmath2.83.6 liblog4cxx-dev liblog4cxx10-dev liblog4cxx10v5
  liblz4-dev liblzma-dev libnetcdf-cxx-legacy-dev libnetcdf-dev libogdi3.2
  libogg-dev libogre-1.9-dev libogre-1.9.0v5 libopencv-calib3d-dev
  libopencv-calib3d2.4v5 libopencv-contrib-dev libopencv-contrib2.4v5
  libopencv-core-dev libopencv-dev libopencv-features2d-dev
  libopencv-flann-dev libopencv-gpu-dev libopencv-gpu2.4v5
  libopencv-highgui-dev libopencv-highgui2.4v5 libopencv-imgproc-dev
  libopencv-legacy-dev libopencv-legacy2.4v5 libopencv-ml-dev
  libopencv-ml2.4v5 libopencv-objdetect-dev libopencv-objdetect2.4v5
  libopencv-ocl-dev libopencv-ocl2.4v5 libopencv-photo-dev
  libopencv-photo2.4v5 libopencv-stitching-dev libopencv-stitching2.4v5
  libopencv-superres-dev libopencv-superres2.4v5 libopencv-ts-dev
  libopencv-ts2.4v5 libopencv-video-dev libopencv-video2.4v5
  libopencv-videostab-dev libopencv-videostab2.4v5 libopencv2.4-java
  libopencv2.4-jni libopenexr-dev libopenjp2-7 libopenni-dev
  libopenni-sensor-pointclouds0 libopenni0 libpcl-apps1.7 libpcl-common1.7
  libpcl-dev libpcl-features1.7 libpcl-filters1.7 libpcl-io1.7
  libpcl-kdtree1.7 libpcl-keypoints1.7 libpcl-octree1.7 libpcl-outofcore1.7
  libpcl-people1.7 libpcl-recognition1.7 libpcl-registration1.7
  libpcl-sample-consensus1.7 libpcl-search1.7 libpcl-segmentation1.7
  libpcl-surface1.7 libpcl-tracking1.7 libpcl-visualization1.7 libpcl1.7
  libprotoc-dev libprotoc9v5 libpyside-py3-2.0 libpyside2-dev libpyside2.0
  libqgsttools-p1 libqt5clucene5 libqt5designer5 libqt5designercomponents5
  libqt5help5 libqt5multimediaquick-p5 libqt5multimediawidgets5
  libqt5quickparticles5 libqt5script5 libqt5scripttools5 libqt5svg5-dev
  libqt5webkit5-dev libqt5x11extras5 libqt5x11extras5-dev libqt5xmlpatterns5
  libqt5xmlpatterns5-dev libqt5xmlpatterns5-private-dev libqtwebkit-dev
  libsctp-dev libsctp1 libsdformat4 libsdformat4-dev libshiboken-py3-2.0
  libshiboken2-dev libshiboken2.0 libsimbody-dev libsimbody3.5v5
  libspatialite-dev libspatialite7 libspnav0 libsuperlu4 libtar-dev libtar0
  libtheora-dev libtiff5-dev libtiffxx5 libtinyxml-dev libtinyxml2-2v5
  libtinyxml2-dev liburdfdom-dev liburdfdom-headers-dev
  liburdfdom-model-state0.4 liburdfdom-model0.4 liburdfdom-sensor0.4
  liburdfdom-tools liburdfdom-world0.4 liburiparser1 libvtk6-dev libvtk6-java
  libvtk6-qt-dev libvtk6.2 libvtk6.2-qt libwebp-dev libxerces-c-dev
  libxerces-c3.1 libxml2-dev libxss-dev opencv-data openni-utils pyqt5-dev
  python-attr python-autobahn python-defusedxml python-empy python-lz4
  python-mpi4py python-msgpack python-netifaces python-opengl python-pam
  python-psutil python-pyasn1-modules python-pydot python-pyqt5
  python-pyqt5.qtopengl python-pyqt5.qtsvg python-pyqt5.qtwebkit
  python-pyside2 python-pyside2.qtconcurrent python-pyside2.qtcore
  python-pyside2.qtgui python-pyside2.qthelp python-pyside2.qtnetwork
  python-pyside2.qtprintsupport python-pyside2.qtqml python-pyside2.qtquick
  python-pyside2.qtquickwidgets python-pyside2.qtscript python-pyside2.qtsql
  python-pyside2.qtsvg python-pyside2.qttest python-pyside2.qtuitools
  python-pyside2.qtwebkit python-pyside2.qtwebkitwidgets
  python-pyside2.qtwidgets python-pyside2.qtx11extras python-pyside2.qtxml
  python-serial python-service-identity python-sip-dev python-snappy
  python-twisted python-twisted-bin python-twisted-core python-txaio
  python-vtk6 python-wxtools qtbase5-private-dev qtdeclarative5-dev
  qtdeclarative5-private-dev qtmultimedia5-dev qtscript5-dev
  qtscript5-private-dev qttools5-dev qttools5-dev-tools qttools5-private-dev
  ros-kinetic-actionlib ros-kinetic-actionlib-msgs
  ros-kinetic-actionlib-tutorials ros-kinetic-angles ros-kinetic-bond
  ros-kinetic-bond-core ros-kinetic-bondcpp ros-kinetic-bondpy
  ros-kinetic-camera-calibration ros-kinetic-camera-calibration-parsers
  ros-kinetic-camera-info-manager ros-kinetic-catkin ros-kinetic-class-loader
  ros-kinetic-collada-parser ros-kinetic-collada-urdf ros-kinetic-common-msgs
  ros-kinetic-common-tutorials ros-kinetic-compressed-depth-image-transport
  ros-kinetic-compressed-image-transport ros-kinetic-control-msgs
  ros-kinetic-cpp-common ros-kinetic-cv-bridge ros-kinetic-depth-image-proc
  ros-kinetic-desktop ros-kinetic-desktop-full
  ros-kinetic-diagnostic-aggregator ros-kinetic-diagnostic-analysis
  ros-kinetic-diagnostic-common-diagnostics ros-kinetic-diagnostic-msgs
  ros-kinetic-diagnostic-updater ros-kinetic-diagnostics
  ros-kinetic-dynamic-reconfigure ros-kinetic-eigen-conversions
  ros-kinetic-eigen-stl-containers ros-kinetic-executive-smach
  ros-kinetic-filters ros-kinetic-gazebo-dev ros-kinetic-gazebo-msgs
  ros-kinetic-gazebo-plugins ros-kinetic-gazebo-ros
  ros-kinetic-gazebo-ros-pkgs ros-kinetic-gencpp ros-kinetic-geneus
  ros-kinetic-genlisp ros-kinetic-genmsg ros-kinetic-gennodejs
  ros-kinetic-genpy ros-kinetic-geometric-shapes ros-kinetic-geometry
  ros-kinetic-geometry-msgs ros-kinetic-geometry-tutorials
  ros-kinetic-gl-dependency ros-kinetic-image-common
  ros-kinetic-image-geometry ros-kinetic-image-pipeline ros-kinetic-image-proc
  ros-kinetic-image-publisher ros-kinetic-image-rotate
  ros-kinetic-image-transport ros-kinetic-image-transport-plugins
  ros-kinetic-image-view ros-kinetic-interactive-marker-tutorials
  ros-kinetic-interactive-markers ros-kinetic-joint-state-publisher
  ros-kinetic-kdl-conversions ros-kinetic-kdl-parser
  ros-kinetic-laser-assembler ros-kinetic-laser-filters
  ros-kinetic-laser-geometry ros-kinetic-laser-pipeline
  ros-kinetic-librviz-tutorial ros-kinetic-map-msgs ros-kinetic-media-export
  ros-kinetic-message-filters ros-kinetic-message-generation
  ros-kinetic-message-runtime ros-kinetic-mk ros-kinetic-nav-msgs
  ros-kinetic-nodelet ros-kinetic-nodelet-core ros-kinetic-nodelet-topic-tools
  ros-kinetic-nodelet-tutorial-math ros-kinetic-octomap ros-kinetic-opencv3
  ros-kinetic-orocos-kdl ros-kinetic-pcl-conversions ros-kinetic-pcl-msgs
  ros-kinetic-pcl-ros ros-kinetic-perception ros-kinetic-perception-pcl
  ros-kinetic-pluginlib ros-kinetic-pluginlib-tutorials
  ros-kinetic-polled-camera ros-kinetic-python-orocos-kdl
  ros-kinetic-python-qt-binding ros-kinetic-qt-dotgraph ros-kinetic-qt-gui
  ros-kinetic-qt-gui-cpp ros-kinetic-qt-gui-py-common
  ros-kinetic-qwt-dependency ros-kinetic-random-numbers
  ros-kinetic-resource-retriever ros-kinetic-robot ros-kinetic-robot-model
  ros-kinetic-robot-state-publisher ros-kinetic-ros ros-kinetic-ros-base
  ros-kinetic-ros-comm ros-kinetic-ros-core ros-kinetic-ros-environment
  ros-kinetic-ros-tutorials ros-kinetic-rosbag
  ros-kinetic-rosbag-migration-rule ros-kinetic-rosbag-storage
  ros-kinetic-rosbash ros-kinetic-rosboost-cfg ros-kinetic-rosbuild
  ros-kinetic-rosclean ros-kinetic-rosconsole ros-kinetic-rosconsole-bridge
  ros-kinetic-roscpp ros-kinetic-roscpp-core ros-kinetic-roscpp-serialization
  ros-kinetic-roscpp-traits ros-kinetic-roscpp-tutorials ros-kinetic-roscreate
  ros-kinetic-rosgraph ros-kinetic-rosgraph-msgs ros-kinetic-roslang
  ros-kinetic-roslaunch ros-kinetic-roslib ros-kinetic-roslint
  ros-kinetic-roslisp ros-kinetic-roslz4 ros-kinetic-rosmake
  ros-kinetic-rosmaster ros-kinetic-rosmsg ros-kinetic-rosnode
  ros-kinetic-rosout ros-kinetic-rospack ros-kinetic-rosparam
  ros-kinetic-rospy ros-kinetic-rospy-tutorials ros-kinetic-rosservice
  ros-kinetic-rostest ros-kinetic-rostime ros-kinetic-rostopic
  ros-kinetic-rosunit ros-kinetic-roswtf ros-kinetic-rqt-action
  ros-kinetic-rqt-bag ros-kinetic-rqt-bag-plugins
  ros-kinetic-rqt-common-plugins ros-kinetic-rqt-console ros-kinetic-rqt-dep
  ros-kinetic-rqt-graph ros-kinetic-rqt-gui ros-kinetic-rqt-gui-cpp
  ros-kinetic-rqt-gui-py ros-kinetic-rqt-image-view ros-kinetic-rqt-launch
  ros-kinetic-rqt-logger-level ros-kinetic-rqt-moveit ros-kinetic-rqt-msg
  ros-kinetic-rqt-nav-view ros-kinetic-rqt-plot ros-kinetic-rqt-pose-view
  ros-kinetic-rqt-publisher ros-kinetic-rqt-py-common
  ros-kinetic-rqt-py-console ros-kinetic-rqt-reconfigure
  ros-kinetic-rqt-robot-dashboard ros-kinetic-rqt-robot-monitor
  ros-kinetic-rqt-robot-plugins ros-kinetic-rqt-robot-steering
  ros-kinetic-rqt-runtime-monitor ros-kinetic-rqt-rviz
  ros-kinetic-rqt-service-caller ros-kinetic-rqt-shell ros-kinetic-rqt-srv
  ros-kinetic-rqt-tf-tree ros-kinetic-rqt-top ros-kinetic-rqt-topic
  ros-kinetic-rqt-web ros-kinetic-rviz ros-kinetic-rviz-plugin-tutorials
  ros-kinetic-rviz-python-tutorial ros-kinetic-self-test
  ros-kinetic-sensor-msgs ros-kinetic-shape-msgs ros-kinetic-simulators
  ros-kinetic-smach ros-kinetic-smach-msgs ros-kinetic-smach-ros
  ros-kinetic-smclib ros-kinetic-stage ros-kinetic-stage-ros
  ros-kinetic-std-msgs ros-kinetic-std-srvs ros-kinetic-stereo-image-proc
  ros-kinetic-stereo-msgs ros-kinetic-tf ros-kinetic-tf-conversions
  ros-kinetic-tf2 ros-kinetic-tf2-eigen ros-kinetic-tf2-geometry-msgs
  ros-kinetic-tf2-kdl ros-kinetic-tf2-msgs ros-kinetic-tf2-py
  ros-kinetic-tf2-ros ros-kinetic-theora-image-transport
  ros-kinetic-topic-tools ros-kinetic-trajectory-msgs
  ros-kinetic-turtle-actionlib ros-kinetic-turtle-tf ros-kinetic-turtle-tf2
  ros-kinetic-turtlesim ros-kinetic-urdf ros-kinetic-urdf-parser-plugin
  ros-kinetic-urdf-tutorial ros-kinetic-vision-opencv
  ros-kinetic-visualization-marker-tutorials ros-kinetic-visualization-msgs
  ros-kinetic-visualization-tutorials ros-kinetic-viz
  ros-kinetic-webkit-dependency ros-kinetic-xacro ros-kinetic-xmlrpcpp sbcl
  sdformat-sdf shiboken2 sip-dev tango-icon-theme tcl-dev tcl-vtk6 tcl8.6-dev
  tk-dev tk8.6-dev ttf-dejavu-core ttf-liberation uuid-dev vtk6
  x11proto-scrnsaver-dev
升級了 0 個軟體包,新安裝了 0 個軟體包,要解除安裝 504 個軟體包,有 258 個軟體包未被升級。
解壓縮後將會空出 1,707 MB 的空間。
您希望繼續執行嗎? [Y/n] 
我選了是!!!!

好了重新走一波安裝吧【手動微笑】萬幸的是,這次解除安裝了哪些安裝包還知道,可以一個一個地重新安裝回來。筆芯筆芯。