Ubuntu

2022/8/20·2 views

安装Ubuntu后另外磁盘出现只读的解决办法

mount
blkid
sudo ntfsfix /dev/sdb1
mount -a

其他

卸载硬盘:

chen@ilaptop:/$ sudo umount /dev/sdb1

读写挂载硬盘

chen@ilaptop:/$ sudo mount -o rw /dev/sdb1

参考:https://jakting.com/archives/ubuntu-rw-windows-files.html

ppa源管理

在Ubuntu中,每个PPA源是单独存放在/etc/apt/sources.list.d/文件夹中的,进入到该文件夹,使用ls命令查询即可列出当前系统添加的PPA源。

shell 复制代码
sudo add-apt-repository ppa:ownername/projectname
sudo apt update
sudo apt install something

安装ImageMagic

  1. 安装:
shell 复制代码
sudo apt-get install imagemagick
  1. 测试:
    1). 版本察看
    简单地执行:
    引用
    convert -version

如果看到下面的信息说明安装已经成功
引用
Version: ImageMagick 6.4.3 2008-08-27 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC

2). 压缩图片.
当前目录下有一个文件名字叫hill.png,执行
引用
convert -sample 25%x25% hill.png hill_t.png

将缩小hill.png为原来的25%,生成新的文件名叫hill_t.png

如果出现如下错误提示:
引用
convert: error while loading shared libraries: libMagickCore.so.1: cannot open shared object file: No such file or directory

将so所在的路径加入到LD_LIBRARY_PATH(前面的安装方式默认安装so到/usr/local/lib目录下)
引用
export LD_LIBRARY_PATH=/usr/local/lib

当执行jpg图片缩放的时候,
3). 压缩jpg图片
引用
convert -sample 25%x25% water.png water_t.png

系统提示:
引用
convert: no decode delegate for this image format water.jpg'. convert: missing an image filename t_water.jpg'.

其他:

ImageMagick是一个免费的创建、编辑、合成图片的软件。

原文地址:https://blog.csdn.net/jacke121/article/details/76126245

Ubuntu20.04 中文显示不正确的解决方案

如下图是没有安装语言包的文件列表:

复制代码
drwxr-xr-x 11 root root  4096 Jun 14 09:52  ./
drwxr-xr-x  4 root root  4096 Jun 14 09:53  ../
-rwxr-xr-x  1 root root    18 Apr 28 22:24  .htaccess*
-rw-r--r--  1 root root    47 Oct 22  2020  .user.ini
drwxr-xr-x  6 root root  4096 May 23 22:21  app/
-rwxr-xr-x  1 root root   684 May  5 11:32  composer.json*
-rwxr-xr-x  1 root root 23126 Jun 10 22:57  composer.lock*
drwxr-xr-x  2 root root  4096 Jun  6 10:35  config/
drwxr-xr-x  2 root root  4096 Apr 28 22:24  extend/
-rwxr-xr-x  1 root root   506 Apr 28 22:24  max*
drwxr-xr-x  4 root root  4096 Jun 14 10:14  public/
drwxr-xr-x  2 root root  4096 Apr 28 22:24  routes/
drwxrwxrwx  4 root root  4096 Jun 12 14:36  storage/
drwxr-xr-x  8 root root  4096 Jun 14 10:47  vendor/
drwxr-xr-x  3 root root  4096 May 18 14:05  views/
drwxr-xr-x  2 root root  4096 Jun 12 05:51 ''$'\346\226\207\346\241\243'/

下面介绍下一般的解决办法:

首先安装语言包

复制代码
sudo apt-get install language-pack-zh-hans

安装完成后需要将我们的LANG设置为中文。

复制代码
locale -a 

上面命令查看安装的语言

复制代码
root@VM-0-10-ubuntu:/var/www/codeemo.cn# locale -a
C
C.UTF-8
POSIX
en_US.utf8
zh_CN.utf8
zh_SG.utf8

接下来

复制代码
export LANG=zh_CN.utf8

然后看下文件列表

复制代码
drwxr-xr-x 11 root root  4096 6月  14 09:52 ./
drwxr-xr-x  4 root root  4096 6月  14 09:53 ../
drwxr-xr-x  2 root root  4096 6月  12 05:51 文档/
drwxr-xr-x  6 root root  4096 5月  23 22:21 app/
-rwxr-xr-x  1 root root   684 5月   5 11:32 composer.json*
-rwxr-xr-x  1 root root 23126 6月  10 22:57 composer.lock*
drwxr-xr-x  2 root root  4096 6月   6 10:35 config/
drwxr-xr-x  2 root root  4096 4月  28 22:24 extend/
-rwxr-xr-x  1 root root    18 4月  28 22:24 .htaccess*
-rwxr-xr-x  1 root root   506 4月  28 22:24 max*
drwxr-xr-x  4 root root  4096 6月  14 10:14 public/
drwxr-xr-x  2 root root  4096 4月  28 22:24 routes/
drwxrwxrwx  4 root root  4096 6月  12 14:36 storage/
-rw-r--r--  1 root root    47 10月 22  2020 .user.ini
drwxr-xr-x  8 root root  4096 6月  14 10:47 vendor/
drwxr-xr-x  3 root root  4096 5月  18 14:05 views/

文档被显示出来了。

最后我将他添加到家目录下的.bashrc文件里

复制代码
export LANG=zh_CN.utf8

就可以一直正常显示中文了。

ubuntu开启messages log

less /etc/rsyslog.d/50-default.conf

复制代码
#*.=info;*.=notice;*.=warn;\
#       auth,authpriv.none;\
#       cron,daemon.none;\
#       mail,news.none          -/var/log/messages

删掉以上部分的注释,重启rsyslog

复制代码
service rsyslog restart

使用以下命令查看log文件

复制代码
tail -f /var/log/messages
复制代码
tail -10 /var/log/messages

创建不需要密码就能登录的用户

添加一个密码为空的用户(sudo useradd -m 用户名),在 /etc/ssh/sshd_config 中设置 PermitEmptyPasswords yes 然后重启 ssh 服务(sudo systemctl restart ssh)

登录移除ubuntu各种提示

shell 复制代码
touch ~/.hushlogin