User Tools

Site Tools


linux常见问题与解决

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux常见问题与解决 [2019/11/26 11:34]
jordan
linux常见问题与解决 [2023/03/08 16:09] (current)
xujianglong ↷ Page moved from 内部资料:linux常见问题与解决 to linux常见问题与解决
Line 1: Line 1:
-Ubuntu设置强密码+====== Ubuntu设置强密码 ======
  
-https://help.ubuntu.com/community/StrongPasswords+[[https://help.ubuntu.com/community/StrongPasswords|https://help.ubuntu.com/community/StrongPasswords]]
  
-Linux端口占用+====== Linux端口占用情况查询 ======
  
-参考[StackOverflow](https://stackoverflow.com/questions/20239232/error-that-port-is-already-in-use)+参考:[[https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/|How to check if port is in use on Linux or Unix - nixCraft]]
  
-执行命令`sudo lsof -t -i tcp:<port_number>`查看被占用的端口号对应的进程id,然后kill相应进程,或者直接执行`sudo lsof -t -i tcp:<port_number> | xargs kill -9`或`sudo fuser -k <port_number>/tcp`kill占用端口的进程。+<code bash> 
 +sudo lsof -i -P -n | grep LISTEN 
 +sudo netstat -tulpn | grep LISTEN 
 +sudo lsof -i:22 ## see a specific port such as 22 ## 
 +sudo nmap -sTU -O IP-address-Here
  
-# 停用系统服务 
  
-```bash+</code> 
 + 
 +====== Linux端口被占用 ====== 
 + 
 +参考[[https://stackoverflow.com/questions/20239232/error-that-port-is-already-in-use|StackOverflow]] 
 + 
 +执行命令''<nowiki>sudo lsof -t -i tcp:<port_number></nowiki>'' 查看被占用的端口号对应的进程id,然后kill相应进程,或者直接执行''<nowiki>sudo lsof -t -i tcp:<port_number> | xargs kill -9</nowiki>'' 或''<nowiki>sudo fuser -k <port_number>/tcp</nowiki>''kill占用端口的进程。 
 +====== 停用系统服务 ====== 
 + 
 +<code bash>
 # 例如:sudo systemctl disable tomcat8 # 例如:sudo systemctl disable tomcat8
 sudo systemctl disable <service_name> sudo systemctl disable <service_name>
-``` 
  
-# 触摸板双指操作在休眠后失效 
  
-编辑`/etc/default/grub`文件,添加`psmouse.synaptics_intertouch=0``GRUB_CMDLINE_LINUX_DEFAULT`的最后,例如:`GRUB_CMDLINE_LINUX_DEFAULT="quiet splash psmouse.synaptics_intertouch=0"`+</code> 
 + 
 +====== 触摸板双指操作在休眠后失效 ====== 
 + 
 +编辑''<nowiki>/etc/default/grub</nowiki>'' 文件,添加''<nowiki>psmouse.synaptics_intertouch=0</nowiki>'' ''<nowiki>GRUB_CMDLINE_LINUX_DEFAULT</nowiki>'' 的最后,例如:''<nowiki>GRUB_CMDLINE_LINUX_DEFAULT="quiet splash psmouse.synaptics_intertouch=0"</nowiki>'' 
 +====== 问题:当linux非root权限用户对不属于当前用户目录下的文件,进行操作或移动时需要使用哪类命令才能使用root命令? ====== 
 + 
 +答:“sudo” 例如:sudo mv <html><文件名></html> <html><目标文件></html> (sudo是linux系统管理指令,允许系统管理员让普通用户执行一些或者全部的root命令的一个工具) 
 + 
 +====== 如何在退出命令行后保持程序运行(Screen命令) ====== 
 + 
 +===== Basic Linux Screen Usage(更多内容,参照 How To Use Linux Screen ) ===== 
 + 
 +Below are the most basic steps for getting started with screen: 
 + 
 +  - On the command prompt, type ''screen''
 +  - Run the desired program. 
 +  - Use the key sequence ''Ctrl-a''  + ''Ctrl-d''  to detach from the screen session. 
 +  - Reattach to the screen session by typing ''screen -r''
 + 
 +====== Mac或Linux中grep命令搜索中文 ====== 
 + 
 +搜索受到当前语言环境的影响,需要配置语言环境,命令如下: 
 +<code> 
 + 
 +env LANG=LC_ALL grep ... 
 + 
 +</code>
  
-# 问题:当linux非root权限用户对不属于当前用户目录下的文件,进行操作或移动时需要使用哪类命令才能使用root命令? 
- 答:“sudo” 例如:sudo mv <文件名> <目标文件> (sudo是linux系统管理指令,允许系统管理员让普通用户执行一些或者全部的root命令的一个工具) 
  
-# 如何查看Linux系统版本 
-```bash 
-# 例如rhel查看版本,可以使用cat /etc/redhat-release 
-cat /etc/**-release 
-``` 
-详见 [How do I determine RHEL (Red Hat Enterprise Linux) version? - nixCraft](https://www.cyberciti.biz/faq/how-do-i-determine-rhel-version/) 
linux常见问题与解决.1574739261.txt.gz · Last modified: 2021/02/10 21:29 (external edit)