xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

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/

  1. sharing

  1. 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-2025

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @   xgqfrms  阅读(814)  评论(5编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2018-05-22 Create a Array with two papameters without using loop!
2016-05-22 WebVTT 及 HTML5 <track> 元素简介
点击右上角即可分享
微信分享提示