Linux 常见问题记录

本文主要记录笔者在使用 Linux 系统过程中遇到的一些问题以及解决的方案。

博主博客

Ubuntu 常见问题

apt 安装失败(E: Could not get lock /var/lib/dpkg/lock)

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
// 使用下面命令删除即可
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

找不到 node (/usr/bin/env: ‘node’: No such file or directory)

我使用bower的时候提示这个, 由于文件里面使用了 node, 而安装 node 的时候, 默认是nodejs(在 /usr/bin/env文件夹中可以看到). 进入 /usr/local/lib/node_modules/bower/bin, 里面有一个bower文件, 使用 vim 编辑:

#!/usr/bin/env node // 把这里的 node 改成 nodejs
require('../lib/bin/bower');

CentOS 常见问题

nukix is not in the sudoers file. This incident will be reported.

当我使用sudo时,输入密码后提示nukix is not in the sudoers file. This incident will be reported.错误。
操作步骤:

// 切换到 root,这里使用 su - 代表使用 root 的环境变量,只用 su 代表使用当前角色的环境变量
[nukix@bogon Desktop]$ su -	
// 输入root的密码
Password: 
// 编辑配置文件,这里vi与sudo没有空格
[root@bogon ~]# visudo

1.把光标移到最后一行。
2.按i进入编辑状态。
3.在最后一行添加用户名 ALL=(ALL) ALL。例如我添加nukix ALL=(ALL) ALL
4.按Esc退出编辑模式。
5.输入:wq,保存并且退出。
最后切换回原来的用户,即可使用 sudo 命令。

777;notify;Command completed;clear[nukix@bogon Desktop]$

当CentOS 7 系统更新后(yum update),终端用户名出现]777;notify;Command completed;clear,而且每一次输入新的命令,内容也会跟着改变。

以下为解决方法(只对当前用户有效)。

]777;notify;Command completed;clear[nukix@bogon Desktop]$ 
]777;notify;Command completed;clear[nukix@bogon Desktop]$ vim ~/.bashrc
# 在文件末尾加入 unset PROMPT_COMMAND
# 加入后按Esc,:wq 保存退出
# 然后切换用户, 最后切回去即可发现命令行正常显示
]777;notify;Command completed;vim ~/.bashrc[nukix@bogon Desktop]$ su root
Password: 
ABRT has detected 1 problem(s). For more info run: abrt-cli list --since 1560651602
]777;notify;Command completed;su nukix[root@bogon Desktop]# su nukix
[nukix@bogon Desktop]$
  1. bash的配置文件:
    .bashrc文件:每次打开新shell时要执行的命令在这里,别名和函数之类的都放在这里;
    .bash_profile文件:登录shell时要执行的命令;
    .bash_logout文件:退出shell时要执行的命令;
    .bash_history文件:记录历史命令。
  2. 系统级别的配置文件:
    /etc/profile文件, /etc/bashrc文件, /etc/profiled文件。

参考资料: https://blog.youkuaiyun.com/u013894429/article/details/83309412

// Todo: 未完待续…

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

nukix

如果觉得对你有帮助,欢迎打赏!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值