bluetoothlover_doc icon indicating copy to clipboard operation
bluetoothlover_doc copied to clipboard

Linux常用命令记录

Open xupenghu opened this issue 3 years ago • 14 comments

记录常用Linux命令的用法,不定期更新一下

xupenghu avatar Sep 25 '21 14:09 xupenghu

查看一个长文件可以用more命令,也可以用less命令,less可以上下翻页,也可以搜索 用 /keywords

xupenghu avatar Sep 25 '21 14:09 xupenghu

linux 三剑客,有时,非常实用, grep 搜索 awk 分割行,选择某列 sed 查找替换

应用比如 《精准提取MDK工程和SES Segger embeded studio工程的源文件和头文件》, 一起来围观吧 https://blog.csdn.net/u011581240/article/details/120424309?utm_source=app&app_version=4.14.0&code=app_1562916241&uLinkId=usr1mkqgl919blen

chenyingchun0312 avatar Sep 25 '21 15:09 chenyingchun0312

嗯 这是一个长期维护的issue 后面的命令会慢慢增加,内容也慢慢丰富 欢迎扩充

xupenghu avatar Sep 26 '21 02:09 xupenghu

# 更新系统时间
$date -s "2021-09-26 16:44:30"
# 将时间保存到硬件rtc中,下次复位时间还是正常的
$hwclock -w

xupenghu avatar Sep 26 '21 08:09 xupenghu

ls -h # 可以将文件大小以我们常用的单位来标识 而不是字节

/mnt/sdcard/faceai/resource # ls -lah ai_face_list_123.csv 
-rwxr-xr-x    1 root     root        3.5M Sep 27 17:56 ai_face_list_123.csv

xupenghu avatar Sep 27 '21 10:09 xupenghu

locate 在文件资料库中查找文件

作用

在文件资料库中查找文件,速度非常的快。它维护了一个数据库,可以做到秒级搜索。

用法

$ locate 文件名

xupenghu avatar Oct 07 '21 12:10 xupenghu

which

作用

搜索命令所在目录和别名信息

使用

$ which ls
/usr/bin/ls

xupenghu avatar Oct 07 '21 12:10 xupenghu

whereis

作用

搜索命令所在目录和帮助文档路径

用法

$ whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz

xupenghu avatar Oct 07 '21 12:10 xupenghu

grep

作用

在文件中搜寻字符串匹配的行并输出 -i 不区分大小写 -v 排除指定的字符串

用法

# grep [指定字符串] [文件]
$ grep mysql /root/install.log

xupenghu avatar Oct 07 '21 12:10 xupenghu

grep

作用

在文件中搜寻字符串匹配的行并输出 -i 不区分大小写 -v 排除指定的字符串

用法

# grep [指定字符串] [文件]
$ grep mysql /root/install.log

https://www.runoob.com/linux/linux-comm-grep.html

supperthomas avatar Oct 09 '21 01:10 supperthomas

安装的时候如何搜索软件包: apt-cache search xxxx

supperthomas avatar Nov 03 '21 14:11 supperthomas

VMware ubuntu 虚拟机无法识别共享文件夹

  • vmhgfs-fuse /mnt/hgfs/

xupenghu avatar Apr 06 '22 03:04 xupenghu

Ubuntu 重新获取ip

// 清除ip
# dhclient -r   
// 重新获取ip
# dhclient 

xupenghu avatar May 31 '22 02:05 xupenghu

neofetch 可以查看系统基本信息

supperthomas avatar May 31 '23 02:05 supperthomas