Linux commands - HelloMorningStar/HomeAssistant GitHub Wiki

1,复制命令: sudo cp -r ~/.homeassistant/deps/. /home/usr/HDD/homeassistant/deps
  源文件夹~/.homeassistant/deps/.所有内容包括子目录
  到
  目标文件夹~/homeassistant/deps (如果没有deps会自动创建deps目录)

2,更高权限的图形文件浏览器:Alt+F2输入sudo nautilus

3,设置全局执行用软连接ln -s <source_path> <target_path>
例如安装了ydcv词典 pip3 install ydcv
结果安装到了 ~/.local/bin/ydcv
每次要输入路径才能执行,很麻烦,那么就搞个软连接(类似windows快捷方式) 如果要想打开终端输入ydcv即可打开词典,可以建立一个软连接 sudo ln -s ~/.local/bin/ydcv /usr/local/bin/ydcv

4,为root设置密码 sudo passwd root

5,解决问题 usr is not in the sudoers file

sudo gedit gedit /etc/sudoers
在root下面添加用户,例如用户是homeassistant
# User privilege specification
root ALL=(ALL:ALL) ALL
homeassistant ALL=(ALL)ALL

6,禁止IPV6
https://support.purevpn.com/how-to-disable-ipv6-linuxubuntu

1)Open Terminal

2)Enter gksudo gedit /etc/sysctl.conf and open the configuration file and add the following lines at the end

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

net.ipv6.conf.lo.disable_ipv6 = 1

3)After that run $ cat /proc/sys/net/ipv6/conf/all/disable_ipv6

If it reports ‘1′ means you have disabled IPV6. If it reports ‘0‘ then please follow Step 4 and Step 5.

4)Type command sudo sysctl -p you will see this in terminal.

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

net.ipv6.conf.lo.disable_ipv6 = 1

5)Repeat above “Step 3” and it will now report 1.

7,查找文件
find / -name +文件名
locate+文件名
which+可执行文件名
whereis+程序名称

8,开启服务器X11
$ sudo vi /etc/ssh/sshd_config
X11Forwarding yes
X11UseLocalhost no
sudo /etc/init.d/ssh restart
or
sudo systemctl restart ssh.service
ssh -X [email protected]
例如文本编辑就可以使用gedit了

9,中文输入法问题(无法按照数字键选择词语)
sudo rm -rf ~/.cache/ibus/libpinyin 重启 ibus restart

10,对于安装多操作系统引导顺序有用
#更改GRUB引导菜单默认启动项#
1)修改 /etc/default/grub 文件
root@ubuntu:
# vi  /etc/default/grub
找到GRUB_DEFAULT=0     #更改数字设置默认启动项,想要改为第N项默认就把0改成N-1看到启动界面是第几项N就是几,将数字减去1
GRUB_TIMEOUT=10 选项是设定菜单等待时间,默认为10秒,设置为-1取消倒计时,这个选项也可以一起更改。
2)重新生成GRUB的启动菜单配置文件(/boot/grub/grub.cfg),如果上面的一起配置,执行一次就可以。
root@ubuntu:~# update-grub

11,使用百度网盘,比windows下好用
sudo ~/baidu/BaiduPCS-Go
BaiduPCS-Go > login 我已经配置好了,自动登陆
退出命令logout
登陆后,输入下载命令 download -p 1000 your_filename_or_folder
我的下载路径也自动配置好了,会下载到非系统HDD的Download文件夹中

12,modify timezone
sudo tzselect
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

13, install ssh
service ssh status
sudo apt install ssh
See more

14, modify the whole directory rights
chmod 777 * -R

15, github gist
192.30.253.118 gist 192.30.253.119 gist

16, nmap
nmap -sP 10.88.0.0/24

17, screen
Run script /dev/null to own the shell (more info over at Server Fault); then try screen again.
try it reference from

18, check ubuntu version
lsb_release -a
uname -a
cat /proc/version

19, ICMP重定向:vim /etc/sysctl.conf(开关文件查询)
20, git clone: sudo git clone https://github.com/LT21/xiaomi_airconditioning_c1
ubuntu@ubuntu:/home/homeassistant/.homeassistant/custom_components$ sudo cp -r /home/homeassistant/.homeassistant/download/xiaomi_airconditioning_c1/custom_components/xiaomi_airconditioning_c1 ./