【Ubuntu 2】命令行和问题篇

【Ubuntu 2】命令行和问题篇,第1张

【Ubuntu 2】命令行和问题篇

这个系列最开始是19年9月份自己第一次使用ROS 也是第一次使用ubuntu写的,很多都是前人用过的 然后帮我调试的过程中告诉我的,感觉所有的存在在这里的都是我不止一遍 用过的;十分OK,希望这个笔记能帮助到不少人 更便捷的使用Ubuntu ;
更新:大哥们跟我说:当你不知道一条命令的含义的时候最好不用运行 所以在此篇中 我写下的每条带sudo的命令行我都进行了注释 共同学习【当然有不对的地方希望能指出】

此部分进行了分割 不然一篇的内容太长了

1. 系统命令 删除key

首先需要查看一下key:

sudo apt-key list

然后删除:

sudo apt-key del "7437 0C2D E998 AE89 EC42  EC87 2E09 77E0 8B98 BD68"
链接 查看命令

9.查看电脑配置——linux系

  1. uname -a 查看内核版本与系统
  2. cat /proc/version查看内核版本号、编译器版本号、Ubuntu版本号
  3. cat /proc/cpuinfo 查看cpu信息
  4. free -m 查看运行内存量

10.复制命令行
-v的含义:Cp command can explain what is being done with -v option:

cp  -v foo.txt bar.doc resume.pdf /media/backup/

此句的含义:将 foo.txt bar.doc resume.pdf 文件复制到/media/bakcup文件夹下,并且输出状态信息(就是复制到哪一步了


-r的含义:Pass the -r (recursive) option to cp command.

cp -r ~/documents/ /media/usbpen/

此句的含义:将整个documents文件夹复制到/media/usbpen文件夹下

11.解压命令行
As of the options,
c – Telling “tar” tool to create an archive
z – Use “gunzip” compression. That’s why the file extension – GZ.
v – Verbose mode. Tar will log each of its activity into the screen.
f – Allows you specifying a file name for the output file.
x – Tells “tar” to extract an archive

tar -xzvf test.tar.gz -C ~/Desktop/testDir1/

12.解锁文件夹
主要是HDD 机械硬盘装上去的时候,他总是需要sudo权限,所幸直接解锁掉好了

sudo chmod -R 777 *

777是可读可写,-R是整个文件夹下的所有文件都生效

2. 命令行补充【备注记录】

1. ROSCORE WARNING
WARNING: disk usage in log directory [/home/mohammad/.ros/log] is over 1GB. It’s recommended that you use the ‘rosclean’ command.

rosclean purge

2. ROS小插件
2.1 imu姿态漂移校准

sudo apt install ros-kinetic-rviz-imu-plugin
sudo apt install ros-melodic-rviz-imu-plugin

2.2 查看plotjuggler数据图形

sudo apt-get install ros-kinetic-plotjuggler 
sudo apt install ros-melodic-plotjuggler 

运行成功看一下:

rosrun plotjuggler PlotJuggler

3. 删除文件夹 ubuntu【慎用 在你不知道你删掉的是什么东西的情况下 请不要用】

sudo rm -rf 文件夹名

4. 单独编译一个包

  1. catkin_make -DCATKIN_WHITELIST_PACKAGES=
  2. 【这个情况下会保存只编译此包的指令 如果要返回全局的命令是?】
    在https://answers.ros.org/question/54178/how-to-build-just-one-package-using-catkin_make/ 这个链接中,大神提供了另外的几种单独编译某个包的方法:
    1.使用 --only-pkg-with-deps
catkin_make --only-pkg-with-deps 

5.删除二进制包

  1. 首先卸载包
sudo apt-get purge ros-kinetic-**
sudo apt-get purge ros-melodic-**
  1. 然后卸载依赖包
sudo apt-get autoremove

6.查询空间
linux – 查看磁盘空间的大小
命令格式: df -hl
显示格式为:
  文件系统 容量 已用 可用 已用% 挂载点
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 45G 19G 24G 44% / /dev/hda1 494

8.Ubuntu查看系统任务管理器(cpu+内存资源占用)
在终端输入:gnome-system-monitor
打开ubuntu下的任务管理器,启动桌面管理,显示系统cpu,内存占用情况,如图所示

不想每次系列 xxx source /devel/setup.bash

在home文件夹下,ctrl+H显示出了隐藏文件(再按一次ctrl+H就能又隐藏了)双击打开.bashrc文件:
不出意外,你可以看到一行

source /opt/ros/kinetic/setup.bash

这就是ROS自身的功能包所在位置,已经在你安装的时候的某个步骤添加了进来,所以你可以直接调用到ROS的自带功能包

最后一行添入

source ~/tutorial_ws/devel/setup.bash
source /mnt/hgfs/Share/Kin_ws/devel/setup.bash
source ~/kin_ws/devel/setup.bash

例如,博主这里就是添加了自己的三个工作空间供大家参考,注意需要将****这里改成自己的工作空间哦

source ~devel/setup.bash
sudo chmod 777 /dev/ttyUSB*

调试ROS的时候开了比较多的传感器,每次开机都得chomd的一次,跟着以前步骤,添加进用户名组即可。

sudo gedit /etc/group

然后可以发现有这么一行:

dialout:x:20:

冒号后面填入自己的用户名,你可能可以看到有些:后面有熟悉的你的用户名,没错,那就是你的,例如:

root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:syslog,kin
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:kin

kin就是博主的用户名

问题合集 Software & Update 软件与更新不能打开

这个问题是出现在ubuntu16.04不能打开
Ubuntu16.04 的软件和更新,好像需要默认 python3.5来开。将3.5升级到3.6后,就打不开了。尝试将版本链接回退到3.5,可以正常打开。

# 1. 这条指令是进root权限
sudo -su
# 2. 这条指令是移除现在软链接的python版本(16的话是指向python2.7)
rm /usr/bin/python
# 3. 这句话是建立软链接将系统python默认版本指向python3.5 如果想指回python2.7只需改成2.7即可
ln -s /usr/bin/python3.5 /usr/bin/python

然后可以正常打开了。链接更新会3.6就又打不开了,可能暂时没有找到根本原因

参考:ubuntu16.04“软件和更新”打不开,没有任何反应,这是什么原因?

Encountered a section with no Package: header" Error In Ubuntu

*号是出现在上面的文件

sudo rm /var/lib/apt/lists/* -vf
/dev/nvme0n1p3 requires a manual fsck

自动修复/dev/sda2硬盘

fsck -y /dev/sda2
The following packages have unmet dependencies:

【有风险慎用 因为他在帮你让你选择性处理依赖 但是这样依赖的链接容易出现问题】

sudo apt install aptitude
sudo aptitude install ***你要安装的包名称***
终端http
export http_proxy="http://127.0.0.1:12333"
curl www.google.com
curl www.baidu.com
docker和wine的不同

reddit上的原回答

WINE is taking windows file structures and calls and translating them to Linux.
Docker containers are isolating Linux commands. If you install Docker for windows it still uses a VM for the Linux kernel, docker then just uses this VM as the underlying kernel. So docker is isolating linux commands to run on linux,
WINE is trying to allow windows commands on linux. You can run Linux containers on Linux, Windows, or OS X.
You can run Windows containers on Windows.

Unable to access ‘git/attributes’

I ran into this situation myself. After verifying that it was looking in ~/.config/ I noticed the owner of that folder was root. I changed this to my_user_name and it worked.

cd ~/
ls -al

sudo chown -R $(whoami) .config
Ubuntu 18.04设置界面消失了
sudo aptitude install gnome-control-center

我也不知道为啥突然自己的界面没有了,然后使劲sudo apt install 安不上,只能使用处理依赖的降一个包的版本了:

进入系统前 鼠标键盘无法使用

首先打开启动界面,进入recovery模式,选择network链接,然后走到root shell prompt,然后:

apt install xserver-xorg-input-all

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5681913.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存