linux redhat版本

本文档记录了在Ubuntu系统中遇到的一些常见问题及其解决办法,包括Eclipse启动时缺少JRE,VMware启动卡在nfskernel,调整显示器分辨率,uboot编译错误,Chrome打开报错,以及批量修改MP3文件标签。通过命令行操作,如`update-alternatives`,`xrandr`,`iwlist`等,成功解决了这些问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这本阿里P8撰写的算法笔记,再次推荐给大家,身边不少朋友学完这本书最后加入大厂:

Github 疯传!史上最强悍!阿里大佬「LeetCode刷题手册」开放下载了!

一.系统使用

\5. 打开eclipse会出现错误:

A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations: /opt/andorid/eclipse/jre/bin/java java in your current PATH

  1. sun@ubuntu:/usr/share/applications$ sudo update-alternatives --install /usr/bin/java java /opt/andorid/jdk1.6.0_24/bin/java 300
  2. sun@ubuntu:/usr/share/applications$ sudo update-alternatives --install /usr/bin/javac javac /opt/andorid/jdk1.6.0_24/bin/javac 300

http://liyixing1.iteye.com/blog/1335617

\6. vmware 停在starting nfs kernel 中

ubuntu 无法启动,停在

starting nfs kernel daemon [ok]

上面,就没有动静了。看到网上有人说“不用管等几十分钟就可以起来”,我了个去等了二十分钟还没有反应,是不是我上面装的软件多,又等了二个二十分钟,坑爹啊,还没有起来!

a. 分析上面的打印感觉是跟网络有关,我的虚拟机上有两处与网络有关:

一个是网卡,另一个是与windows共享的文件夹,先把这两个都去掉试一下,

​ vmware setting –> Network Adpator –> Devices status –> 去掉connected 和 connect at power on

vmware setting –> Options –> Shared Folders –> Disabled

b. 重开机,正常启动。

c. 进一步排除,把网卡选上重启动,也是正常的;再把共享文件夹选上,不能启动。


\7. change resolution of unknown monitor

  1. 今天开机发现ubuntu分辨率不正常只有1024×768, Displays选项卡下面最大的分辨率是1024×768
  2. a.
  3. sun@ubuntu:~$ xrandr
  4. Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192
  5. VGA1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
  6. 1024x768 60.0*
  7. 800x600 60.3 56.2
  8. 848x480 60.0
  9. 640x480 59.9
  10. sun@ubuntu:~$ cvt 1440 900
  11. # 1440x900 59.89 Hz (CVT 1.30MA) hsync: 55.93 kHz; pclk: 106.50 MHz
  12. Modeline "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
  13. sun@ubuntu:~$ xrandr
  14. Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192
  15. VGA1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
  16. 1024x768 60.0*
  17. 800x600 60.3 56.2
  18. 848x480 60.0
  19. 640x480 59.9
  20. sun@ubuntu:~$ cvt 1440 900
  21. # 1440x900 59.89 Hz (CVT 1.30MA) hsync: 55.93 kHz; pclk: 106.50 MHz
  22. Modeline "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
  23. sun@ubuntu:~$ xrandr --newmode "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync 中间的×与*容易混淆
  24. sun@ubuntu:~$ xrandr --newmode "1440*900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
  25. sun@ubuntu:~$ xrandr --addmode VGA1 1440*900_60.00
  26. sun@ubuntu:~$ xrandr --output VAG1 --mode 1440*900_60.00
  27. warning: output VAG1 not found; ignoring
  28. sun@ubuntu:~$ xrandr --output VAG1 --mode 1440*900_60.00^C
  29. sun@ubuntu:~$ sudo cp /etc/X11/xorg.conf.failsafe /etc/X11/xorg.conf
  30. [sudo] password for sun:
  31. sun@ubuntu:~$ vi /etc/X11/xorg.conf
  32. sun@ubuntu:~$ sudo gedit /etc/X11/xorg.conf
  33. http://webcache.googleusercontent.com/search?q=cache:a3zWvZLNaT8J:anhe51.wordpress.com/2012/01/30/change-resolution-of-unknown-monitor-in-ubuntu-11-10/+ubuntu+unknown+displays&cd=1&hl=zh-TW&ct=clnk&gl=hk
  34. 出来了,终于可以将分辨率调高了!

8.uboot编译出问题

./scripts/dtc-version.sh: line 17: dtc: command not found

这说明dct工具没有安装

cong@msi:/code/ct/lichee/u-boot$ sudo apt-get install device-tree-compiler

9.chrome打开出错

命令行运行chrome报错

  1. [11191:11232:1009/232424:ERROR:connection.cc(1060)] Web sqlite error 5, errno 0: database is locked, sql: PRAGMA journal_mode = PERSIST

删除/home/cong/.config/google-chrome即可,删除之前记得备份书签等

  1. wlan_11n无线配置

  2. [root@localhost /]# ifconfig eth0 down ;首先关闭有线网卡

  3. [root@localhost /]# wlanconfig ath0 create wlandev wifi0 wlanmode sta ;如果没有无线则创建

  4. [root@localhost /]# ifconfig ath0 up ;启动无线网卡ath0

  5. [root@localhost /]# ifconfig ;查看无线信息,出现HWaddr 00:12:34:56:78:90

  6. [root@localhost /]# iwlist ath0 scan

  7. ath0 Scan completed :

  8. ​ Cell 01 - Address: 00:1F:64:E1:96:51

  9. ​ ESSID:"test1"

  10. ​ Mode:Master

  11. ​ Frequency:2.412 GHz (Channel 1)

  12. ​ Quality=50/94 Signal level=-71 dBm Noise level=-121 dBm

  13. ​ Encryption key:off

  14. ​ Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s

  15. ​ 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s

  16. ​ 48 Mb/s; 54 Mb/s

  17. ​ Extra:bcn_int=100

  18. ​ Extra:rsn_ie=30140100000fac020100000fac020100000fac020000

  19. ​ Extra:wme_ie=dd180050f2020101020003a4000027a4000042435e0062322f00

  20. ​ Extra:ath_ie=dd0900037f01010000ff7f

  21. [root@localhost /]# iwconfig ath0 essid " test1" ;使用无线网络名称接入

  22. [root@localhost /]# ifconfig ath0 192.168.22.196 ;不解释

  23. [root@localhost /]# ping 192.168.22.1 ;验证一下


二.文本处理 1.文本文件的编码

a. 查看文本文件的编码

在Vim 中可以直接查看文件编码 --> :set fileencoding

b.转换文本文件的编码

iconv 转换,iconv的命令格式如下:

iconv -f encoding -t encoding inputfile -o outputfile

比如将一个UTF-16LE 编码的文件转换成UTF-8编码

iconv -f

UTF-16LE

-t UTF-8 file1 -o file2

其中 -f 是指from -t是指to

c. 一个小脚本

作用是将ass字幕文件的编码由utf-16le转为utf-8

然后替换其分辨率由640×360为1024×576

  1. #!/bin/sh
  2. for assfile in find . -name "*.ass"
  3. do
  4. ​ echo $assfile
  5. iconv -f UTF-16LE -t UTF-8 $assfile -o $assfile.tmp
  6. ​ mv $assfile.tmp $assfile
  7. ​ sed -i 's/PlayResX: 640/PlayResX: 1024/' $assfile
  8. ​ sed -i 's/PlayResY: 360/PlayResY: 576/' $assfile
  9. done

2.批量改mp3的title

现在很多音频播放器都按mp3内部的tags显示文件名,但是很多音频文件只有一个文件名,没有tags的名字

所以用了ffmpeg来改mp3文件的tags

  1. #!/bin/sh
  2. FFMPEG_OUT=/work/ffmpeg/out
  3. FFMPEG_LIB=$FFMPEG_OUT/lib
  4. FFMPEG_BIN=$FFMPEG_OUT/bin
  5. export LD_LIBRARY_PATH=$FFMPEG_LIB
  6. #./ffmpeg -i /tmp/test/S1E07.mp3 -codec copy -metadata title="out1" -metadata album="" -metadata artist="" out1.mp3
  7. for mp3file in find . -name "*.mp3"
  8. do
  9. ​ echo "mp3file=$mp3file"
  10. ​ titlename=echo "$mp3file" | sed 's/.mp3//'
  11. ​ titlename=echo "$titlename" | sed 's/.\///'
  12. ​ echo "titlename=$titlename"
  13. ​ echo "$FFMPEG_BIN/ffmpeg -i $mp3file -codec copy -metadata title="$titlename" -metadata album="" -metadata artist="" $mp3file.mp3"
  14. ​ $FFMPEG_BIN/ffmpeg -i $mp3file -codec copy -metadata title="$titlename" -metadata album="" -metadata artist="" $mp3file.mp3
  15. ​ mv $mp3file.mp3 $mp3file
  16. done

注意: ffmpeg是按照输出文件的后缀来转换格式的,如果输出文件为

S1E07.mp3.tmp时,则ffmpeg会报如下错误

:

Unable to find a suitable output format for 'S1E07.mp3.tmp' 3.去掉文件名中的空格 #!/bin/sh find . -type f | while read F do #echo "F=$F" temp=echo "$F" | sed 's/Friends //' #echo "temp=$temp" echo "mv $F $temp" mv "$F" $temp done


三.命令使用 3.1 zip 避免符号链接丢失 zip -ry test.zip ./test/ -->加上y选项 3.2. pkg-config 查找路径: /usr/lib/pkgconfig /usr/lib/i386-linux-gnu/pkgconfig/ /usr/lib/x86_64-linux-gnu/pkgconfig /usr/share/pkgconfig/ 如果没有找到,则会查找 PKG_CONFIG_PATH 所定义的路径使用自定义:export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/work/opencv/opencv-2.4.13/build/INSTALL/lib/pkgconfig/$ pkg-config --cflags opencv$ pkg-config --libs opencv 3.find使用 a. 把当前目录下面的.zip,移动到/tmp下 find . -name ".zip" -exec mv {} /tmp ;

这本阿里P8撰写的算法笔记,再次推荐给大家,身边不少朋友学完这本书最后加入大厂:

Github 疯传!史上最强悍!阿里大佬「LeetCode刷题手册」开放下载了!

以上就是良许教程网为各位朋友分享的Linux相关知识。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值