Linux & change username & computer name & .bashrc
Linux & change username & computer name
ubuntu change username and computer name
https://askubuntu.com/questions/817452/i-need-to-change-terminal-name
solution
https://www.ostechnix.com/hide-modify-usernamelocalhost-part-terminal/
# backup
$ cp ~/.bashrc ~/.bashrc.bak
~/.bashrc
/home/xgqfrms
$ cd ~/.
$ pwd
$ cat .bashrc
$ sudo vim .bashrc
# i
# Esc :wq
OK
computer name
https://askubuntu.com/questions/9540/how-do-i-change-the-computer-name
$ pwd
$ ls -al
$ whoami
$ cd ~/
$ cat hostname
$ vim hostname
# i
# Esc :wq
# Esc :wq!
# Esc :wqa!
# Esc :qa!
change username
https://askubuntu.com/questions/34074/how-do-i-change-my-username
$
.bashrc & rename hostname & rename username
$ pwd
$ cd ~
$ pwd
$ cat .bashrc
$ vim .bashrc
# sudo vim .bashrc
# i
# ESC + :wq!
macOS
todo...
xgqfrms@mbp2019
macOS terminal change hostname
https://www.howtogeek.com/tips/how-to-change-your-computer-name-on-mac-os-x/
- sharing
sudo scutil --set HostName [NewHostNameHere]
OK
Linux $PS1
PS1 (Prompt String 1)
$ echo $PS1
https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
https://www.linuxnix.com/linuxunix-shell-ps1-prompt-explained-in-detail/
https://linuxconfig.org/bash-prompt-basics
Linux 如何一次切换到 home 目录
相对路径 & 绝对路径
cd ./ 代表当前目录
cd ../ 代表上级目录
cd ~ 当前用户的根目录
cd / 系统的根目录
$ cd ~
$ pwd
# /Users/xgqfrms-mbp
$ cd /
$ ls
# Applications Users cores home sbin var Library Volumes dev opt tmp System bin etc private usr
# etc, usr, home, Users
# 切换到 etc 并打开 hosts 文件
$ cd ../../etc
$ cd /etc && cat hosts
$ cd /etc && code hosts
$ cd /etc && sudo vim hosts
# :wq!
# php, nginx (created: 2020.08.08)
127.0.0.1 www.webfullstack.xyz
refs
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/10904594.html
未经授权禁止转载,违者必究!