【Ubuntu】汇总各种安装与使用命令

Cmake installation:

https://askubuntu.com/questions/355565/how-do-i-install-the-latest-version-of-cmake-from-the-command-line/865294#865294?newreg=75cc1ce82a4d46ad9e022418155d921f

sudo apt-get install cmake

 

Complie .c file in ubuntu:

http://www.akira.ruc.dk/~keld/teaching/CAN_e14/Readings/How%20to%20Compile%20and%20Run%20a%20C%20Program%20on%20Ubuntu%20Linux.pdf

gedit <abc>.c

 

remove folders (directory):

https://askubuntu.com/questions/217893/how-to-delete-a-non-empty-directory-in-terminal

 

install wechat:

http://ubuntuhandbook.org/index.php/2017/07/install-wechat-desktop-app-ubuntu-16-04-higher/

 

Create .sh file:

https://www.youtube.com/watch?v=He-5BpUGSag

vi <abc>.sh

 

Copy a file to another directory:

cp  or mv

example:

cp backup/cmake/t1/main.c backup/cmake/t2

copies main.c from folder t1 to foder t2

if they are in the same folder, you can also do:

mv main.c src

 

Create a .txt file:

Method 1:

nano <abc>.txt

 

Method 2:

vi <abc>.txt    then press i to start editing the file (entering the editing mode), and press Esc when finished. After going back to the viewing mode, type :w to save and :q to quit.

 

Create python virtual environment in ubuntu:

https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-ubuntu-16-04

 

mkdir pyenvs

cd pyenvs

python3 -m venv my_env

source my_env/bin/activate

nano hello.py

python hello.py

deactivate

 

Install python idle on Ubuntu:

sudo apt-get install idle3

when using it:

idle3 <filename>.py


 

GPU Replacement:

https://askubuntu.com/questions/620693/what-driver-should-i-choose-for-my-nvidia-gpu

https://ubuntuforums.org/showthread.php?t=2334268

https://www.linuxbabe.com/desktop-linux/switch-intel-nvidia-graphics-card-ubuntu

https://ubuntu-mate.community/t/how-to-install-graphics-card-drivers-in-ubuntu/3228/2

https://www.dell.com/support/article/us/en/19/sln298431/a-guide-to-nvidia-optimus-on-dell-pcs-with-an-ubuntu-operating-system?lang=en


 

tf.mul problem:

tf.mul, tf.sub and tf.neg are deprecated in favor of tf.multiply, tf.subtract and tf.negative.

https://stackoverflow.com/questions/42217059/tensorflowattributeerror-module-object-has-no-attribute-mul

 

Complie C file:

gedit hello.c

… (write contents in hello.c)

gcc -o hello hello.c

./hello

 

Install tar.gz package:

unzip to where you want to install - {address}

cd {address}

cd bin

./xx.sh

 

Download sth from github to local:

git clone https://github.com/xxxx

 

Use vim:

touch main.cpp

vim main.cpp

(inside vim) press i to enter the insert mode

(insert mode) edit, …, exit by press Esc

(inside vim) :wq     //write and quit

 

Check file contents:

cat main.cpp

 

Create cmake - Use CMake to manage a project:

Method 1 (easy but messy):

touch CMakeLists.txt

vim CMakeLists.txt

project(helloSLAM)

add_executable( sayHello main.cpp)

cmake .

make

./sayHello

 

Method 2 (not messy, put processing files in build, head files in include, source files in src):

mkdir build

mkdir include src

touch include/Hello.h src/Hello.cpp

vim include/Hello.h

(content in Hello.h)

#pragma once

void SayHello();

vim src/Hello.cpp

(content in Hello.cpp)

#include "Hello.h"

#include <iostream>

using namespace std;

void SayHello() {

    cout<<"Hello SLAM!"<<endl;

}

vim main.cpp

(content in main.cpp)

#include "Hello.h"

 

using namespace std;

 

int main(int argc, char** argv){

   SayHello();

   return 0;

}

vim CMakeLists.txt

(content in CMakeLists.txt)

project(helloSLAM)

 

#where we have header files

include_directories( "include" )

 

#only source files

add_library( libHello src/Hello.cpp )

 

add_executable( sayHello main.cpp )

target_link_libraries( sayHello libHello )

cd build

cmake ..

make

./sayHello

Method 3 (same as Method 2 except defining a debug mode):

cmake_minimum_required( VERSION 2.8 )

project(helloSLAM)

 

#specify compile mode to debug

set( CMAKE_BUILD_TYPE Debug )

 

#where we have header files

include_directories( "include" )

 

#only source files

add_library( libHello src/Hello.cpp )

 

add_executable( sayHello main.cpp )

target_link_libraries( sayHello libHello )

 

Define Env Variable:

https://www.jianshu.com/p/ac2bc0ad3d74

 

change PS1:

https://askubuntu.com/questions/145618/how-can-i-shorten-my-command-line-bash-prompt

PS1='\u:\W\$ '

 

Install OpenGL:

sudo apt-get update

sudo apt-get install freeglut3-dev

 

Install glew:

sudo apt-get install libglew-dev

 

Install Pangolin:

https://github.com/stevenlovegrove/Pangolin

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值