[Backup] Using ubuntu for a month, recorded problems and solutions

record

I collected 50 pieces, and recorded them at random. They are all the problems I actually encountered. Most of them have been solved. If you have any questions, you can comment and ask.

50. Recommended Ubuntu artifact: Utools

I first used Quicker on win, but after I switched to Ubuntu, I couldn’t use it, so I switched to utools. To be honest, I just started using it, and it was very difficult, and I feel that there are not many plug-ins, which are incomparable with some plug-ins automated by Quicker, but in Ubuntu There are also great advantages:

1. Screenshot (very useful) 2. Clipboard (non-paid ones can also be used) 3. LAN file sharing (good) 4. MarkDown (also available) 5. TODO (available)

6. Text recognition (can be combined with screenshots) 7. Translation (can be combined with text recognition)

49. Recommended webpage shortcut key operation artifact: Vimium

Good things to use every day:

q closes the left tab w closes the current tab e closes the right tab

a toggle left tab d toggle right tab

z search copy content c copy

o Pop-up search box (can search, search history, search favorites)

48.vnc extended screen

The RealVNC server can’t figure it out, it’s all in English, and the characters are very small. I’ve been looking for a long time to expand the screen, but I can’t figure it out

Switch to VirtScreen: Turn Your iPad/Tablet/Computer into a Secondary Display on Linux.

从发布页面下载 .deb 包。然后安装它:
sudo apt-get update
sudo apt-get install x11vnc
sudo dpkg -i virtscreen.deb

After installation, open the software, find the icon on the top bar, and click open VirtScreen

Set up the method of projecting screen to ipad or iphone in Linux environment (Android is the same)

set extension

Ubuntu dual-screen display setting method – primary and secondary screen, copy, extension, only display secondary screen

 xrandr --listmonitors           
 
Monitors: 2
 0: +*eDP-1 1920/344x1080/193+0+0  eDP-1
 1: +HDMI-1 1920/508x1080/286+0+0  HDMI-1
 xrandr --output HDMI-1 --primary --right-of eDP-1
 xrandr --output eDP-1 --primary --left-of HDMI-1xrandr --output HDMI-1 --right-of eDP-1 --auto
xrandr --auto --output eDP-1 --pos 0x0 --mode 1920x1080 --primary --output HDMI-1 --mode 1024x768 --right-of eDP-1

None of the above will work, there is only an occasional expansion in the middle, and the card will not work

Set up a virtual screen without HDMI

Use tablet and mobile phone as the second screen of computer (under Linux system)

No virtual screen VIRTUAL1, add VIRTUAL1

If you are currently using an independent display, you must first switch to the integrated display before configuring, otherwise you will not be able to enter the graphical interface after restarting

sudo vim /usr/share/X11/xorg.conf.d/20-intel.confFill in the following content in the file

Section "Device"
    Identifier "intelgpu0"
    Driver "intel"
    Option "VirtualHeads" "1"
EndSection

After configuration, you need to restart the computer.

After restarting, you can open the terminal and enter commands xrandrto check whether it is successfully enabled.

At this point, you can use advance to select VIRTUAL1

If the pattern has been added according to the above tutorial, delete it:

You need to turn off the virtual screen first, select single monitor or

xrandr --output VIRTUAL1 --off
xrandr --delmode VIRTUAL1 "1920x1080_60.00"

after that it's ok

mouse movement

Can the remote VNC client obtain the mouse cursor position of the server?

git clone [email protected]:LibVNC/x11vnc.git
cd x11vnc
sudo apt-get install libvncserver-dev
./autogen.sh
./configure
make
sudo make install

According to the above operation, x11vnc 0.9.16 is installed, but virtScreen is deleted and cannot be installed

So the application image is downloaded and you can run

47. Input method

Chinese and English, full width

Full-width is suitable for the Chinese character system, and the numbers and letters occupy a large space, which is the width of a Chinese character

Half-width is suitable for English system, occupying a small space

south gedit

English-terminal-gedit-shift to switch Chinese, enter capital letters, and the space cannot be displayed on the screen

After cutting out, the space can be displayed on the screen, Chinese can be switched back, and Chinese can be input

Shift to switch English, you can input English, then shift to switch Chinese, input capital letters

Click to switch, shift does not work, and capslock does not work, which will cause the keyboard state in the editor to be inconsistent with the state of the input method

Causes shift to become a capital key (press shift to switch case)

clion does not follow the cursor

There are two problems, one is not followed , and after solving the problem that md cannot be previewed, the second one is solved

The first one looks like the official one, with a version description, and the second one was changed by the boss

The second latest version I downloaded directly

After decompression, press CTRL+SHIFT+A in the IDE, enter choose runtime, add a custom directory, and restart

46. ​​Chinese input under root

Add two xims in /root/.bashrc, env changed successfully, both su and su- changed

But only uppercase letters can be entered after su, not sudo

【Help】Unable to switch input method under sudo - Ubuntu Chinese Forum

  1. Create /etc/sudoers_env and add the following content
GTK_IM_MODULE=xim
QT_IM_MODULE=xim
QT4_IM_MODULE=xim
  1. Execute sudo visudo and add the following content
Defaults env_keep += "XMODIFIERS"
Defaults env_file="/etc/sudoers_env"

The first time you open eedit, it is still in capital letters, and you can open it the second time

It turned out to be like this: the Chinese input method can enter gedit, and the English input method can be capitalized

Programs run as Root will always have problems with normal user X sessions (in general, not just fcitx), because dbus is a user session-only process. The only way to use fcitx in the root program is through XIM, you need to set GTK_IM_MODULE=xim and QT_IM_MODULE=xim before starting the program.

https://fcitx-im.org/wiki/FAQ/zh-hans#.E5.9C.A8.E4.B8.80.E8.88.AC.E7.94.A8.E6.88.B7.E7.9A.84_X_.E4.B8.8B_.E8.BF.90.E8.A1.8C_Root_.E6.9D.83.E9.99.90.E7.9A.84.E7.A8.8B.E5.BA.8F

Set the root environment variable

sudo visudo

After the modification, gedit cannot be linked. It is confirmed that it is a format problem. There are no spaces on both sides of +=, and it must be +=

Set in /root/.bashrc, the environment has changed, but still cannot input Chinese

Remote root user using gedit

qwe用户运行:
xhost + 
允许其他用户启动的图形程序将图形显示在当前屏幕上

https://blog.csdn.net/Gloriiiaaa/article/details/109794696

https://blog.csdn.net/WingWudan/article/details/82864472

45. Enable root login

ubuntu20.04 use the root user to log in to the system

44. sudo password-free

Set the terminal editor to vim (nano will not be used)

sudo update-alternatives --config editor

Linux, sudo with no password (sudo without password)

sudo visudo

qwe	ALL=(ALL:ALL) NOPASSWD:ALL

43.nohup sudo x &

Puts the process in the background (& at the end of the command), but sudo may require password authentication, which is why the process stops .

Try one of the following:

1) sudo -d background running command

2) Change /etc/sudoers to not ask user for password by adding the following line: qwe ALL=(ALL:ALL) NOPASSWD:ALL

3) If your application is waiting for input other than the password
reply, then you can pipe the input to the following command: $ cat response.txt | sudo mycommand.php

nohup sudo -b xxx & The meaning of the parameter is "execute the command in the background", probably background

After execution, the log is output to nohup.out, and you are prompted to enter the sudo password. After entering, press Enter to run, even if the terminal is closed, it can run normally.

42. Add Typora to the application

Double-click the md file and open it with Typora

Or gedit add md preview plugin

41.gedit adds highlighting to identify document types

The syntax highlighting rules and processing are handled by another tool called: gtksourceview-3.0

Directly edit the configuration file /usr/share/gtksourceview-3.0/language-specs/javascript.lang

This is an xml file, used by globs to identify files: .js; .node;*.qml

40. ANSI escape codes

Linux tips: set the terminal character display color and move the cursor position in the code

# 获取光标位置
echo -ne "\033[6n"            # ask the terminal for the position
read -s -d\[ garbage          # discard the first part of the response
read -s -d R foo              # store the position in bash variable 'foo'
echo -n "Current position: "
echo "$foo"                   # print the position
# 输出位置很奇怪


# 获取鼠标位置
printf '\e[?1000;1006;1015h' # 开启跟踪
read -s -d\[ garbage          # \[ 及之前的丢弃
read -s -d M foo              # store the position in bash variable 'foo'
echo -n "Current position: "
echo "$foo" #按下0;1;1M  抬起m
printf '\e[?1000;1006;1015l' # Disable tracking


# 设置光标位置 # print -n '\033[y;xH'
echo -ne "\033[3;1H" # 直接将 qwe@tfnmdx移到了xy位置,然后就是新的行了,后面的字符都无了

39. Terminal mouse

[Tips] Use the mouse to position the cursor in zsh, which is simple and direct, saves time and improves the efficiency of command line operations- Know almost

Single-line commands have offsets, and the offsets are random

Copy and paste multi-line commands, only the first line is misplaced, to solve the problem of the first line:

这里仍然有一点小问题,因为我只在第一行(界面上的一行)增加了识别,而原程序只识别除第一行(回车符前连续一行)外的,所以在第一个回车之前,一行太长的话,这一部分就不能点击。解决方法就是删掉一些或把终端界面拉长。
    #################################
	# mouse:  mx:lie my:hang		#
	# setCursor:  CURSOR			#
	#  Move cursor.	edited!!!!		#
	# There is still a small issue here, which can be avoided by keeping the command before the first carriage return no more than one line.
	#############################
	 if (( flag == 0 )); then # no \n
		if (( my == 1 )); then # 1 hang
	 		CURSOR=$mx-5
		else
		 CURSOR=$((($my-1)*80+$mx-5))
		fi
	else
		if (( my == 1 )); then # 1 hang
	 		CURSOR=$mx-5
		else
	 		CURSOR=$mouse_CURSOR
		fi
	fi

bash:mouse_xterm

useless

38. Keymap

Optimization - Keyboard and Mouse - Additional Layout Options

Map capsLock to Esc, currently only found to be valid in the terminal

Unstable, sometimes fails

xmodmap

Ubuntu modify keymap

Swap the Esc and Caps Lock keys with xmodmap

xmodmap -pke	#直接查看多按键十进制编码
xmodmap -pm		#部分按键十六进制lock Caps_Lock(0x42)
cd ~ && vim .Xmodmap

!将Caps_Lock映射为Esc	!clear lock
remove Lock = Caps_Lock
keycode  66 = Escape NoSymbol Escape
add Lock = Caps_Lock

xmodmap ~/.Xmodmap

keycode  66 = Caps_Lock NoSymbol Caps_Lock
add Lock = Caps_Lock
xmodmap ~/.XmodmapBack

37. Port

Ubuntu comes with its own firewall ufw

https://www.cnblogs.com/zqifa/p/ubuntu-ufw-1.html

netstat -tanlp query all port numbers

netstat -apn | grep 3306 Query the specified port number

netstat -apn | grep 3306 close the specified port number

36.nmap scan

1. Scan which ports are open on the host of 172.16.88.90: nmap -sT 172.16.88.90

2.nmap -sS -O 172.16.88.190

-sS half-open scanning, will not be included in the scanned host log, more hidden

-O OS scan

35. Disk Management

https://blog.csdn.net/qq_43265072/article/details/112312223

https://blog.csdn.net/qq_34769162/article/details/108051689

sudo apt-get install gparted 
sudo gparted
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdc4 during installation
UUID=0f5807e4-e612-49e3-9873-2b4a6c8e66b5 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdc2 during installation
UUID=18C9-3988  /boot/efi       vfat    umask=0077      0       1
# /home was on /dev/sdc5 during installation
UUID=9e00b0eb-d57f-4a9d-bffe-528873ba53c2 /home           ext4    defaults        0       2
# swap was on /dev/sdc3 during installation
UUID=718c1f4b-eeea-429b-8059-4d86a4b98e5f none            swap    sw              0       0

34. Shutdown default waiting time

sudo gedit /etc/systemd/system.conf

sudo systemctl daemon-reload

33. HackBGRT computer logo

1.查看efi信息
sudo efibootmgr -v
2.添加efi选项HackBGRT
sudo efibootmgr -c -w -L "HackBGRT" -d /dev/sdc -p 2 -l \\EFI\\HackBGRT\\bootx64.efi
3.删除
sudo efibootmgr -b 0004 -B
4.更新
sudo update-grub

32.lsblk

31.update-initramfs

Auto Mode, Manual Mode: How to Change Default Terminal in Ubuntu

sudo update-alternatives --config default.plymouth
[sudo] qwe 的密码: 
有 2 个候选项可用于替换 default.plymouth (提供 /usr/share/plymouth/themes/default.plymouth)。

  选择       路径                                                           优先级  状态
------------------------------------------------------------
  0            /usr/share/plymouth/themes/vortex-ubuntu/vortex-ubuntu.plymouth   100       自动模式
  1            /usr/share/plymouth/themes/ubuntu-logo/ubuntu-logo.plymouth       100       手动模式
* 2            /usr/share/plymouth/themes/vortex-ubuntu/vortex-ubuntu.plymouth   100       手动模式

要维持当前值[*]请按<回车键>,或者键入选择的编号:
plymouth-set-default-theme theme-name #设置开机主题
5.编译镜像
plymouth-set-default-theme -R theme-name #重新编译镜像,加载开机主题引导程序
~ ❯ sudo update-initramfs  -u                                                                                 4m 11s
update-initramfs: Generating /boot/initrd.img-5.4.0-146-generic
I: The initramfs will attempt to resume from /dev/sdc3
I: (UUID=718c1f4b-eeea-429b-8059-4d86a4b98e5f)
I: Set the RESUME variable to override this.

Important initialization scripts, kernel modules, configuration files, etc. are all located in the initramfs file, which is why we often need to update the initramfs file and then restart the operating system to take effect after we modify some configuration files;

Linux generates initramfs, Linux boot process and initramfs - Tencent Cloud Developer Community - Tencent Cloud

30.fastGithub

29.rename

i=1; for x in *; do mv $x $i.png; let i=i+1; done

28. Set Hibernation

https://zhuanlan.zhihu.com/p/464007568

View swap UUID:

cat /etc/fstab | grep swap
grep swap /etc/fstab

# swap was on /dev/sdc3 during installation
UUID=718c1f4b-eeea-429b-8059-4d86a4b98e5f none            swap    sw              0       0

View swap information:

free -m
              总计         已用        空闲      共享    缓冲/缓存    可用
内存:        7843        2450        3067         579        2325        4547
交换:       15258         927       14331

swapon -s
文件名				类型		大小	已用	权限
/dev/sdc3                              	partition	15625212	949504	-2

Modify grub:

eedit /etc/default/grub
找到 GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" 一行,在 quiet splash 后添加:resume=UUID=××××
sudo update-grub         

sleep:

sudo systemctl hibernate

27. Small fish ROS

Add xxx.zsh in .zshrc

It is detected that the system has a ROS environment, and a startup option has been generated for you. Modify ~/.bashrc to close
Congratulations, the installation is successful, and you will be given a robot learning treasure website: Yuxiang Community: https://fishros.org .cn/forum

Xiaoyu, yellow hint: you have installed ROS1, you can open a new terminal and enter roscore to test!
Welcome to join the robot learning exchange QQ group: 686914208 (password: one-click installation)
If you encounter any problems during use, please open: https://fishros.org.cn/forum for feedback

26. View disk

df -h
iostat [-x] [刷新间隔] [刷新次数]
iostat -x 5 3

25.wmctrl

  1. l list windows
  2. x use WM_CLASS name
  3. a Activate the window
  4. c close the window
  5. F name exact match
  6. r WIN b STAGE((remove|add|toggle),[,])

modal, sticky, maximized_vert, maximized_horz,shaded, skip_taskbar, skip_pager, hidden,fullscreen, above, below

activation:

wmctrl -a qwe

Top:

wmctrl -r qwe -b add,above
wmctrl -rx terminal -b add,above 

24.Typora image storage

Default storage path: /home/qwe/.config/Typora/typora-user-images

23. ssh remote login

https://blog.csdn.net/y22y22y/article/details/120339331

ssh -p 22 [email protected]

xrdp desktop connection

Created a new desktop environment, logged in as a Qu user, disconnected remotely, but did not log out, so I couldn’t log in to Qu locally

https://blog.csdn.net/weixin_43315707/article/details/107518380

mstsc

[Linux] The default value and maximum value of the tcp buffer size

cat /proc/sys/net/ipv4/tcp_wmem 
4096	16384	4194304
最小值 	默认值 	最大值
cat /proc/sys/net/ipv4/tcp_rmem

Xrdp experience optimization reduces/resolves screen freeze

调整 Xrdp 配置参数——非常有用,但还是有点卡
编辑 /etc/xrdp/xrdp.ini

tcp_send_buffer_bytes=4194304
tcp_recv_buffer_bytes=6291456
调整系统参数——貌似没啥用
临时生效
sudo sysctl -w net.core.rmem_max=12582912
sudo sysctl -w net.core.wmem_max=8388608
查看
cat /proc/sys/net/core/rmem_max
cat /proc/sys/net/core/wmem_max
优先使用物理内存,而不是swap分区——好像有点用,还有一点点卡
cat /proc/sys/vm/swappiness
sysctl vm.swappiness=10

Tweaking the settings - seems to help a bit

16色
LAN

Pay attention to whether gnome-shell has a memory leak

Win has built-in tools, and it is smoother to use only a certain fixed page, but it is stuck when dragging or switching windows

Use MobaXterm

22. Oil monkey plug-in

Network disk download assistant

Network Disk Identification Assistant

[Oil Monkey Script Development Guide] with solves the problem of requiring the introduction- Know about

21. Configure Git-Gitee

https://www.bilibili.com/video/BV1Jk4y1r7fF

https://blog.csdn.net/tfnmdmx/article/details/130055775

20.zip unzip Chinese garbled characters

https://blog.csdn.net/qq_42328335/article/details/109217381

**方法1**:在命令行中解压文件设置参数
    通过unzip行命令解压,指定字符集
    unzip -O GBK xxx.zip (用CP936, GB18030也可以)
**方法2**:修改设置环境
    在命令行中输入下面命令,vim打开环境设置
    $sudo vim /var/lib/locales/supported.d/local
    然后编辑,添入下面的中文字符集
    zh_CN.GBK GBK
    zh_CN.GB2312 GB2312
    zh_CN.GB18030 GB18030
    保存退出vim
    使其生效:
    sudo dpkg-reconfigure --force locales
    这样修改完后,使用右键提取文件还是会中文乱码的,但是在命令行中使用命令解压文件就不会乱码了。
**方法3**:替换文件
	在ubuntu10.04下用gnome自带的归档管理器
	解压windows下压缩的zip文件,中文会出现乱码。
	将压缩包中以7z开头的文件全部复制到/usr/lib/p7zip/目录下,
	替换掉原有的文件。这样乱码就解决了。

19. Add win10


### BEGIN /etc/grub.d/40_custom_proxy ###
menuentry "Windows" {
insmod part_gpt
insmod chain
insmod ntfs
set root='(hd0,gpt3)'
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
### END /etc/grub.d/40_custom_proxy ###

18. Folder English

export LANG=en_US    #改变支持的语言为英语
xdg-user-dirs-gtk-update   #更新系统语言,按照中文对应的英语进行翻译
export LANG=zh_CN.UTF-8    #重新支持中文
注销,保留旧的

17. xargs

https://ruanyifeng.com/blog/2019/08/xargs-tutorial.html

  • -a file read from file as stdin
  • -e flag, note that sometimes it may be -E, flag must be a flag separated by spaces, and stop when xargs analyzes the flag containing flag.
  • -p Ask the user every time an argument is executed.
  • -n num is followed by the number of times, indicating the number of arguments used at one time when the command is executed, and all of them are used by default.
  • -t means to print the command first, and then execute it.
  • -i or -I, it depends on the support of linux, assign each name of xargs to {} line by line, you can use {} instead.
  • -r no-run-if-empty Stop xargs when the input of xargs is empty, no need to execute it again.
  • -s num The maximum number of characters in the command line refers to the maximum number of characters in the command line of the command behind xargs.
  • -L num Read num lines from standard input to command at a time.
  • -l Same as -L.
  • -d delim delimiter, the default xargs delimiter is a carriage return, and the delimiter of argument is a space. Here, the delimiter of xargs is modified.
  • The meaning of -x exit is mainly used with -s. .
  • -P Modify the maximum number of processes, the default is 1, when it is 0, it is as many as it can

bash -c

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

-cThe command indicates that the following parameters will be read as a string to be executed as the command.

16. Ubuntu has no sound

https://blog.csdn.net/qq_38333041/article/details/105002868

Reason: Restart from win and enter ubuntu, there will be no sound

15. Running in background

https://blog.csdn.net/caesar1228/article/details/118853871

https://cloud.tencent.com/developer/article/1722018

(1) nohup:加在一个命令的最前面,表示不挂断的运行命令
(2) &:加载一个命令的最后面,表示这个命令放在后台执行

cmd & : 后台运行,关掉终端会停止运行
nohup cmd & : 后台运行,关掉终端不会停止运行
ps -aux|grep java:a: 显示所有程序 u: 以用户为主的格式来显示  x: 显示所有程序,不以终端机来区分
jobs:查看当前有多少在后台运行的命令,-l选项可显示所有任务的PID。

fg:将后台命令放回前台运行。
bg:将嵌套命令放到后台运行。
ctrl + z:将正在前台执行的命令放到后台,且让命令处于暂停状态。

kill 命令:使用SIGKILL(9)信息尝试强制删除程序,即 kill -9
(1)通过jobs命令查看jobnum,然后执行  kill %jobnum
(2)通过ps命令查看进程号PID,然后执行 kill %PID

nohup+& doesn't work

https://blog.csdn.net/qq_34021712/article/details/115587702#t10

nohup, you need to exit the terminal with exit

huponexit configuration item: default off (off), exitwhen using the command to exit the terminal, it will not send SIGHUPa signal to the task to which the terminal belongs

shopt: can only be used under bash

查看:shopt | grep huponexit
打开:shopt -s huponexit
关闭:shopt -u huponexit
disown可以将指定任务从"后台任务"列表(jobs命令的返回结果)之中移除

14. Screen recording

If you are a Gnome3 system user, you can press ctrl + shift + alt + r, and a red dot will appear in the lower right corner of the screen to start recording the screen. To finish, press ctrl + shift + alt + r again, and the recorded video is in ~/ under video

修改默认30秒的问题
gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 3600
改成1小时

13. Highlight keywords

https://blog.csdn.net/qq_33446100/article/details/108880766

tail -f path | perl -pe 's/keyword/\e[1;31m$&\e[0m/g'

12. Initial value of Shell variable

   ${var-初始值} 如果没有定义,则表达式返回默认值
   
   没有定义或者为空字符串,则表达式返回默认值
   ${var:-初始值}	临时调用,变量var并不改变,仍然为空
    
   ${var:=初始值}	调用初始值后,变量var也赋予了一个值
传=${1:-'1.0.0'}
参=${2:-'test demo'}

11. Various brackets in the shell

https://blog.csdn.net/u013402321/article/details/80333272

Both $( ) and ` ` (backtick) can be used for command substitution

Use ∗ ∗ variable substitution ∗ ∗ . In general, { } is used for **variable substitution**. In general,forVariable substitution. In general, var is no different from ${var}

[ ] sum [] sum[ ] and (()) are the same, bothperform mathematical operations.

(( )) and [[ ]] are enhanced versions of [ ] for mathematical comparison expressions and string expressions , respectively.

10. gedit comment shortcut key

ctrl+m ctrl+shift+m

9.LibreOffice

https://www.cnblogs.com/qlqwjy/p/9846904.html

https://blog.csdn.net/weixin_45876766/article/details/118928482

doc to txt:

libreoffice --headless --convert-to txt Linux.docx

Linux.docx ==》 Linux.txt

libreoffice --headless --convert-to pdf srcPath --outdir  desPath

8.terminal opens the current folder

nautilus .

7. Convert image type

webp

dwebp image.webp -o final.png
ls -1 *.webp | xargs -tn 1 bash -c 'dwebp "$0" -o "${0%.webp}.png"'

convert

https://www.cnblogs.com/yymn/p/4479805.html

1. Convert image format (JPG, BMP, PCX, GIF, PNG, TIFF, XPM, XWD)

convert input.jpg output.png

2. Rotate the image: convert -rotate

convert -rotate 90 input.png output.png

3. Crop the image: convert -crop

convert -crop 100x100+10+10 input.png output.png

Take input.png from (10,10) as the starting point, cut out a 100x100 pixel part, and save it as output.png.

2. Generate thumbnails: convert -resize or convert -sample

convert -resize 1024x768  xxx.jpg   xxx1.jpg    将图像的像素改为1024*768,注意1024与768之间是小写字母x 
convert -sample 50%x50%  xxx.jpg  xxx1.jpg   将图像的缩减为原来的50%*50% 

batch

----------- 从 PNG 转换到 JPG ----------- 
ls -1 *.png | xargs -n 1 bash -c 'convert "$0" "${0%.png}.jpg"'
 
----------- 从 JPG 转换到 PNG ----------- 
ls -1 *.jpg | xargs -n 1 bash -c 'convert "$0" "${0%.jpg}.png"'

6. Boot error

The actual situation is not that Ubuntu is prone to internal errors, but that once the program crashes once, a .crash file will be generated to record the crash information, which is stored in the directory:

/var/crash/

As long as you don't deal with it, you will be prompted that there is an error every time you start up.

Unable to delete file, operation not permitted

https://blog.csdn.net/qq_41538097/article/details/10765368216.

Turn off the boot error report prompt

https://blog.csdn.net/qq_33406883/article/details/111912528

sudo gedit /etc/default/apport
修改 enabled=0,重启生效。

5. Boot up automatically

https://blog.csdn.net/t624124600/article/details/111085234

5.1 tweak

5.2

gnome-session-properties

5.3

sudo gedit /etc/rc.local
sudo systemctl start rc-local.service
sudo systemctl status rc-local.service
sudo systemctl enable rc-local

sudo systemctl enable rc-local feeling that the INT 2m 7s
unit file has no installation configuration (wanntedby, RequiredBy, Also, Alias)
[Install] section settings, and the DefaultInstance of the template unit).
This means they should not be enabled using systemctl.
Possible reasons for using such a unit are:
1) A unit can statically enable a .wants/ or .requires/ directory via a symlink to another unit
.
2) A unit's purpose may be to act as a helper for other units whose
needs depend on it.
3) A unit can be activated when needed via (socket, path, timer,
D-Bus, udev, scripted systemctl calls, ...)
4) In case of a template unit, the unit is meant to enable some specified instance name of the .

Check the system directory /lib/systemd/system/rc-local.service

Check /etc/systemd/system/rc-local.service

#### 文件中本身就有的
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no

####  需要自己添加
[Install]
WantedBy=multi-user.target
Alias=rc-local.service

Error Unknown section 'install'. Ignoring.

4.alias

Multiple commands:

func(){
        cd ..
        ls
        pwd
}
alias cdd='func'

Parameter passing: There is a space between the command and {curly braces, and there is a ; semicolon at the end of the command

alias ezshrc="nohup sudo gedit /home/qwe/.zshrc >/dev/null 2>&1 & disown"

3. Switch between zsh and bash

zsh configuration: https://linux.cn/article-13030-1.html

The ultimate shell of the shell - zsh

view shell

cat /etc/shells

set as default shell

sudo usermod -s /bin/zsh tfnmdmx

or

chsh -s /bin/zsh

chsh -s whichzsh

If you want to switch back to bash:

chsh -s /bin/bash

  1. exec bash switches the command line from zsh to bash
  2. source ~/.bashrc
  3. exec zsh reruns the zsh command line tool

2. Beautification

1.1 Theme is in /usr/share/themes
1.2 Icons /usr/share/icons
1.3 Login interface GDM, file location is in /usr/share/gnome-shell/theme/ubuntu.css, background is in /usr/share/backgrounds

~/.local/share/nautilus/scripts        /SetAsWallpaper

1.4 Boot animation (Plymouth Themes), the file location is /usr/share/plymouth/themes

/usr/share/plymouth/themes/vortex-ubuntu

1.5 System selection interface (GRUB Themes), the file location is /boot/grub/themes

/boot/grub/themes/tela

modify grub

sudo gedit /boot/grub/grub.cfg
cd /etc/grub.d

sudo gedit /etc/default/grub
sudo update-grub

Reference https://blog.csdn.net/ljw_study_in_CSDN/article/details/120969704

1. Modify Ubuntu time

Change UTC to CST: sudo timedatectl set-local-rtc 1

Guess you like

Origin blog.csdn.net/tfnmdmx/article/details/130351415