Linux development common index

这篇博客详细介绍了Linux系统中常见的命令行操作,包括文件查看、软件搜索、网络连接、错误处理、磁盘空间查看等。此外,还讲解了如何通过SSH在VSCode上进行远程开发,无密码SSH连接,以及使用4G连接在特定设备上的配置。最后,提到了如何在终端关闭和打开图形界面以及4G连接在RV1126设备上的设置步骤。

(0)Basic command

  1. See file content
cat $certain_file
  1. find a file in specific folder
ls \xxx\xx*
  1. Find a softeare in terminal
apt-cache search $particular_keywords
  1. Download file form a website
wget $specific_webpage
  1. show usb devices:
lsusb
  1. See which program dominated the port
#print certain port message from eth0 network card
tcpdump -i eth0 -nnA 'port 443'
#see pid by port
lsof -i:443
#see port by pid
netstat -anp|grep pid
#see pid by process name
pgrep name
  1. Error handle : “cannot open shared object file: No such file or directory”
sudo gedit ~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/path
source ~/.bashrc
  1. View the space of disk:
df -hl
  1. Mirror local port to public network server
  • Download particular zip file at Link according to your system and cpu.Or you can compile the source file yourself.
    Modify frps.ini on server A and set the bind_port to be connected to frp clients:
# frps.ini
[common]
bind_port = 7000
Start frps on server A:
./frps -c ./frps.ini
#or run in background
nohup ./frps -c frps.ini >/dev/null 2>&1 &
  • On server B, modify frpc.ini to put in your frps server public IP as server_addr field:
# frpc.ini
[common]
server_addr = x.x.x.x
server_port = 7000

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
  • Note that local_port (listened on client) and remote_port (exposed on server) are for traffic goes in/out the frp system, whereas server_port is used between frps.

  • Start frpc on server B:

./frpc -c ./frpc.ini
#Or run in background
nohup ./frpc -c frpc.ini >/dev/null 2>&1 &
  • From another machine, SSH to server B like this (assuming that username is test):
ssh -oPort=6000 test@x.x.x.x
  1. Update specific software
apt-get upgrade $xxx
  1. Git download all modules
git submodule update --init --recursive
  1. soft link (copy to folder but do not occupy storage)
Ln -s $source $destination
  1. Start ssh
sudo service ssh start
  1. Git common command
#Git global setup
git config --global user.name "Asil"
git config --global user.email "XXXX@gmail.com"

#Create a new repository
git clone ssh://git@gitlab.xxxx.com:8322/Lee/1_2_test.git
cd 1_2_test
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

#Push an existing folder
cd existing_folder
git init
git remote add origin ssh://git@gitlab.xxxx.com:8322/Lee/1_2_test.git
git add .
git commit -m "Initial commit"
git push -u origin master

#Push an existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin ssh://git@gitlab.xxxx.com:8322/Lee/1_2_test.git
git push -u origin --all
git push -u origin --tags

(1)ssh on vscode

  1. Download “Remote-ssh” extension on vscode !
  2. Config xxx.ssh\config file with format:
Host RV
    HostName 10.10.13.183
    User root
    port 22
  1. Click “connect” bottom on the top right of certain label
  2. Wait and see

(2)ssh on vscode with no password

  1. open terminal on windows plantform and input with
ssh-keygen
  1. Then tap “Enter” key twice till the following sentence occured
C:\Users\Administrator/.ssh/id_rsa already exists
  1. go to folder “C:\Users\Administrator/.ssh/” and ssh-key is stored in file “id_rsa.pub” and copy it.
  2. Go to folder “/root” or “/home”, and check if there is a folder named with “.ssh”. If existed, cd to this “.ssh” folder, if not, you need to create folder “.ssh” in each path and have a try. Once you cd to the “.ssh” path:
touch authorized_keys

and copy the whole content of “id_rsa.pub” to file authorized_keys
5. reopen the vscode and you will find there will not need to type password anymore

(3)Connect wifi on terminal

view device list:

sudo nmcli dev
```bash
turn on wifi:
```bash
sudo nmcli r wifi on

scan wifi nearby:

sudo nmcli dev wifi

connect to specific wifi:

sudo nmcli dev wifi connect "SSID" password "xxxx" ifname wlan0

example:

sudo nmcli dev wifi connect "E2:B8:E6:01:86:2F" password "xxxx" ifname wlan0

(4)Close and open graph interface

close:

systemctl set-default multi-user.target

open:

systemctl set-default graphical.target

(5)Connect with 4G on rv1126

  • first Dial
pppd call quectel-ppp &
  • then add remote
route add default dev ppp0
  • then test
  • Reference: R1
<think>好的,我现在需要帮助用户解决他们遇到的几个JavaScript错误。首先,用户提供了三个不同的错误信息,我需要逐一分析每个错误的原因,并给出相应的解决方案。 第一个错误是“Uncaught ReferenceError: module is not defined at vue.common.dev.js:12008:1”。这个错误通常发生在使用CommonJS模块系统(如module.exports)的环境中,而浏览器环境默认不支持CommonJS。用户可能在项目中错误地引入了适用于Node.js的Vue构建版本,或者构建工具有配置问题。我需要检查用户是否正确使用了Vue的浏览器版本,比如vue.js或vue.min.js,并确认他们是否错误地使用了require语句而不是ES6的import。另外,如果使用Webpack或Parcel等工具,需要确保配置正确,支持模块化加载。 第二个错误是“Uncaught SyntaxError: Invalid or unexpected token at index.css:1”。这个错误提示在CSS文件的第1行有无效的字符,可能由于文件编码问题、特殊字符或隐藏字符(如BOM头),或者CSS语法错误。用户需要检查index.css文件的开头部分是否有不可见的字符,并确保文件编码为UTF-8无BOM。同时,使用代码编辑器检查是否有拼写错误或未闭合的选择器。 第三个错误是“[Vue warn]: Cannot find element: #app”。这表明Vue实例在挂载时找不到ID为“app”的DOM元素。可能的原因是HTML中没有对应的元素,或者Vue实例在DOM加载之前就执行了。用户需要确认HTML中存在<div id="app"></div>,并且确保Vue的初始化代码放在DOM元素之后,或者使用Vue的 mounted 生命周期钩子,或者将脚本放在body末尾。 接下来,我需要将这些分析整理成结构清晰的步骤,用中文简明扼要地解释每个错误的原因和解决方法。同时,注意使用正确的LaTeX格式,虽然在这个问题中可能不需要数学公式,但需要遵循用户提供的格式要求,比如行内公式用$...$,独立公式用$$...$$,但当前问题可能不涉及数学表达式,所以可能不需要使用。 另外,用户可能是在开发Vue应用时遇到这些问题,所以需要给出具体的建议,比如检查Vue的引入方式、构建工具配置、HTML结构等。同时,注意用户可能对前端开发不太熟悉,所以语言要尽量通俗易懂,避免使用过于专业的术语,或者在必要时解释术语。 最后,要确保回答覆盖所有三个错误,每个错误单独分点,每个分点下有原因分析和解决方案。这样用户能够一步步排查问题,找到对应的解决方法。需要检查是否有遗漏的错误点,以及解决方案是否切实可行,比如推荐使用开发工具调试、检查文件编码等具体操作。</think>你遇到的错误涉及三个不同问题,我们逐一分析解决: $\textcolor{green}{[错误1:Uncaught ReferenceError: module is not defined]}$ $\textcolor{blue}{▶ 原因分析}$ 1. 使用了Node.js环境特有的`module.exports`语法 2. 错误引入Vue构建版本(可能使用了服务端渲染版本) 3. 构建工具(如Webpack)配置未正确处理模块系统 $\textcolor{blue}{✅ 解决方案}$ 1. 检查Vue引入方式,应使用浏览器直接支持的版本: ```html <!-- 开发环境 --> <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> <!-- 生产环境 --> <script src="https://cdn.jsdelivr.net/npm/vue@2"></script> ``` 2. 若使用构建工具,确保配置文件中包含: ```javascript // webpack.config.js module.exports = { // ... externals: { vue: 'Vue' // 声明Vue为外部依赖 } } ``` $\textcolor{green}{[错误2:Uncaught SyntaxError: Invalid or unexpected token]}$ $\textcolor{blue}{▶ 原因分析}$ 1. CSS文件包含隐藏字符(如BOM头) 2. 文件编码非UTF-8 3. CSS语法错误(如中文标点) $\textcolor{blue}{✅ 解决方案}$ 1. 使用VS Code等编辑器打开`index.css` 2. 查看第一行是否存在不可见字符(推荐安装Hex Editor插件检查) 3. 转换为UTF-8编码(无BOM): ```bash # 使用iconv转换(Linux/Mac) iconv -f GBK -t UTF-8 index.css > index_utf8.css ``` $\textcolor{green}{[错误3:Vue warn: Cannot find element: #app]}$ $\textcolor{blue}{▶ 原因分析}$ 1. DOM元素加载顺序错误 2. 元素选择器书写错误 3. Vue实例初始化过早 $\textcolor{blue}{✅ 解决方案}$ 1. 确认HTML结构: ```html <body> <!-- 必须存在此元素 --> <div id="app">{{ message }}</div> <!-- Vue脚本必须放在元素之后 --> <script src="vue.js"></script> <script src="app.js"></script> </body> ``` 2. 或使用DOMContentLoaded事件: ```javascript document.addEventListener('DOMContentLoaded', () => { new Vue({ el: '#app', data: { message: 'Hello Vue!' } }) }) ``` $\textcolor{red}{🔧 综合调试建议}$ 1. 按F12打开开发者工具 2. 在Sources面板检查文件加载状态 3. 使用Console面板的报错定位功能 4. 推荐安装Vue Devtools扩展: ```bash # 通过npm安装(需构建环境) npm install -g @vue/devtools ``` 这些错误通常由环境配置问题引发,建议使用官方脚手架初始化项目: ```bash # Vue 2项目初始化 npm install -g @vue/cli vue create my-project ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值