FAQ: Linux

1. 如何修改shell提示符?

通过修改4个环境变量PS1,PS2,PS3,PS4实现;

(99条消息) 修改Linux Shell命令提示符_NFTDigger的博客-CSDN博客

2. 如何修改系统默认支持的shell?

Ubuntu默认适合用dash,source命令出现错误。

通过命令 sudo dpkg-reconfigure dash。 然后出现的界面中选择NO。解决。

3. 如何查看哪些用户登录?

命令:w,who,last,finger

(99条消息) Linux下用于查看系统当前登录用户信息的4种方法_渴望自由_看看的博客-CSDN博客_linux 查看当前登录用户

4. 添加删除用户,用户组?

组:

建立 sudo groupadd XXX

删除 sudo groupdel XXX

查看 cat /etc/group

用户:

建立 useradd -m -g <组名> <用户名>   // -m 默认目录,-g 

passwd  <用户名>

删除  userdel -r  <username>  // -r 循环删除目录

查看 cat /etc/passwd | grep username

5. 查询某个用户是否属于某个组?

groups username

cat /etc/group |grep username

id username

Linux 系统查看用户组 | Server 运维论坛 (learnku.com)

6. 查看删除进程

ps

kill ID

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

修改 /etc/sudoers 文件,添加 XX用户到相应行。

8. ubuntu在profile和bashrc中配置环境变量的理解

profile在系统登录后执行,只在登录系统时执行一次,包括针对系统的/etc/profile针对用户的~/.profile。

ashrc在每次启动bash shell(打开终端或者在终端输入sh)后执行,包括针对系统的/etc/bash.bashrc针对用户的~/.bashrc(这里注意一下我的ubuntu里是/etc/bash.bashrc,其它系统可能是/etc/bashrc)

ubuntu下关于profile和bashrc中环境变量的理解(转) - lh03061238 - 博客园 (cnblogs.com)

更好的解释:

To quote from the bash man-page:

When  bash is invoked as an interactive login shell, or as a non-interactive
shell with the --login option, it first reads and executes commands from the
file  /etc/profile,  if that file exists.  After reading that file, it looks
for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads
and  executes  commands from the first one that exists and is readable.  The
--noprofile option may be used when the shell is  started  to  inhibit  this
behavior.

When  a  login  shell  exits, bash reads and executes commands from the file
~/.bash_logout, if it exists.

When an interactive shell that is not a login shell is started,  bash  reads
and  executes  commands  from /etc/bash.bashrc and ~/.bashrc, if these files
exist.  This may be inhibited by using the --norc option.  The --rcfile file
option  will  force  bash  to read and execute commands from file instead of
/etc/bash.bashrc and ~/.bashrc.

bash - Where can I find a complete reference for the $PS1 variable? - Ask Ubuntu

9. how to find out which desktop environments you are using?

echo $XDG_CRRENT_DESKTOP

How to Find Out Which Desktop Environment You are Using? (itsfoss.com)

10. 查看linux系统版本号?

11. source的作用?

Source命令是一个内置的shell命令,用于从当前shell会话中的文件读取和执行命令。source命令通常用于保留、更改当前shell中的环境变量。简而言之,source一个脚本,将会在当前shell中运行execute命令。

source命令可用于:

  • 刷新当前的shell环境
  • 在当前环境使用source执行Shell脚本
  • 从脚本中导入环境中一个Shell函数
  • 从另一个Shell脚本中读取变量

Linux中source命令的使用方式 | 《Linux就该这么学》 (linuxprobe.com)

12. linux下载工具

wget下载速度慢,网上有人推荐mwget,github搜到源码安装,make过程中总有报错,试了其它方法未成功,放弃。

又有人推荐aria2,安装后,不如预期,有些文件下载仍如龟速。

妥协的办法:遇到较大而又速度慢的下载场景,在windows下载后,再xftp推到linux服务器上。

13. Username is not in the sudoers file问题How to Fix "Username is not in the sudoers file. This incident will be reported" in Ubuntu (tecmint.com)Bash Shell PS1: 10 Examples to Make Your Linux Prompt like Angelina Jolie (thegeekstuff.com)icon-default.png?t=M85Bhttps://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/
 

14. 常用shell 风格

Bash Shell PS1: 10 Examples to Make Your Linux Prompt like Angelina Jolie (thegeekstuff.com)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值